[RFC PATCH v2 2/2] openbmc: Use JFFS2 for RW overlay filesystem

Milton Miller II miltonm at us.ibm.com
Fri Feb 19 10:08:41 AEDT 2016


Around 02/17/2016 01:27AM in some time zone Andrew Jeffery wrote:

> We can enable JFFS2 support on mtd6 (the RW mtd partition) with a
> (first-pass) kernel patch[1] applied to work-around a 'stutter' in the
> (optimised) ARM mmiocpy() implementation.
> 
> [1] Unmerged, but tested: https://lists.ozlabs.org/pipermail/openbmc/2016-February/001874.html
> 
> Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 meta-phosphor/classes/image-overlay.bbclass                |  7 ++++++-
 .../classes/obmc-phosphor-image_types_uboot.bbclass        | 14 ++++++++++++--
 .../obmc-phosphor-initfs/files/obmc-init.sh                |  2 +-
 .../obmc-phosphor-initfs/files/obmc-update.sh              |  2 +-
 4 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/meta-phosphor/classes/image-overlay.bbclass b/meta-phosphor/classes/image-overlay.bbclass
index 1c6137d..9203955 100644
--- a/meta-phosphor/classes/image-overlay.bbclass
+++ b/meta-phosphor/classes/image-overlay.bbclass
@@ -3,7 +3,12 @@ INITRD_IMAGE ?= "core-image-minimal-initramfs"
 INITRD ?= "${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}-${MACHINE}.cpio.${INITRD_CTYPE}${uboot}"
 
 IMAGE_BASETYPE ?= "squashfs-xz"
-OVERLAY_BASETYPE ?= "ext4"
+OVERLAY_BASETYPE ?= "jffs2"
+
> +# Note: OVERLAY_BASETYPE_OPTS is not used when OVERLAY_BASETYPE=jffs2
> +# Options for when OVERLAY_BASETYPE=ext4
> +#
> +# OVERLAY_BASETYPE_OPTS ?= "-b 4096 -F -O^huge_file"
> 

This should be something like OVERLAY_MKFS_OPTS_ext4

Its options for the mkfs invocation of the overlay, not the 
base type.

The options are likely mkfs.ext4 specific.

In bitbake, if you want options to apply for a specific type the 
convention is to use that type of naming.  In many cases the build system 
resolves conditionally adding the text to the base variable (but it might 
need to be tested explicitly in this use case).

That also removes the need for a comment explaining it doesn't apply.

 
> diff --git a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass b/meta-phosphor/classes/obmc-phosphor-
> image_types_uboot.bbclass
> index c390c36..abbbe75 100644
> --- a/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
> +++ b/meta-phosphor/classes/obmc-phosphor-image_types_uboot.bbclass
>         oe_mkimage  "${initrd}" "${INITRD_CTYPE}" || bbfatal "oe_mkimage initrd"
> -       dd if=/dev/zero of=${ddir}/${rwfs} bs=1k count=${RWFS_SIZE}
> -       mkfs.${OVERLAY_BASETYPE} -b 4096 -F -O^huge_file ${ddir}/${rwfs} || bbfatal "mkfs rwfs"
> +
> +       # Set all the bits to effecitvely erase the RW partition on the NOR when

transposed typo: effectively 

> +       # the image is written
> +       dd if=/dev/zero bs=1k count=${RWFS_SIZE} \
> +              | tr '\000' '\377' > ${ddir}/${rwfs}
> +       if [ "${OVERLAY_BASETYPE}" != jffs2 ]; then

Maybe you could create a mkfs.jffs2 that just does nothing ?  Or verifies the erased
pattern?   Maybe it becomes jffs2-nor like squashfs-xz?   Not sure on this last part.

> +              # jffs2 can mount an erased filesystem as if it were formatted,
> +              # so don't bother formatting unless we're configured to use
> +              # something different.
> +              mkfs.${OVERLAY_BASETYPE} ${OVERLAY_BASETYPE_OPTS} \
> +                     ${ddir}/${rwfs} || bbfatal "mkfs rwfs"
> +       fi


Also could you try taking a stab at trying to mount ext4 before jffs2 in the
update copy-from script to allow the upgrade transition to work?

If not I will put it on top of your branch.

milton



More information about the openbmc mailing list