From b0ac481dda99d8f4be8015964fcb2cb01afce08c Mon Sep 17 00:00:00 2001 From: Nitin A Kamble Date: Tue, 29 Jul 2014 11:34:45 -0700 Subject: INITRD var: make it a list of filesystem images The initrd image used by the Linux kernel is list of file system images concatenated together and presented as a single initrd file at boot time. So far the initrd is a single filesystem image. But in cases like to support early microcode loading, the initrd image need to have multiple filesystem images concatenated together. This commit is extending the INITRD variable from a single filesystem image to a list of filesystem images to satisfy the need mentioned above. Signed-off-by: Nitin A Kamble Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/classes/boot-directdisk.bbclass | 13 ++++++++++--- meta/classes/bootimg.bbclass | 27 ++++++++++++++++++++++----- meta/classes/grub-efi.bbclass | 2 +- meta/classes/syslinux.bbclass | 2 +- meta/conf/documentation.conf | 2 +- 5 files changed, 35 insertions(+), 11 deletions(-) (limited to 'meta') diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass index 0da9932f4f..995d3e7fc6 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -71,10 +71,17 @@ boot_direct_populate() { # Install bzImage, initrd, and rootfs.img in DEST for all loaders to use. install -m 0644 ${STAGING_KERNEL_DIR}/bzImage $dest/vmlinuz - if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then - install -m 0644 ${INITRD} $dest/initrd + # initrd is made of concatenation of multiple filesystem images + if [ -n "${INITRD}" ]; then + rm -f $dest/initrd + for fs in ${INITRD} + do + if [ -n "${fs}" ] && [ -s "${fs}" ]; then + cat ${fs} >> $dest/initrd + fi + done + chmod 0644 $dest/initrd fi - } build_boot_dd() { diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass index d52aacea81..7b3ce65910 100644 --- a/meta/classes/bootimg.bbclass +++ b/meta/classes/bootimg.bbclass @@ -18,7 +18,7 @@ # an hdd) # External variables (also used by syslinux.bbclass) -# ${INITRD} - indicates a filesystem image to use as an initrd (optional) +# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional) # ${COMPRESSISO} - Transparent compress ISO, reduce size ~40% if set to 1 # ${NOISO} - skip building the ISO image if set to 1 # ${NOHDD} - skip building the HDD image if set to 1 @@ -67,9 +67,17 @@ populate() { # Install bzImage, initrd, and rootfs.img in DEST for all loaders to use. install -m 0644 ${STAGING_KERNEL_DIR}/bzImage ${DEST}/vmlinuz - - if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then - install -m 0644 ${INITRD} ${DEST}/initrd + + # initrd is made of concatenation of multiple filesystem images + if [ -n "${INITRD}" ]; then + rm -f ${DEST}/initrd + for fs in ${INITRD} + do + if [ -s "${fs}" ]; then + cat ${fs} >> ${DEST}/initrd + fi + done + chmod 0644 ${DEST}/initrd fi if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then @@ -80,10 +88,19 @@ populate() { build_iso() { # Only create an ISO if we have an INITRD and NOISO was not set - if [ -z "${INITRD}" ] || [ ! -s "${INITRD}" ] || [ "${NOISO}" = "1" ]; then + if [ -z "${INITRD}" ] || [ "${NOISO}" = "1" ]; then bbnote "ISO image will not be created." return fi + # ${INITRD} is a list of multiple filesystem images + for fs in ${INITRD} + do + if [ ! -s "${fs}" ]; then + bbnote "ISO image will not be created. ${fs} is invalid." + return + fi + done + populate ${ISODIR} diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass index 505d032cc8..47bd35e049 100644 --- a/meta/classes/grub-efi.bbclass +++ b/meta/classes/grub-efi.bbclass @@ -7,7 +7,7 @@ # Provide grub-efi specific functions for building bootable images. # External variables -# ${INITRD} - indicates a filesystem image to use as an initrd (optional) +# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional) # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) # ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu # ${LABELS} - a list of targets for the automatic config diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass index b9701bf237..d6498d98bb 100644 --- a/meta/classes/syslinux.bbclass +++ b/meta/classes/syslinux.bbclass @@ -5,7 +5,7 @@ # Provide syslinux specific functions for building bootable images. # External variables -# ${INITRD} - indicates a filesystem image to use as an initrd (optional) +# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional) # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) # ${AUTO_SYSLINUXMENU} - set this to 1 to enable creating an automatic menu # ${LABELS} - a list of targets for the automatic config diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index 7fa3f318b9..31fbd6c43b 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -225,7 +225,7 @@ INHIBIT_PACKAGE_STRIP[doc] = "If set to "1", causes the build to not strip binar INHERIT[doc] = "Causes the named class to be inherited at this point during parsing. The variable is only valid in configuration files." INHERIT_DISTRO[doc] = "Lists classes that will be inherited at the distribution level. It is unlikely that you want to edit this variable." INITRAMFS_FSTYPES[doc] = "Defines the format for the output image of an initial RAM disk (initramfs), which is used during boot." -INITRD[doc] = "Indicates a filesystem image to use as an initial RAM disk (initrd)." +INITRD[doc] = "Indicates list of filesystem images to concatenate and use as an initial RAM disk (initrd)." INITSCRIPT_NAME[doc] = "The filename of the initialization script as installed to ${sysconfdir}/init.d." INITSCRIPT_PACKAGES[doc] = "A list of the packages that contain initscripts. This variable is used in recipes when using update-rc.d.bbclass. The variable is optional and defaults to the PN variable." INITSCRIPT_PARAMS[doc] = "Specifies the options to pass to update-rc.d. The variable is mandatory and is used in recipes when using update-rc.d.bbclass." -- cgit 1.2.3-korg