diff mbox series

image_types.bbclass: make fsck optional

Message ID 585429b3-5763-4c61-97ae-2c73266c887d@elder-tomes.com
State New
Headers show
Series image_types.bbclass: make fsck optional | expand

Commit Message

Levi Shafter Dec. 31, 2025, 10:52 p.m. UTC
The fsck in oe_mkext234fs() was added to prevent an extra reboot on the
target:

https://git.openembedded.org/openembedded-core/commit/?id=a93d0059341

This has the side effect of increasing delta between images which
prevents reproducibility. In many cases, the added security provided by
image reproducibility is worth the extra reboot upon first booting the
target. The use of fsck should be included by default, but left
configurable.

[YOCTO #16110]

Signed-off-by: Levi Shafter <levi.shafter@elder-tomes.com>
---
Sponsor: 21SoftWare LLC

 meta/classes-recipe/image_types.bbclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

+	fi
 }

 IMAGE_CMD:ext2 = "oe_mkext234fs ext2 ${EXTRA_IMAGECMD}"
diff mbox series

Patch

diff --git a/meta/classes-recipe/image_types.bbclass
b/meta/classes-recipe/image_types.bbclass
index e6ef0ce11e..63dc504f8c 100644
--- a/meta/classes-recipe/image_types.bbclass
+++ b/meta/classes-recipe/image_types.bbclass
@@ -92,8 +92,14 @@  oe_mkext234fs () {
 	bbdebug 1 "Actual Partition size: `stat -c '%s'
${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype`"
 	bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd
${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype -d ${IMAGE_ROOTFS}"
 	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype
-d ${IMAGE_ROOTFS}
-	# Error codes 0-3 indicate successfull operation of fsck (no errors or
errors corrected)
-	fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype || [ $? -le 3 ]
+
+	if [ '${RUN_FSCK}' = "0" ]; then
+		bbdebug 1 "Skipping fsck for reduced image delta"
+	else
+		bbdebug 1 "Running fsck on image"
+		# Error codes 0-3 indicate successful operation of fsck (no errors or
errors corrected)
+		fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype || [ $? -le 3 ]