[OE-core] [PATCH] image_types: perform fsck on created ext image

Daniel Schultz d.schultz at phytec.de
Fri Mar 24 13:34:00 UTC 2017


Hi Enrico,

I have sent fixes for the same problem on Monday.
These include a fix of the wrong return code after optimizations (now it 
returns 0) and an fsck execution after the creation of EXT partitions.

The patch which is identical to yours wasn't applied so far, the other 
ones were.

-- 
Mit freundlichen Grüßen,
With best regards,
   Daniel Schultz

Am 24.03.2017 um 12:15 schrieb Enrico Jorns:
> When performing a file system check, the image created with mkfs will
> trigger Pass 3A ('Optimizing directories') which turns the file system
> into state "changed" (EXT2_FLAG_CHANGED).
>
> This will let fsck request a reboot by setting the return code flag "2".
>
> The result of this is that each ext-image built with oe-core will
> trigger a reboot during the first time an fsck is triggered.
>
> A common case where this might occur is when fsck detects having
> a future superblock write time. This always happens when booting a
> newly created ext4 rootfs with a target that does not have a recent time
> set.
>
> This patch moves the initial fsck run that performs the optimization
> from the target to the host system and thus prevents the target from
> performing an avoidable reboot.
>
> Signed-off-by: Enrico Jorns <ejo at pengutronix.de>
> Signed-off-by: Ulrich Ölmann <uol at pengutronix.de>
> ---
>  meta/classes/image_types.bbclass | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
> index 1ce8334e3a..52d3af0cc1 100644
> --- a/meta/classes/image_types.bbclass
> +++ b/meta/classes/image_types.bbclass
> @@ -66,6 +66,8 @@ oe_mkext234fs () {
>  	# Create a sparse image block
>  	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
>  	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
> +	# Error codes 0-3 indicate successfull operation of fsck (no errors or errors corrected)
> +	fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype || [ $? -le 3 ]
>  }
>
>  IMAGE_CMD_ext2 = "oe_mkext234fs ext2 ${EXTRA_IMAGECMD}"
>




More information about the Openembedded-core mailing list