next up previous contents index
Next: 10.14.5 Linking MultiBoot kernels Up: (X86 PC) MultiBoot Startup Previous: 10.14.3 Memory model

10.14.4 Command-line arguments

The MultiBoot specification allows an arbitrary ASCII string to be passed from the boot loader to the OS as a ``command line'' for the OS to interpret as it sees fit. As passed from the boot loader to the OS, this is a single null-terminated ASCII string. However, the default MultiBoot initialization code provided by the OSKit performs some preprocessing of the command line before the actual OS receives control in its main routine. In particular, it parses the single command line string into an array of individual argument strings so that the arguments can be passed to the OS through the normal C-language argc/argv parameters to main. In addition, any command-line arguments containing an equals sign (`=') are added to the environ array rather than the argv array, effectively providing the OS with a minimal initial environment that can be specified by the user (through the boot loader) and examined by the OS using the normal getenv mechanism (see Section 9.4.17).

Note that this command-line preprocessing mechanism matches the kernel command-line conventions established by Linux, although it provides more convenience and flexibility to the OS by providing this information to the OS through standard C-language facilities, and by not restricting the ``environment variables'' to be comma-separated lists of numeric constants, as Linux does. This mechanism also provides much more flexibility than traditional BSD/Mach command-line mechanisms, in which the boot loader itself does most of the command-line parsing, and basically only passes a single fixed ``flags'' word to the OS.



University of Utah Flux Research Group