Difference between revisions of "Linux.c32"

From Syslinux Wiki
Jump to: navigation, search
m (Syntax: correct "linux.32" to "linux.c32")
(Wiki formatting. Add "initrd+=" and "initrdfile=" info.)
Line 2: Line 2:
 
[[Category:Modules]]
 
[[Category:Modules]]
  
= About =
+
'''linux.c32''' is a comboot module for Syslinux that loads  
'''linux.c32''' is a comboot module for Syslinux that loads Linux kernels and memdisk.
+
[[Config#LINUX|{{nowrap|Linux-like}}]] kernels and [[MEMDISK]].
  
The linux.c32 module can deal with memory holes better than is the case using syslinux directly. Eg. on some systems with large initramfs files you may have to use linux.c32. The other difference is that for PXE boot, you can make it pass a copy
+
The linux.c32 module can deal with memory holes better than  
of the PXE configuration packets into the initramfs.
+
using the bootloader directly.  
 +
For instance, linux.c32 might be needed / recommended
 +
on some systems with large initramfs files.  
 +
The other difference is that, for PXE boot,  
 +
it can pass a copy of the PXE configuration packets into the initramfs.
  
The linux.c32 code will be included as part of the core in Syslinux 5.
+
== Syntax ==
  
= Requirements =
 
* working Syslinux environment
 
* working kernel (and initrd/initramfs)
 
 
= Syntax =
 
 
  linux.c32 [-dhcpinfo] path/kernel arguments...
 
  linux.c32 [-dhcpinfo] path/kernel arguments...
  
If -dhcpinfo is specified, the DHCP info is written into the file /dhcpinfo.dat in the initramfs.
+
If <code>-dhcpinfo</code> is specified,  
 
+
the DHCP info is written into the  
 +
<tt>/dhcpinfo.dat</tt> file in the initramfs.
  
 
== Example ==
 
== Example ==
Here is an example pxelinux.cfg file for booting
+
 
 +
A configuration example with linux.c32:
 +
 
 
<pre>
 
<pre>
label superLinuxOS
+
label superLinuxOS
   kernel linux.c32
+
   COM32 linux.c32
   append path/kernel initrd=path/initramfs.cgz root=/dev/ram0 rw quiet
+
   APPEND path/kernel initrd=path/initramfs.cgz root=/dev/ram0 rw quiet
 
</pre>
 
</pre>
  
= Further Reading =
+
 
None
+
<br />
 +
 
 +
== initrd+= ==
 +
 
 +
<!-- Leaving an alternative manual "anchor". -->
 +
<span id="initrd+"></span>
 +
<!--  -->
 +
<!-- [syslinux] [PATCH] 4 Patches for initrd+= and initrdfile= Options -->
 +
<!-- http://www.syslinux.org/archives/2012-October/018708.html -->
 +
<!-- http://repo.or.cz/syslinux.git/commit/66484b55fe52e1393b8c6b522ca8d18b898e18f3 -->
 +
<!--  -->
 +
<!--  -->
 +
The "initrd+=" option allows the appending of
 +
{{nowrap|initramfs-style}} blobs
 +
(files that can be produced with
 +
{{nowrap|<code>'cpio -o -H newc'</code>}})
 +
to whatever "initrd" was specified via the
 +
{{nowrap|"<tt>initrd{{{|=}}}</tt>"}} option
 +
(or was specified indirectly via
 +
the [[Config#INITRD|INITRD]] directive).
 +
 
 +
Some custom initramfs with some
 +
particular / personal / specific / desired
 +
content can be layered on top of whichever initramfs
 +
some Linux distribution originally / generally provides to its users;
 +
useful for changing {{nowrap|start-up}} scripts
 +
or adding drivers / features,
 +
or for changing the original behavior.
 +
 
 +
This option can be specified more than once,
 +
and can take a {{nowrap|comma-separated}} list of files.
 +
 
 +
Linux.c32 processes the kernel's {{nowrap|command-line}} for
 +
{{nowrap|"<tt>initrd+{{{|=}}}</tt>"}} options.
 +
 
 +
By appending {{nowrap|"<tt>initrd+{{{|=}}}foo</tt>"}},
 +
linux.c32 will concatenate the file "foo"
 +
to the initrds that it has already loaded
 +
due to the {{nowrap|"<tt>initrd{{{|=}}}</tt>"}} option.
 +
 
 +
Given {{nowrap|"<tt>initrd+{{{|=}}}foo,bar</tt>"}},
 +
linux.c32 will concatenate both files, "foo" and "bar",
 +
to the initrds that it has already loaded
 +
due to the {{nowrap|"<tt>initrd{{{|=}}}</tt>"}} option.
 +
That is, multiple filenames
 +
can be specified with comma separators.
 +
 
 +
Given {{nowrap|"<tt>initrd+{{{|=}}}foo initrd+{{{|=}}}bar</tt>"}},
 +
linux.c32 will concatenate both files, "foo" and "bar",
 +
to the initrds that it has already loaded
 +
due to the {{nowrap|"<tt>initrd{{{|=}}}</tt>"}} option.
 +
That is, the {{nowrap|"<tt>initrd+{{{|=}}}</tt>"}} option
 +
can be specified multiple times.
 +
 
 +
The position of any {{nowrap|"<tt>initrd{{{|=}}}</tt>"}} option,
 +
relative to any {{nowrap|"<tt>initrd+{{{|=}}}</tt>"}} option,
 +
is irrelevant.
 +
The {{nowrap|"<tt>initrd{{{|=}}}</tt>"}}
 +
option is always processed before
 +
all {{nowrap|"<tt>initrd+{{{|=}}}</tt>"}} options.
 +
 
 +
PLEASE NOTE: There are <u>no spaces</u> involved in using the
 +
{{nowrap|"<tt>initrd+{{{|=}}}</tt>"}} option;
 +
{{nowrap|"<tt>initrd +{{{|=}}} foo</tt>"}} will not work.
 +
 
 +
 
 +
<br />
 +
 
 +
== initrdfile= ==
 +
 
 +
<!-- Leaving an alternative manual "anchor". -->
 +
<span id="initrdfile"></span>
 +
<!--  -->
 +
<!-- [syslinux] [PATCH] 4 Patches for initrd+= and initrdfile= Options -->
 +
<!-- http://www.syslinux.org/archives/2012-October/018708.html -->
 +
<!-- http://repo.or.cz/syslinux.git/commit/fb3e1a576ca0243c37786bfd81cc9600d589db45 -->
 +
<!--  -->
 +
<!--  -->
 +
The "initrdfile=" option allows to load a file
 +
and encapsulate it as though
 +
{{nowrap|<code>'cpio -o -H newc'</code>}}
 +
had been used,
 +
and then passes the resulting blob alongside the other items
 +
that might have been specified with
 +
{{nowrap|"<tt>initrd{{{|=}}}</tt>"}} and
 +
{{nowrap|"<tt>initrd+{{{|=}}}</tt>"}}.
 +
 
 +
By appending
 +
{{nowrap|"<tt>initrdfile{{{|=}}}foo</tt>"}}
 +
to <tt>linux.c32</tt>,
 +
the <tt>foo</tt> file will be loaded,
 +
encapsulated with the initramfs cpio format,
 +
then passed alongside any initramfs files that were specified by
 +
{{nowrap|"<tt>initrd{{{|=}}}</tt>"}} and
 +
{{nowrap|"<tt>initrd+{{{|=}}}</tt>"}} options.
 +
 
 +
This option is useful for taking a raw file
 +
from the Syslinux {{nowrap|booted-from}} filesystem and
 +
sending it through to the kernel's rootfs via the initramfs scheme.
 +
 
 +
Besides its use for Linux,
 +
this implementation also allows Syslinux's users
 +
to boot Michael Brown's 'wimboot' kernel and
 +
be able to pass it the raw files it needs,
 +
in order to boot a Microsoft Windows PE .WIM.
 +
 
 +
The desired (destination) path/filename
 +
for the file to have within the rootfs
 +
can be specified by using the {{nowrap|"at" ("@") sign}}, as in:
 +
 
 +
  initrdfile=foo@/goes/to/foo
 +
 
 +
Multiple files can also be specified, separated by commas, such as:
 +
 +
  initrdfile=foo,bar@/somewhere/bar,baz
 +
 
 +
This option can also be used multiple times, as in:
 +
 
 +
  initrdfile=foo,bar initrdfile=baz@/somewhere/baz

Revision as of 06:37, 18 March 2016


linux.c32 is a comboot module for Syslinux that loads Linux-like kernels and MEMDISK.

The linux.c32 module can deal with memory holes better than using the bootloader directly. For instance, linux.c32 might be needed / recommended on some systems with large initramfs files. The other difference is that, for PXE boot, it can pass a copy of the PXE configuration packets into the initramfs.

Syntax

linux.c32 [-dhcpinfo] path/kernel arguments...

If -dhcpinfo is specified, the DHCP info is written into the /dhcpinfo.dat file in the initramfs.

Example

A configuration example with linux.c32:

 label superLinuxOS
  COM32 linux.c32
  APPEND path/kernel initrd=path/initramfs.cgz root=/dev/ram0 rw quiet



initrd+=

The "initrd+=" option allows the appending of initramfs-style blobs (files that can be produced with 'cpio -o -H newc') to whatever "initrd" was specified via the "initrd=" option (or was specified indirectly via the INITRD directive).

Some custom initramfs with some particular / personal / specific / desired content can be layered on top of whichever initramfs some Linux distribution originally / generally provides to its users; useful for changing start-up scripts or adding drivers / features, or for changing the original behavior.

This option can be specified more than once, and can take a comma-separated list of files.

Linux.c32 processes the kernel's command-line for "initrd+=" options.

By appending "initrd+=foo", linux.c32 will concatenate the file "foo" to the initrds that it has already loaded due to the "initrd=" option.

Given "initrd+=foo,bar", linux.c32 will concatenate both files, "foo" and "bar", to the initrds that it has already loaded due to the "initrd=" option. That is, multiple filenames can be specified with comma separators.

Given "initrd+=foo initrd+=bar", linux.c32 will concatenate both files, "foo" and "bar", to the initrds that it has already loaded due to the "initrd=" option. That is, the "initrd+=" option can be specified multiple times.

The position of any "initrd=" option, relative to any "initrd+=" option, is irrelevant. The "initrd=" option is always processed before all "initrd+=" options.

PLEASE NOTE: There are no spaces involved in using the "initrd+=" option; "initrd += foo" will not work.



initrdfile=

The "initrdfile=" option allows to load a file and encapsulate it as though 'cpio -o -H newc' had been used, and then passes the resulting blob alongside the other items that might have been specified with "initrd=" and "initrd+=".

By appending "initrdfile=foo" to linux.c32, the foo file will be loaded, encapsulated with the initramfs cpio format, then passed alongside any initramfs files that were specified by "initrd=" and "initrd+=" options.

This option is useful for taking a raw file from the Syslinux booted-from filesystem and sending it through to the kernel's rootfs via the initramfs scheme.

Besides its use for Linux, this implementation also allows Syslinux's users to boot Michael Brown's 'wimboot' kernel and be able to pass it the raw files it needs, in order to boot a Microsoft Windows PE .WIM.

The desired (destination) path/filename for the file to have within the rootfs can be specified by using the "at" ("@") sign, as in:

 initrdfile=foo@/goes/to/foo

Multiple files can also be specified, separated by commas, such as:

 initrdfile=foo,bar@/somewhere/bar,baz

This option can also be used multiple times, as in:

 initrdfile=foo,bar initrdfile=baz@/somewhere/baz