Difference between revisions of "Comboot/chain.c32"

From Syslinux Wiki
Jump to: navigation, search
m (Improve table's hidden text format for better browser compatibility.)
(Updates. Corrections. Remove or hide old options that are no longer valid in newer versions. Hide less-"popular" options. Wiki formatting. Link to Wikipedia.)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Release Documentation]]
 
 
[[Category:Comboot]]
 
[[Category:Comboot]]
 
[[Category:Modules]]
 
[[Category:Modules]]
'''chain.c32''' is a COM32 module for Syslinux. It can chainload MBRs, partition boot sectors, Windows bootloaders (ntldr, setupldr.bin and bootmgr), MS-DOS and PC-DOS io.sys, Freedos kernel.sys, isolinux.bin (only from ISOLINUX), grldr of grub4dos or a bootsector saved to a file. It can also swap BIOS drive numbers or hide partitions.  
+
'''chain.c32''' is a COM32 module for Syslinux.  
 +
It can chainload MBRs, partition boot sectors, Windows bootloaders (ntldr,  
 +
setupldr.bin and bootmgr), MS-DOS and PC-DOS io.sys, Freedos kernel.sys,  
 +
isolinux.bin (only from ISOLINUX), grldr of grub4dos, or a bootsector saved to a file.  
 +
It can also swap BIOS drive numbers, or hide partitions (via partition's ID).  
  
 
All options as available in chain.c32 of Syslinux 3.85 (with some updates introduced in later versions):
 
All options as available in chain.c32 of Syslinux 3.85 (with some updates introduced in later versions):
Line 16: Line 19:
 
chain.c32 guid=<label> [options]
 
chain.c32 guid=<label> [options]
 
</pre>
 
</pre>
{| border="0" cellpadding="10" cellspacing="0" bgcolor="#f9f9f9" width="100%" style="padding: 1em; border: 1px dashed darkgray;"
+
 
|+ <code>chain.c32 options:</code>
+
{| border="0" cellpadding="1" cellspacing="0" bgcolor="#f9f9f9" width="100%" style="border: 1px dashed darkgray; padding: 1em; background: #f9f9f9; width: 100%; font-family: monospace; "
 +
|+ style="text-align: left; width: 100%; white-space: nowrap; " | <code>chain.c32 options:</code>  
 +
|-
 +
|style="white-space: nowrap; color: #f9f9f9; visibility: hidden; display: none; height: 0px; " | <code> 123456789012345678901234567 </code>  <!-- THIS ROW SETS COLUMN1 WIDTH -->
 +
|style="white-space: nowrap; color: #f9f9f9; visibility: hidden; display: none; height: 0px; " |  <code> THIS ROW SETS COLUMN1 WIDTH </code>  <!-- THIS ROW SETS COLUMN1 (column1 only. not column2) WIDTH -->
 +
|-
 +
|    <code> file=</><path/to/><loader>  </code> 
 +
|-
 +
| colspan="2" | &nbsp; Load file, instead of boot sector
 +
&nbsp;
 
|-
 
|-
|style="white-space: nowrap; color: #f9f9f9; visibility: hidden; "|  <code> 1234567890123456789 </code>  <!-- THIS ROW SETS COLUMN1 WIDTH -->
 
|style="white-space: nowrap; color: #f9f9f9; visibility: hidden; display: none;"|  <code> THIS ROW SETS COLUMN1 WIDTH </code>  <!-- THIS ROW SETS COLUMN1 (column1 only. not column2) WIDTH -->
 
|- valign="top"
 
|    <code> file=<loader>  </code> 
 
|  <code> load file, instead of boot sector </code> 
 
|- valign="top"
 
 
|    <code> isolinux=<loader>  </code>   
 
|    <code> isolinux=<loader>  </code>   
| <code> load another version of ISOLINUX </code> 
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Load another version of ISOLINUX  
 +
&nbsp;
 +
|-
 
|    <code> ntldr=<loader>  </code>   
 
|    <code> ntldr=<loader>  </code>   
| <code> load Windows' NTLDR, SETUPLDR.BIN or BOOTMGR, or GRLDR </code>   
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Load Windows' NTLDR, SETUPLDR.BIN or BOOTMGR, or GRLDR  
 +
&nbsp;
 +
|-
 +
|    <code> grldr=<loader>  </code>   
 +
|-
 +
| colspan="2" | &nbsp; Load GRUB4DOS' grldr
 +
&nbsp;
 +
|-
 
|    <code> cmldr=<loader>  </code>   
 
|    <code> cmldr=<loader>  </code>   
| <code> load Recovery Console of Windows NT/2K/XP </code> 
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Load Recovery Console of Windows NT/2K/XP  
 +
&nbsp;
 +
|-
 
|    <code> freedos=<loader>  </code>   
 
|    <code> freedos=<loader>  </code>   
| <code> load FreeDOS kernel.sys </code> 
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Load FreeDOS kernel.sys  
|   <code> msdos=<loader>  </code> 
+
&nbsp;
|  <code> load MS-DOS (2.xx to 6.xx) io.sys </code> 
+
|-
|- valign="top"
+
 
|    <code> pcdos=<loader>  </code>   
 
|    <code> pcdos=<loader>  </code>   
|  <code> load PC-DOS ibmbio.com </code>   
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Load PC-DOS ibmbio.com
 +
&nbsp;
 +
|-
 +
|    <code> msdos=<loader> </code>
 +
|-
 +
| colspan="2" | &nbsp; Load MS-DOS (2.xx to 6.xx) io.sys
 +
&nbsp;
 +
|-
 +
|    <code> msdos7=<loader>  </code>   
 +
|-
 +
| colspan="2" | &nbsp; Load MS-DOS 7+ io.sys
 +
&nbsp;
 +
|-
 +
|    <code> drmk=<loader>  </code> 
 +
|-
 +
| colspan="2" | &nbsp; Load DRMK dellbio.bin
 +
&nbsp;
 +
|-
 
|    <code> reactos=<loader>  </code>   
 
|    <code> reactos=<loader>  </code>   
| <code> load ReactOS freeldr </code> 
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Load ReactOS freeldr.sys
 +
&nbsp;
 +
|-
 
|    <code> grub=<loader>  &nbsp;[grubcfg=<config>]  </code>   
 
|    <code> grub=<loader>  &nbsp;[grubcfg=<config>]  </code>   
| <code> load grub legacy stage2 </code> 
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Load grub legacy stage2  
|    <code> seg=<segment>  </code>
+
&nbsp;
| <code> jump to <seg>:0000 instead of 0000:7C00 </code>   
+
|-
|- valign="top"
+
<!-- <nowiki> |    <code> seg=<segment>:<offset>:<ip>  </code>   </nowiki> -->
 +
<!-- <nowiki> |- </nowiki> -->
 +
<!-- <nowiki> | colspan="2" | &nbsp; Jump to <seg>:0000 instead of 0000:7C00 </nowiki> -->
 +
<!-- <nowiki> &nbsp; </nowiki> -->
 +
<!-- <nowiki> |- </nowiki> -->
 
|    <code> swap  </code>   
 
|    <code> swap  </code>   
| <code> swap drive numbers, if bootdisk is not fd0/hd0 </code> 
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Swap drive numbers, if boot drive is not fd0/hd0  
 +
&nbsp;
 +
|-
 
|    <code> hide  </code>   
 
|    <code> hide  </code>   
| <code> hide primary partitions, except selected partition </code>  
+
|-
|- valign="top"
+
| colspan="2" | &nbsp; Hide primary partitions, except selected partition  
|    <code> sethidden  </code>
+
<!-- &nbsp; -->
| <code> set the FAT/NTFS hidden sectors field </code>
+
<!-- <nowiki> |- </nowiki> -->
 +
<!-- <nowiki> |    <code> sethidden  </code>   </nowiki> -->
 +
<!-- <nowiki> |- </nowiki> -->
 +
<!-- <nowiki> | colspan="2" | &nbsp; Set the FAT/NTFS hidden sectors field </nowiki> -->
 
|}
 
|}
  
 +
See [[doc/chain]] for more options.
  
 
== Numbering of Drives and Partitions ==
 
== Numbering of Drives and Partitions ==
Line 85: Line 130:
  
 
Find partition by uuid or label in all GPT partitions on all available drives:
 
Find partition by uuid or label in all GPT partitions on all available drives:
* <tt>'''label'''=''label''</tt>
+
* <tt>'''label'''=''mylabel''</tt>
* <tt>'''guid'''=''guid''</tt>
+
* <tt>'''guid'''=''myguid''</tt>
Note that '''label''' and '''guid''' works only on GPT partition tables, it is not ''filesystem'' but ''partition'' label and uuid.
+
Note that '''label''' and '''guid''' work only on GPT partition tables; it is not ''filesystem'' but ''partition'' label and guid.
  
  
 
=== Partition numbering ===
 
=== Partition numbering ===
 +
 +
The physical devices are counted starting at zero.
 +
The partitions are counted starting at one.
 +
 +
In a GPT scheme, there are only "primary" partitions.
 +
Usually up to a maximum of 128 primary partitions can be created in one GPT device
 +
(the specification allows for more; it requires appropriate conditions).
 +
 +
In a "DOS" (aka. "traditional" or "legacy" or "MBR") partition table scheme,
 +
a maximum of 4 "primary" partitions can be created,
 +
or alternatively up to 3 "primary" partitions and one "extended" partition,
 +
the latter containing "logical" partitions.
 +
 +
Please note that for devices with a traditional MBR ("DOS") partition table scheme,
 +
{{nowrap|"<tt>chain.c32</tt>"}} counts the "logical" partitions
 +
starting from "five", even if not all "primary" slots are in used.
 +
 +
GPT partitions are simply counted in order, starting at one.
 +
  
 
Partition numbers (short):
 
Partition numbers (short):
Line 111: Line 175:
 
::* <tt>'''10'''</tt> : sixth logical partition
 
::* <tt>'''10'''</tt> : sixth logical partition
 
::* <tt>'''11'''</tt> : seventh logical partition
 
::* <tt>'''11'''</tt> : seventh logical partition
::* <tt>'''12'''</tt> : eighths logical partition
+
::* <tt>'''12'''</tt> : eighth logical partition
 
::* ...
 
::* ...
 +
 +
{| cellpadding="10" cellspacing="1" style="text-align:center; padding: 1em; border-style: solid; border-width: 1px;"
 +
|+ style="text-align: left; width: 100%; white-space: nowrap; " | <code>Partition Numbering:</code>
 +
! scope="col" | First disk<br />as seen by BIOS
 +
! scope="col" bgcolor="#FFFF00" | PRIMARY
 +
! scope="col" bgcolor="#FFFF00" | LOGICAL
 +
! scope="col" colspan="3" | Numbering
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 0
 +
| colspan="2" bgcolor="#FFFF99" style="text-align:left;font-weight: light;" | (MBR)
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 1
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | First
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 1
 +
|
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 2
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | Second
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 2
 +
|
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 3
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | Third
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 3
 +
|
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 4
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | Fourth
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 4
 +
|
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 5
 +
|
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | First
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 5
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 6
 +
|
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | Second
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 6
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 7
 +
|
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | Third
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 7
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 8
 +
|
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | Fourth
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 8
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 9
 +
|
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | Fifth
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 9
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" | hd0 10
 +
|
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | Sixth
 +
|
 +
|
 +
| bgcolor="#E6E64C" | 10
 +
|-
 +
| scope="row" bgcolor="#E6E6FA" style="font-weight: light;" | hd0 ...
 +
|
 +
| scope="row" bgcolor="#FFFF99" style="text-align:left; font-weight: light;" | ...
 +
|
 +
|
 +
| bgcolor="#E6E64C" style="font-weight: light;" | ...
 +
|}
  
 
=== Examples ===
 
=== Examples ===
Line 145: Line 300:
  
 
LABEL boot_hd2_2
 
LABEL boot_hd2_2
MENU LABEL Boot second primary partition from thirth hard drive
+
MENU LABEL Boot second primary partition from third hard drive
 
COM32 chain.c32
 
COM32 chain.c32
 
APPEND hd2 2
 
APPEND hd2 2
Line 160: Line 315:
  
 
LABEL boot_part_win7fs
 
LABEL boot_part_win7fs
MENU LABEL Boot ntld from GPT partition labelled "win7fs"
+
MENU LABEL Boot ntldr from GPT partition labelled "win7fs"
 
COM32 chain.c32
 
COM32 chain.c32
 
APPEND label=win7fs ntldr=/bootmgr
 
APPEND label=win7fs ntldr=/bootmgr
 
</pre>
 
</pre>
  
== mbr: ==
+
== mbr ==
  
The mbr: syntax means search all the hard disks until one with a specific MBR serial number (bytes 440-443) is found.
+
The mbr: syntax means search all the hard disks until one  
 +
with a specific MBR serial number (bytes 440-443) is found.
  
You can get the MBR serial number, by running the following command (change /dev/sda to the correct device):
+
You can get the MBR serial number, by running the following command  
 +
(change /dev/sda to the correct device):
 
<pre>
 
<pre>
 
$ hexdump -s 440 -n 4 -e '"0x%08x\n"' /dev/sda
 
$ hexdump -s 440 -n 4 -e '"0x%08x\n"' /dev/sda
Line 190: Line 347:
 
== Options ==
 
== Options ==
  
''' file=<loader> '''
+
The following are some popular options available for chain.c32.
:loads the file <loader> **from the SYSLINUX filesystem** instead of loading the boot sector.
+
See [[doc/chain]] for more options.
  
''' seg=<segment> '''
+
''' file=<loader> '''
:loads at and jumps to <seg>:0000 instead of 0000:7C00.
+
:Load the file <loader> <u>from the SYSLINUX filesystem</u> instead of loading the boot sector.
 +
<!-- -->
 +
<!-- This is not a "popular" option -->
 +
<!-- ''' seg=<segment> ''' -->
 +
<!-- :loads at and jumps to <segment>:0000 instead of 0000:7C00. -->
  
 
''' isolinux=<loader> '''
 
''' isolinux=<loader> '''
:Chainload another version/build of the ISOLINUX bootloader and patch the loader with appropriate parameters in memory. This avoids the need for the -eltorito-alt-boot parameter of mkisofs, when you want more than one ISOLINUX per CD/DVD.
+
:Load another version/build of the ISOLINUX bootloader <!--
 +
--> and patch the loader with appropriate parameters in memory. <!--
 +
--> This avoids the need for the {{nowrap|-eltorito-alt-boot}} <!--
 +
--> parameter of mkisofs, when more than one ISOLINUX per CD/DVD is needed.
  
 
''' ntldr=<loader> '''
 
''' ntldr=<loader> '''
:equivalent to seg=0x2000 file=<loader> sethidden, used with WinNT's loaders
+
:Equivalent to {{nowrap|1=<tt>file=<loader> seg=0x2000 setbpb nohand</tt>}}
 +
:Used with WinNT's loaders
 
::Example loaders: NTLDR (XP, 2003), BOOTMGR (Vista, 2008, 7), GRLDR (Grub4DOS).
 
::Example loaders: NTLDR (XP, 2003), BOOTMGR (Vista, 2008, 7), GRLDR (Grub4DOS).
 
::See: [[HowTos]] & [[Linux_and_Windows_deployment|Linux and Windows deployment]]
 
::See: [[HowTos]] & [[Linux_and_Windows_deployment|Linux and Windows deployment]]
 +
 +
''' grldr=<loader> '''
 +
:Load GRUB4DOS grldr, performing additional corrections on the file in memory.
  
 
''' cmldr=<loader> '''
 
''' cmldr=<loader> '''
:used with Recovery Console of Windows NT/2K/XP. same as ntldr=<loader> & "cmdcons\0" written to the system name field in the bootsector.
+
:Equivalent to {{nowrap|1=<tt>ntldr=<loader> & "cmdcons\0"</tt>}}
 +
:Used with Recovery Console of Windows NT/2K/XP, <!--
 +
--> written to the system name field in the bootsector.
  
 
''' freedos=<loader> '''
 
''' freedos=<loader> '''
:equivalent to seg=0x60 file=<loader> sethidden, used with FreeDOS kernel.sys.
+
:Equivalent to {{nowrap|1=<tt>file=<loader> seg=0x60 sect=0x1FE0 setbpb nohand</tt>}}
 +
:Used with FreeDOS' kernel.sys
 +
 
 +
''' pcdos=<loader> '''
 +
:Equivalent to {{nowrap|1=<tt>file=<loader> seg=0x70 sect=0x8000 setbpb nohand</tt>}}
 +
:Used with PC-DOS' ibmbio.com
  
 
''' msdos=<loader> '''
 
''' msdos=<loader> '''
:equivalent to seg=0x70 file=<loader> sethidden, used with MS-DOS (v.2.xx to 6.xx)' io.sys.
+
:Equivalent to {{nowrap|1=<tt>file=<loader> seg=0x70 sect=0x8000 setbpb nohand</tt>}}
 +
:Used with MS-DOS (v.2.xx to 6.xx)' io.sys
  
''' pcdos=<loader> '''
+
 
:equivalent to seg=0x70 file=<loader> sethidden, used with PC-DOS' ibmbio.com.
+
''' msdos7=<loader> '''
 +
:Equivalent to {{nowrap|1=<tt>file=<loader> seg=0x70:0:0x200 sect=0x8000 setbpb nohand</tt>}}
 +
:Used with MS-DOS v.7+' io.sys
 +
 
 +
''' drmk=<loader> '''
 +
:Equivalent to {{nowrap|1=<tt>file=<loader> seg=0x70 sect=0x2000 setbpb nohand</tt>}}
 +
:Used with DRMK' dellbio.bin
  
 
''' reactos=<loader> '''
 
''' reactos=<loader> '''
:equivalent to seg=0:0x8000:0x8100 file=<loader> setbpb nohand, used with ReactOS' freeldr. Add 'save' option so to store corrected BPB values. Supported since Syslinux v.4.05.
+
:{{V|6.04+}}Equivalent to {{nowrap|1=<tt>file=<loader> seg=0x0F80 setbpb nohand</tt>}}
 +
:Used with ReactOS' freeldr.sys. <!--
 +
--> Add 'save' option so as to store corrected BPB values.
  
''' grub=<loader> [grubcfg=<config>] '''
+
''' grub=<loader> [grubcfg=<myconfig>] '''
:equivalent to seg=0x800::0x200 file=<loader> nohand nosect grub, used with grub legacy's stage2, performing additional corrections on the file in memory. Optionally, an alternate config file can be specified through the 'grubcfg=' option. Supported since Syslinux v.4.02.
+
:{{V|4.02+}}Equivalent to {{nowrap|1=<tt>file=<loader> seg=0x800::0x200 nohand nosect grub</tt>}}
 +
:Used with grub legacy's stage2, performing additional corrections on the file in memory. <!--
 +
--> Optionally, an alternative config file can be specified via the 'grubcfg' option.
  
 
''' swap '''
 
''' swap '''
:if the disk is not fd0/hd0, install a BIOS stub which swaps the drive numbers.
+
:If the drive is not fd0/hd0, install a BIOS stub which swaps the drive numbers.
  
 
''' hide '''
 
''' hide '''
:change type of primary partitions with IDs 01, 04, 06, 07, 0b, 0c, or 0e to 1x, except for the selected partition, which is converted the other way.
+
:Change type of primary partitions with IDs 01, 04, 06, 07, 0b, 0c, or 0e, to 1x, <!--
 +
--> except for the selected partition, which is converted the other way.
 +
 
 +
<!-- This is not a "popular" option, and it is no longer valid -->
 +
<!-- ''' sethidden ''' -->
 +
<!-- :update the "hidden sectors" (partition offset) field in a FAT/NTFS boot sector. -->
 +
 
 +
== UEFI ==
 +
 
 +
In UEFI, the boot process is slightly different than in BIOS. For booting the system, UEFI does not use traditional boot records, but rather {{nowrap|efi-compatible}} {{nowrap|files/images}}.
 +
 
 +
When using UEFI mode, there are no such things as chaining to a traditional {{nowrap|MBR/VBR}} or loading a file that is not {{nowrap|efi-compatible}}.
 +
 
 +
As of version 6.03, <tt>{{nowrap|chain.c32}}</tt> cannot chainload {{nowrap|efi-compatible}} files, so there is no practical use of it in UEFI mode.
 +
 
 +
When using CSM mode (aka "legacy" or "BIOS" mode) in a UEFI system, <tt>{{nowrap|chain.c32}}</tt> should work as in a traditional BIOS-based hardware, provided that the adequate binary is being used (from the "BIOS" firmware architecture, not from "EFI") and that the firmware correctly and fully supports CSM mode.
 +
 
 +
 
 +
== See Also ==
  
''' sethidden '''
+
* [[doc/chain]]
:update the "hidden sectors" (partition offset) field in a FAT/NTFS boot sector.
+
* [[DRMK]]
 +
* BPB: [https://en.wikipedia.org/wiki/BIOS_parameter_block BIOS Parameter Block]

Latest revision as of 21:23, 13 April 2017

chain.c32 is a COM32 module for Syslinux. It can chainload MBRs, partition boot sectors, Windows bootloaders (ntldr, setupldr.bin and bootmgr), MS-DOS and PC-DOS io.sys, Freedos kernel.sys, isolinux.bin (only from ISOLINUX), grldr of grub4dos, or a bootsector saved to a file. It can also swap BIOS drive numbers, or hide partitions (via partition's ID).

All options as available in chain.c32 of Syslinux 3.85 (with some updates introduced in later versions):

Usage:

chain.c32 hd<disk#> [<partition>] [options]
chain.c32 fd<disk#> [options]
chain.c32 mbr:<id> [<partition>] [options]
chain.c32 boot [<partition>] [options]
chain.c32 fs [options]
chain.c32 label=<label> [options]
chain.c32 guid=<label> [options]
chain.c32 options:
123456789012345678901234567 THIS ROW SETS COLUMN1 WIDTH
file=</><path/to/><loader>
  Load file, instead of boot sector

 

isolinux=<loader>
  Load another version of ISOLINUX

 

ntldr=<loader>
  Load Windows' NTLDR, SETUPLDR.BIN or BOOTMGR, or GRLDR

 

grldr=<loader>
  Load GRUB4DOS' grldr

 

cmldr=<loader>
  Load Recovery Console of Windows NT/2K/XP

 

freedos=<loader>
  Load FreeDOS kernel.sys

 

pcdos=<loader>
  Load PC-DOS ibmbio.com

 

msdos=<loader>
  Load MS-DOS (2.xx to 6.xx) io.sys

 

msdos7=<loader>
  Load MS-DOS 7+ io.sys

 

drmk=<loader>
  Load DRMK dellbio.bin

 

reactos=<loader>
  Load ReactOS freeldr.sys

 

grub=<loader>  [grubcfg=<config>]
  Load grub legacy stage2

 

swap
  Swap drive numbers, if boot drive is not fd0/hd0

 

hide
  Hide primary partitions, except selected partition

See doc/chain for more options.

Numbering of Drives and Partitions

Drive numbering

Hard drive numbering starts at 0:

  • hd0 : first hard drive (as seen by the BIOS)
  • hd1 : second hard drive
  • hd2 : third hard drive
  • ...

Floppy drive numbering starts at 0:

  • fd0 : first floppy drive
  • fd1 : second floppy drive

The drive from which Syslinux is booted can be referred to with the parameter:

  • boot

The drive and partition from which Syslinux is booted can be referred to with the parameter:

  • fs

Find partition by uuid or label in all GPT partitions on all available drives:

  • label=mylabel
  • guid=myguid

Note that label and guid work only on GPT partition tables; it is not filesystem but partition label and guid.


Partition numbering

The physical devices are counted starting at zero. The partitions are counted starting at one.

In a GPT scheme, there are only "primary" partitions. Usually up to a maximum of 128 primary partitions can be created in one GPT device (the specification allows for more; it requires appropriate conditions).

In a "DOS" (aka. "traditional" or "legacy" or "MBR") partition table scheme, a maximum of 4 "primary" partitions can be created, or alternatively up to 3 "primary" partitions and one "extended" partition, the latter containing "logical" partitions.

Please note that for devices with a traditional MBR ("DOS") partition table scheme, "chain.c32" counts the "logical" partitions starting from "five", even if not all "primary" slots are in used.

GPT partitions are simply counted in order, starting at one.


Partition numbers (short):

  • 0 : MBR (default.)
  • 1-4 : primary partitions
  • 5 and higher : logical partitions


Partition numbers (long):

  • 0 : MBR (default)
  • 1 : first primary partition
  • 2 : second primary partition
  • 3 : third primary partition
  • 4 : fourth primary partition
  • 5 : first logical partition
  • 6 : second logical partition
  • 7 : third logical partition
  • 8 : fourth logical partition
  • 9 : fifth logical partition
  • 10 : sixth logical partition
  • 11 : seventh logical partition
  • 12 : eighth logical partition
  • ...
Partition Numbering:
First disk
as seen by BIOS
PRIMARY LOGICAL Numbering
hd0 0 (MBR)
hd0 1 First 1
hd0 2 Second 2
hd0 3 Third 3
hd0 4 Fourth 4
hd0 5 First 5
hd0 6 Second 6
hd0 7 Third 7
hd0 8 Fourth 8
hd0 9 Fifth 9
hd0 10 Sixth 10
hd0 ... ... ...

Examples

UI menu.c32

LABEL boot_hd0
MENU LABEL Boot from first hard drive
COM32 chain.c32
APPEND hd0

LABEL boot_hd1
MENU LABEL Boot from second hard drive
COM32 chain.c32
APPEND hd1

LABEL boot_fd0
MENU LABEL Boot from first floppy drive
COM32 chain.c32
APPEND fd0

LABEL boot_syslinux_drive
MENU LABEL Boot the drive from which Syslinux is booted (hard drive or floppy drive)
COM32 chain.c32
APPEND boot

LABEL boot_syslinux_filesystem
MENU LABEL Boot the filesystem from which Syslinux is booted (partition in hard drive or floppy drive)
COM32 chain.c32
APPEND fs

LABEL boot_hd2_2
MENU LABEL Boot second primary partition from third hard drive
COM32 chain.c32
APPEND hd2 2

LABEL boot_hd1_5
MENU LABEL Boot first logical partition from second hard drive
COM32 chain.c32
APPEND hd1 5

LABEL boot_hd3_0
MENU LABEL Boot MBR of fourth hard drive (same as "APPEND hd3")
COM32 chain.c32
APPEND hd3 0

LABEL boot_part_win7fs
MENU LABEL Boot ntldr from GPT partition labelled "win7fs"
COM32 chain.c32
APPEND label=win7fs ntldr=/bootmgr

mbr

The mbr: syntax means search all the hard disks until one with a specific MBR serial number (bytes 440-443) is found.

You can get the MBR serial number, by running the following command (change /dev/sda to the correct device):

$ hexdump -s 440 -n 4 -e '"0x%08x\n"' /dev/sda
0x0ec8694c

Or by running:

$ fdisk -l /dev/sda
...
Disk identifier: 0x0ec8694c

Example:

LABEL mbr_serial
COM32 chain.c32
APPEND mbr:0x0ec8694c


Options

The following are some popular options available for chain.c32. See doc/chain for more options.

file=<loader>

Load the file <loader> from the SYSLINUX filesystem instead of loading the boot sector.

isolinux=<loader>

Load another version/build of the ISOLINUX bootloader and patch the loader with appropriate parameters in memory. This avoids the need for the -eltorito-alt-boot parameter of mkisofs, when more than one ISOLINUX per CD/DVD is needed.

ntldr=<loader>

Equivalent to file=<loader> seg=0x2000 setbpb nohand
Used with WinNT's loaders
Example loaders: NTLDR (XP, 2003), BOOTMGR (Vista, 2008, 7), GRLDR (Grub4DOS).
See: HowTos & Linux and Windows deployment

grldr=<loader>

Load GRUB4DOS grldr, performing additional corrections on the file in memory.

cmldr=<loader>

Equivalent to ntldr=<loader> & "cmdcons\0"
Used with Recovery Console of Windows NT/2K/XP, written to the system name field in the bootsector.

freedos=<loader>

Equivalent to file=<loader> seg=0x60 sect=0x1FE0 setbpb nohand
Used with FreeDOS' kernel.sys

pcdos=<loader>

Equivalent to file=<loader> seg=0x70 sect=0x8000 setbpb nohand
Used with PC-DOS' ibmbio.com

msdos=<loader>

Equivalent to file=<loader> seg=0x70 sect=0x8000 setbpb nohand
Used with MS-DOS (v.2.xx to 6.xx)' io.sys


msdos7=<loader>

Equivalent to file=<loader> seg=0x70:0:0x200 sect=0x8000 setbpb nohand
Used with MS-DOS v.7+' io.sys

drmk=<loader>

Equivalent to file=<loader> seg=0x70 sect=0x2000 setbpb nohand
Used with DRMK' dellbio.bin

reactos=<loader>

[6.04+] Equivalent to file=<loader> seg=0x0F80 setbpb nohand
Used with ReactOS' freeldr.sys. Add 'save' option so as to store corrected BPB values.

grub=<loader> [grubcfg=<myconfig>]

[4.02+] Equivalent to file=<loader> seg=0x800::0x200 nohand nosect grub
Used with grub legacy's stage2, performing additional corrections on the file in memory. Optionally, an alternative config file can be specified via the 'grubcfg' option.

swap

If the drive is not fd0/hd0, install a BIOS stub which swaps the drive numbers.

hide

Change type of primary partitions with IDs 01, 04, 06, 07, 0b, 0c, or 0e, to 1x, except for the selected partition, which is converted the other way.


UEFI

In UEFI, the boot process is slightly different than in BIOS. For booting the system, UEFI does not use traditional boot records, but rather efi-compatible files/images.

When using UEFI mode, there are no such things as chaining to a traditional MBR/VBR or loading a file that is not efi-compatible.

As of version 6.03, chain.c32 cannot chainload efi-compatible files, so there is no practical use of it in UEFI mode.

When using CSM mode (aka "legacy" or "BIOS" mode) in a UEFI system, chain.c32 should work as in a traditional BIOS-based hardware, provided that the adequate binary is being used (from the "BIOS" firmware architecture, not from "EFI") and that the firmware correctly and fully supports CSM mode.


See Also