memset(&hdat, 0, sizeof(hdat));
memset(&sdat, 0, sizeof(sdat));
memset(&opt, 0, sizeof(opt));
- opt.sect = true; /* by def load sector */
- opt.maps = true; /* by def map sector */
- opt.hand = true; /* by def prepare handover */
+ opt.sect = true; /* by def. load sector */
+ opt.maps = true; /* by def. map sector */
+ opt.hand = true; /* by def. prepare handover */
+ opt.chain = true; /* by def. do chainload */
opt.foff = opt.soff = opt.fip = opt.sip = 0x7C00;
opt.drivename = "boot";
#ifdef DEBUG
goto bail;
/*
- * Prepare boot-time mmap data We should to it here, as manglers could
+ * Prepare boot-time mmap data. We should to it here, as manglers could
* potentially alter some of the data.
*/
wait_key();
}
- do_boot(data, ndata);
+ if (ndata && opt.chain) /* boot only if we actually chainload */
+ do_boot(data, ndata);
+ else
+ error("Service-only run completed, exiting.\n");
bail:
pi_del(&iter);
/* Free allocated areas */
chain.c32 fs [options]\n\
", "\
\nOptions ('no' prefix specifies default value):\n\
- file=<file> Load and execute <file>\n\
- seg=<s[:o[:i]]> Load file at <s:o>, jump to <s:i>\n\
- - defaults to 0:0x7C00:0x7C00\n\
- - ommited o/i values default to 0\n\
sect[=<s[:o[:i]]>] Load sector at <s:o>, jump to <s:i>\n\
- defaults to 0:0x7C00:0x7C00\n\
- ommited o/i values default to 0x7C00\n\
nosave Write adjusted sector back to disk\n\
hand Prepare handover area\n\
nohptr Force ds:si and ds:bp to point to handover area\n\
- bss=<filename> Emulate syslinux's BSS\n\
- bs=<filename> Emulate syslinux's BS\n\
noswap Swap drive numbers, if bootdisk is not fd0/hd0\n\
- nohide Hide primary partitions, unhide selected partition\n\
- nohideall Hide *all* partitions, unhide selected partition\n\
+ nohide Disable all hide variations (also the default)\n\
+ hide Hide primary partitions, unhide selected partition\n\
+ hideall Hide *all* partitions, unhide selected partition\n\
+ unhide Unhide primary partitions\n\
+ unhideall Unhide *all* partitions\n\
nombrchs Walk *all* partitions and fix E/MBRs' chs values\n\
nokeeppxe Keep the PXE and UNDI stacks in memory (PXELINUX)\n\
nowarn Wait for a keypress to continue chainloading\n\
- useful to see emited warnings\n\
+ chain Actually perform the chainloading\n\
", "\
\nOptions continued ...\n\
+ file=<file> Load and execute <file>\n\
+ seg=<s[:o[:i]]> Load file at <s:o>, jump to <s:i>\n\
+ - defaults to 0:0x7C00:0x7C00\n\
+ - ommited o/i values default to 0\n\
isolinux=<loader> Load another version of ISOLINUX\n\
ntldr=<loader> Load Windows NTLDR, SETUPLDR.BIN or BOOTMGR\n\
cmldr=<loader> Load Recovery Console of Windows NT/2K/XP/2003\n\
grub=<loader> Load GRUB Legacy stage2\n\
grubcfg=<filename> Set alternative config filename for GRUB Legacy\n\
grldr=<loader> Load GRUB4DOS grldr\n\
+ bss=<filename> Emulate syslinux's BSS\n\
+ bs=<filename> Emulate syslinux's BS\n\
\nPlease see doc/chain.txt for the detailed documentation.\n\
"
};
opt.warn = true;
} else if (!strcmp(argv[i], "nowarn")) {
opt.warn = false;
+ } else if (!strcmp(argv[i], "chain")) {
+ opt.chain = true;
+ } else if (!strcmp(argv[i], "nochain")) {
+ opt.chain = false;
+ opt.file = NULL;
+ opt.maps = false;
+ opt.hand = false;
} else if (((argv[i][0] == 'h' || argv[i][0] == 'f')
&& argv[i][1] == 'd')
|| !strncmp(argv[i], "mbr:", 4)
goto bail;
}
+#if 0
if ((!opt.maps || !opt.sect) && !opt.file) {
error("You have to load something.\n");
goto bail;
}
+#endif
if (opt.filebpb && !opt.file) {
error("Option 'filebpb' requires a file.\n");
bool filebpb;
bool mbrchs;
bool warn;
+ bool chain;
uint16_t keeppxe;
struct syslinux_rm_regs regs;
};
- load and jump to a file (also loading a sector for other purposes)
- prepare handover data to use 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 and DOS partitions, as well as boot the
first sector from a raw disk.
specified) 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:
+
+- 'nochain' is in effect
+
+or
+
+- 'nofile' and 'nomaps' are in effect
+
+This is useful for invocations such as:
+
+chain.c32 hdN M setbpb save nochain
+chain.c32 hdN mbrchs nochain
+chain.c32 hdN unhideall nochain
+
+Please see respective options for more details.
+
Module invocation:
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. Similary, 'hideall' will hide all hidable partitions, except the
-one we're booting from. Hiding is performed only on the booting drive. Options
+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).
Writing is only performed, if the os type values actually changed.
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 complainig about 'logical CHS differs from physcial' of sfdisk about
+FreeDOS complainig about 'logical CHS differs from physical' of sfdisk about
'found (...) expected (...). Functionally seems to be mostly cosmetic, as
Microsoft world - in cases it cares about geometry - generally sticks to values
written in bootsectors. And the rest of the world generally doesn't care about
This option will wait for a keypress right before continuing the chainloading.
Useful to see warnings emited by the chain module.
+ *chain
+ nochain
+ nochain sets: nofile nomaps nohand
+
+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.
+'nochain' option disables handover, file loading and sector mapping, as these
+are pointless in such scenario (although file might be reenabled in some future
+version, if writing to actual files becomes possible). Mainly useful for
+options 'mbrchs', '[un]hide[all]' and setbpb.
+
isolinux=<file>
sets: file=<file> nohand nosect isolinux
in memory.
bss=<file>
- sets: bss=<file> nomaps setbpb bss
+ sets: file=<file> nomaps setbpb bss
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
disk/partition.
bs=<file>
- sets: bs=<file> nosect filebpb
+ sets: file=<file> nosect filebpb
This emulates syslinux's native BS option. This loads the file and if possible
- adjusts its BPB values. Everything is made with reference to the selected