[PATCH v3 4/6] openbmc: Generate images that erase empty NOR sections
Andrew Jeffery
andrew at aj.id.au
Wed Feb 24 10:54:42 AEDT 2016
On Wed, 2016-02-24 at 09:36 +1030, Joel Stanley wrote:
> On Wed, Feb 24, 2016 at 1:15 AM, Andrew Jeffery <andrew at aj.id.au> wrote:
>
> Why do we need to do this?
Primarily for the following patch where we conditionally call
mkfs.${OVERLAY_BASETYPE} when creating the RW FS. jffs2 can mount raw
erased partitions, so we ensure flash-palmetto and image-rwfs are in a
state where this can be achieved (after the image has been written to
the NOR). Erasing the partition then writing zeros isn't helpful.
To be fair we don't have to do this for the ${FLASH_SIZE} file, it's
not necessary, but Milton requested it and I don't really have a strong
opinion on the issue.
Andrew
>
> > Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
> > ---
> > meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass | 11 +++++++++--
> > 1 file 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 bf987bb..96193a3 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}
> > --
> > 2.5.0
> >
> > _______________________________________________
> > openbmc mailing list
> > openbmc at lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/openbmc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160224/c265ee6e/attachment.sig>
More information about the openbmc
mailing list