关于爱心的议论文:syslinux常用菜单命令讲解示例

来源:百度文库 编辑:中财网 时间:2024/05/09 18:08:23

syslinux常用菜单命令讲解示例

网上飞鹰对syslinux菜单布局有过较深入的研究:
http://bbs.wuyou.com/viewthread.php?tid=158723

这里再介绍几条常用的syslinux菜单命令:


MENU DISABLE
        (Only valid after a LABEL statement.)
        Makes the entry unselectable.
            仅用于LABEL语句后面,使用该项菜单项不可选择(即能看不能用)。

MENU SEPARATOR
        Insert an empty line in the menu.
            在菜单中插入一个空行

MENU INDENT count
        (Only valid after a LABEL statement.)
        Will add "count" spaces in front of the displayed menu entry.
            仅在LABEL语句后有效。使用该命令,可在显示时将菜单项之前加上conut个空格。

MENU DEFAULT
        (Only valid after a LABEL statement.)
        Indicates that this entry should be the default for this
            仅在LABLE语句后有效,指定默认菜单项

TEXT HELP
Help text ...
... which can span multiple lines
ENDTEXT
        (Only valid after a LABEL statement.)
        Specifies a help text that should be displayed when a particular
        selection is highlighted.
        particular submenu.  See also the DEFAULT directive below.
            仅在LABEL语句后有效,用于在该菜单项被选定高亮时显示其中的文本信息(可为多行)
MENU PASSWD passwd
        (Only valid after a LABEL statement.)
        Sets a password on this menu entry.  "passwd" can be either a
        cleartext password or a password encrypted with one of the
        following algorithms:
        MD5                (Signature: $1$)
        SHA-1                (Signature: $4$)
        SHA-2-256        (Signature: $5$)
        SHA-2-512        (Signature: $6$)
      
        Use the included Perl scripts "sha1pass" or "md5pass" to
        encrypt passwords.  MD5 passwords are compatible with most
        Unix password file utilities; SHA-1 passwords are probably
        unique to Syslinux; SHA-2 passwords are compatible with very
        recent Linux distributions.  Obviously, if you don't encrypt
        your passwords they will not be very secure at all.

        If you are using passwords, you want to make sure you also use
        the settings "NOESCAPE 1", "PROMPT 0", and either set
        "ALLOWOPTIONS 0" or use a master password (see below.)

        If passwd is an empty string, this menu entry can only be
        unlocked with the master password.
仅在LABEL语句后有效,用于对该菜单加一特定密码。

MENU MASTER PASSWD passwd

        Sets a master password.  This password can be used to boot any
        menu entry, and is required for the [Tab] and [Esc] keys to
        work.
设置主密码,用于对任意菜单项加密码。需要按 [Tab] 及 [Esc]键进入输入界面。

注意,syslinux/isolinux/pxelinux4.0版开始支持快捷键直接进入子菜单。格式如下:
MENU IMMEDIATE
仅用于LABEL语句后面。


最近发现syslinux中boot命令非常好用。(参见http://bbs.wuyou.com/viewthread.php?tid=188217&;page=2#pid2173525)
比如想不进菜单直接启动grldr 这一g4d内置菜单,可以这样使用:

QUOTE:default a
label a
boot /grldr
这样,实际上没有使用任何.c32文件就达到目的了,涉及到的只有引导syslinux的pbr、ldlinux.sys、/boot/syslinux/syslinux.cfg及那个grldr。

一个最重要的好处是:boot命令对扩展名不敏感,比如0PE的内置菜单为0PE.BIN或者grldr,以前在pxelinux网启时,使用kernel命令的对象必须是.0文件,如 kernel /0PE.0,如果使用boot命令,现在只要 boot /0pe.bin 或 boot /grldr 或者 boot /0pe.0均可。即boot命令适应性还是很强的。

如果想加载ISO文件,可参考下面的命令:

QUOTE:
        LABEL xxxISO
       MENU LABEL < ^1 > XXX
        LINUX memdisk
        INITRD /****.iso
        APPEND iso raw
或者:

QUOTE:label XXX
kernel /memdisk raw iso initrd=/XXX.iso

如果想加载IMG文件,可参考下面的命令:

QUOTE:LABEL maxdos
MENU LABEL [^1] MaxDOS 8
MENU IMMEDIATE
kernel /BOOT/SYSLINUX/MEMDISK c=194 h=2 s=36 floppy
append initrd=/BOOT/IMGS/MAXDOS.IMG
注意当IMG大小超过2.88M后,需要加上CHS参数。此参数的数值确定可用工具,也可通过winimage查看。具体搜索下吧。


启动PE的seupldr.bin文件,在syslinux下通常是加上一个ldntldr的头文件,再kernel之。当合盘时,grub4dos启动的是没有头文件的setupldr.bin,为了节省文件及空间,可以使用如下命令达到syslinux启动PE的要求:

QUOTE:LABEL xxx
MENU LABEL [^2] xxxxxx
MENU IMMEDIATE
kernel /BOOT/LDNTLDR
append initrd=/BOOT/SETUPLDR.BIN
这样的效果等同于 kernel  (LDNTLDR+SETUPLDR.BIN)
红字的MENU IMMEDIATE仅4.0以上版本支持。

启动子菜单

QUOTE:LABEL XXX
MENU LABEL [^3] XXX
MENU IMMEDIATE
config /BOOT/SYSLINUX/3.CFG
3.CFG即为子菜单。

启动bootmgr:

QUOTE:LABEL bootmgr
MENU LABEL [^B] BOOTMGR
MENU IMMEDIATE
kernel /BOOT/LDNTLDR
append initrd=/BOOTMGR
启动hd0,1上nt5系统:

QUOTE:LABEL localboot
MENU LABEL [^N] nt5
MENU IMMEDIATE
kernel /BOOT/SYSLINUX/CHAIN.C32 hd0,1
append ntldr=/ntldr
这里,需要存在/BOOT/SYSLINUX/CHAIN.C32这一文件。

启动本地硬盘上系统:

QUOTE:LABEL localboot
MENU LABEL [^L] local boot
MENU IMMEDIATE
localboot 0x80
启动(bios)下一设备:

QUOTE:LABEL next
MENU LABEL [^N] next
MENU IMMEDIATE
localboot -1
关机:

QUOTE:LABEL poweroff
MENU LABEL [^S] poweroff
MENU IMMEDIATE
kernel /BOOT/SYSLINUX/POWEROFF.COM
这里,需要存在/BOOT/SYSLINUX/POWEROFF.COM这一文件。


重启:

QUOTE:LABEL reboot
MENU LABEL [^R] reboot
MENU IMMEDIATE
kernel /BOOT/SYSLINUX/REBOOT.C32
这里,需要存在/BOOT/SYSLINUX/REBOOT.C32这一文件。




顺便转载一下《syslinux是什么》,官方网站文章,百度文库收录的中英对照版。
syslinux.zip (30.78 KB)