Patchwork [v2] image_types.bbclass: allow JFFS2 image with cleanmarkers

login
register
mail settings
Submitter Andrea Adami
Date Oct. 16, 2013, 11:03 p.m.
Message ID <1381964601-28226-1-git-send-email-andrea.adami@gmail.com>
Download mbox | patch
Permalink /patch/60047/
State Superseded, archived
Headers show

Comments

Andrea Adami - Oct. 16, 2013, 11:03 p.m.
The creation of JFFS2 images was hardcoding the
--no-cleanmarkers option (-n) after those two commits:

70a276509f0f006fcc269296afc3dcc88d2825e1
7c803cea58737ea0abc62cd21c3813d955f07224

The documentation explains that the -n option is
intended for flash NAND only: devices with NOR flash
need the cleanmarkers and should not make use of this option.

To add more flexibility, parametrize the padding size
as well, creating JFFS2_PADSIZE.

Finally, add EXTRA_IMAGE_CMD_jffs2 in explicit form:
sumtool has slightly different options:

 -l  --littleendian
 -p, --pad

To give an idea about size differences:

core-image-base-xxx.rootfs.jffs2     | 16496K
core-image-base-xxx.rootfs.sum.jffs2 | 22816K

core-image-minimal-xxx.rootfs.jffs2     | 6160384
core-image-minimal-xxx.rootfs.sum.jffs2 | 9879552

Patch v.2 fixes generation of sum.jffs2 using JFFS2_PADSIZE

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 meta/classes/image_types.bbclass | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
Andrea Adami - Oct. 20, 2013, 10:37 a.m.
Hi,

I've tested the patch in all possible JFFS2 combinations and there is
still a little bug.
The --pad options must be

--pad=0x0FFFF

- p 0x0FFF

I'll resend a final version splitting the changes for a better review.

Cheers

Andrea


On Thu, Oct 17, 2013 at 1:03 AM, Andrea Adami <andrea.adami@gmail.com> wrote:
> The creation of JFFS2 images was hardcoding the
> --no-cleanmarkers option (-n) after those two commits:
>
> 70a276509f0f006fcc269296afc3dcc88d2825e1
> 7c803cea58737ea0abc62cd21c3813d955f07224
>
> The documentation explains that the -n option is
> intended for flash NAND only: devices with NOR flash
> need the cleanmarkers and should not make use of this option.
>
> To add more flexibility, parametrize the padding size
> as well, creating JFFS2_PADSIZE.
>
> Finally, add EXTRA_IMAGE_CMD_jffs2 in explicit form:
> sumtool has slightly different options:
>
>  -l  --littleendian
>  -p, --pad
>
> To give an idea about size differences:
>
> core-image-base-xxx.rootfs.jffs2     | 16496K
> core-image-base-xxx.rootfs.sum.jffs2 | 22816K
>
> core-image-minimal-xxx.rootfs.jffs2     | 6160384
> core-image-minimal-xxx.rootfs.sum.jffs2 | 9879552
>
> Patch v.2 fixes generation of sum.jffs2 using JFFS2_PADSIZE
>
> Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
> ---
>  meta/classes/image_types.bbclass | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
> index 9ead059..0def6d7 100644
> --- a/meta/classes/image_types.bbclass
> +++ b/meta/classes/image_types.bbclass
> @@ -140,9 +140,9 @@ XZ_COMPRESSION_LEVEL ?= "-e -6"
>  XZ_INTEGRITY_CHECK ?= "crc32"
>  XZ_THREADS ?= "-T 0"
>
> -IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 -n ${EXTRA_IMAGECMD}"
> -IMAGE_CMD_sum.jffs2 = "${IMAGE_CMD_jffs2} && sumtool -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 \
> -       -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.sum.jffs2 -n ${EXTRA_IMAGECMD}"
> +IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}"
> +IMAGE_CMD_sum.jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD_jffs2} \
> +       && sumtool -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.sum.jffs2 ${EXTRA_IMAGECMD}"
>
>  IMAGE_CMD_cramfs = "mkfs.cramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}"
>
> @@ -209,9 +209,12 @@ IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_
>  EXTRA_IMAGECMD = ""
>
>  inherit siteinfo
> -JFFS2_ENDIANNESS ?= "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '--little-endian', '--big-endian', d)}"
> +JFFS2_PADSIZE ?= ""
> +JFFS2_ENDIANNESS ?= "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-l', '-b', d)}"
>  JFFS2_ERASEBLOCK ?= "0x40000"
> -EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} --no-cleanmarkers"
> +JFFS2_NOCLEANMARKERS ?= "--no-cleanmarkers"
> +EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_PADSIZE} ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} ${JFFS2_NOCLEANMARKERS}"
> +EXTRA_IMAGECMD_sum.jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} ${JFFS2_NOCLEANMARKERS}"
>
>  # Change these if you want default mkfs behavior (i.e. create minimal inode number)
>  EXTRA_IMAGECMD_ext2 ?= "-i 8192"
> --
> 1.8.1.5
>

Patch

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 9ead059..0def6d7 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -140,9 +140,9 @@  XZ_COMPRESSION_LEVEL ?= "-e -6"
 XZ_INTEGRITY_CHECK ?= "crc32"
 XZ_THREADS ?= "-T 0"
 
-IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 -n ${EXTRA_IMAGECMD}"
-IMAGE_CMD_sum.jffs2 = "${IMAGE_CMD_jffs2} && sumtool -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 \
-	-o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.sum.jffs2 -n ${EXTRA_IMAGECMD}"
+IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}"
+IMAGE_CMD_sum.jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD_jffs2} \
+	&& sumtool -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.sum.jffs2 ${EXTRA_IMAGECMD}"
 
 IMAGE_CMD_cramfs = "mkfs.cramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}"
 
@@ -209,9 +209,12 @@  IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_
 EXTRA_IMAGECMD = ""
 
 inherit siteinfo
-JFFS2_ENDIANNESS ?= "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '--little-endian', '--big-endian', d)}"
+JFFS2_PADSIZE ?= ""
+JFFS2_ENDIANNESS ?= "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-l', '-b', d)}"
 JFFS2_ERASEBLOCK ?= "0x40000"
-EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} --no-cleanmarkers"
+JFFS2_NOCLEANMARKERS ?= "--no-cleanmarkers"
+EXTRA_IMAGECMD_jffs2 ?= "--pad ${JFFS2_PADSIZE} ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} ${JFFS2_NOCLEANMARKERS}"
+EXTRA_IMAGECMD_sum.jffs2 ?= "--pad ${JFFS2_ENDIANNESS} --eraseblock=${JFFS2_ERASEBLOCK} ${JFFS2_NOCLEANMARKERS}"
 
 # Change these if you want default mkfs behavior (i.e. create minimal inode number)
 EXTRA_IMAGECMD_ext2 ?= "-i 8192"