<!DOCTYPE html> <html dir="ltr" lang="en"> <head> <meta charset='utf-8'> <title>1.3. Boot</title> </head> <body> <a href="index.html">GNU/Linux Index</a> <h1>1.3. Boot</h1> <p>Follow this instructions with active chroot, first <a href="configure.html#chroot">mount partitions</a> and before chroot mount follow file systems;</p> <pre> $ sudo mount --bind /dev $CHROOT/dev $ sudo mount -vt devpts devpts $CHROOT/dev/pts $ sudo mount -vt tmpfs shm $CHROOT/dev/shm $ sudo mount -vt proc proc $CHROOT/proc $ sudo mount -vt sysfs sysfs $CHROOT/sys </pre> <p>Now you can chroot;</p> <pre> $ sudo chroot $CHROOT /usr/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /bin/bash --login </pre> <h2 id="linux">1.3.1. Kernel</h2> <p>Install <a href="ports/linux-gnu">linux-gnu</a> port, linux libre kernel is a true source based kernel that respects your freedoms. Read <a href="linux.html">linux kernel</a> for more information.</p> <p>Default crux configuration can be obtained from iso, kernel port depend on <a href="reboot.html#dracut">dracut</a>, grub2 and grub2-efi. You don't need them to build with pkgmk, to install boot related tools use prt-get;</p> <pre> $ prt-get depinst linux-gnu </pre> <p>If you don't have the port binary package build it;</p> <pre> # cd /usr/ports/machine-ports/linux-gnu # pkgmk -d </pre> <p>Install kernel;</p> <pre> # pkgadd /usr/ports/packages/linux-gnu#4.9.86-2.pkg.tar.gz </pre> <h2 id="dracut">1.3.2. Dracut</h2> <p>Install dracut;</p> <pre> # cd /usr/ports/machine-ports/dracut # pkgmk -d # pkgadd /usr/ports/packages/dracut#044-2.pkg.tar.gz </pre> <p>Review configuration file;</p> <pre> # PUT YOUR CONFIG IN separate files # in /etc/dracut.conf.d named "<name>.conf" # Equivalent to -H hostonly="no" # Mount / and /usr read-only by default. ro_mnt="no" # Equivalent to -m "module module module" dracutmodules+="dash kernel-modules rootfs-block udev-rules usrmount base fs-lib shutdown" # Equivalent to -a "module" add_dracutmodules+="caps debug" # Equivalent to -o "module" #omit_dracutmodules+="systemd systemd-bootchart systemd-networkd systemd-initrd" # SEE man dracut.conf(5) for options </pre> <p>Run dracut to create init ram filesystem for port linux-blob kernel;</p> <pre> # dracut --kver 4.9.86-gnu </pre> <h2 id="grub">1.3.3. Grub</h2> <p>Create grub file in /etc/default/grub with values;</p> <pre> GRUB_DISABLE_LINUX_UUID=false GRUB_ENABLE_LINUX_LABEL=false </pre> <p><a href="http://www.gnu.org/software/grub/manual/grub.html">Grub Manual</a>, install grub on MBR of disk sdb;</p> <pre> # grub-install /dev/sdb Installation finished. No error reported. </pre> <p>If you are installing on removable media;</p> <pre> # grub-install --removable /dev/sdb Installation finished. No error reported. </pre> <p>grub-mkconfig generates grub.cfg, it will try to discover available kernels and attempt to generate menu entries for them;</p> <pre> # grub-mkconfig -o /boot/grub/grub.cfg Generating grub.cfg ... Found linux image: /boot/vmlinuz-4.9.86-gnu Found initrd image: /boot/initramfs-4.9.86-gnu.img done # </pre> <p>Check /boot/grub/grub.cfg, if is wrong add menu to /etc/grub.d/40_custom, replace correct partition from grub-prob output and correct UUID from fstab or blkid</p> <pre> # grub-probe --target=hints_string / </pre> <h3>1.3.3.1. Rescue iso</h3> <p>Simple way to have "resque" system is to mount boot as read only, this assures that even as root nothing can be changed without remount. To have different system independent from host grub will have entry to boot small iso on /boot partition;</p> <p>Crux iso is not used because at the moment it fails to find "crux-media" during or after init.</p> <pre> $ wget http://ftp.nluug.nl/os/Linux/distr/tinycorelinux/7.x/x86/release/CorePlus-current.iso $ sudo mv CorePlus-current.iso /boot/tinycore.iso </pre> <p>Edit /etc/grub.d/40_custom</p> <pre> menuentry "Rescue" { load_video set gfxpayload=keep set isofil<style>pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold }