Shao Miller
2012-Oct-26 06:49 UTC
[syslinux] [PATCH] 4 Patches for initrd+= and initrdfile= Options
Attached are 4 patches against Syslinux 4.06 providing two new options for the linux.c32 ComBoot32 module. If we are shifting gears towards 4.10 or 5 any time soon, feel free to let me know and I'll attempt to apply the patches to those and to deal with any conflicts. You can merge these commits onto your 4.06 from my 'multi_initrd' branch at: git://git.zytor.com/users/sha0/syslinux.git In brief: The "initrd+=" option allows you to append initramfs-style blobs (files which 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). This means you can have some custom initramfs that contains some stuff you might like to layer on top of whatever initramfs your Linux distribution gives you; useful for changing startup scripts or adding drivers/features or changing behaviour. This option can be specified more than once, and can take a comma-separated list of files. Please note: This option uses the plus-sign symbol, so _please_ bring forward any conflicts with existing processing of the kernel command-line or of Syslinux config-files which may result. The "initrdfile=" option allows you to load a file and encapsulate it as though you had used 'cpio -o -H newc', and pass the resulting blob alongside the other items that might have been specified with "initrd=" or "initrd+=". This is useful for taking a raw file from the Syslinux booted-from filesystem and sending it through to Linux' rootfs via the initramfs scheme. This option can be specified more than once, and can take a comma-separated list of files. Besides use for Linux, this implementation also allows Syslinux 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. Thanks to Brandon Penglase for very patiently testing the wimboot functionality. Thanks to Michael Brown for wimboot and iPXE, naturally. Thanks to Ady for criticizing the plus-sign symbol and suggesting alternatives. Some patch details follow. Enjoy!>From 693903de260d39db89e246a1e569a084f444cdd7 Mon Sep 17 00:00:00 2001From: Shao Miller <sha0.miller at gmail.com> Date: Thu, 25 Oct 2012 02:17:36 -0400 Subject: [PATCH 1/4] linux.c32: Move some initrd=x,y,z code out of main In handling an "initrd=x,y,z" option, it seems reasonable to be able to handle similar options in a similar fashion, so some of the code has been moved out of 'main' and into a new 'process_initramfs_args' function. Signed-off-by: Shao Miller <sha0.miller at gmail.com> --- com32/modules/linux.c | 82 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 21 deletions(-)>From 4610994cf5b8388d9351549987c6c6270ad0ee7e Mon Sep 17 00:00:00 2001From: Shao Miller <sha0.miller at gmail.com> Date: Thu, 25 Oct 2012 03:58:07 -0400 Subject: [PATCH 2/4] linux.c32: Add new initrd+= option for multiple initrds linux.c32 now processes the kernel's command-line for "initrd+=" options. Given "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: It is important to note that there are NO SPACES involved in using the "initrd+=" option. "initrd += foo" will not work. Signed-off-by: Shao Miller <sha0.miller at gmail.com> --- com32/modules/linux.c | 7 +++++++ 1 file changed, 7 insertions(+)>From bd70ee4433a5eb3f71fabcb26c47ae10e848b6ee Mon Sep 17 00:00:00 2001From: Shao Miller <sha0.miller at gmail.com> Date: Thu, 25 Oct 2012 21:25:38 -0400 Subject: [PATCH 3/4] linux.c32: Introduce initrdfile= option It is useful to be able to load a file and pass it into a kernel's rootfs via the initramfs scheme. Given "initrdfile=foo", we will load the file foo, encapsulate it with the initramfs cpio format, then pass it alongside any initramfs files that were specified by "initrd=" and "initrd+=" options. One can specify the desired path/filename for the file to have within the rootfs by using the at (@) sign, as in: initrdfile=foo@/goes/to/foo One can also specify multiple files, separated by commas, such as: initrdfile=foo,bar@/somewhere/bar,baz One can also use this option multiple times, as in: initrdfile=foo,bar initrdfile=baz@/somewhere/baz Signed-off-by: Shao Miller <sha0.miller at gmail.com> --- com32/modules/linux.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)>From ff696292491b77bec7f5a85c72626ff8f70dc45f Mon Sep 17 00:00:00 2001From: Shao Miller <sha0.miller at gmail.com> Date: Fri, 26 Oct 2012 02:14:28 -0400 Subject: [PATCH 4/4] initramfs chain handling: Accounting fixes for padding, etc. Signed-off-by: Shao Miller <sha0.miller at gmail.com> --- com32/lib/syslinux/initramfs_file.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-linux.c32-Move-some-initrd-x-y-z-code-out-of-main.patch Type: application/octet-stream Size: 3251 bytes Desc: not available URL: <http://www.zytor.com/pipermail/syslinux/attachments/20121026/61e77f38/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-linux.c32-Add-new-initrd-option-for-multiple-initrds.patch Type: application/octet-stream Size: 1833 bytes Desc: not available URL: <http://www.zytor.com/pipermail/syslinux/attachments/20121026/61e77f38/attachment-0001.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-linux.c32-Introduce-initrdfile-option.patch Type: application/octet-stream Size: 3295 bytes Desc: not available URL: <http://www.zytor.com/pipermail/syslinux/attachments/20121026/61e77f38/attachment-0002.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-initramfs-chain-handling-Accounting-fixes-for-paddin.patch Type: application/octet-stream Size: 2617 bytes Desc: not available URL: <http://www.zytor.com/pipermail/syslinux/attachments/20121026/61e77f38/attachment-0003.obj>
Shao Miller
2012-Oct-26 07:12 UTC
[syslinux] [PATCH] 4 Patches for initrd+= and initrdfile= Options
I forgot two important notes: 1. The "initrdfile=" option allows you to specify the target path for the file that will be encapsulated, using the '@' symbol. Please see commit messages, way down below. 2. Thanks to H. Peter Anvin for having already implemented all of the initramfs processing and for all the guidance! Obviously, hpa > Syslinux > these new features. :) - Shao Miller -----Original Message----- From: Shao Miller [mailto:sha0.miller at gmail.com] Sent: Friday, October 26, 2012 02:50 To: 'For discussion of Syslinux and tftp-hpa' Subject: [PATCH] 4 Patches for initrd+= and initrdfile= Options Attached are 4 patches against Syslinux 4.06 providing two new options for the linux.c32 ComBoot32 module. If we are shifting gears towards 4.10 or 5 any time soon, feel free to let me know and I'll attempt to apply the patches to those and to deal with any conflicts. You can merge these commits onto your 4.06 from my 'multi_initrd' branch at: git://git.zytor.com/users/sha0/syslinux.git In brief: The "initrd+=" option allows you to append initramfs-style blobs (files which 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). This means you can have some custom initramfs that contains some stuff you might like to layer on top of whatever initramfs your Linux distribution gives you; useful for changing startup scripts or adding drivers/features or changing behaviour. This option can be specified more than once, and can take a comma-separated list of files. Please note: This option uses the plus-sign symbol, so _please_ bring forward any conflicts with existing processing of the kernel command-line or of Syslinux config-files which may result. The "initrdfile=" option allows you to load a file and encapsulate it as though you had used 'cpio -o -H newc', and pass the resulting blob alongside the other items that might have been specified with "initrd=" or "initrd+=". This is useful for taking a raw file from the Syslinux booted-from filesystem and sending it through to Linux' rootfs via the initramfs scheme. This option can be specified more than once, and can take a comma-separated list of files. Besides use for Linux, this implementation also allows Syslinux 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. Thanks to Brandon Penglase for very patiently testing the wimboot functionality. Thanks to Michael Brown for wimboot and iPXE, naturally. Thanks to Ady for criticizing the plus-sign symbol and suggesting alternatives. Some patch details follow. Enjoy!>From 693903de260d39db89e246a1e569a084f444cdd7 Mon Sep 17 00:00:00 2001From: Shao Miller <sha0.miller at gmail.com> Date: Thu, 25 Oct 2012 02:17:36 -0400 Subject: [PATCH 1/4] linux.c32: Move some initrd=x,y,z code out of main In handling an "initrd=x,y,z" option, it seems reasonable to be able to handle similar options in a similar fashion, so some of the code has been moved out of 'main' and into a new 'process_initramfs_args' function. Signed-off-by: Shao Miller <sha0.miller at gmail.com> --- com32/modules/linux.c | 82 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 21 deletions(-)>From 4610994cf5b8388d9351549987c6c6270ad0ee7e Mon Sep 17 00:00:00 2001From: Shao Miller <sha0.miller at gmail.com> Date: Thu, 25 Oct 2012 03:58:07 -0400 Subject: [PATCH 2/4] linux.c32: Add new initrd+= option for multiple initrds linux.c32 now processes the kernel's command-line for "initrd+=" options. Given "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: It is important to note that there are NO SPACES involved in using the "initrd+=" option. "initrd += foo" will not work. Signed-off-by: Shao Miller <sha0.miller at gmail.com> --- com32/modules/linux.c | 7 +++++++ 1 file changed, 7 insertions(+)>From bd70ee4433a5eb3f71fabcb26c47ae10e848b6ee Mon Sep 17 00:00:00 2001From: Shao Miller <sha0.miller at gmail.com> Date: Thu, 25 Oct 2012 21:25:38 -0400 Subject: [PATCH 3/4] linux.c32: Introduce initrdfile= option It is useful to be able to load a file and pass it into a kernel's rootfs via the initramfs scheme. Given "initrdfile=foo", we will load the file foo, encapsulate it with the initramfs cpio format, then pass it alongside any initramfs files that were specified by "initrd=" and "initrd+=" options. One can specify the desired path/filename for the file to have within the rootfs by using the at (@) sign, as in: initrdfile=foo@/goes/to/foo One can also specify multiple files, separated by commas, such as: initrdfile=foo,bar@/somewhere/bar,baz One can also use this option multiple times, as in: initrdfile=foo,bar initrdfile=baz@/somewhere/baz Signed-off-by: Shao Miller <sha0.miller at gmail.com> --- com32/modules/linux.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)>From ff696292491b77bec7f5a85c72626ff8f70dc45f Mon Sep 17 00:00:00 2001From: Shao Miller <sha0.miller at gmail.com> Date: Fri, 26 Oct 2012 02:14:28 -0400 Subject: [PATCH 4/4] initramfs chain handling: Accounting fixes for padding, etc. Signed-off-by: Shao Miller <sha0.miller at gmail.com> --- com32/lib/syslinux/initramfs_file.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
H. Peter Anvin
2012-Oct-26 21:56 UTC
[syslinux] [PATCH] 4 Patches for initrd+= and initrdfile= Options
On 10/25/2012 11:49 PM, Shao Miller wrote:> Attached are 4 patches against Syslinux 4.06 providing two new options for > the linux.c32 ComBoot32 module. If we are shifting gears towards 4.10 or 5 > any time soon, feel free to let me know and I'll attempt to apply the > patches to those and to deal with any conflicts.The goal is to switch to 5.00 ASAP; Matt is working on the 4.06->5.00 merge at this point. 4.10 is more of a development sidetrack -- what I'd like to do with 4.10 is to merge the lwip logic into 5.00 as a separate driver, so we can have pxelinux.0 and lpxelinux.0 since I really doubt we're going to be able to smoke out enough bugs to make lwip as reliable as the current pxelinux.0. -hpa