summaryrefslogtreecommitdiff
path: root/meta-phosphor/classes
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2016-02-23 16:12:06 +0300
committerAndrew Jeffery <andrew@aj.id.au>2016-02-24 08:51:22 +0300
commit43f931d610c79b13faea2ca31b12eb7f50559e72 (patch)
tree9c35b7643511b45bb25367242173eea59f083fa7 /meta-phosphor/classes
parent25a5022d7a9f5619bb85dc968a27e640d34560b2 (diff)
downloadopenbmc-43f931d610c79b13faea2ca31b12eb7f50559e72.tar.xz
openbmc: Generate images with empty NOR sections in the erased state
An erased NOR partition is considered to be a valid JFFS2 filesystem (i.e. can be successfully mounted as JFFS2). As such there's no need to execute mkfs to produce an empty JFFS2 image if the target partition is in the erased state. Thus, when generating the flash-palmetto and image-rwfs image files, start with a base image file in the erased state (with all bits set). The change shifts the common logic to generate the base image files into a shell function. Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Diffstat (limited to 'meta-phosphor/classes')
-rw-r--r--meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass11
1 files changed, 9 insertions, 2 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
index bf987bb689..96193a3516 100644
--- a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
@@ -27,6 +27,13 @@ RWFS_SIZE ?= "4096"
# IMAGE_POSTPROCESS_COMMAND += "do_generate_flash"
+mk_nor_image() {
+ image_dst="$1"
+ image_size_kb=$2
+ dd if=/dev/zero bs=1k count=${image_size_kb} \
+ | tr '\000' '\377' > ${image_dst}
+}
+
do_generate_flash() {
INITRD_CTYPE=${INITRAMFS_CTYPE}
ddir="${DEPLOY_DIR_IMAGE}"
@@ -51,12 +58,12 @@ do_generate_flash() {
fi
oe_mkimage "${initrd}" "${INITRD_CTYPE}" || bbfatal "oe_mkimage initrd"
- dd if=/dev/zero of=${ddir}/${rwfs} bs=1k count=${RWFS_SIZE}
+ mk_nor_image ${ddir}/${rwfs} ${RWFS_SIZE}
mkfs.${OVERLAY_BASETYPE} -b 4096 -F -O^huge_file ${ddir}/${rwfs} || bbfatal "mkfs rwfs"
dst="${ddir}/${FLASH_IMAGE_NAME}"
rm -rf $dst
- dd if=/dev/zero of=${dst} bs=1k count=${FLASH_SIZE}
+ mk_nor_image ${dst} ${FLASH_SIZE}
dd if=${ddir}/${uboot} of=${dst} bs=1k seek=${FLASH_UBOOT_OFFSET}
dd if=${ddir}/${kernel} of=${dst} bs=1k seek=${FLASH_KERNEL_OFFSET}
dd if=${ddir}/${uinitrd} of=${dst} bs=1k seek=${FLASH_INITRD_OFFSET}