Difference between revisions of "Doc/chain"

From Syslinux Wiki
Jump to: navigation, search
(Based on doc/chain.txt.)
 
m (Wiki formatting.)
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
Although Syslinux is capable of (very simple) native chainloading  
 
Although Syslinux is capable of (very simple) native chainloading  
(through .bss and .bs options - see [[doc/syslinux]]), it also features  
+
(through .bss and .bs files - see [[doc/syslinux]]), it also features  
 
a very robust and rich <tt>com32</tt> module designed for such purpose.
 
a very robust and rich <tt>com32</tt> module designed for such purpose.
  
Line 10: Line 10:
 
* load and jump to a sector
 
* load and jump to a sector
 
* load and jump to a file (also loading a sector for other purposes)
 
* load and jump to a file (also loading a sector for other purposes)
* prepare handover data to use by a file / boot sector
+
* prepare handover data to be used by a file / boot sector
 
* fix different options in a file / sector / partition entries
 
* fix different options in a file / sector / partition entries
 
* perform a ''service-only'' run.
 
* perform a ''service-only'' run.
  
It can chainload data from both GPT and DOS partitions, as well as boot the  
+
It can chainload data from both, GPT {{V|4.00+}} and MBR (aka. DOS) partitions,  
first sector from a raw disk.
+
as well as boot the first sector from a raw disk.
  
 
A rough overview of the code is as follows:
 
A rough overview of the code is as follows:
Line 30: Line 30:
 
# Chainload.
 
# Chainload.
  
In its most basic form, SYSLINUX loads a specified boot sector (or MBR, if
+
In its most basic form, chain.c32 loads either an MBR
not specified) at <code>0:0x7c00</code>, prepares handover area as a  
+
or a specified boot sector at '<code>0:0x7c00</code>',  
standard MBR would do, and jumps to <code>0:0x7c00</code>.
+
prepares handover area as a standard MBR would do,  
 +
and jumps to '<code>0:0x7c00</code>'.
  
 
A ''service-only'' run is possible when either:
 
A ''service-only'' run is possible when either:
  
* <tt>break</tt> is in effect; or,
+
* the '<tt>break</tt>' option is in effect; or,
* <tt>nofile</tt> and <tt>nomaps</tt> (or <tt>nosect</tt>) are in effect.
+
* options '<tt>nofile</tt>' and '<tt>nomaps</tt>' (or '<tt>nosect</tt>') are in effect.
  
 
This is useful for invocations such as:
 
This is useful for invocations such as:
 
<pre>
 
<pre>
chain.c32 hdN M setbpb save break
+
  chain.c32 hdN M setbpb save break
chain.c32 hdN fixchs break
+
  chain.c32 hdN fixchs break
chain.c32 hdN unhideall break
+
  chain.c32 hdN unhideall break
 
</pre>
 
</pre>
 +
 
Please see the respective options for more details.
 
Please see the respective options for more details.
  
 +
<br />
 +
== Syntax ==
  
== Module invocation: ==
+
<pre>
 +
  chain [drive/partition] [options]
 +
</pre>
  
<pre>chain [drive/partition] [options]</pre>
+
In case of repeated arguments, the rightmost ones take precedence.
  
In case of repeated arguments, rightmost ones take precedence.
+
Note that some options cannot be combined with some other options.
  
 +
{| class="wikitable"
 +
!OPTION
 +
!TYPE
 +
!BIOS
 +
!MBR/GPT
 +
!PT
 +
!VBR
 +
<!-- <nowiki>!FILE</nowiki> -->
 +
<!-- <nowiki>!OTHER</nowiki> -->
 +
|-
 +
|boot
 +
|flag
 +
|Syslinux's boot drive
 +
|-
 +
|mbr
 +
|argument
 +
|
 +
|Match ID
 +
|-
 +
|guid
 +
|argument
 +
|
 +
|Match ID
 +
|Match ID
 +
|-
 +
|label
 +
|argument
 +
|
 +
|
 +
|Match ID
 +
|-
 +
|hd#,#
 +
|argument
 +
|Device #
 +
|
 +
|Device #
 +
|-
 +
|fs
 +
|flag
 +
|
 +
|
 +
|
 +
|Syslinux's boot volume
 +
|-
 +
|fd#
 +
|argument
 +
|Device #
 +
|}
  
== DRIVE / PARTITION SPECIFICATION ==
+
<br />
 +
== Drive ==
  
Drive can be specified as either <code>'hd#', 'fd#', 'boot', 'mbr', or
+
Drives can be specified as either:
'guid'</code>:
+
  
* 'mbr' selects a drive by its signature;
+
; <tt>mbr</tt>
* 'guid' selects a drive by its guid (GPT only);
+
: select a disk by its signature;
* 'boot' is the drive SYSLINUX was booted from. This is the default value, if nothing else is specified.
+
; <tt>guid</tt>
* 'hd#' and 'fd#' are standard ways to specify drive number as seen by BIOS, starting from 0.
+
: select a disk by its guid (GPT only);
 +
; <tt>boot</tt>
 +
: the drive SYSLINUX was booted from. <!--
 +
--> This is the default value, if nothing else is specified.
 +
; <tt>hd''#''</tt>
 +
: drive number as seen by BIOS, starting from 0.
 +
; <tt>fd''#''</tt>
 +
: floppy drive number as seen by BIOS, starting from 0.
  
Option 'guid' is shared with partition selection (see below). If you happen
+
Option 'guid' is shared with [[#partition|partition]] selection.  
to have non-unique guids, they are searched in disk0, partitions of disk0,  
+
If there are non-unique guids, they are searched first in disk0,  
disk1, ...  order.
+
then partitions of disk0, then disk1, ...  order.
  
'mbr' and 'guid' take an extra parameter; you should use either ':' or '='  
+
'mbr' and 'guid' take an extra parameter;  
as delimiter.
+
use either ':' or '=' as delimiter.
  
''Partition'' can be specified as <code>'#', 'guid', 'label' or 'fs'</code>:
+
== Partition ==
  
* 'guid' selects a partition by a specified guid value (not by type ''guid'' !);
+
''Partition'' can be specified as either:
* 'label' selects a partition by label (searching by disk order);
+
* 'fs' selects the partition from which SYSLINUX was executed;
+
* '#' is the standard method.
+
Partitions 1-4 are primary, 5+ are logical, 0 = boot MBR (default).
+
  
If you use a number to select a partition, it should be specified after a
+
; <tt>guid</tt>
drive by using either a ''space'' or a ''comma'' character as delimiter
+
: select a partition by a specified guid value (not by ''guid'' type !);
(after 'hd#', 'fd#', 'mbr', 'guid' or 'boot').
+
; <tt>label</tt>
 +
: select a partition by a specified label (searching by disk order);
 +
; <tt>fs</tt>
 +
: the partition SYSLINUX was booted from;
 +
; <tt>''#''</tt>
 +
: partition number within disk; the standard method. <!--
 +
--> Partitions 1-4 are primary, 5+ are logical, 0 (zero) is the MBR (default).
  
 +
If a partition is selected by number, it should be specified after a
 +
disk drive notation by using either a ''space'' or a ''comma'' character as delimiter
 +
(after <tt>'hd''#''<nowiki />', 'fd''#''<nowiki />', 'mbr', 'guid' or 'boot'</tt>).
  
== OPTIONS ==
+
<br />
 +
== Options ==
  
<br /><br /><pre>
+
{| class="wikitable"
        file=<file>
+
!OPTION
        *nofile
+
!TYPE
 +
!BIOS
 +
!MBR/GPT
 +
!PT
 +
!VBR
 +
!FILE
 +
!OTHER
 +
|-
 +
|[[#swap|swap]]
 +
|flag
 +
|Set as first device
 +
|-
 +
|[[#prefmbr|prefmbr]]
 +
|flag
 +
|
 +
|Prefer MBR over GPT
 +
|-
 +
|[[#hide|hide]]
 +
|multiflag
 +
|
 +
|
 +
|Modify partition ID
 +
|-
 +
|[[#fixchs|fixchs]]
 +
|flag
 +
|
 +
|
 +
|Fix CHS
 +
|-
 +
|[[#gpthcrc_and_gptlcrc|gpthcrc]]
 +
|flag
 +
|
 +
|GPT header checksum
 +
|-
 +
|[[#gpthcrc_and_gptlcrc|gptlcrc]]
 +
|flag
 +
|
 +
|
 +
|GPT list checksum
 +
|-
 +
|[[#strict|strict]]
 +
|multiflag
 +
|
 +
|
 +
|Sanity check level
 +
|-
 +
|[[#file|file]]
 +
|argument
 +
|
 +
|
 +
|
 +
|
 +
|Select file to load
 +
|-
 +
|[[#seg|seg]]
 +
|argument
 +
|
 +
|
 +
|
 +
|
 +
|Address
 +
|-
 +
|[[#sect|sect]]
 +
|argument
 +
|
 +
|
 +
|
 +
|Address
 +
|-
 +
|[[#maps|maps]]
 +
|flag
 +
|
 +
|
 +
|
 +
|Map in address
 +
|-
 +
|[[#hand|hand]]
 +
|flag
 +
|
 +
|
 +
|
 +
|
 +
|Use handover (area)
 +
|-
 +
|[[#hptr|hptr]]
 +
|flag
 +
|
 +
|
 +
|
 +
|Point registers to handover area
 +
|-
 +
|[[#setbpb|setbpb]]
 +
|flag
 +
|
 +
|
 +
|
 +
|Patch BPB
 +
|-
 +
|[[#filebpb|filebpb]]
 +
|flag
 +
|
 +
|
 +
|
 +
|
 +
|Patch BPB
 +
|-
 +
|[[#save|save]]
 +
|flag
 +
|
 +
|
 +
|
 +
|Write BPB
 +
|-
 +
|[[#keeppxe|keeppxe]]
 +
|flag
 +
|
 +
|
 +
|
 +
|
 +
|
 +
|Keep UNDI stack loaded
 +
|-
 +
|[[#break|break]]
 +
|flag
 +
|
 +
|
 +
|
 +
|
 +
|
 +
|Service-only run
 +
|-
 +
|[[#warn|warn]]
 +
|flag
 +
|
 +
|
 +
|
 +
|
 +
|
 +
|Wait for a key-press
 +
|-
 +
|[[#exit|exit]]
 +
|flag
 +
|
 +
|
 +
|
 +
|
 +
|
 +
|Force end of command line
 +
|-
 +
|[[#isolinux|isolinux]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|Load a different ISOLINUX version
 +
|-
 +
|[[#ntldr|ntldr]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|Windows NTLDR
 +
|-
 +
|[[#cmldr|cmldr]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|Windows Recovery Console
 +
|-
 +
|[[#reactos|reactos]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|Reactos freeldr.sys
 +
|-
 +
|[[#freedos|freedos]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|FreeDOS kernel.sys
 +
|-
 +
|[[#msdos_and_pcdos|pcdos]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|PCDOS ibmbio.com
 +
|-
 +
|[[#msdos_and_pcdos|msdos]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|MSDOS 2-6.xx io.sys
 +
|-
 +
|[[#msdos7|msdos7]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|MSDOS7+ io.sys
 +
|-
 +
|[[#drmk|drmk]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|DELLDOS dellbio.bin
 +
|-
 +
|[[#grub|grub]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|GRUB legacy's stage2
 +
|-
 +
|[[#grldr|grldr]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|GRUB4DOS grldr
 +
|-
 +
|[[#bs|bs]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|Emulate SYSLINUX's BS
 +
|-
 +
|[[#bss|bss]]
 +
|shortcut
 +
|
 +
|
 +
|
 +
|
 +
|Emulate SYSLINUX's BSS
 +
|}
 +
 
 +
=== swap ===
 +
<pre>
 +
  swap
 +
  *noswap
 +
</pre>
 +
{{S|swap}}{{V|3.70+}}
 +
Install a tiny stub code that swaps device numbers, if the
 +
device we use during chainloading is not '<tt>fd0</tt>' nor '<tt>hd0</tt>'.
 +
 
 +
=== prefmbr ===
 +
<pre>
 +
  prefmbr
 +
  *noprefmbr
 +
</pre>
 +
{{S|prefmbr}}
 +
In case non-standard hybrid MBR/GPT layout is present,
 +
this flag makes the chain module prefer MBR layout over GPT.
 +
 
 +
=== hide ===
 +
{|
 +
|
 +
<pre>
 +
  [un]hide[all]        &rarr; sets: strict=2
 +
  *nohide
 +
</pre>
 +
|}
 +
{{S|hide}}{{V|3.71+}}
 +
Modify the partition ID ("type") in the partition table
 +
(typically, "0x0''n''"&harr;"0x1''n''").
 +
In certain situations it is useful to hide partitions; for example to make sure
 +
DOS gets "C:". '<tt>hide</tt>' will hide hidable ''primary'' partitions, except the one we are
 +
booting from. Similarly, '<tt>hideall</tt>' will hide all hidable partitions, except the
 +
one we are booting from. Hiding is performed only on the selected disk. Options
 +
starting with '<tt>un</tt>' will simply unhide partitions (primary ones or all, accordingly).
 +
The writing is only performed if the values actually changed. See also '[[#break|break]]'.
 +
 
 +
=== fixchs ===
 +
{|
 +
|
 +
<pre>
 +
  fixchs              &rarr; sets: strict=2
 +
  *nofixchs
 +
</pre>
 +
|}
 +
{{S|fixchs}}
 +
Fix all partitions' CHS numbers so as to make the partition table totally
 +
compatible with the current BIOS. This option can be useful, for example, to silence
 +
FreeDOS complaining about "''logical CHS differs from physical''", or sfdisk about
 +
"''found (...) expected (...)''". Functionally, it seems to be mostly cosmetic, as
 +
Microsoft's world (when it cares about geometry) generally sticks to values
 +
written in bootsectors. And the rest of the world generally doesn't care about
 +
them at all. The writing is only performed if the values actually changed.
 +
See also '[[#break|break]]'.
 +
 
 +
=== gpthcrc and gptlcrc ===
 +
{|
 +
|
 +
<pre>
 +
  *gpthcrc            &rarr; Perform gpt header crc check
 +
  nogpthcrc            &rarr; Skip crc check
 +
  *gptlcrc            &rarr; Perform gpt list crc check
 +
  nogptlcrc            &rarr; Skip crc check
 +
</pre>
 +
|}
 +
{{S|gpthcrc_and_gptlcrc}}
 +
Force boot when checksums of GPT header and/or
 +
partition list are invalid.
 +
This works independently from the '[[#strict|strict]]' option.
 +
 
 +
=== strict ===
 +
<pre>
 +
  strict[=<0|1|2>]
 +
  *strict=1
 +
  relax
 +
</pre>
 +
* '<code>strict=1</code>' enables checks, but ignores those that involve disk size.
 +
* '<code>strict=2</code>' enables all checks.
 +
* '<code>relax</code>' and '<code>nostrict</code>' are equivalent to '<code>strict=0</code>'.
 +
* '<code>norelax</code>' and '<code>strict</code>' are equivalent to '<code>strict=2</code>'.
 +
 
 +
{{S|strict}}{{V|6.03+}}
 +
Control the level of sanity checks
 +
used during the traversal of partition table(s).
 +
This is potentially useful in (buggy) corner cases,
 +
for example when the disk size is reported differently
 +
across different computers or virtual machines
 +
(if it happens at all, the size usually differs by 1 sector).
 +
Normally, the partition iterator would report an error and abort in such case.
 +
Another case scenario is disk corruption in some later EMBR partition.
 +
 
 +
=== file ===
 +
<pre>
 +
  file=</><path/to/><myfile>
 +
  *nofile
 
</pre>
 
</pre>
It's often convenient to load a file directly and transfer control to it,  
+
{{S|file}}{{V|3.70+}}
instead of the sector from the disk. Note that the
+
It is often convenient to load a file directly and transfer control to it,  
''<nowiki><file></nowiki>'' must reside on the SYSLINUX's partition.
+
instead of the sector from the disk. Note that  
 +
<u>''<nowiki><myfile></nowiki>'' must reside on the ''Syslinux's filesystem volume''.</u>
  
If you choose this option without explicitly specifying any addresses (see  
+
Choosing a file without explicitly specifying any addresses  
options 'sect=' and 'seg='), the file will cause the sector to not be loaded  
+
(see options '[[#sect|sect]]' and '[[#seg|seg]]')  
 +
will cause the sector to not be loaded  
 
at all (as their memory placement would overlap).
 
at all (as their memory placement would overlap).
  
<br /><br /><pre>
+
=== seg ===
        seg=<segment>:<offset>:<ip>
+
<pre>
        *seg=0:0x7c00:0x7c00
+
  seg=<segment>:<offset>:<ip>
 +
  *seg=0:0x7c00:0x7c00
 
</pre>
 
</pre>
This triplet lets you alter the addresses a file will use. It's loaded at  
+
{{S|seg}}{{V|3.70+}}
<code><segment:offset></code>; the entry point is at <code><segment:ip></code>.
+
Alter the addresses a file will use. It is loaded at  
When you chainload some other bootloader or kernel, this option is almost
+
'<code><segment:offset></code>'; the entry point is at '<code><segment:ip></code>'.
always mandatory.
+
  
If this option is not specified, the defaults are <code>0:0x7c00:0x7c00</code>.  
+
When chainloading some other bootloader or kernel,
If any field is omitted (e.g. 0x2000::), it defaults to 0.
+
this option is almost always mandatory.
<br /><br /><pre>
+
 
        sect=<segment>:<offset>:<ip>
+
If this option is not specified, the defaults are '<code>0:0x7c00:0x7c00</code>'.  
        *sect=0:0x7c00:0x7c00
+
If any field is omitted (e.g. {{nowrap|'<tt>0x2000::</tt>'),}} it defaults to 0.
        nosect
+
 
        nosect sets: nomaps
+
=== sect ===
 +
{|
 +
|
 +
<pre>
 +
  sect=<segment>:<offset>:<ip>
 +
  *sect=0:0x7c00:0x7c00
 +
  nosect               &rarr; sets: nomaps
 
</pre>
 
</pre>
This triplet lets you alter the addresses a sector will use. It's loaded at  
+
|}
<code><segment:offset></code>; the entry point is at <code><segment:ip></code>.
+
{{S|sect}}
This option is mostly used in tandem with the 'file=' and 'seg=' options, as
+
Alter the addresses a sector will use. It is loaded at  
some loaders/kernels expect a relocated sector at some particular address
+
'<code><segment:offset></code>; the entry point is at '<code><segment:ip></code>'.  
(e.g. DRKM).
+
  
'nosect' will cause the sector to not be loaded at all. In many cases, when a
+
'sect' is mostly used in tandem with options '[[#file|file]]' and
file is being chainloaded, specifying a sector is not necessary.
+
'[[#seg|seg]]', as some loaders/kernels expect a relocated
 +
sector at some particular address (e.g. [[#drmk|DRMK]]).
  
If this option is not specified, the defaults are <code>0:0x7c00:0x7c00</code>.  
+
'nosect' will cause the sector to not be loaded at all.
If any field is omitted (e.g. 0x2000::), it defaults to 0.
+
In many cases, when a file is being chainloaded,
<br /><br /><pre>
+
specifying a sector is not necessary.
        *maps
+
 
        nomaps
+
If this option is not specified, the defaults are '<code>0:0x7c00:0x7c00</code>'.  
 +
If any field is omitted (e.g. {{nowrap|'<tt>0x2000::</tt>'),}} it defaults to 0.
 +
 
 +
=== maps ===
 +
<pre>
 +
  *maps
 +
  nomaps
 
</pre>
 
</pre>
In some cases, it's useful to fix BPB values in NTFS/FATxx boot sectors and  
+
{{S|maps}}
 +
In some cases, it is useful to fix BPB values in NTFS/FATxx boot sectors and  
 
eventually write them back, but otherwise the boot sector itself is not  
 
eventually write them back, but otherwise the boot sector itself is not  
necessary so to continue the booting process. 'nomaps' allows such situation:  
+
necessary so as to continue the booting process. 'nomaps' allows such situation:  
 
a sector will be loaded, but it won't be mapped into real memory.  
 
a sector will be loaded, but it won't be mapped into real memory.  
 
Any overlap tests (vs. handover or file areas) are not performed,  
 
Any overlap tests (vs. handover or file areas) are not performed,  
 
being meaningless in such case.
 
being meaningless in such case.
<br /><br /><pre>
+
 
        setbpb
+
=== hand ===
        *nosetbpb
+
<pre>
 +
  *hand
 +
  nohand
 
</pre>
 
</pre>
 +
{{S|hand}}
 +
By default, a handover area is prepared if possible - meaning, if it
 +
doesn't overlap with other areas. This is often not necessary though;
 +
usually, a chainloaded file or kernel does not care about it anymore,
 +
so a user can disable it explicitly with 'nohand'.
 +
 +
=== hptr ===
 +
<pre>
 +
  hptr
 +
  *nohptr
 +
</pre>
 +
{{S|hptr}}
 +
In case both, file and sector, are loaded, then '<code>ds:si</code>' and '<code>ds:bp</code>'
 +
will point to the sector address before chainloading. This option forces
 +
those registers to point to the handover area. This is useful when both the
 +
file and the sector are actually a sector's image and the sector is mapped.
 +
 +
=== setbpb ===
 +
<pre>
 +
  setbpb
 +
  *nosetbpb
 +
</pre>
 +
{{S|setbpb}}
 
Microsoft's side of the world is particularly sensitive to certain BPB values.  
 
Microsoft's side of the world is particularly sensitive to certain BPB values.  
Depending on the system and the chainloading method (i.e. sector or file),  
+
Depending on the system and on the chainloading method (i.e. sector or file),  
 
some or all of those fields must match "reality"; but after performing  
 
some or all of those fields must match "reality"; but after performing  
certain operations such as drive cloning, or when using a USB stick in  
+
certain operations such as disk cloning, or when using a USB stick in  
 
different computers, that's often not the case (i.e. some BPB values might  
 
different computers, that's often not the case (i.e. some BPB values might  
 
not match the real media).
 
not match the real media).
Line 153: Line 607:
 
: Valid offset of the partition from the beginning of the disk.
 
: Valid offset of the partition from the beginning of the disk.
 
; "geometry"
 
; "geometry"
: Valid disk geometry as reported by BIOS.
+
: Valid drive geometry as reported by BIOS.
 
; "drive"
 
; "drive"
 
: Valid drive number.
 
: Valid drive number.
  
 
This option will automatically determine the type of BPB and fix what it can,  
 
This option will automatically determine the type of BPB and fix what it can,  
according to the detected BPB. If the detection of the BPB is not possible,  
+
according to the detected BPB.  
this function does nothing.
+
If the detection of the BPB is not possible, this function does nothing.
<br /><br /><pre>
+
 
        filebpb
+
=== filebpb ===
        *nofilebpb
+
<pre>
 +
  filebpb
 +
  *nofilebpb
 
</pre>
 
</pre>
A chainloaded file can simply be an image of a sector. In such case, it  
+
{{S|filebpb}}
could be useful to also fix its BPB values.
+
A chainloaded file can simply be an image of a sector.  
<br /><br /><pre>
+
In such case, it could be useful to also fix its BPB values.
        save
+
 
        *nosave
+
=== save ===
 +
{|
 +
|
 +
<pre>
 +
  save                 &rarr; sets: strict=2
 +
  *nosave
 
</pre>
 
</pre>
Fixing BPB values only in memory might not be enough. This option allows  
+
|}
writing the corrected values to the sector. You would probably want to use
+
{{S|save}}
this option together with 'setbpb'.
+
Fixing BPB values (with '[[#setbpb|setbpb]]') only in memory might not be enough.  
 +
This option allows writing the corrected values to the sector.
  
* this option never applies to a loaded file.
+
By default, the chain module will not save anything (such as BPB values)  
* by default, the chain module will not save anything (such as BPB values) to disk (other than options such as 'hide' or 'fixchs', which are directly related to partition entries).
+
to disk, other than options such as '[[#hide|hide]]' or '[[#fixchs|fixchs]]',  
 +
which are directly related to partition entries.
 +
 
 +
When 'save' is used:
 +
* it can apply to a sector, never to a loaded file;
 
* the writing is only performed if the values actually changed.
 
* the writing is only performed if the values actually changed.
<br /><br /><pre>
+
 
        *hand
+
=== keeppxe ===
        nohand
+
<pre>
 +
  keepexe
 +
  *nokeepexe
 
</pre>
 
</pre>
By default, a handover area is prepared if possible - meaning it
+
{{S|keeppxe}}{{V|PXELINUX only}}
doesn't overlap with other areas. This is often not necessary though;
+
When booting over a network using PXELINUX, 'keeppxe'
usually, a chainloaded file or kernel doesn't care about it anymore, so a
+
will keep UNDI stacks in memory.
user can disable it explicitly with this option.
+
 
<br /><br /><pre>
+
=== break ===
        hptr
+
{|
        *nohptr
+
|
 +
<pre>
 +
  break                &rarr; sets: nofile nomaps nohand
 +
  *nobreak
 
</pre>
 
</pre>
In case both, file and sector, are loaded, then <code>ds:si</code> and <code>ds:bp</code>
+
|}
will point to the sector address before the chainloading. This option forces
+
{{S|break}}{{V|4.05+}}
those registers to point to the handover area. This is useful when both the
+
Trigger a ''service-only'' run;
file and the sector are actually a sector's image and the sector is mapped.
+
the chain module will do everything requested as usual,  
<br /><br /><pre>
+
but it will not perform the actual chainloading.  
        swap
+
The '<tt>break</tt>' option disables the handover,
        *noswap
+
file loading and sector mapping,
 +
as these are pointless in such scenario
 +
(although the file might be re-enabled in some future version,
 +
if writing to actual files becomes possible).  
 +
Mainly useful for options such as '[[#fixchs|fixchs]]',
 +
{{nowrap|'<code>[un][[#hide|hide]][all]</code>'}} and '[[#setbpb|setbpb]]'.
 +
 
 +
=== warn ===
 +
<pre>
 +
  warn
 +
  *nowarn
 
</pre>
 
</pre>
This option installs a tiny stub code used to swap drive numbers, if the
+
{{S|warn}}
drive we use during chainloading is not 'fd0' or 'hd0'.
+
Wait for a key-press, right before continuing the chainloading.  
<br /><br /><pre>
+
        hide[all]
+
        unhide[all]
+
        *nohide
+
</pre>
+
In certain situations it's useful to hide partitions - for example to make sure
+
DOS gets C:. 'hide' will hide hidable primary partitions, except the one we're
+
booting from. Similarly, 'hideall' will hide all hidable partitions, except the
+
one we're booting from. Hiding is performed only on the selected drive. Options
+
starting with 'un' will simply unhide every partition (primary ones or all).
+
The writing is only performed if the OS type values actually changed.
+
<br /><br /><pre>
+
        fixchs
+
        *nofixchs
+
</pre>
+
If you want to make a drive you're booting from totally compatible with current
+
BIOS, you can use this to fix all partitions' CHS numbers. Good to silence e.g.
+
FreeDOS complaining about ''logical CHS differs from physical'', or sfdisk about
+
''found (...) expected (...)''. Functionally, it seems to be mostly cosmetic, as
+
Microsoft world (in those cases it cares about geometry) generally sticks to values
+
written in bootsectors. And the rest of the world generally doesn't care about
+
them at all. The writing is only performed if the values actually changed.
+
<br /><br /><pre>
+
        keepexe
+
        *nokeepexe
+
</pre>
+
If you are booting over a network using PXELINUX, this option lets you keep
+
UNDI stacks in memory (PXELINUX only).
+
<br /><br /><pre>
+
        warn
+
        *nowarn
+
</pre>
+
This option will wait for a key-press right before continuing the chainloading.  
+
 
Useful to see warnings emitted by the chain module.
 
Useful to see warnings emitted by the chain module.
<br /><br /><pre>
+
 
        prefmbr
+
=== exit ===
        *noprefmbr
+
{{S|exit}}{{V|6.04+}}
 +
Impose the end of the command to be parsed by chain.c32.
 +
In some cases (e.g. when using gfxboot) the resulting command line
 +
seems to end with some "garbage" that chain.c32 cannot understand,
 +
creating unexpected behavior.
 +
By adding '<tt>exit</tt>' to the end of the command,
 +
chain.c32 disregards anything after this option and should work as expected.
 +
Usually, this option is not required.
 +
 
 +
 
 +
=== isolinux ===
 +
{|
 +
|
 +
<pre>
 +
  isolinux=<myfile>
 +
  &rarr; sets: file=<myfile> nohand nosect isolinux
 
</pre>
 
</pre>
In case non-standard hybrid MBR/GPT layout is present, this flag makes the  
+
|}
chain module prefer MBR layout over GPT.
+
{{S|isolinux}}{{V|ISOLINUX only; 3.83+}}
<br /><br /><pre>
+
Chainload to another version/build of the ISOLINUX bootloader and patch the  
        relax
+
loader with appropriate parameters in memory. This avoids the need for the
        *norelax
+
{{nowrap|"<code>-eltorito-alt-boot</code>"}} parameter of mkisofs,
 +
when you want more than one ISOLINUX per CD/DVD.
 +
 
 +
=== ntldr ===
 +
{|
 +
|
 +
<pre>
 +
  ntldr=<myfile>
 +
  &rarr; sets: file=<myfile> seg=0x2000 setbpb nohand
 
</pre>
 
</pre>
This option inhibits sanity checks during the traversal of the partition table.  
+
|}
This is potentially useful in corner cases, when for example an USB stick moved
+
{{S|ntldr}}{{V|3.70+}}
to some different computer would report a smaller size than previously with
+
Prepare to load ''ntldr'' directly. Add the  
partitions spanning the whole space. Normally, the partition iterator would report
+
'[[#save|save]]' option so as to store corrected BPB values.
an error and abort in such case. Another case scenario is disk corruption in
+
 
some later EMBR partition.
+
=== cmldr ===
<br /><br /><pre>
+
{|
        break
+
|
        *nobreak
+
<pre>
        break sets: nofile nomaps nohand
+
  cmldr=<myfile>
 +
  &rarr; sets: file=<myfile> seg=0x2000 setbpb nohand cmldr
 
</pre>
 
</pre>
It is possible to trigger a ''service-only'' run; the chain module will do
+
|}
everything requested as usual, but it will not perform the actual chainloading.  
+
{{S|cmldr}}{{V|3.85+}}
The 'break' option disables the handover, file loading and sector mapping, as these
+
Prepare to load ''Windows Recovery Console'' directly.  
are pointless in such scenario (although the file might be re-enabled in some future
+
The in-memory copy of the bootsector is patched
version, if the writing to actual files becomes possible). Mainly useful for
+
with {{nowrap|1='<code> cmdcons\0 </code>'}}.
options such as 'fixchs', '<nowiki>[un]hide[all]</nowiki>' and 'setbpb'.
+
Same remarks as in '[[#ntldr|ntldr]]'.
<br /><br /><pre>
+
 
        isolinux=<file>
+
=== reactos ===
        sets: file=<file> nohand nosect isolinux
+
{|
 +
|
 +
<pre>
 +
  reactos=<myfile>
 +
  &rarr; sets: file=<myfile> seg=0x0F80 setbpb nohand
 
</pre>
 
</pre>
Chainload to another version/build of the ISOLINUX bootloader and patch the loader
+
|}
with appropriate parameters in memory. This avoids the need for the
+
{{S|reactos}}{{V|6.04+}}
-eltorito-alt-boot parameter of mkisofs, when you want more than one ISOLINUX
+
Prepare to load ''ReactOS's freeldr'' directly.  
per CD/DVD.
+
Add the '[[#save|save]]'  
<br /><br /><pre>
+
option so as to store corrected BPB values.
        ntldr=<file>
+
 
        sets: file=<file> seg=0x2000 setbpb nohand
+
=== freedos ===
</pre>
+
{|
Prepares to load ''ntldr'' directly. You might want to add the 'save' option
+
|
so to store corrected BPB values.
+
<pre>
<br /><br /><pre>
+
  freedos=<myfile>
        cmldr=<file>
+
  &rarr; sets: file=<myfile> seg=0x60 sect=0x1FE0 setbpb nohand
        sets: file=<file> seg=0x2000 setbpb nohand cmldr
+
</pre>
+
Prepares to load ''recovery console'' directly. The in-memory copy of the bootsector is
+
patched with <code> cmdcons\0 </code>. Same remarks as in 'ntldr='.
+
<br /><br /><pre>
+
        reactos=<file>
+
        sets: file=<file> seg=0:0x8000:0x8100 setbpb nohand
+
</pre>
+
Prepares to load ''ReactOS's freeldr'' directly. You might want to add the 'save'
+
option so to store corrected BPB values.
+
<br /><br /><pre>
+
        freedos=<file>
+
        sets: file=<file> seg=0x60 sect=0x1FE0 setbpb nohand
+
 
</pre>
 
</pre>
Prepares to load ''FreeDOS kernel'' directly. You will likely want to add the 'save'  
+
|}
option, as those kernels seem to require a proper geometry written back to disk.  
+
{{S|freedos}}{{V|3.70+}}
 +
Prepare to load ''FreeDOS kernel'' directly.  
 +
The '[[#save|save]]' option is likely needed,  
 +
as these kernels seem to require a proper geometry written back to disk.  
 
The sector address is chosen based on where FreeDOS' bootsectors relocate themselves,  
 
The sector address is chosen based on where FreeDOS' bootsectors relocate themselves,  
 
although it seems the kernel doesn't rely on it.
 
although it seems the kernel doesn't rely on it.
  
You might also want to employ the 'hide' option, if you have problems with  
+
Consider using the '[[#hide|hide]]' option,  
properly assigning the C: drive.
+
if the OS has problems with properly assigning the "C:" drive letter.
<br /><br /><pre>
+
 
        pcdos=<file>
+
=== msdos and pcdos ===
        msdos=<file>
+
{|
        sets: file=<file> seg=0x70 sect=0x8000 setbpb nohand
+
|
 +
<pre>
 +
  pcdos=<myfile>
 +
  msdos=<myfile>
 +
  &rarr; sets: file=<myfile> seg=0x70 sect=0x8000 setbpb nohand
 
</pre>
 
</pre>
Similarly to 'freedos=', this prepares to load MSDOS 2.00 - 6.xx or derivatives.  
+
|}
The sector address is chosen arbitrarily. Otherwise, comments as above.
+
{{S|msdos_and_pcdos}}{{V|3.70+}}
<br /><br /><pre>
+
Similarly to '[[#freedos|Freedos]]', prepare to load MSDOS 2.00 - 6.xx or derivatives.  
        msdos7=<file>
+
The sector address is chosen arbitrarily. Otherwise, same remarks as in '[[#freedos|Freedos]]'.
        sets: file=<file> seg=0x70::0x200 sect=0x8000 setbpb nohand
+
 
 +
=== msdos7 ===
 +
{|
 +
|
 +
<pre>
 +
  msdos7=<myfile>
 +
  &rarr; sets: file=<myfile> seg=0x70::0x200 sect=0x8000 setbpb nohand
 
</pre>
 
</pre>
Only for MSDOS 7+ versions (98se ~ 7.xx, Me ~ 8.xx). Comments as above.
+
|}
 +
{{S|msdos7}}
 +
Only for MSDOS 7+ versions (98se ~ 7.xx, Me ~ 8.xx).  
 +
Otherwise, same remarks as in '[[#freedos|Freedos]]'.
  
 +
<!--  -->
 +
<!--  -->
 +
<!--    TODO/TEST -->
 +
<!--    TODO/TEST -->
 +
<!--    TODO/TEST -->
 +
<!--  -->
 +
<!--  -->
  
<!-- TODO/TEST -->
+
=== drmk ===
 +
{|
 +
|
 +
<pre>
 +
  drmk=<myfile>
 +
  &rarr; sets: file=<myfile> seg=0x70 sect=0x2000:0:0 setbpb nohand
 +
</pre>
 +
|}
 +
{{S|drmk}}{{V|4.03+}}
 +
Used for loading of [[DRMK|Dell's]] DOS derivatives <u>only</u>.
 +
It requires a boot sector at <tt>0x2000</tt> and overall valid BPB values.
 +
As in other DOS-ish cases, likely candidates for use
 +
are options '[[#save|save]]' and '[[#hide|hide]]'.
  
 +
=== grub ===
 +
{|
 +
|
 +
<pre>
 +
  grub=<myfile> [grubcfg=<myconfig>]
 +
  &rarr; sets: file=<myfile> seg=0x800::0x200 nohand nosect grub
 +
</pre>
 +
|}
 +
{{S|grub}}{{V|4.00+}}
 +
Chainload to grub legacy's stage2,
 +
performing additional corrections on the file in memory.
 +
{{V|4.02+}}Optionally, an alternative ''<nowiki><myconfig></nowiki>''
 +
file can be specified via the '<code>grubcfg</code>' option.
  
<br /><br /><pre>
+
=== grldr ===
        drmk=<file>
+
{|
        sets: file=<file> seg=0x70 sect=0x2000:0:0 setbpb nohand
+
|
 +
<pre>
 +
  grldr=<myfile>
 +
  &rarr; sets: file=<myfile> nohand nosect grldr
 
</pre>
 
</pre>
This is used for loading of Dell's DOS derivatives <u>only</u>. It does require a boot
+
|}
sector at 0x2000 and overall valid BPB values. As in other DOS-ish cases,  
+
{{S|grldr}}{{V|3.85+}}
likely candidates for use are the 'save' and 'hide' options.
+
Chainload to GRUB4DOS grldr,  
<br /><br /><pre>
+
performing additional corrections on the file in memory.
        grub=<file> [grubcfg=<config>]
+
 
        sets: file=<file> seg=0x800::0x200 nohand nosect grub
+
=== bs ===
 +
{|
 +
|
 +
<pre>
 +
  bs=<myfile>
 +
  &rarr; sets: file=<myfile> nosect filebpb
 
</pre>
 
</pre>
Chainloads to grub legacy's stage2, performing additional corrections on the file
+
|}
in memory. Additionally, an alternate config file can be specified through the
+
{{S|bs}}
'grubcfg=' option.
+
Emulate SYSLINUX's native BS option. Load the file and,
<br /><br /><pre>
+
if possible, also adjust its BPB values.
        grldr=<file>
+
Everything is made in reference to the selected disk/partition.
        sets: file=<file> nohand nosect grldr
+
 
</pre>
+
=== bss ===
Chainloads to GRUB4DOS grldr, performing additional corrections on the file
+
{|
in memory.
+
|
<br /><br /><pre>
+
<pre>
        bss=<file>
+
  bss=<myfile>
        sets: file=<file> nomaps setbpb bss
+
  &rarr; sets: file=<myfile> nomaps setbpb bss
</pre>
+
This emulates SYSLINUX's native BSS option. This loads both the file and the
+
sector, adjusts BPB values in the loaded sector, then copies all possible BPB
+
fields to the loaded file. Everything is made in reference to the selected  
+
disk/partition.
+
<br /><br /><pre>
+
        bs=<file>
+
        sets: file=<file> nosect filebpb
+
 
</pre>
 
</pre>
This emulates SYSLINUX's native BS option. This loads the file and, if possible,  
+
|}
also adjusts its BPB values. Everything is made in reference to the selected  
+
{{S|bss}}
disk/partition.
+
Emulate SYSLINUX's native BSS option. Load both, the  
 +
file and the sector, adjust BPB values in the loaded sector,  
 +
and then copy all possible BPB fields to the loaded file.  
 +
Everything is made in reference to the selected disk/partition.
  
  
 +
<br />
 
== See Also ==
 
== See Also ==
  
 
* [[Comboot/chain.c32]]
 
* [[Comboot/chain.c32]]
 +
* BPB: [https://en.wikipedia.org/wiki/BIOS_parameter_block BIOS Parameter Block]

Latest revision as of 04:29, 2 August 2019

Introduction

Although Syslinux is capable of (very simple) native chainloading (through .bss and .bs files - see doc/syslinux), it also features a very robust and rich com32 module designed for such purpose.

The chain.c32 module can perform some basic tasks:

  • load and jump to a sector
  • load and jump to a file (also loading a sector for other purposes)
  • prepare handover data to be used by a file / boot sector
  • fix different options in a file / sector / partition entries
  • perform a service-only run.

It can chainload data from both, GPT [4.00+] and MBR (aka. DOS) partitions, as well as boot the first sector from a raw disk.

A rough overview of the code is as follows:

  1. Parse arguments.
  2. Find drive and/or partition to boot from.
  3. Perform partition-level patching - for example (un)hiding, fixing CHS values, etc.
  4. Load a file to boot from.
  5. Load a sector to boot from, if it doesn't conflict with #4.
  6. Prepare handover area, if it doesn't conflict with #4 and #5.
  7. Prepare registers.
  8. Patch loaded file if necessary.
  9. Patch loaded sector if necessary.
  10. Chainload.

In its most basic form, chain.c32 loads either an MBR or a specified boot sector at '0:0x7c00', prepares handover area as a standard MBR would do, and jumps to '0:0x7c00'.

A service-only run is possible when either:

  • the 'break' option is in effect; or,
  • options 'nofile' and 'nomaps' (or 'nosect') are in effect.

This is useful for invocations such as:

  chain.c32 hdN M setbpb save break
  chain.c32 hdN fixchs break
  chain.c32 hdN unhideall break

Please see the respective options for more details.


Syntax

  chain [drive/partition] [options]

In case of repeated arguments, the rightmost ones take precedence.

Note that some options cannot be combined with some other options.

OPTION TYPE BIOS MBR/GPT PT VBR
boot flag Syslinux's boot drive
mbr argument Match ID
guid argument Match ID Match ID
label argument Match ID
hd#,# argument Device # Device #
fs flag Syslinux's boot volume
fd# argument Device #


Drive

Drives can be specified as either:

mbr
select a disk by its signature;
guid
select a disk by its guid (GPT only);
boot
the drive SYSLINUX was booted from. This is the default value, if nothing else is specified.
hd#
drive number as seen by BIOS, starting from 0.
fd#
floppy drive number as seen by BIOS, starting from 0.

Option 'guid' is shared with partition selection. If there are non-unique guids, they are searched first in disk0, then partitions of disk0, then disk1, ... order.

'mbr' and 'guid' take an extra parameter; use either ':' or '=' as delimiter.

Partition

Partition can be specified as either:

guid
select a partition by a specified guid value (not by guid type !);
label
select a partition by a specified label (searching by disk order);
fs
the partition SYSLINUX was booted from;
#
partition number within disk; the standard method. Partitions 1-4 are primary, 5+ are logical, 0 (zero) is the MBR (default).

If a partition is selected by number, it should be specified after a disk drive notation by using either a space or a comma character as delimiter (after 'hd#', 'fd#', 'mbr', 'guid' or 'boot').


Options

OPTION TYPE BIOS MBR/GPT PT VBR FILE OTHER
swap flag Set as first device
prefmbr flag Prefer MBR over GPT
hide multiflag Modify partition ID
fixchs flag Fix CHS
gpthcrc flag GPT header checksum
gptlcrc flag GPT list checksum
strict multiflag Sanity check level
file argument Select file to load
seg argument Address
sect argument Address
maps flag Map in address
hand flag Use handover (area)
hptr flag Point registers to handover area
setbpb flag Patch BPB
filebpb flag Patch BPB
save flag Write BPB
keeppxe flag Keep UNDI stack loaded
break flag Service-only run
warn flag Wait for a key-press
exit flag Force end of command line
isolinux shortcut Load a different ISOLINUX version
ntldr shortcut Windows NTLDR
cmldr shortcut Windows Recovery Console
reactos shortcut Reactos freeldr.sys
freedos shortcut FreeDOS kernel.sys
pcdos shortcut PCDOS ibmbio.com
msdos shortcut MSDOS 2-6.xx io.sys
msdos7 shortcut MSDOS7+ io.sys
drmk shortcut DELLDOS dellbio.bin
grub shortcut GRUB legacy's stage2
grldr shortcut GRUB4DOS grldr
bs shortcut Emulate SYSLINUX's BS
bss shortcut Emulate SYSLINUX's BSS

swap

  swap
  *noswap

§ [3.70+] Install a tiny stub code that swaps device numbers, if the device we use during chainloading is not 'fd0' nor 'hd0'.

prefmbr

  prefmbr
  *noprefmbr

§  In case non-standard hybrid MBR/GPT layout is present, this flag makes the chain module prefer MBR layout over GPT.

hide

  [un]hide[all]        		→ sets: strict=2
  *nohide

§ [3.71+] Modify the partition ID ("type") in the partition table (typically, "0x0n"↔"0x1n"). In certain situations it is useful to hide partitions; for example to make sure DOS gets "C:". 'hide' will hide hidable primary partitions, except the one we are booting from. Similarly, 'hideall' will hide all hidable partitions, except the one we are booting from. Hiding is performed only on the selected disk. Options starting with 'un' will simply unhide partitions (primary ones or all, accordingly). The writing is only performed if the values actually changed. See also 'break'.

fixchs

  fixchs               		→ sets: strict=2
  *nofixchs

§  Fix all partitions' CHS numbers so as to make the partition table totally compatible with the current BIOS. This option can be useful, for example, to silence FreeDOS complaining about "logical CHS differs from physical", or sfdisk about "found (...) expected (...)". Functionally, it seems to be mostly cosmetic, as Microsoft's world (when it cares about geometry) generally sticks to values written in bootsectors. And the rest of the world generally doesn't care about them at all. The writing is only performed if the values actually changed. See also 'break'.

gpthcrc and gptlcrc

  *gpthcrc             		→ Perform gpt header crc check
  nogpthcrc            		→ Skip crc check
  *gptlcrc             		→ Perform gpt list crc check
  nogptlcrc            		→ Skip crc check

§  Force boot when checksums of GPT header and/or partition list are invalid. This works independently from the 'strict' option.

strict

  strict[=<0|1|2>] 
  *strict=1
  relax
  • 'strict=1' enables checks, but ignores those that involve disk size.
  • 'strict=2' enables all checks.
  • 'relax' and 'nostrict' are equivalent to 'strict=0'.
  • 'norelax' and 'strict' are equivalent to 'strict=2'.

§ [6.03+] Control the level of sanity checks used during the traversal of partition table(s). This is potentially useful in (buggy) corner cases, for example when the disk size is reported differently across different computers or virtual machines (if it happens at all, the size usually differs by 1 sector). Normally, the partition iterator would report an error and abort in such case. Another case scenario is disk corruption in some later EMBR partition.

file

  file=</><path/to/><myfile>
  *nofile

§ [3.70+] It is often convenient to load a file directly and transfer control to it, instead of the sector from the disk. Note that <myfile> must reside on the Syslinux's filesystem volume.

Choosing a file without explicitly specifying any addresses (see options 'sect' and 'seg') will cause the sector to not be loaded at all (as their memory placement would overlap).

seg

  seg=<segment>:<offset>:<ip>
  *seg=0:0x7c00:0x7c00

§ [3.70+] Alter the addresses a file will use. It is loaded at '<segment:offset>'; the entry point is at '<segment:ip>'.

When chainloading some other bootloader or kernel, this option is almost always mandatory.

If this option is not specified, the defaults are '0:0x7c00:0x7c00'. If any field is omitted (e.g. '0x2000::'), it defaults to 0.

sect

  sect=<segment>:<offset>:<ip>
  *sect=0:0x7c00:0x7c00
  nosect               		→ sets: nomaps

§  Alter the addresses a sector will use. It is loaded at '<segment:offset>; the entry point is at '<segment:ip>'.

'sect' is mostly used in tandem with options 'file' and 'seg', as some loaders/kernels expect a relocated sector at some particular address (e.g. DRMK).

'nosect' will cause the sector to not be loaded at all. In many cases, when a file is being chainloaded, specifying a sector is not necessary.

If this option is not specified, the defaults are '0:0x7c00:0x7c00'. If any field is omitted (e.g. '0x2000::'), it defaults to 0.

maps

  *maps
  nomaps

§  In some cases, it is useful to fix BPB values in NTFS/FATxx boot sectors and eventually write them back, but otherwise the boot sector itself is not necessary so as to continue the booting process. 'nomaps' allows such situation: a sector will be loaded, but it won't be mapped into real memory. Any overlap tests (vs. handover or file areas) are not performed, being meaningless in such case.

hand

  *hand
  nohand

§  By default, a handover area is prepared if possible - meaning, if it doesn't overlap with other areas. This is often not necessary though; usually, a chainloaded file or kernel does not care about it anymore, so a user can disable it explicitly with 'nohand'.

hptr

  hptr
  *nohptr

§  In case both, file and sector, are loaded, then 'ds:si' and 'ds:bp' will point to the sector address before chainloading. This option forces those registers to point to the handover area. This is useful when both the file and the sector are actually a sector's image and the sector is mapped.

setbpb

  setbpb
  *nosetbpb

§  Microsoft's side of the world is particularly sensitive to certain BPB values. Depending on the system and on the chainloading method (i.e. sector or file), some or all of those fields must match "reality"; but after performing certain operations such as disk cloning, or when using a USB stick in different computers, that's often not the case (i.e. some BPB values might not match the real media).

Matching the "reality" means evaluating:

"hidden sectors"
Valid offset of the partition from the beginning of the disk.
"geometry"
Valid drive geometry as reported by BIOS.
"drive"
Valid drive number.

This option will automatically determine the type of BPB and fix what it can, according to the detected BPB. If the detection of the BPB is not possible, this function does nothing.

filebpb

  filebpb
  *nofilebpb

§  A chainloaded file can simply be an image of a sector. In such case, it could be useful to also fix its BPB values.

save

  save                 		→ sets: strict=2
  *nosave

§  Fixing BPB values (with 'setbpb') only in memory might not be enough. This option allows writing the corrected values to the sector.

By default, the chain module will not save anything (such as BPB values) to disk, other than options such as 'hide' or 'fixchs', which are directly related to partition entries.

When 'save' is used:

  • it can apply to a sector, never to a loaded file;
  • the writing is only performed if the values actually changed.

keeppxe

  keepexe
  *nokeepexe

§ [PXELINUX only] When booting over a network using PXELINUX, 'keeppxe' will keep UNDI stacks in memory.

break

  break                		→ sets: nofile nomaps nohand
  *nobreak

§ [4.05+] Trigger a service-only run; the chain module will do everything requested as usual, but it will not perform the actual chainloading. The 'break' option disables the handover, file loading and sector mapping, as these are pointless in such scenario (although the file might be re-enabled in some future version, if writing to actual files becomes possible). Mainly useful for options such as 'fixchs', '[un]hide[all]' and 'setbpb'.

warn

  warn
  *nowarn

§  Wait for a key-press, right before continuing the chainloading. Useful to see warnings emitted by the chain module.

exit

§ [6.04+] Impose the end of the command to be parsed by chain.c32. In some cases (e.g. when using gfxboot) the resulting command line seems to end with some "garbage" that chain.c32 cannot understand, creating unexpected behavior. By adding 'exit' to the end of the command, chain.c32 disregards anything after this option and should work as expected. Usually, this option is not required.


isolinux

  isolinux=<myfile>
  → sets: file=<myfile> nohand nosect isolinux

§ [ISOLINUX only; 3.83+] Chainload to 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.

ntldr

  ntldr=<myfile>
  → sets: file=<myfile> seg=0x2000 setbpb nohand

§ [3.70+] Prepare to load ntldr directly. Add the 'save' option so as to store corrected BPB values.

cmldr

  cmldr=<myfile>
  → sets: file=<myfile> seg=0x2000 setbpb nohand cmldr

§ [3.85+] Prepare to load Windows Recovery Console directly. The in-memory copy of the bootsector is patched with ' cmdcons\0 '. Same remarks as in 'ntldr'.

reactos

  reactos=<myfile>
  → sets: file=<myfile> seg=0x0F80 setbpb nohand

§ [6.04+] Prepare to load ReactOS's freeldr directly. Add the 'save' option so as to store corrected BPB values.

freedos

  freedos=<myfile>
  → sets: file=<myfile> seg=0x60 sect=0x1FE0 setbpb nohand

§ [3.70+] Prepare to load FreeDOS kernel directly. The 'save' option is likely needed, as these kernels seem to require a proper geometry written back to disk. The sector address is chosen based on where FreeDOS' bootsectors relocate themselves, although it seems the kernel doesn't rely on it.

Consider using the 'hide' option, if the OS has problems with properly assigning the "C:" drive letter.

msdos and pcdos

  pcdos=<myfile>
  msdos=<myfile>
  → sets: file=<myfile> seg=0x70 sect=0x8000 setbpb nohand

§ [3.70+] Similarly to 'Freedos', prepare to load MSDOS 2.00 - 6.xx or derivatives. The sector address is chosen arbitrarily. Otherwise, same remarks as in 'Freedos'.

msdos7

  msdos7=<myfile>
  → sets: file=<myfile> seg=0x70::0x200 sect=0x8000 setbpb nohand

§  Only for MSDOS 7+ versions (98se ~ 7.xx, Me ~ 8.xx). Otherwise, same remarks as in 'Freedos'.


drmk

  drmk=<myfile>
  → sets: file=<myfile> seg=0x70 sect=0x2000:0:0 setbpb nohand

§ [4.03+] Used for loading of Dell's DOS derivatives only. It requires a boot sector at 0x2000 and overall valid BPB values. As in other DOS-ish cases, likely candidates for use are options 'save' and 'hide'.

grub

  grub=<myfile> [grubcfg=<myconfig>]
  → sets: file=<myfile> seg=0x800::0x200 nohand nosect grub

§ [4.00+] Chainload to grub legacy's stage2, performing additional corrections on the file in memory. [4.02+] Optionally, an alternative <myconfig> file can be specified via the 'grubcfg' option.

grldr

  grldr=<myfile>
  → sets: file=<myfile> nohand nosect grldr

§ [3.85+] Chainload to GRUB4DOS grldr, performing additional corrections on the file in memory.

bs

  bs=<myfile>
  → sets: file=<myfile> nosect filebpb

§  Emulate SYSLINUX's native BS option. Load the file and, if possible, also adjust its BPB values. Everything is made in reference to the selected disk/partition.

bss

  bss=<myfile>
  → sets: file=<myfile> nomaps setbpb bss

§  Emulate SYSLINUX's native BSS option. Load both, the file and the sector, adjust BPB values in the loaded sector, and then copy all possible BPB fields to the loaded file. Everything is made in reference to the selected disk/partition.



See Also