This trick probably has other applications, but I am going to only discuss one use case, specifically adding a preseed file to a debian install for setting values configured before the network, on both pc and efi platforms.

Under the pc platform this is quite easy as long as your initrd is in cpio format (the default these days):


kernel debian/linux <other args>
initrd debian/initrd.gz
initrd debian/preseed.cfg preseed.cfg

The way this works is simple the second initrd line loads the file debian/preseed.cfg names it preseed.cfg and puts it in a cpio archive, and then passes both it and debian/initrd.gz (a gziped cpio archive) to the linux kernel as initrd images, linux uncompresses as needed and extracts both cpio archives into the ramdrive and then continues booting as normal, but with one extra file. Note that no initrd is specified on the linux command line, it is not needed.

EFI presents a couple challenges. The default efi builds of ipxe do not support linux calling conventions. This is a relatively minor issue as linux also supports efi calling conventions, but they are different as efi does not strictly have the idea of passing multiple initrds to linux. It does however support the concept of boot file system. There are two easy ways to support multiple initrds on efi linux. The first is to compile ipxe with linux support and use traditional linux calling conventions. This has a fair number of problems which is why linux support was dropped as a default from efi ipxe. The easier solution is to use efi calling conventions a little creatively.


kernel debian/linux initrd=one.gz initrd=two <other args>
initrd --name one.gz debian/initrd.gz
initrd --name two debian/preseed.cfg preseed.cfg

This is just a little more complicated than the previous example in that efi linux requires the initrd(s) to be passed on the command line, and we are playing with names to make sure this is easy to understand (well as easy as possible) and to explicitly tell linux which file to use. The way this works is as follows: ipxe loads debian/linux recognises it as efi stores it in memory with the command line, then loads debian/initrd.gz names it one.gz and stores it in memory, loads debian/preseed.cfg names it pressed.cfg and puts it in a cpio archive called two, then boots linux. linux loads one.gz (which really is debian/initrd.gz) decompresses it extracts the files from it and puts them in the ram drive, then loads two, extracts preseed.cfg (which is debian/preseed.cfg) from it and puts in the ramdrive.

This also happens to work fine for pc linux calling conventions because file names are not passed and initrd= parameters are ignored. Just for completeness here is a minimal example with no name changes.


kernel linux initrd=initrd.gz initrd=preseed.cfg <other args>
initrd initrd.gz
initrd preseed.cfg preseed.cfg
appnote/debian_preseed.txt · Last modified: 2015/12/13 23:13 by ben
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
All uses of this content must include an attribution to the iPXE project and the URL
References to "iPXE" may not be altered or removed.