Update BOOTLOADER.md

This commit is contained in:
mayfrost 2018-07-11 10:35:38 +00:00 committed by GitHub
parent 786049ddb2
commit 06319c97bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,107 +21,133 @@ Supported filesystems by bootloaders, they will boot the OS only if the "_/boot_
* If on UEFI use __elilo__ and change names to "_/etc/elilo.conf_" instead of "_/etc/lilo.conf_" and "_elilo_" instead of "_lilo_" in commands. * If on UEFI use __elilo__ and change names to "_/etc/elilo.conf_" instead of "_/etc/lilo.conf_" and "_elilo_" instead of "_lilo_" in commands.
`nano /etc/lilo.conf` `nano /etc/lilo.conf`
* 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) * 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)
`boot = /dev/sda` ```
`image = /boot/vmlinuz` boot = /dev/sda
` Label = <DISTRO_NAME>` image = /boot/vmlinuz
` root = /dev/sda<PARTITION_NUMBER_OF_ROOT>` Label = <DISTRO_NAME>
`other = /dev/sda<PARTITION_NUMBER_OF_FREEDOS>` root = /dev/sda<PARTITION_NUMBER_OF_ROOT>
` table = /dev/sda` other = /dev/sda<PARTITION_NUMBER_OF_FREEDOS>
` Label = FreeDOS` table = /dev/sda
`other = /dev/sda<PARTITION_NUMBER_OF_WINDOWS>` Label = FreeDOS
` table = /dev/sda` other = /dev/sda<PARTITION_NUMBER_OF_WINDOWS>
` Label = Windows7` table = /dev/sda
Label = Windows7
```
* Set boot entry * Set boot entry
`lilo -A /dev/sda 1` ```
`lilo` lilo -A /dev/sda 1
lilo
```
* Prevent anyone but root of reading the config file (in case you used a password) * Prevent anyone but root of reading the config file (in case you used a password)
`chmod 600 /etc/lilo.conf` `chmod 600 /etc/lilo.conf`
## SYSLINUX ## SYSLINUX
* If on BIOS make directory and copy files accordingly * If on BIOS make directory and copy files accordingly
`mkdir -p /boot/syslinux` ```
`cp /usr/lib/syslinux/bios/*.c32 /boot/syslinux/` mkdir -p /boot/syslinux
cp /usr/lib/syslinux/bios/*.c32 /boot/syslinux/
```
* If on UEFI make directory and copy files accordingly * If on UEFI make directory and copy files accordingly
`mkdir -p /boot/efi/EFI/syslinux` ```
`cp -r /usr/lib/syslinux/efi64/* /boot/efi/EFI/syslinux/` mkdir -p /boot/efi/EFI/syslinux
cp -r /usr/lib/syslinux/efi64/* /boot/efi/EFI/syslinux/
```
* If on BIOS set boot entry * If on BIOS set boot entry
`umount /dev/sda1` ```
`syslinux --directory syslinux --install /dev/sda1` umount /dev/sda1
`mount /dev/sda1 /boot` syslinux --directory syslinux --install /dev/sda1
mount /dev/sda1 /boot
```
* If on UEFI set boot entry using "_efibootmgr_" * If on UEFI set boot entry using "_efibootmgr_"
`umount /dev/sda1` ```
`efibootmgr -c -d /dev/sda -p 1 -l /boot/efi/EFI/syslinux/syslinux.efi -L Syslinux` umount /dev/sda1
`mount /dev/sda1 /boot/efi` efibootmgr -c -d /dev/sda -p 1 -l /boot/efi/EFI/syslinux/syslinux.efi -L Syslinux
mount /dev/sda1 /boot/efi
```
* Edit "_/boot/syslinux/syslinux.cfg_" if on BIOS or "_/boot/efi/EFI/syslinux/syslinux.cfg_" if on UEFI * Edit "_/boot/syslinux/syslinux.cfg_" if on BIOS or "_/boot/efi/EFI/syslinux/syslinux.cfg_" if on UEFI
* "_splash.png_" is the splash screen image located in "_/boot/syslinux/_" if on BIOS or "_/boot/efi/EFI/syslinux/_" if on UEFI * "_splash.png_" is the splash screen image located in "_/boot/syslinux/_" if on BIOS or "_/boot/efi/EFI/syslinux/_" if on UEFI
`PROMPT 1` ```
`TIMEOUT 50` PROMPT 1
`MENU BACKGROUND splash.png` TIMEOUT 50
`DEFAULT <DISTRO_NAME>` MENU BACKGROUND splash.png
`LABEL <DISTRO_NAME>` DEFAULT <DISTRO_NAME>
` MENU LABEL <DISTRO_NAME>` LABEL <DISTRO_NAME>
` LINUX /boot/vmlinuz` MENU LABEL <DISTRO_NAME>
` INITRD /boot/initramfs.img` LINUX /boot/vmlinuz
`LABEL FreeDOS` INITRD /boot/initramfs.img
` MENU LABEL FreeDOS` LABEL FreeDOS
` KERNEL chain.c32` MENU LABEL FreeDOS
` APPEND sda <PARTITION_NUMBER_OF_FREEDOS>` KERNEL chain.c32
`LABEL Windows7` APPEND sda <PARTITION_NUMBER_OF_FREEDOS>
` MENU LABEL Windows7` LABEL Windows7
` KERNEL chain.c32` MENU LABEL Windows7
` APPEND sda <PARTITION_NUMBER_OF_WINDOWS>` KERNEL chain.c32
APPEND sda <PARTITION_NUMBER_OF_WINDOWS>
```
## GRUB Legacy ## GRUB Legacy
* If on BIOS set boot entry (boot partition must be mounted) * If on BIOS set boot entry (boot partition must be mounted)
`mount /dev/sda1 /boot` ```
`grub-install /dev/sda` mount /dev/sda1 /boot
grub-install /dev/sda
```
* If on UEFI set boot entry (boot partition must be mounted) * If on UEFI set boot entry (boot partition must be mounted)
`mount /dev/sda1 /boot/efi` ```
grub-install /boot/efi` mount /dev/sda1 /boot/efi
grub-install /boot/efi
```
* Edit configuration file "_/boot/grub/menu.lst_" * Edit configuration file "_/boot/grub/menu.lst_"
`default=0` ```
`timeout=10` default=0
`splashimage=(hd0,0)/grub/splash.xpm.gz` timeout=10
`#hiddenmenu` splashimage=(hd0,0)/grub/splash.xpm.gz
`title <DISTRO_NAME> (<KERNEL_VERSION>)` #hiddenmenu
` root (hd0,<PARTITION_NUMBER_OF_ROOT>)` title <DISTRO_NAME> (<KERNEL_VERSION>)
` kernel /vmlinuz-<KERNEL_VERSION> ro root=/dev/sda5 rhgb quiet` root (hd0,<PARTITION_NUMBER_OF_ROOT>)
` initrd /initramfs-<KERNEL_VERSION>.img` kernel /vmlinuz-<KERNEL_VERSION> ro root=/dev/sda5 rhgb quiet
`title <DISTRO_NAME_alternative_kernel> (<ANOTHER_KERNEL_VERSION>)` initrd /initramfs-<KERNEL_VERSION>.img
` root (hd0,<PARTITION_NUMBER_OF_ROOT>)` title <DISTRO_NAME_alternative_kernel> (<ANOTHER_KERNEL_VERSION>)
` kernel /vmlinuz-<ANOTHER_KERNEL_VERSION> ro root=/dev/sda5 rhgb quiet` root (hd0,<PARTITION_NUMBER_OF_ROOT>)
` initrd /initramfs-<ANOTHER_KERNEL_VERSION>.img` kernel /vmlinuz-<ANOTHER_KERNEL_VERSION> ro root=/dev/sda5 rhgb quiet
`title FreeDOS` initrd /initramfs-<ANOTHER_KERNEL_VERSION>.img
` root (hd0,<PARTITION_NUMBER_OF_FREEDOS>)` title FreeDOS
` kernel /memdisk` root (hd0,<PARTITION_NUMBER_OF_FREEDOS>)
` initrd (hd0,<PARTITION_NUMBER_OF_FREEDOS>)/fdboot.img` kernel /memdisk
`title Windows 7` initrd (hd0,<PARTITION_NUMBER_OF_FREEDOS>)/fdboot.img
` root (hd0,<PARTITION_NUMBER_OF_WINDOWS>)` title Windows 7
` chainloader /EFI/Microsoft/Boot/bootmgfw.efi` root (hd0,<PARTITION_NUMBER_OF_WINDOWS>)
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
```
## GRUB 2 ## GRUB 2
* If on BIOS set boot entry (boot partition must be mounted) * If on BIOS set boot entry (boot partition must be mounted)
`mount /dev/sda1 /boot` ```
`grub-install /dev/sda` mount /dev/sda1 /boot
grub-install /dev/sda
```
* If on UEFI set boot entry (boot partition must be mounted) * If on UEFI set boot entry (boot partition must be mounted)
`mount /dev/sda1 /boot/efi` ```
`grub-install /boot/efi` mount /dev/sda1 /boot/efi
grub-install /boot/efi
```
* If Grub does not detect your OS run "_os-prober_" followed by "_update-grub_" * If Grub does not detect your OS run "_os-prober_" followed by "_update-grub_"
* Or add the OS manually to the Grub config file "_/etc/grub.d/40_custom_" * Or add the OS manually to the Grub config file "_/etc/grub.d/40_custom_"
`menuentry "FreeDOS" {` ```
`set root='(hd0,msdos2)'` menuentry "FreeDOS" {
`linux16 /memdisk` set root='(hd0,msdos2)'
`initrd16 /fdboot.img` linux16 /memdisk
`chainloader +1` initrd16 /fdboot.img
`}` chainloader +1
`menuentry "Windows 7" {` }
`insmod part_msdos` menuentry "Windows 7" {
`insmod ntfs` insmod part_msdos
`insmod search_fs_uuid` insmod ntfs
`insmod ntldr` insmod search_fs_uuid
`search --fs-uuid --no-floppy --set=root 3482FBC382FB879E` insmod ntldr
`chainloader +1` search --fs-uuid --no-floppy --set=root 3482FBC382FB879E
`ntldr /bootmgr` chainloader +1
`}` ntldr /bootmgr
}
```
* Update config file * Update config file
`grub-mkconfig -o /boot/grub/grub.cfg` `grub-mkconfig -o /boot/grub/grub.cfg`