Difference between revisions of "SYSLINUX"

From Syslinux Wiki
Jump to: navigation, search
(tacotroctr)
(spam revert)
Line 1: Line 1:
olozelnovisi
 
 
==What is SYSLINUX?==
 
==What is SYSLINUX?==
 
SYSLINUX is a boot loader for the Linux operating system which operates off an MS-DOS/Windows FAT filesystem. It is intended to simplify first-time installation of Linux, and for creation of rescue- and other special-purpose boot disks.  
 
SYSLINUX is a boot loader for the Linux operating system which operates off an MS-DOS/Windows FAT filesystem. It is intended to simplify first-time installation of Linux, and for creation of rescue- and other special-purpose boot disks.  

Revision as of 08:29, 28 December 2007

What is SYSLINUX?

SYSLINUX is a boot loader for the Linux operating system which operates off an MS-DOS/Windows FAT filesystem. It is intended to simplify first-time installation of Linux, and for creation of rescue- and other special-purpose boot disks.

SYSLINUX can be used, when properly set up, to completely eliminate the need for distribution of raw diskette images for boot floppies. A SYSLINUX floppy can be manipulated using standard MS-DOS (or any other OS that can access an MS-DOS filesystem) tools once it has been created.


What SYSLINUX is Not...

SYSLINUX is probably not suitable as a general purpose boot loader. It can only boot Linux from a FAT filesystem, and not, for example, ext2. Since a native Linux implementation will typically use ext2, another boot loader (e.g. LILO) is probably more suitable. In a system which actually contains DOS or Windows, LOADLIN may be simpler to use.

However, SYSLINUX has shown itself to be quite useful in a number of special-purpose applications.

How do I Create a Bootable Floppy?

In order to create a bootable Linux floppy using SYSLINUX, prepare a normal MS-DOS formatted floppy. Copy one or more Linux kernel files to it, then execute:

DOS

syslinux [-s] a: (or whichever drive letter is appropriate; the [ ] means -s is optional)

  • If you're running in a Win95/98/ME DOS box, you should execute the command lock a: first.
  • If you're running in a WinNT/2K DOS box, you will probably get a dialog box about not getting exclusive access and with Abort/Retry/Ignore buttons; people have reported that selecting "Ignore" makes the command complete correctly.

Linux

syslinux [-s] [-o offset] /dev/fd0 (or, again, whichever device is the correct one.)

This will alter the boot sector on the disk and copy a file named LDLINUX.SYS into its root directory.

The -s option, if given, will install a "safe, slow and stupid" version of SYSLINUX. This version may work on some very buggy BIOSes on which SYSLINUX would otherwise fail. If you find a machine on which the -s option is required to make it boot reliably, please send as much info about your machine as you can, and include the failure mode.

The -o option is used with a disk image file and specifies the byte offset of the filesystem image in the file.

On boot time, by default, the kernel will be loaded from the image named LINUX on the boot floppy. This default can be changed, see the section on the SYSLINUX config file.

If the Shift or Alt keys are held down during boot, or the Caps or Scroll locks are set, SYSLINUX will display a LILO-style "boot:" prompt. The user can then type a kernel file name followed by any kernel parameters. The SYSLINUX loader does not need to know about the kernel file in advance; all that is required is that it is a file located in the root directory on the disk.

How do I Configure SYSLINUX?

All the configurable defaults in SYSLINUX can be changed by putting a file called SYSLINUX.CFG in the root directory of the boot floppy. This is a text file in either UNIX or DOS format, containing one or more of the following items (case is insensitive for keywords; upper case is used here to indicate that a word should be typed verbatim):

All options here applies to PXELINUX as well as SYSLINUX unless otherwise noted. See pxelinux.doc for additional information on PXELINUX.

DEFAULT kernel options...

Sets the default command line. If SYSLINUX boots automatically, it will act just as if the entries after DEFAULT had been typed in at the "boot:" prompt, except that the option "auto" is automatically added, indicating an automatic boot.

If no configuration file is present, or no DEFAULT entry is present in the config file, the default is kernel name "linux", with no options.

APPEND options...

Add one or more options to the kernel command line. These are added both for automatic and manual boots. The options are added at the very beginning of the kernel command line, usually permitting explicitly entered kernel options to override them. This is the equivalent of the LILO "append" option.

IPAPPEND flag_val [PXELINUX only]

The IPAPPEND option is available only on PXELINUX. The flag_val is an OR of the following options:

1: indicates that an option of the following format should be generated and added to the kernel command line:

ip=client-ip:boot-server-ip:gw-ip:netmask 

... based on the input from the DHCP/BOOTP or PXE boot server.

The use of this option is not recommended. If you have to use it, it is probably an indication that your network configuration is broken. Using just ip=dhcp on the kernel command line is a preferrable option, or, better yet, run dhcpcd/dhclient, from an initrd if necessary.

2: indicates that an option of the following format should be generated and added to the kernel command line:

BOOTIF=hardware-address-of-boot-interface 

... in dash-separated hexadecimal with leading hardware type (same as for the configuration file; see pxelinux.doc.)

This allows an initrd program to determine from which interface the system booted.

LABEL label 
KERNEL image
 APPEND options...
 IPAPPEND flag_val [PXELINUX only] 
 Indicates that if "label" is entered as the kernel to boot, SYSLINUX should instead boot "image", and the specified APPEND and IPAPPEND options should be used instead of the ones specified in the global section of the file (before the first LABEL command.) The default for "image" is the same as "label", and if no APPEND is given the default is to use the global entry (if any). Up to 128 LABEL entries are permitted. (for ISOLINUX, 64 LABEL entries.) 

Note that LILO uses the syntax:

image = mykernel
  label = mylabel
  append = "myoptions"

... whereas SYSLINUX uses the syntax:

label mylabel
  kernel mykernel
  append myoptions

Notes: Labels are mangled as if they were filenames, and must be unique after mangling. For example, two labels "v2.1.30" and "v2.1.31" will not be distinguishable under SYSLINUX, since both mangle to the same DOS filename.

The "kernel" doesn't have to be a Linux kernel; it can be a boot sector or a COMBOOT file

APPEND -

Append nothing. APPEND with a single hyphen as argument in a LABEL section can be used to override a global APPEND.

LOCALBOOT type [ISOLINUX, PXELINUX]

On PXELINUX, specifying "LOCALBOOT 0" instead of a "KERNEL" option means invoking this particular label will cause a local disk boot instead of booting a kernel.

The argument 0 means perform a normal boot. The argument 4 will perform a local boot with the Universal Network Driver Interface (UNDI) driver still resident in memory. Finally, the argument 5 will perform a local boot with the entire PXE stack, including the UNDI driver, still resident in memory. All other values are undefined. If you don't know what the UNDI or PXE stacks are, don't worry -- you don't want them; just specify 0.

On ISOLINUX, the "type" specifies the local drive number to boot from; 0x00 is the primary floppy drive and 0x80 is the primary hard drive. The special value -1 causes ISOLINUX to report failure to the BIOS, which, on recent BIOSes, should mean that the next boot device in the boot sequence should be activated.

IMPLICIT flag_val

If flag_val is 0, do not load a kernel image unless it has been explicitly named in a LABEL statement. The default is 1.

ALLOWOPTIONS flag_val

If flag_val is 0, ignore any options added by the user on the command line. The default is 1.

TIMEOUT timeout

Indicates how long to wait at the boot: prompt until booting automatically, in units of 1/10 s. The timeout is cancelled as soon as the user types anything on the keyboard, the assumption being that the user will complete the command line already begun. A timeout of zero will disable the timeout completely, this is also the default.

NOTE: The maximum possible timeout value is 35996; corresponding to just below one hour.

ONTIMEOUT kernel options...

Sets the command line invoked on a timeout. Normally this is the same thing as invoked by DEFAULT. If this is specified, then DEFAULT is used only if the user presses to boot.

ONERROR kernel options...

If a kernel image is not found (either due to it not existing, or because IMPLICIT is set), run the specified command. The faulty command line is appended to the specified options, so if the ONERROR directive reads as:

ONERROR xyzzy plugh 

... and the command line as entered by the user is:

foo bar baz 

... SYSLINUX will execute the following as if entered by the user:

xyzzy plugh foo bar baz

SERIAL port [baudrate [flowcontrol]]

Enables a serial port to act as the console. "port" is a number (0 = /dev/ttyS0 = COM1, etc.); if "baudrate" is omitted, the baud rate defaults to 9600 bps. The serial parameters are hardcoded to be 8 bits, no parity, 1 stop bit.

"flowcontrol" is a combination of the following bits:
0x001 - Assert DTR
0x002 - Assert RTS
0x010 - Wait for CTS assertion
0x020 - Wait for DSR assertion
0x040 - Wait for RI assertion
0x080 - Wait for DCD assertion
0x100 - Ignore input unless CTS asserted
0x200 - Ignore input unless DSR asserted
0x400 - Ignore input unless RI asserted
0x800 - Ignore input unless DCD asserted

For this directive to be guaranteed to work properly, it should be the first directive in the configuration file.

CONSOLE flag_val

If flag_val is 0, disable output to the normal video console. If flag_val is 1, enable output to the video console (this is the default.) Some BIOSes try to forward this to the serial console and sometimes make a total mess thereof, so this option lets you disable the video console on these systems.

FONT filename

Load a font in .psf format before displaying any output (except the copyright line, which is output as ldlinux.sys itself is loaded.) SYSLINUX only loads the font onto the video card; if the .psf file contains a Unicode table it is ignored. This only works on EGA and VGA cards; hopefully it should do nothing on others.

KBDMAP keymap

Install a simple keyboard map. The keyboard remapper used is very simplistic (it simply remaps the keycodes received from the BIOS, which means that only the key combinations relevant in the default layout -- usually U.S. English -- can be mapped) but should at least help people with QWERTZ or AZERTY keyboard layouts and the locations of = and , (two special characters used heavily on the Linux kernel command line.)

The included program keytab-lilo.pl from the LILO distribution can be used to create such keymaps. The file keytab-lilo.doc contains the documentation for this program.

DISPLAY filename

Displays the indicated file on the screen at boot time (before the boot: prompt, if displayed). Please see the section below on DISPLAY files.

NOTE: If the file is missing, this option is simply ignored. 

SAY message

Prints the message on the screen.

PROMPT flag_val

If flag_val is 0, display the boot: prompt only if the Shift or Alt key is pressed, or Caps Lock or Scroll lock is set (this is the default). If flag_val is 1, always display the boot: prompt.

NOESCAPE flag_val

If flag_val is set to 1, ignore the Shift/Alt/Caps Lock/Scroll Lock escapes. Use this (together with PROMPT 0) to force the default boot alternative.

F[1-12] filename

F2 filename
  ...etc...
F9 filename
F10 filename 

Displays the indicated file on the screen when a function key is pressed at the boot: prompt. This can be used to implement pre-boot online help (presumably for the kernel command line options.) For backwards compatibility with earlier releases, F10 can be also entered as "F0". Note that there is currently no way to bind file names to F11 and F12. Please see the section below on DISPLAY files.

When using the serial console, press <Ctrl-F><digit> to get to the help screens, e.g. <Ctrl-F><2> to get to the F2 screen, and <Ctrl-F><0> for the F10 one.

In the configuration file blank lines and comment lines beginning with a hash mark (#) are ignored.

Note that the configuration file is not completely decoded. Syntax different from the one described above may still work correctly in this version of SYSLINUX, but may break in a future one.

Can SYSLINUX Handle Large Kernels?

This version of SYSLINUX supports large kernels (bzImage format), eliminating the 500K size limit of the zImage kernel format. bzImage format kernels are detected automatically and handled transparently to the user.

This version of SYSLINUX also supports a boot-time-loaded ramdisk (initrd). An initrd is loaded from a DOS file if the option "initrd=filename" (where filename is the filename of the initrd image; the file must be located in the root directory on the boot floppy) is present on the processed command line (after APPEND's have been added, etc.). If several initrd options are present, the last one has precedence; this permits user-entered options to override a config file APPEND. Specifying "initrd=" without a filename inhibits initrd loading. The file specified by the initrd= option will typically be a gzipped filesystem image.

NOTE: One of the main advantages with SYSLINUX is that it makes it very easy to support users with new or unexpected configurations, especially in a distribution setting. If initrd is used to extensively modularize the distribution kernel, it is strongly recommended that a simple way of adding drivers to the boot floppy be provided. The suggested manner is to let the initrd system mount the boot floppy and look for additional drivers in a predetermined location.

To bzImage and recent zImage kernels, SYSLINUX 1.30 and higher will identify using the ID byte 0x31. PXELINUX identifies using the ID byte 0x32, ISOLINUX 0x33, and EXTLINUX 0x34. The ID range 0x35-0x3f is reserved for future versions of derivatives of SYSLINUX.

What is the DISPLAY File Format?

DISPLAY and function-key help files are text files in either DOS or UNIX format (with or without <CR>). In addition, the following special codes are interpreted:

<FF>  <FF> = <Ctrl-L> = ASCII 12

Clear the screen, home the cursor. Note that the screen is filled with the current display color.

<SI><bg><fg>  <SI> = <Ctrl-O> = ASCII 15

Set the display colors to the specified background and foreground colors, where <bg> and <fg> are hex digits, corresponding to the standard PC display attributes

0 = black               8 = dark grey
1 = dark blue           9 = bright blue
2 = dark green          a = bright green
3 = dark cyan           b = bright cyan
4 = dark red            c = bright red
5 = dark purple         d = bright purple
6 = brown               e = yellow
7 = light grey          f = white

Picking a bright color (8-f) for the background results in the corresponding dark color (0-7), with the foreground flashing.

Colors are not visible over the serial console.

Example: color.txt file:

^O9eBlinking Yellow on Blue Background
# xxd color.txt
0000000: 0f39 6542 6c69 6e6b 696e 6720 5965 6c6c  .9eBlinking Yell
0000010: 6f77 206f 6e20 426c 7565 2042 6163 6b67  ow on Blue Backg
0000020: 726f 756e 640a                           round.


<CAN>filename<newline>  <CAN> = <Ctrl-X> = ASCII 24

If a VGA display is present, enter graphics mode and display the graphic included in the specified file. The file format is an ad hoc format called LSS16; the included Perl program "ppmtolss16" can be used to produce these images. This Perl program also includes the file format specification.

The image is displayed in 640x480 16-color mode. Once in graphics mode, the display attributes (set by <SI> code sequences) work slightly differently: the background color is ignored, and the foreground colors are the 16 colors specified in the image file. For that reason, ppmtolss16 allows you to specify that certain colors should be assigned to specific color indicies.

Color indicies 0 and 7, in particular, should be chosen with care: 0 is the background color, and 7 is the color used for the text printed by SYSLINUX itself.