BOOTLOADER.md (5919B)
1 # BOOTLOADER 2 * The drive where bootloaders and OSes are installed on these examples is "_/dev/sda_", but could be anywhere. 3 * The bootloader installation __IS__ inside chroot AND with drives mounted, so this guide assumes you are inside "_/mnt/drive_". 4 * "_<PARTITION_NUMBER_OF_ROOT>_", "_<PARTITION_NUMBER_OF_FREEDOS>_" and "_<PARTITION_NUMBER_OF_WINDOWS>_" are just the numbers of partitions. 5 * Specifically, "_<PARTITION_NUMBER_OF_ROOT>_" is the partition number of your root partition. 6 * The "_vmlinuz_" file makes reference to the kernel image, you can rename it or simlink to it in all cases, the only rule is you have to make sure the name is referenced correctly in the bootloader. By default it can have names like "_vmlinuz-linux_", "_vmlinuz-<KERNEL_VERSION>_" and so on. The same with "_initramfs.img_", it can be "_initramfs-<KERNEL_VERSION>.img_" and such. 7 * All bootloader examples have included other OS inside what is called "_stanzas_". 8 * FreeDOS and Windows stanzas are __OPTIONAL__. 9 * If dualbooting with Windows remember that it likes to be in the first partition. 10 * If on UEFI check if module is loaded by issuing "_modprobe efivars_". 11 * On __CRUX__ do "_prt-get remove lilo_" if you dont use LILO. 12 * On __Source Mage GNU/Linux__ do "_cast \<BOOTLOADER>_" to install the preferred bootloader. 13 14 Supported filesystems by bootloaders, they will boot the OS only if the "_/boot_" partition has a supported filesystem. If on "_UEFI_" ignore this as it only supports "_FAT_".: 15 * __LILO__: indifferent (anything?) 16 * __SYSLINUX__: ext2, ext3, ext4, btrfs, ufs 1/2, FAT16, FAT32, iso9660, udf, NTFS. 17 * __GRUB Legacy__: FAT16, FAT32, minix, ext2, ext3, ext4, ReiserFS, JFS, XFS, VSTa fs, Btrfs. 18 * __GRUB 2__: ext2, ext3, ext4, btrfs, zfs, ufs, minix, iso9660, udf, jfs, hfs, hfs+, afs, affs, sfs, xfs, reiserfs, tar, cpio, NTFS, FAT16, FAT32. 19 20 ## LILO 21 * If on UEFI use __elilo__ and change names to "_/etc/elilo.conf_" instead of "_/etc/lilo.conf_" and "_elilo_" instead of "_lilo_" in commands. 22 `nano /etc/lilo.conf` 23 * Inserting "_password=\<PASSWORD>_" inside an OS stanza will protect with a password that OS, but inserting "_password=\<PASSWORD>_" just before the stanzas and outside any of them will protect with a password the bootloader itself (notice the space inside stanzas) 24 ``` 25 boot = /dev/sda 26 image = /boot/vmlinuz 27 Label = <DISTRO_NAME> 28 root = /dev/sda<PARTITION_NUMBER_OF_ROOT> 29 other = /dev/sda<PARTITION_NUMBER_OF_FREEDOS> 30 table = /dev/sda 31 Label = FreeDOS 32 other = /dev/sda<PARTITION_NUMBER_OF_WINDOWS> 33 table = /dev/sda 34 Label = Windows7 35 ``` 36 * Set boot entry 37 ``` 38 lilo -A /dev/sda 1 39 lilo 40 ``` 41 * Prevent anyone but root of reading the config file (in case you used a password) 42 `chmod 600 /etc/lilo.conf` 43 44 ## SYSLINUX 45 * If on BIOS make directory and copy files accordingly 46 ``` 47 mkdir -p /boot/syslinux 48 cp /usr/lib/syslinux/bios/*.c32 /boot/syslinux/ 49 ``` 50 * If on UEFI make directory and copy files accordingly 51 ``` 52 mkdir -p /boot/efi/EFI/syslinux 53 cp -r /usr/lib/syslinux/efi64/* /boot/efi/EFI/syslinux/ 54 ``` 55 * If on BIOS set boot entry 56 ``` 57 umount /dev/sda1 58 syslinux --directory syslinux --install /dev/sda1 59 mount /dev/sda1 /boot 60 ``` 61 * If on UEFI set boot entry using "_efibootmgr_" 62 ``` 63 umount /dev/sda1 64 efibootmgr -c -d /dev/sda -p 1 -l /boot/efi/EFI/syslinux/syslinux.efi -L Syslinux 65 mount /dev/sda1 /boot/efi 66 ``` 67 * Edit "_/boot/syslinux/syslinux.cfg_" if on BIOS or "_/boot/efi/EFI/syslinux/syslinux.cfg_" if on UEFI 68 * "_splash.png_" is the splash screen image located in "_/boot/syslinux/_" if on BIOS or "_/boot/efi/EFI/syslinux/_" if on UEFI 69 ``` 70 PROMPT 1 71 TIMEOUT 50 72 MENU BACKGROUND splash.png 73 DEFAULT <DISTRO_NAME> 74 LABEL <DISTRO_NAME> 75 MENU LABEL <DISTRO_NAME> 76 LINUX /boot/vmlinuz 77 INITRD /boot/initramfs.img 78 LABEL FreeDOS 79 MENU LABEL FreeDOS 80 KERNEL chain.c32 81 APPEND sda <PARTITION_NUMBER_OF_FREEDOS> 82 LABEL Windows7 83 MENU LABEL Windows7 84 KERNEL chain.c32 85 APPEND sda <PARTITION_NUMBER_OF_WINDOWS> 86 ``` 87 88 ## GRUB Legacy 89 * If on BIOS set boot entry (boot partition must be mounted) 90 ``` 91 mount /dev/sda1 /boot 92 grub-install /dev/sda 93 ``` 94 * If on UEFI set boot entry (boot partition must be mounted) 95 ``` 96 mount /dev/sda1 /boot/efi 97 grub-install /boot/efi 98 ``` 99 * Edit configuration file "_/boot/grub/menu.lst_" 100 ``` 101 default=0 102 timeout=10 103 splashimage=(hd0,0)/grub/splash.xpm.gz 104 #hiddenmenu 105 title <DISTRO_NAME> (<KERNEL_VERSION>) 106 root (hd0,<PARTITION_NUMBER_OF_ROOT>) 107 kernel /vmlinuz-<KERNEL_VERSION> ro root=/dev/sda5 rhgb quiet 108 initrd /initramfs-<KERNEL_VERSION>.img 109 title <DISTRO_NAME_alternative_kernel> (<ANOTHER_KERNEL_VERSION>) 110 root (hd0,<PARTITION_NUMBER_OF_ROOT>) 111 kernel /vmlinuz-<ANOTHER_KERNEL_VERSION> ro root=/dev/sda5 rhgb quiet 112 initrd /initramfs-<ANOTHER_KERNEL_VERSION>.img 113 title FreeDOS 114 root (hd0,<PARTITION_NUMBER_OF_FREEDOS>) 115 kernel /memdisk 116 initrd (hd0,<PARTITION_NUMBER_OF_FREEDOS>)/fdboot.img 117 title Windows 7 118 root (hd0,<PARTITION_NUMBER_OF_WINDOWS>) 119 chainloader /EFI/Microsoft/Boot/bootmgfw.efi 120 ``` 121 122 ## GRUB 2 123 * If on BIOS set boot entry (boot partition must be mounted) 124 ``` 125 mount /dev/sda1 /boot 126 grub-install /dev/sda 127 ``` 128 * If on UEFI set boot entry (boot partition must be mounted) 129 ``` 130 mount /dev/sda1 /boot/efi 131 grub-install /boot/efi 132 ``` 133 * If Grub does not detect your OS run "_os-prober_" followed by "_update-grub_" 134 * Or add the OS manually to the Grub config file "_/etc/grub.d/40_custom_" 135 ``` 136 menuentry "FreeDOS" { 137 set root='(hd0,msdos2)' 138 linux16 /memdisk 139 initrd16 /fdboot.img 140 chainloader +1 141 } 142 menuentry "Windows 7" { 143 insmod part_msdos 144 insmod ntfs 145 insmod search_fs_uuid 146 insmod ntldr 147 search --fs-uuid --no-floppy --set=root 3482FBC382FB879E 148 chainloader +1 149 ntldr /bootmgr 150 } 151 ``` 152 * Update config file 153 `grub-mkconfig -o /boot/grub/grub.cfg`