All of lore.kernel.org
 help / color / mirror / Atom feed
From: OpenBMC Patches <openbmc-patches@stwcx.xyz>
To: openbmc@lists.ozlabs.org
Subject: [PATCH openbmc 12/16] image-types_uboot: Package a self contained netboot image
Date: Thu, 30 Jun 2016 18:50:29 -0500	[thread overview]
Message-ID: <20160630235033.17091-13-openbmc-patches@stwcx.xyz> (raw)
In-Reply-To: <20160630235033.17091-1-openbmc-patches@stwcx.xyz>

From: Milton Miller <miltonm@us.ibm.com>

Create a cpio containing the base read-only image, and create a
single combined initramfs image consisting of the image-rofs
and the existing initramfs.

There has been a desire to have a self contained netboot image present
for developer testing and experimentation.   The init script already
supports having the rofs layer sourced from a file packaged into the
initramfs, and will use it if found.

While this image will not fit in the current flash layout in
the initrd space, it will load over the network.  This method
leaves the squashfs compressed in RAM, decompreses is invoked as
needed at runtime, trading boot time and memory space for runtime
decompress on demand.  This will also give similar file access
overheads and performance to reading the data from flash.

Because the rofs is already compressed with xz compression,
don't try to compress this cpio (the cpio packaging adds about 40
bytes of ascii before and after, plus some alignment padding).
Because the kernel requires uncompressed cpios to appear on a
4-byte boundary with 0 byte fill between archives, place this
cpio first in the combined image.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
index 67a389f..dd990bc 100644
--- a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
@@ -51,6 +51,8 @@ do_generate_flash() {
        uinitrd="${initrd}.u-boot"
        rootfs="${IMAGE_LINK_NAME}.${IMAGE_BASETYPE}"
        rwfs="rwfs.${OVERLAY_BASETYPE}"
+       rofsimg=rofs.${IMAGE_BASETYPE}.cpio
+       netimg=initramfs-netboot.cpio
 
        if [ ! -f $ddir/$kernel ]; then
               bbfatal "Kernel file ${ddir}/${kernel} does not exist"
@@ -94,4 +96,12 @@ do_generate_flash() {
 
        tar -h -cvf ${ddir}/${MACHINE}-${DATETIME}.all.tar -C ${ddir} image-bmc
        tar -h -cvf ${ddir}/${MACHINE}-${DATETIME}.tar -C ${ddir} image-u-boot image-kernel image-initramfs image-rofs image-rwfs
+
+       # Package the root image (rofs layer) with the initramfs for net booting.
+       # Uses the symlink above to get the desired name in the cpio
+       ( cd $ddir && echo image-rofs | cpio -oHnewc -L > ${rofsimg} )
+       # Prepend the rofs cpio -- being uncompressed it must be 4-byte aligned
+       cat ${ddir}/${rofsimg} ${ddir}/${initrd} > ${ddir}/${netimg}
+       oe_mkimage  "${netimg}" "${INITRD_CTYPE}"
+
 }
-- 
2.9.0

  parent reply	other threads:[~2016-06-30 23:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 23:50 [PATCH openbmc 00/16] Update flash update to be useable at runtime for v1.0-stable OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 01/16] image_types_uboot: Don't truncate when assembling flash OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 02/16] initfs: Fix recipe, remove unnecessary class OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 03/16] initfs: shutdown: comment on update success OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 04/16] initfs: update: Don't exec sh or sulogin on error just exit 1 OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 05/16] initfs: update: Do not cause an error if no files were saved OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 06/16] initfs: update: Consistently add ERROR: and print to stderr OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 07/16] initfs: update: add option to perform checks but skip actual update OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 08/16] initfs: update: check individual mtd partitions for mounts OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 09/16] initfs: update: add check for image size vs mtd size OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 10/16] initfs: update: add --help message OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 11/16] initfs: init: add file for base options OpenBMC Patches
2016-06-30 23:50 ` OpenBMC Patches [this message]
2016-06-30 23:50 ` [PATCH openbmc 13/16] initfs: update: handle no images to update OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 14/16] initfs: update: Sanitize whitelist directory entries OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 15/16] initfs: whitelist: Sanitize obmc events whitelist entry OpenBMC Patches
2016-06-30 23:50 ` [PATCH openbmc 16/16] initfs: Store whiltelist in a directory of files OpenBMC Patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160630235033.17091-13-openbmc-patches@stwcx.xyz \
    --to=openbmc-patches@stwcx.xyz \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.