3. 執行指令碼syslinux-install_update ,引數使用 -i (安裝) -a (設可啟動標識) -m (安裝到mbr)
/usr/sbin/syslinux-install_update -i -a -m
4. 修改配置檔案 /boot/syslinux/syslinux.cfg
Note: For this to work with GPT, the gptfdisk package is needed as the backend for setting the boot flag.
手工完成安裝
Note: 若你不知你所使用的分割槽表是使用什麼 (MBR or GPT), 預設一般使用的是MBR分割槽表。大部分情況下,GPT將使用整個磁碟建立一個特殊的MBR-型別的分割槽(type 0xEE) ,使用下面命令可顯示:
# fdisk -l /dev/sda
或者可以這樣:
# sgdisk -l /dev/sda
若其非GPT磁碟,將顯示 " GPT: not present".
Note: If you are trying to rescue an installed system with a live CD, be sure to chroot into it before executing these commands. If you do not chroot first, you must prepend all file paths (not /dev/ paths) with the mount point.
Make sure you have the syslinux package installed. Then install Syslinux onto your boot partition, which must contain a fat, ext2, ext3, ext4, or btrfs file system.
# mkdir /boot/syslinux
# extlinux --install /boot/syslinux #run on a mounted directory (not /dev/sdXY)
This config uses the same menu design as the Arch Install CD: syslinux.cfg
The background file can be found here: splash.png
Config:
UI vesamenu.c32
DEFAULT arch
PROMPT 0
MENU TITLE Boot Menu
MENU BACKGROUND splash.png
TIMEOUT 50
MENU WIDTH 78
MENU MARGIN 4
MENU ROWS 5
MENU VSHIFT 10
MENU TIMEOUTROW 13
MENU TABMSGROW 11
MENU CMDLINEROW 11
MENU HELPMSGROW 16
MENU HELPMSGENDROW 29
# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
MENU COLOR border 30;44 #40ffffff #a0000000 std
MENU COLOR title 1;36;44 #9033ccff #a0000000 std
MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel 37;44 #50ffffff #a0000000 std
MENU COLOR help 37;40 #c0ffffff #a0000000 std
MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07 37;40 #90ffffff #a0000000 std
MENU COLOR tabmsg 31;40 #30ffffff #00000000 std
LABEL arch
MENU LABEL Arch Linux
LINUX ../vmlinuz-linux
APPEND root=/dev/sda2 ro
INITRD ../initramfs-linux.img
LABEL archfallback
MENU LABEL Arch Linux Fallback
LINUX ../vmlinuz-linux
APPEND root=/dev/sda2 ro
INITRD ../initramfs-linux-fallback.img
Since Syslinux 3.84 vesamenu.c32 supports the "MENU RESOLUTION $WIDTH $HEIGHT" directive.To use it, insert "MENU RESOLUTION 1440 900" into your config for a 1440x900 resolution.The background picture has to have exactly the right resolution however as syslinux will otherwise refuse to load the menu.
Chainloading
If you want to chainload other operating systems (such as Windows) or boot loaders, copy (or symlink) thechain.c32 module to the syslinux folder (for details, see the instructions in the previous section). Then, create a section in the configuration file:
LABEL windows
MENU LABEL Windows
COM32 chain.c32
APPEND hd0 3
hd0 3 is the third partition on the first BIOS drive - drives are counted from zero, but partitions are counted from one. For more details about chainloading, see [1].
If you have grub2 installed in your boot partition, you can chainload it by using:
LABEL grub2
MENU LABEL Grub2
COM32 chain.c32
append file=../grub/boot.img
This maybe required for booting from iso images.
使用記憶體測試 memtest
使用下面的 LABEL章節部分,可載入(需要安裝軟體包:memtest86+,否則不起作用):
LABEL memtest
MENU LABEL Memtest86+
LINUX ../memtest86+/memtest.bin
使用硬體探測工具HDT
HDT (Hardware Detection Tool) displays hardware information. Like before, the .c32 file has to be copied or symlinked from /boot/syslinux/.For pci info either copy or symlink /usr/share/hwdata/pci.ids to /boot/syslinux/pci.ids
LABEL hdt
MENU LABEL Hardware Info
COM32 hdt.c32
重啟和關閉電源
Use the following sections to reboot or power off your machine.
自動完成安裝
syslinux-install_update指令碼將自動安裝Syslinux, 複製COM32模組到/boot/syslinux, 設定啟動標識,安裝到MBR.可自動根據softraid處理MBR和 GPT磁碟。
下面是安裝過程:
1. 安裝Syslinux
pacman -S syslinux
2. 確認/boot是否已經載入
3. 執行指令碼syslinux-install_update ,引數使用 -i (安裝) -a (設可啟動標識) -m (安裝到mbr)
/usr/sbin/syslinux-install_update -i -a -m
4. 修改配置檔案 /boot/syslinux/syslinux.cfg
Note: For this to work with GPT, the gptfdisk package is needed as the backend for setting the boot flag.
手工完成安裝
Note: 若你不知你所使用的分割槽表是使用什麼 (MBR or GPT), 預設一般使用的是MBR分割槽表。大部分情況下,GPT將使用整個磁碟建立一個特殊的MBR-型別的分割槽(type 0xEE) ,使用下面命令可顯示:
# fdisk -l /dev/sda
或者可以這樣:
# sgdisk -l /dev/sda
若其非GPT磁碟,將顯示 " GPT: not present".
Note: If you are trying to rescue an installed system with a live CD, be sure to chroot into it before executing these commands. If you do not chroot first, you must prepend all file paths (not /dev/ paths) with the mount point.
Make sure you have the syslinux package installed. Then install Syslinux onto your boot partition, which must contain a fat, ext2, ext3, ext4, or btrfs file system.
# mkdir /boot/syslinux
# extlinux --install /boot/syslinux #run on a mounted directory (not /dev/sdXY)
/boot/syslinux/ is device /dev/sda1
MBR分割槽表
需要標識啟動分割槽為啟用狀態.可用這些工具實現:fdisk, cfdisk, sfdisk, (g)parted.最後結果看起來是這樣:
# fdisk -l /dev/sda
[...]
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 104447 51200 83 Linux
/dev/sda2 104448 625142447 312519000 83 Linux
安裝到主啟動卷區:
# dd bs=440 conv=notrunc count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/sda
GUID Partition Table aka GPT
Main article GUID_Partition_Table
Bit 2 of the attributes for the /boot partition need to be set.
# sgdisk /dev/sda --attributes=1:set:2
This would toggle the attribute legacy BIOS bootable on partition 1
Verify:
# sgdisk /dev/sda --attributes=1:show
1:2:1 (legacy BIOS bootable)
安裝主啟動卷區:
# dd bs=440 conv=notrunc count=1 if=/usr/lib/syslinux/gptmbr.bin of=/dev/sda
重啟
如果此時重啟,會有提示,以確認是自動啟動還是給出一個啟動選單,此時需要建立一個配置檔案。
配置 syslinux
syslinux的配置檔案 syslinux.cfg 必須和syslinux放在同一個目錄下,在我們的例子中,是 "/boot/syslinux/"
啟動器將自動尋找這兩個配置檔案:syslinux.cfg (優先) 或者 extlinux.conf
補充:
Instead of LINUX, the keyword KERNEL can also be used. KERNEL tries to detect the type of the file, while LINUX always expects a Linux kernel.
TIMEOUT 的值是1/10秒,也就是50代表5秒
示例
比較簡單的 Syslinux 配置
這是一個非常簡單的配置,有啟動提示,並且在5秒後自動啟動第一個系統。
配置檔案:
PROMPT 1
TIMEOUT 50
DEFAULT arch
LABEL arch
LINUX ../vmlinuz-linux
APPEND root=/dev/sda2 ro
INITRD ../initramfs-linux.img
LABEL archfallback
LINUX ../vmlinuz-linux
APPEND root=/dev/sda2 ro
INITRD ../initramfs-linux-fallback.img
若不想看到提示,設定PROMPT(顯示時間)為0.
文字的啟動選單
把模組menu COM32複製到syslinux目錄中,即可使用文字選單:
# cp /usr/lib/syslinux/menu.c32 /boot/syslinux/
若沒有給/boot單獨分割槽,且和/usr同一分割槽,那麼,也可以僅使用一個軟連結:
# ln -s /usr/lib/syslinux/menu.c32 /boot/syslinux/
配置:
UI menu.c32
PROMPT 0
MENU TITLE Boot Menu
TIMEOUT 50
DEFAULT arch
LABEL arch
MENU LABEL Arch Linux
LINUX ../vmlinuz-linux
APPEND root=/dev/sda2 ro
INITRD ../initramfs-linux.img
LABEL archfallback
MENU LABEL Arch Linux Fallback
LINUX /vmlinuz-linux
APPEND root=/dev/sda2 ro
INITRD /initramfs-linux-fallback.img
p=boot/syslinux/syslinux.git;a=blob;f=doc/menu.txt.
圖形化的啟動選單
把vesamenu COM32移入到syslinux目錄中,可使用圖形啟動介面:
# cp /usr/lib/syslinux/vesamenu.c32 /boot/syslinux/
若沒有給/boot單獨分割槽,且和/usr同一分割槽,那麼,也可以僅使用一個軟連結: :
# ln -s /usr/lib/syslinux/vesamenu.c32 /boot/syslinux/
This config uses the same menu design as the Arch Install CD: syslinux.cfg
The background file can be found here: splash.png
Config:
UI vesamenu.c32
DEFAULT arch
PROMPT 0
MENU TITLE Boot Menu
MENU BACKGROUND splash.png
TIMEOUT 50
MENU WIDTH 78
MENU MARGIN 4
MENU ROWS 5
MENU VSHIFT 10
MENU TIMEOUTROW 13
MENU TABMSGROW 11
MENU CMDLINEROW 11
MENU HELPMSGROW 16
MENU HELPMSGENDROW 29
# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
MENU COLOR border 30;44 #40ffffff #a0000000 std
MENU COLOR title 1;36;44 #9033ccff #a0000000 std
MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel 37;44 #50ffffff #a0000000 std
MENU COLOR help 37;40 #c0ffffff #a0000000 std
MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07 37;40 #90ffffff #a0000000 std
MENU COLOR tabmsg 31;40 #30ffffff #00000000 std
LABEL arch
MENU LABEL Arch Linux
LINUX ../vmlinuz-linux
APPEND root=/dev/sda2 ro
INITRD ../initramfs-linux.img
LABEL archfallback
MENU LABEL Arch Linux Fallback
LINUX ../vmlinuz-linux
APPEND root=/dev/sda2 ro
INITRD ../initramfs-linux-fallback.img
Since Syslinux 3.84 vesamenu.c32 supports the "MENU RESOLUTION $WIDTH $HEIGHT" directive.To use it, insert "MENU RESOLUTION 1440 900" into your config for a 1440x900 resolution.The background picture has to have exactly the right resolution however as syslinux will otherwise refuse to load the menu.
Chainloading
If you want to chainload other operating systems (such as Windows) or boot loaders, copy (or symlink) thechain.c32 module to the syslinux folder (for details, see the instructions in the previous section). Then, create a section in the configuration file:
LABEL windows
MENU LABEL Windows
COM32 chain.c32
APPEND hd0 3
hd0 3 is the third partition on the first BIOS drive - drives are counted from zero, but partitions are counted from one. For more details about chainloading, see [1].
If you have grub2 installed in your boot partition, you can chainload it by using:
LABEL grub2
MENU LABEL Grub2
COM32 chain.c32
append file=../grub/boot.img
This maybe required for booting from iso images.
使用記憶體測試 memtest
使用下面的 LABEL章節部分,可載入(需要安裝軟體包:memtest86+,否則不起作用):
LABEL memtest
MENU LABEL Memtest86+
LINUX ../memtest86+/memtest.bin
使用硬體探測工具HDT
HDT (Hardware Detection Tool) displays hardware information. Like before, the .c32 file has to be copied or symlinked from /boot/syslinux/.For pci info either copy or symlink /usr/share/hwdata/pci.ids to /boot/syslinux/pci.ids
LABEL hdt
MENU LABEL Hardware Info
COM32 hdt.c32
重啟和關閉電源
Use the following sections to reboot or power off your machine.
LABEL reboot
MENU LABEL Reboot
COM32 reboot.c32
LABEL poweroff
MENU LABEL Power Off
COMBOOT poweroff.com