Syslinux

Syslinux是一个优秀的系统启动加载器,可引导自硬盘、光盘和通过PXE的网络启动。支持fat, ext2, ext3, ext4 and btrfs文件系统.

注意: 从Syslinux 4起, Extlinux和Syslinux是指同一个东西的

Contents

Syslinux 引导过程

电脑启动时,会先加载MBR (/usr/lib/syslinux/mbr.bin),然后MBR查找那些活动的分区(标注了可启动的),找到这个分区后,卷启动记录程序(VBR=volume boot record)将被执行。如果是ext2/3/4和fat 12/16/32,ldlinux.sys开始的扇区是被写死进卷启动记录程序里的,卷启动记录程序将执行(ldlinux.sys)。当然,如果ldlinux.sys 的位置发生改变,syslinux将无法加载。如果是btrfs,因为文件不断移动导致ldlinux.sys扇区的位置不断变化,而让上面方法失效。从而使得整个syslinux需要被存储在文件系统之外。程序将被存储在卷启动记录程序之后。

当syslinux完全加载完毕,它将自动寻找一个配置文件,名字叫 extlinux.conf 或者syslinux.cfg.找到之后,将加载整个配置文件,否则,将给出提示。


安装

自动完成安装

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

更多信息可见: http://git.kernel.org/?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) the chain.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

常见问题

I have a Syslinux Prompt - Yikes!

You can type in the LABEL name of the entry that you want to boot (as per your syslinux.cfg). If you used the example configs just type

boot: arch

If you get an error that the config file could not be loaded you can pass your needed boot parameters, e.g.:

boot: ../vmlinuz-linux root=/dev/sda2 ro initrd=../initramfs-linux.img

If you don't have access to 'boot:' in ramfs, and therefore temporarily unable to boot kernel again

1) create temp directory, in order to mount your root partition (if it doesn't exist already)

 mkdir -p /new_root

2) mount / under /new_root (in case /boot/ is on same partition, otherwise you'll need to mount them both)

 mount /dev/sd[a-z][1-9] /new_root

3) use 'vi' and edit syslinux.cfg again to suit your needs and save file;

4) reboot

某些电脑中,会出现没找到默认配置或者界面

Certain motherboard manufacturers have less compatibility for booting from USB devices than others. While an ext4 formatted usb drive may boot on a more recent computer, some computers may hang if the boot partition containing the kernel and initrd are not on a fat16 partition. to prevent an older machine from loading ldlinux and failing to read syslinux.cfg, use cfdisk to create a fat-16 partition (<=2GB) and format with

# pacman -S dosfstools
# mkfs.msdos -F 16 /dev/sda1

then install and configure syslinux.

MISSING OPERATING SYSTEM

If you get this message, check if the partition that contains /boot has the boot flag enabled. If the flag is enabled, then perhaps this partition starts at sector 1 rather than sector 63 or 2048. Check this with fdisk -l. If it starts at sector 1, you can move the partition(s) with gparted from a rescue disk. Or, if you have a separate boot partition, you can back up /boot with

cp -a /boot /boot.bak

and then boot up with the arch install disk. Next, use cfdisk to delete the /boot partition, and recreate it. This time it should begin at the proper sector, 63. Now mount your partitions and chroot into your mounted system, as described in the beginners guide. Restore /boot with the command

cp -a /boot.bak/* /boot

Check if /etc/fstab is correct. Then run

/usr/sbin/syslinux-install_update -iam

and reboot.

Windows boots up! No Syslinux!

Solution: Make sure the partition that contains /boot has the boot flag enabled. Also, make sure the boot flag is not enabled on the windows partition. See the installation section above.

The MBR that comes with syslinux looks for the first active partition that has the boot flag set. The windows partition was likely found first and had the boot flag set. If you wanted you could use the MBR that windows or msdos fdisk provides.

进入子菜单,但干不了任何事

You select a menu entry and it does nothing. It "refreshes" the menu
This usually means that you have an error in your configuration. Hit TAB to edit your boot parameters. Alternatively, press ESC and type in the LABEL of your boot entry (Example: arch)


无法删除ldlinux.sys

ldlinux.sys has the immutable attribute set which prevents the file from being deleted or overwritten. This is because the sector location of the file must not change or else syslinux has to be reinstalled.To remove:

chattr -i /boot/syslinux/ldlinux.sys
rm /boot/syslinux/ldlinux.sys

更多信息可见

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: syslinux603.zip是一个压缩包,包含了Syslinux 6.03版本的安装程序和相关文件。Syslinux是一个轻量级的引导加载程序,它的主要作用是在Linux系统启动时加载内核,并提供显示菜单、设置内核参数等功能。Syslinux还可以用于在移动设备上引导Linux系统,如U盘启动等。 syslinux603.zip包含了以下几个主要文件:syslinux.exe、extlinux.exe、menu.c32、memdisk等。其中,syslinux.exe是用于硬盘安装Syslinux的程序,extlinux.exe是用于安装Syslinux到分区引导扇区的程序,menu.c32是提供菜单显示功能的模块,memdisk是提供内存虚拟磁盘功能的模块,可以用于挂载ISO镜像文件等。 使用syslinux603.zip安装Syslinux需要先解压缩压缩包中的文件,然后在命令行窗口中运行相应的安装程序,根据提示进行安装即可。安装完成后,可以将Syslinux配置文件syslinux.cfg和menu.cfg放置到安装目录下,用于设置引导菜单、内核参数等。在启动时,Syslinux将自动加载这些配置文件,并执行相应的操作。 总之,syslinux603.zip是一个方便快捷安装Syslinux的工具包,可以提高Linux系统的启动效率和可靠性。 ### 回答2: syslinux603.zip 是一个压缩文件,其中包含 Syslinux 引导加载程序的源代码和二进制文件。Syslinux 是一款开源的引导加载程序,可用于在计算机上引导 Linux 操作系统以及其他类 Unix 的操作系统。它是 GNU 项目的一部分,被广泛用于 Linux 发行版的安装介质中。 在 syslinux603.zip 中,包含了 Syslinux 的几个可执行文件,例如 syslinux.exe、pxelinux.0、memdisk 等。其中,syslinux.exe 用于安装 Syslinux 引导加载程序到引导扇区,pxelinux.0 用于在计算机上启动远程网络安装,memdisk 则用于在计算机上模拟软盘或 CD-ROM 驱动器。 此外,在 syslinux603.zip 中,还包含了 Syslinux 的配置文件和帮助文档,用户可以自行修改配置文件以满足自己的需求。整个压缩文件还包含了 Makefile、LICENSE 和 README 等文件,方便开发者进行二次开发和使用。 总之,syslinux603.zip 是一个免费的、开源的 Syslinux 引导加载程序的源代码和二进制文件的压缩文件,非常适合需要引导 Linux 操作系统或其他类 Unix 操作系统的计算机用户和开发者使用。 ### 回答3: syslinux603.zip是一个开源软件集合,它包含了一个实用的系统引导程序SyslinuxSyslinux是一个轻量级的Linux引导加载程序,它能够在各种计算机体系结构上启动Linux内核。 Syslinux的特点是快速启动、占用系统资源低、易于使用和支持多种文件系统。Syslinux能够支持从网络、光盘和硬盘驱动器中加载内核镜像文件。此外,它还支持多种格式,如FAT16、FAT32、NTFS、EXT2和EXT3。 syslinux603.zip 是Syslinux 6.03版本的压缩文件,其中包含了Syslinux的源代码、文档和示例文件。用户可以在Linux系统上编译并安装它,也可以将它用于在Live CD和Linux安装光盘中引导系统。 总之,syslinux603.zip是一款非常实用的系统引导程序集合,它能够帮助用户快速启动Linux,同时也符合开源软件的精神,让更多的人受益。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值