From patchwork Sun Mar 29 13:47:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Couret Charles-Antoine X-Patchwork-Id: 84705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD1CFF3D607 for ; Sun, 29 Mar 2026 13:47:46 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.29636.1774792065675705550 for ; Sun, 29 Mar 2026 06:47:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@mind.be header.s=google header.b=N9e2gyXb; spf=pass (domain: essensium.com, ip: 209.85.221.50, mailfrom: charles-antoine.couret@essensium.com) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-43cfce3a195so116739f8f.2 for ; Sun, 29 Mar 2026 06:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1774792064; x=1775396864; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o7Nl74kfpQmCaKbHROzqIV+fTTBgAJkRL7+Rn7wDsqo=; b=N9e2gyXb7oSVOb0gahJNb7HJrfjO4/hA+g5Jt5hYc8E8Mr9+cQODVWxvtZLBoMcRTw oW42BC6/0R8sqPDVwgD3CP/VF3LDkb/NSy5Rd1CxIWjmB44qjolaRc78uLtcusIvUVjq LDCfYyoOlsushMUjw0A0eHiPfwNXvx3QFFqov//tX8fp0OgfOmBe+qyLPNrY9UBubYNP n2Mljb0LDFBB0mJ0Q6yEK4k3FzMEEFPiBEvZN6B7t+XerCJrPXJXsxLOhkGyvjKB+cZi RP8ncXOQY58+d9e6f/p2uLgwne35VnVJivsdqciDyk1QNf/FXDL0ibBGxX3PFUg/ybAZ Dqbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774792064; x=1775396864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=o7Nl74kfpQmCaKbHROzqIV+fTTBgAJkRL7+Rn7wDsqo=; b=fuX9ZUVu3D3todzgMCFSvmqhh2/+kO2Iy+0G4ciYdVFnsI8rTS5j7syVlezG/mA3e0 EAaKudOuKk1qU8oGa9PMcPCWW8VliCYx2lyBO3jkzCmnIeJ9xpvBiX1xI7OxHhhQzsp2 gPc2BretdcvEQKJWHFqmHRGXCyB6tg1TA24bTCQ1jCAnoIrAvZGr/8KqiDxV6Kp9S9ib 7OtEsGtRxZn8QxgdaEByMSrblKBuSTU3wtb/+Mc1qB2s25zxPksvutwMqVRAwlWG2nfL yGaOiXniffEljJyOmhDYPIgMruDM0W2Y8W3gDKwN00l1W+pXb08DXw8CkTFzDcs+YFXy KD9Q== X-Gm-Message-State: AOJu0YwmFAzxIEGhWDeDPLZPbtezcqpw0zMuTmMtok2B+EjY/CwsWq// QkuBYr8cTFpvhL85J48ebqwK3BJV4R0/dd4sDUNrdQY7pf9IX/GWLzbzpRnYArd0oHeLpqVFpAf cuy5F X-Gm-Gg: ATEYQzwHrGIOz6L/RNsqw74MZcMVc0PNdjVNceQfnxoLSJygA9RsjDesVDKiUefQNm5 JUPdfAi+z802Snj5cKlAokTn+qVjFwqYuhDFqPDjv5gaE+Ei1jXzc0aYg/xsebvTD0RSFnhnkTK avG++kWPTOAlLhhI/cejo2RaQEMUimOKncRV7gKy6GNRPSCtXkD7+nun+RHPcB9zu0ieszUUQ6b Eg4H0uf9XsdqF+zurJbwZ7txNWNYg0XmwY8H+DuwyAqujQLBjpih9soUDxLk37ONdS6zfnKIUmt UTYsmBzf9DR0NhtiEM2C7fQQJIsyW3EsfU++rsH6JGCb+Wulg4IQ5BBvMBSXRPeoQsew1UPI1af L59Bd4pd1xlpnIbMCiI1RwyUiqWEQcRI0i75lq1xOc+f//WNcyZiLUen06x1Xa4CIONQ+C1P3YZ ra+Fx6FVEM71CjbKrq1nILsNm/jfiG4fCpLYm4SYJqnfutE26EjnBJ+w== X-Received: by 2002:a05:6000:40db:b0:43c:fbcd:4b65 with SMTP id ffacd0b85a97d-43cfbcd5421mr3105064f8f.50.1774792063879; Sun, 29 Mar 2026 06:47:43 -0700 (PDT) Received: from Jimmy.fritz.box ([2a02:578:85c6:1101:1ab9:445:1169:11e3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf21e9e18sm11162908f8f.9.2026.03.29.06.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2026 06:47:43 -0700 (PDT) From: charles-antoine.couret@mind.be To: openembedded-core@lists.openembedded.org Cc: Charles-Antoine Couret Subject: [PATCH 1/5 v4] image_types: add python function to get the IMAGE_FILE_MAXSIZE:fstype value Date: Sun, 29 Mar 2026 15:47:11 +0200 Message-ID: <20260329134716.3185469-2-charles-antoine.couret@mind.be> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260329134716.3185469-1-charles-antoine.couret@mind.be> References: <20260329134716.3185469-1-charles-antoine.couret@mind.be> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 29 Mar 2026 13:47:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/234144 From: Charles-Antoine Couret It returns 0 if the variable is not set for this filesystem. In case of fixed partitionning where the rootfs partition can't exceed an amount of bytes, there is currently no automatic and no generic way to have this requirement met in any case. Until now, ROOTFS_SIZE value got from directory_size() does not takes into account the size of required metadata for the filesystem itself (and does not work well for other block size than 4k BTW). Obviously it's a difficult task which depends on rootfs size and filesystem type. The workaround was to set IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE to add the required extra margins. But when the final rootfs is closed to the maximum size, it's difficult to adjust them correctly. And if you remove or add new recipes in your image, you've to recompute these margins to have enough space for these metadata when the rootfs is small, and to not have too big final image when the rootfs is big. It's cumbersome and error prone to just have a build failure when the final output can't be flashed into the partition. The solution is to follow how it's implemented in buildroot by having a specific variable, here IMAGE_FILE_MAXSIZE, to create the final sparse file and trying to fill it with the content of rootfs. If there is enough space, margins are well compressed and does not consume space in the filesystem. If there is no enough space, an error is triggered to warm the developer before trying to use it in the device. If IMAGE_FILE_MAXSIZE is not set, the idea is to keep the previous behaviour for compatibility reason and to met other requirements. Signed-off-by: Charles-Antoine Couret --- meta/classes-recipe/image_types.bbclass | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta/classes-recipe/image_types.bbclass b/meta/classes-recipe/image_types.bbclass index e6ef0ce11e..2905c23d4e 100644 --- a/meta/classes-recipe/image_types.bbclass +++ b/meta/classes-recipe/image_types.bbclass @@ -54,6 +54,13 @@ def imagetypes_getdepends(d): # Sort the set so that ordering is consistant return " ".join(sorted(deps)) +def get_max_image_size(d, fs): + max_size = d.getVar("IMAGE_FILE_MAXSIZE:%s" % fs) + if max_size is not None: + return max_size + + return 0 + XZ_COMPRESSION_LEVEL ?= "-6" XZ_INTEGRITY_CHECK ?= "crc32" From patchwork Sun Mar 29 13:47:12 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Couret Charles-Antoine X-Patchwork-Id: 84706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFDD1F3D608 for ; Sun, 29 Mar 2026 13:47:56 +0000 (UTC) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.29637.1774792066935683222 for ; Sun, 29 Mar 2026 06:47:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@mind.be header.s=google header.b=XTDNyoXm; spf=pass (domain: essensium.com, ip: 209.85.221.43, mailfrom: charles-antoine.couret@essensium.com) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-43cf906b007so284642f8f.0 for ; Sun, 29 Mar 2026 06:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1774792065; x=1775396865; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vjbc9bSep6kD7cASiOZg46P531+lHDOO0jQu2EObubg=; b=XTDNyoXmMy+0xjzzl/SdXLi34l+nuO6FmW+4MbwB/0/ijWYpTPOI9eFuTUg21o7lv6 gVZZPp7KGcItYu+v1lHPu1EQPEAYE4BHY0StRxh70r2FZxohEZWOtHB4aQulasFvPgGK oxG/JeZ4QWSZjtaTwkJImpdtJ0KZCx40yYXkAyfhWUBDlSxwZavsqCzJoRcAGOX/h5cd LLUvNqkj2SBD8aYeJa7IMS/WWhaghzYU0/WA/ID8QeMgPoWA51w9ehwKg3Hz18YhS3/E H3csLSSjaFuPSEu7HUZOA7eup3VP3uoj+nJuQuUTkn8rHd+kJfWbQa4bIgyNia9ByeBB 292A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774792065; x=1775396865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Vjbc9bSep6kD7cASiOZg46P531+lHDOO0jQu2EObubg=; b=bs0ascjxFiCwhy/Ree6tTgf5ODrAnV8CXR8kpifGXpdGQ2S5DIiRTPCSjJFhHF/Mc2 bUb9UmVQ5v6yprs1lKxkRoanOBh1sR/PXbgUaV4ifEXT9kDhAa86pI/1gfwzEMZdLCmu uPAgobeluy0lRZIRkw4r9eKK1RkJB1yoTEiDwN2niQNR9oR71lF+KhTDhBUlGQg39mBo UJC2dmwRajXVWG6wodRggW4ntzHmBbiwT0XUikX6OindatA0koHPYU9y6/yQi2jKWfEq p00ObMXjVSkttLg/eqrwI1qLAxt5F+pC19OJjr1OD1M17fjBB6RuxFpIltc8xWVVIEoE Cq2A== X-Gm-Message-State: AOJu0Yx5YsCMaDkjTQlrBD+kkOQAJlzVMCVgd3+ef5rhc1XQCIEUBeAg OoTdKRMaLODh88NG63AmJIXpntK5dmRwZL4FWHd0Byakpy9bhlD2i8NTrRPK3ziTkQQuAhPaBI6 KVWm3 X-Gm-Gg: ATEYQzzeeUdinvZFCgJuJ7bK65mSSuzmYME8dGKM+l8yDQ1wMonRiMjq8WTy81TyS6J +XRfi/LssDNKMQnk1zCfOBCN6zutkCNsQS4sFrMm6p3i1HNuTBcAHJ+pgYrG/DD5whCSrhVlhV0 SDTAyvYV2G1XgpQx3y0LGb1abKszPQWWxPXkc85v+Fmq1QGkSI/z4CG72FcW9tL9LEhdmv3+hg/ /R1tv69p4gggFCJlgbHMfYVjr8BXrTdwHpB7OC9r7vbzfghGMcZl3Hi0dyr6SrI2Mr0bZNZCRoC AL1YsW7VwSk1sZquJQl0vUpkSEp3+dC9hShPSp379QTyX1PaJBOwexGWJfwVVRJm9M3c18tNSUK 8KDB1w/nYVZLNQqhMFC8XXvZTE4/M2vMFR8oX5Gkg9FofzRRm+Rtj0VFXJp721fdcALznLZSH7A 2XlvBnOmG1crh86V0U4S7kd5wuq6YI6Zhp/1hdateonas= X-Received: by 2002:a05:6000:25c8:b0:43b:48ab:5672 with SMTP id ffacd0b85a97d-43b9e9fb463mr14905991f8f.45.1774792065293; Sun, 29 Mar 2026 06:47:45 -0700 (PDT) Received: from Jimmy.fritz.box ([2a02:578:85c6:1101:1ab9:445:1169:11e3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf21e9e18sm11162908f8f.9.2026.03.29.06.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2026 06:47:45 -0700 (PDT) From: charles-antoine.couret@mind.be To: openembedded-core@lists.openembedded.org Cc: Charles-Antoine Couret Subject: [PATCH 2/5 v4] image_types: use IMAGE_FILE_MAXSIZE variable for ext2/3/4 image types Date: Sun, 29 Mar 2026 15:47:12 +0200 Message-ID: <20260329134716.3185469-3-charles-antoine.couret@mind.be> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260329134716.3185469-1-charles-antoine.couret@mind.be> References: <20260329134716.3185469-1-charles-antoine.couret@mind.be> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 29 Mar 2026 13:47:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/234145 From: Charles-Antoine Couret If defined, this variable value overrides the size of ext* partition file created by mkfs. Otherwise previous logic based on ROOTFS_SIZE variable is used. It should be set when the final file size would not be above a specific value due to fixed partitionning for example. Signed-off-by: Charles-Antoine Couret --- meta/classes-recipe/image_types.bbclass | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/meta/classes-recipe/image_types.bbclass b/meta/classes-recipe/image_types.bbclass index 2905c23d4e..bcb0c75b9f 100644 --- a/meta/classes-recipe/image_types.bbclass +++ b/meta/classes-recipe/image_types.bbclass @@ -77,24 +77,32 @@ IMAGE_CMD:cramfs = "mkfs.cramfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}.cr oe_mkext234fs () { fstype=$1 + image_file_maxsize=$2 extra_imagecmd="" + rootfs_file_size=$ROOTFS_SIZE - if [ $# -gt 1 ]; then - shift + if [ $# -gt 2 ]; then + shift 2 extra_imagecmd=$@ fi + + if [ ${image_file_maxsize} -ne 0 ]; then + rootfs_file_size=${image_file_maxsize} + fi + # If generating an empty image the size of the sparse block should be large # enough to allocate an ext4 filesystem using 4096 bytes per inode, this is # about 60K, so dd needs a minimum count of 60, with bs=1024 (bytes per IO) eval local COUNT=\"0\" eval local MIN_COUNT=\"60\" - if [ $ROOTFS_SIZE -lt $MIN_COUNT ]; then + if [ $rootfs_file_size -lt $MIN_COUNT ]; then eval COUNT=\"$MIN_COUNT\" fi + # Create a sparse image block - bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024" - dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024 + bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype seek=$rootfs_file_size count=$COUNT bs=1024" + dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype seek=$rootfs_file_size count=$COUNT bs=1024 bbdebug 1 "Actual Rootfs size: `du -s ${IMAGE_ROOTFS}`" 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}" @@ -103,9 +111,9 @@ oe_mkext234fs () { fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype || [ $? -le 3 ] } -IMAGE_CMD:ext2 = "oe_mkext234fs ext2 ${EXTRA_IMAGECMD}" -IMAGE_CMD:ext3 = "oe_mkext234fs ext3 ${EXTRA_IMAGECMD}" -IMAGE_CMD:ext4 = "oe_mkext234fs ext4 ${EXTRA_IMAGECMD}" +IMAGE_CMD:ext2 = "oe_mkext234fs ext2 ${@get_max_image_size(d, 'ext2')} ${EXTRA_IMAGECMD}" +IMAGE_CMD:ext3 = "oe_mkext234fs ext3 ${@get_max_image_size(d, 'ext3')} ${EXTRA_IMAGECMD}" +IMAGE_CMD:ext4 = "oe_mkext234fs ext4 ${@get_max_image_size(d, 'ext4')} ${EXTRA_IMAGECMD}" MIN_BTRFS_SIZE ?= "16384" IMAGE_CMD:btrfs () { From patchwork Sun Mar 29 13:47:13 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Couret Charles-Antoine X-Patchwork-Id: 84708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18683F3D60E for ; Sun, 29 Mar 2026 13:47:57 +0000 (UTC) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.29638.1774792068339942115 for ; Sun, 29 Mar 2026 06:47:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@mind.be header.s=google header.b=UICwZD9Z; spf=pass (domain: essensium.com, ip: 209.85.221.53, mailfrom: charles-antoine.couret@essensium.com) Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-43cfbd17589so313772f8f.0 for ; Sun, 29 Mar 2026 06:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1774792067; x=1775396867; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qVvJJ+Gj8mlASHbywrVw9gIse80aNj0aD9a7Vi9D8b0=; b=UICwZD9ZlVp5PbQB9jB9PafNk9S1UraI/qwIR3zC18SY2FxCEWjmHKUi51NsrcQGZT dm0HuYVqYkIr5nWJ3j81ZyvjueP67cIdn6TyYyso1MORwBnsDYa2jg2Cgn6tP7VQe1gm 6rvP0Go7roiyoolE29BfKAdyw2m73qcQQLLE8W67jzn11ZOLePfNIDH8PlW16meVBA3O 8/HZYxPxmoWge/9UvpPi/DIdzzOF6cxoyIokQTmki+t3WXahAMi3rk+heSDqb90TckHo iOHi5Izl1K7wDCvikYuhxSTvDZ72thZ17AN7GIGFwQDsWEzkSu6UP+KZkYIDTpxiYcoF 0Xng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774792067; x=1775396867; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qVvJJ+Gj8mlASHbywrVw9gIse80aNj0aD9a7Vi9D8b0=; b=RQkN0amGJCdYqDWlQSOJE7i18iI3fiTM199jkPR3K2goYjJ8EhG/8W+5LoZk9Wah9k WHnM+TOiC3VtJK0cy3ijBMwPX/raQV9dGLfDssKkbj+Ke7nw/K1FOYFG0DkZCVkcGAPo GsHio7YQ8aJWVgzeAGsszaU1DTqHjPyEmVR41YWTFQxq33/MFz+snnMqPMCkcNYKEj+o ockJf5q+OLyS480Fs0iMiNGQOIIUIgCYUGyxgniDZBg0oWyynVP2ZvpsC0PXSaH351WT XnLtj0rGL/FnIqTDI37T0TupIhUxeUPQec+Tr4j/XySt4hxY6xk+WhRsYo3tAHXdNyxb BxfQ== X-Gm-Message-State: AOJu0YxbxEVwr+sQxkimc/TDBI22GSNHYBARs4GM4YiCtS7anQF3Vnbs DBl7hgvdko9ECih0HTsgxmUztA8mJA9Cy8WhfEIf6SO5z4UPLE5YdwVhPUMd7DnGgaRmEn9Rpy5 AYQaQ X-Gm-Gg: ATEYQzw+8iU3UihFqD6Z6GzO5Hcc8mOr6taHijL46EYybPyt/Mq8TwW8lsmd02fpG6r YEnjzG1/pka2DfVpxbcxeIl7W+4SjbGb57UNQq/7W4m5y/Yryu6wXjQN2UKqFzHfJ7mxkpCvne7 qBriONm4vVlMHIi3zHerQjpIGKkFgRG5i9XAIIUG4KkDCICa7Igp0MRoA2HI/zGCEqtQmzyrAxw UuVNDdSQpZG5KUyf7G/zjb4RsFLm8Qw1ArkxWvVBB7qYP90Oj0a0AKXVoukyGqnSZgXcVgsGkUu vW6bQD8dgviYmj4UWckrHkf+mQeZ206m3RUJt+7Bs3GS+8OZr1PX4fwAd0gl61LC0+zyGRyjb2G C+5S6qwi7oU9tEk/T7lkVKJPJDePsav9mm0uczJ5BOFYEIZU5LN/ZxR/d116yKUajovh2h93aJK Ugs9YQ/dXwZw+vaDmTsPOuwvmaR4Uhicmuh2cQxXJWWmo= X-Received: by 2002:a05:6000:4203:b0:439:cb9f:d635 with SMTP id ffacd0b85a97d-43b9ea771a7mr15221725f8f.46.1774792066545; Sun, 29 Mar 2026 06:47:46 -0700 (PDT) Received: from Jimmy.fritz.box ([2a02:578:85c6:1101:1ab9:445:1169:11e3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf21e9e18sm11162908f8f.9.2026.03.29.06.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2026 06:47:46 -0700 (PDT) From: charles-antoine.couret@mind.be To: openembedded-core@lists.openembedded.org Cc: Charles-Antoine Couret Subject: [PATCH 3/5 v4] image_types: use IMAGE_FILE_MAXSIZE variable for btrfs image types Date: Sun, 29 Mar 2026 15:47:13 +0200 Message-ID: <20260329134716.3185469-4-charles-antoine.couret@mind.be> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260329134716.3185469-1-charles-antoine.couret@mind.be> References: <20260329134716.3185469-1-charles-antoine.couret@mind.be> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 29 Mar 2026 13:47:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/234146 From: Charles-Antoine Couret If defined, this variable value overrides the size of btrfs partition file created by mkfs. Otherwise previous logic based on ROOTFS_SIZE variable is used. It should be set when the final file size would not be above a specific value due to fixed partitionning for example. Signed-off-by: Charles-Antoine Couret --- meta/classes-recipe/image_types.bbclass | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta/classes-recipe/image_types.bbclass b/meta/classes-recipe/image_types.bbclass index bcb0c75b9f..125fd64313 100644 --- a/meta/classes-recipe/image_types.bbclass +++ b/meta/classes-recipe/image_types.bbclass @@ -118,6 +118,12 @@ IMAGE_CMD:ext4 = "oe_mkext234fs ext4 ${@get_max_image_size(d, 'ext4')} ${EXTRA_I MIN_BTRFS_SIZE ?= "16384" IMAGE_CMD:btrfs () { size=${ROOTFS_SIZE} + image_file_maxsize=${@get_max_image_size(d, "btrfs")} + + if [ ${image_file_maxsize} -ne 0 ]; then + size=${image_file_maxsize} + fi + if [ ${size} -lt ${MIN_BTRFS_SIZE} ] ; then size=${MIN_BTRFS_SIZE} bbwarn "Rootfs size is too small for BTRFS. Filesystem will be extended to ${size}K" From patchwork Sun Mar 29 13:47:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Couret Charles-Antoine X-Patchwork-Id: 84709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46E86F3D60F for ; Sun, 29 Mar 2026 13:47:57 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.29773.1774792069402717578 for ; Sun, 29 Mar 2026 06:47:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@mind.be header.s=google header.b=dhB5PCp6; spf=pass (domain: essensium.com, ip: 209.85.128.52, mailfrom: charles-antoine.couret@essensium.com) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-486fe36cfabso22834685e9.1 for ; Sun, 29 Mar 2026 06:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1774792068; x=1775396868; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kw79mGZD9hhjELFAHn8A7IWzh1DTuWLo7CaIIMkilK8=; b=dhB5PCp6cTexTHE4UZLbG3KbwAsFAVID9vMzCshmNDGoP0pphBRJ9QMwX3a5TFwArQ ccwJ05AQgas+Zev+qVg6t35W5HUDAjd3PKM44dqQoWr7VYyBnbR+QX9mlwi+tUQsTup3 9weLNWy/jxv34IIZNU9Tre4oSsZiHmkD6GGit6Nr44+aCwzbBl6eW+42v7gPTwkpSw7J Wvy9XyWnObLK86XVpKWwtjCyz/9oo7+SsQRujUafxFR5FlPYvzq6cJAvvO14+qQGc/OV z0Q7taUz5MaWSkuSyA0fb6x8X7hbprGAzc1lDwZJYkUcag4a1HpNmNMCxoE00q8AQGeq JSPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774792068; x=1775396868; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Kw79mGZD9hhjELFAHn8A7IWzh1DTuWLo7CaIIMkilK8=; b=Sdivf9SCZpQ3HNbVIeXYQon/Q3qcr3gIBUnbXQXmoJySngFWyJTcw/GShbByTRo8gs OmTRjU1LOeNRyZ1TLB2vsoSNNtR/I3NnP3i+C9jp6wF+HDQ0Y2PaOanUzCpZSTkS0Xey OTeneHvBe6TaZNskvt486dGbH0I86nu0EmxW8DcI0fhH0zQm0Piinto3/PxrGGD76bGI EvMZt7MpdT8Q5ltYyNAm8pOew3S7N1dCfQkF2QQHuJGGKdzAN0VLUNG9FL8gQlCNyqZP icRM0MuHuK2parfA9Vpvnu/OXe98M+dW11JdQa53H1YQSFOQAqaE+xl6ofI3gGQ+mjQE Zs7Q== X-Gm-Message-State: AOJu0YySxI/1us8LE38Ke9JbLWygv1Yrxsx+bbeWWkTrsXVfTQCi5Wuf LzMQ/t5lttnaDq4dDuIKIjv0M7jdR0qpcSgqocO0h60afa6Zr7c9z4BdVCowLPCanHEs9zAjqig GuK8v X-Gm-Gg: ATEYQzzySu/JxQRsPM1osNy1/bogOTF7VQbKYcoZAnRyE4Sz8ph9n8Ev+xLXiVtbpEC nWZudATU671/yNZujx4U1Ab1iOx1tK5Z6Crjn8QFi0M/WSdaPoMQczQgE1spNdg+F3Mdbizp7GN B5r3k5YF745Hz9u1kzZ+OG62oDMoRjuSoxhuEHwXoxRnBJ/U+upVMYKDPLWRaj0IvS5rDpdWIax ld5QMbSqsGO6k6Nu9N3AVMRuecfbHaxfeC01falWQXBhN71dpiH+7dwAdoRHLvJ/7nFiWsfSUpk JCVAbTSA6bbD4M8Up8A3DSWD03a7IsWyBAoMhCS29qbwIuTVXpYJzRLnJtGJAle/cgbKezEQ55j L3g2Xt4aplmcjZ9OtxizUMLA2PmbPChBTpoXycx+INvWsdYeIo35GYi2bYvBvfutHSg/zKID8cE R7HgLVkswOJDPk739nacNxfru/x26Pqyb+mfrOATUgOuM= X-Received: by 2002:a05:600c:638e:b0:485:3c09:843 with SMTP id 5b1f17b1804b1-48722be44b4mr227073595e9.9.1774792067662; Sun, 29 Mar 2026 06:47:47 -0700 (PDT) Received: from Jimmy.fritz.box ([2a02:578:85c6:1101:1ab9:445:1169:11e3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf21e9e18sm11162908f8f.9.2026.03.29.06.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2026 06:47:47 -0700 (PDT) From: charles-antoine.couret@mind.be To: openembedded-core@lists.openembedded.org Cc: Charles-Antoine Couret Subject: [PATCH 4/5 v4] image_types: use IMAGE_FILE_MAXSIZE variable for f2fs image types Date: Sun, 29 Mar 2026 15:47:14 +0200 Message-ID: <20260329134716.3185469-5-charles-antoine.couret@mind.be> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260329134716.3185469-1-charles-antoine.couret@mind.be> References: <20260329134716.3185469-1-charles-antoine.couret@mind.be> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 29 Mar 2026 13:47:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/234147 From: Charles-Antoine Couret If defined, this variable value overrides the size of f2fs partition file created by mkfs. Otherwise previous logic based on ROOTFS_SIZE variable is used. It should be set when the final file size would not be above a specific value due to fixed partitionning for example. Signed-off-by: Charles-Antoine Couret --- meta/classes-recipe/image_types.bbclass | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta/classes-recipe/image_types.bbclass b/meta/classes-recipe/image_types.bbclass index 125fd64313..915e31e0bb 100644 --- a/meta/classes-recipe/image_types.bbclass +++ b/meta/classes-recipe/image_types.bbclass @@ -276,6 +276,12 @@ IMAGE_CMD:f2fs () { # 500M the standard IMAGE_OVERHEAD_FACTOR does not work, so add additional # space here when under 500M size=${ROOTFS_SIZE} + image_file_maxsize=${@get_max_image_size(d, "f2fs")} + + if [ ${image_file_maxsize} -ne 0 ]; then + size=${image_file_maxsize} + fi + if [ ${size} -lt ${MIN_F2FS_SIZE} ] ; then size=${MIN_F2FS_SIZE} bbwarn "Rootfs size is too small for F2FS. Filesystem will be extended to ${size}K" From patchwork Sun Mar 29 13:47:15 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Couret Charles-Antoine X-Patchwork-Id: 84707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E048AF3D60A for ; Sun, 29 Mar 2026 13:47:56 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.29640.1774792070715473687 for ; Sun, 29 Mar 2026 06:47:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@mind.be header.s=google header.b=KqXJSQXO; spf=pass (domain: essensium.com, ip: 209.85.221.44, mailfrom: charles-antoine.couret@essensium.com) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-43cfce3a195so116754f8f.2 for ; Sun, 29 Mar 2026 06:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; t=1774792069; x=1775396869; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CzQAqf6w0j08d70wxJNSzhxEpwxdWYNbRT0uzfDjNpo=; b=KqXJSQXOOmDBtjzuyN40qZp7SaDK9IG/w72Njk7JbO6HFd/erFmSExgJNxnrOc2yuu hYfsvh06XAbTikMzHkMtw6/lgR59Lu03/VwsKTjzjeAy2CcUNoiq4o4u1rQPvcj0sFCF tx6NHFW3vhueuAoyZFNJFRF90lFqFyI65YudTqb89WDTJ4WVExXvyot3HsCiSx3SmAeN JjZsDK/l0DrLi6DKZsvYlcKk8K04vIPuNc9/aeMqG7Qe8XlpfaA5iVIkeldOK+KxMouV 3bg7he5yZLvpfvqWrX9P1SlxxTYZI4LYrZ+PLoI4k9SRrZAm2l3NFDwvvBDxAdUWHQ95 X6FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774792069; x=1775396869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CzQAqf6w0j08d70wxJNSzhxEpwxdWYNbRT0uzfDjNpo=; b=qF2+yBUJi96tFSMV29gupgkxfEaTJB0VJm3nPtsoQjXLSJ2Z7O90PSK9UgMUxOKRLE 5gGrZKqGIauyYx3KhDx5ns+SeNPSJtdeqnRvaf0IAUhMyAdJMWlck2V2U+CSuMgbhdYH maTXKw1x+HKYrRPGVZ7c0TZfaB2vS6h5MfL6voFKO5ejXNvT3C71CwpYk3BPpNF+dkhB O4gpMCb/rV7DnS765mn/ckrofAjKZQ9163pMlt9lkQ42L8ZqKqWAlDsMnUHd2UFxADAk JfxK8Z44LBiYQNqn+TJLchaPat9OPH9nrPb3AMGxjGXG6ZLfXGrueQlM5oRhzNdSLrw3 f4jg== X-Gm-Message-State: AOJu0YxE/JeFuv+5HF6LI553/loV2abWmy1dp7pcnf+L7lQTLIttDQwX az0xhFoZTPumbMhdwXfPzxDiHCOCVdqI6VCCwCIwcasr9csXPIPFj/rLyMeWKBV2YEfu9YofXDo +k9z1 X-Gm-Gg: ATEYQzxYFkWcbfKYUDC8b9sTxOle06/MmBtQihCHXXCbQyHx6CTM9rAJcE7oB9b7Q45 vdp24obyCEnoyTgSnQIhhW1+z772kBuMlzl3oTSXzauIl764+mhdeESVtsGluabN2CDGsP+FC6d tX4db92oTjmJJVxPKvVQUgmexmpDro/GygdFuqz+8zRwtWSbL/M4BG3f3cIyvMFofccahXzLTTM GoMzmeqRPSc+HQFDjzEODSkIga8yrKEZFXHCBcQrCkTwm6HVpVnyAGn85DkQ6F6zx1rtTv8QZAi Yr1VqG0rSByh1YnCD1fg5JOMXd25IUIvXjkZQlQRWRJZAZItQIQszOmrJYSXbYgms/ED+apFaPp 9QlWj6xZyV0EfpnLMKaVRGpALyooJKPboG5pupjDUeyZIYE8q4EVHPmBABFkW/u+Nibr9vPE5EX IfTBCdN8jURD2ks3vAKvmExsY5DytH7eyTjNnsIe3Y2dbMYK1xWQf9Cg== X-Received: by 2002:a5d:5d13:0:b0:43c:fd18:a30e with SMTP id ffacd0b85a97d-43cfd18a82fmr2407517f8f.35.1774792068985; Sun, 29 Mar 2026 06:47:48 -0700 (PDT) Received: from Jimmy.fritz.box ([2a02:578:85c6:1101:1ab9:445:1169:11e3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf21e9e18sm11162908f8f.9.2026.03.29.06.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2026 06:47:48 -0700 (PDT) From: charles-antoine.couret@mind.be To: openembedded-core@lists.openembedded.org Cc: Charles-Antoine Couret Subject: [PATCH 5/5 v4] image: add check_image_max_size as post function to check file size against IMAGE_FILE_MAXSIZE Date: Sun, 29 Mar 2026 15:47:15 +0200 Message-ID: <20260329134716.3185469-6-charles-antoine.couret@mind.be> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260329134716.3185469-1-charles-antoine.couret@mind.be> References: <20260329134716.3185469-1-charles-antoine.couret@mind.be> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 29 Mar 2026 13:47:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/234148 From: Charles-Antoine Couret Trigger an error if the final size is above IMAGE_FILE_MAXSIZE value. Which is relevant if the partition size is fixed and the user wants to be sure that the image can be entirely installed into its partition. If the variable is not set, no error is trigger. It works for all filesystems. Signed-off-by: Charles-Antoine Couret --- meta/classes-recipe/image.bbclass | 29 ++++++++++ meta/lib/oeqa/selftest/cases/imagefeatures.py | 53 +++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass index 53f1a9dc45..e0c66f0a31 100644 --- a/meta/classes-recipe/image.bbclass +++ b/meta/classes-recipe/image.bbclass @@ -524,6 +524,7 @@ python () { d.setVarFlag(task, 'imagetype', t) d.appendVarFlag(task, 'prefuncs', ' ' + debug + ' set_image_size') + d.prependVarFlag(task, 'postfuncs', 'check_image_max_size ') d.prependVarFlag(task, 'postfuncs', 'create_symlinks ') d.appendVarFlag(task, 'subimages', ' ' + ' '.join(subimages)) d.appendVarFlag(task, 'vardeps', ' ' + ' '.join(vardeps)) @@ -626,6 +627,34 @@ python create_symlinks() { bb.note("Skipping symlink, source does not exist: %s -> %s" % (dst, src)) } +# +# Check if image size is lighter than maximum size +# +python check_image_max_size() { + def get_max_image_size(d, fs): + max_size = d.getVar("IMAGE_FILE_MAXSIZE:%s" % fs) + if max_size is not None: + return int(max_size) + + return None + + deploy_dir = d.getVar('IMGDEPLOYDIR') + img_name = d.getVar('IMAGE_NAME') + taskname = d.getVar("BB_CURRENTTASK") + subimages = (d.getVarFlag("do_" + taskname, 'subimages', False) or "").split() + + for type in subimages: + file_name = os.path.join(deploy_dir, img_name + "." + type) + + if os.path.exists(file_name): + file_size = os.stat(file_name).st_size / 1024 + max_size = get_max_image_size(d, type) + if max_size is not None: + if file_size > max_size: + bb.fatal("The image %s size %d(K) exceeds IMAGE_FILE_MAXSIZE: %d(K)" % \ + (file_name, file_size, max_size)) +} + python write_image_output_manifest() { import json from pathlib import Path diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py index 87c3da228a..b956cfd32a 100644 --- a/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -234,6 +234,59 @@ UBINIZE_ARGS_mtd_4_256 ?= "-m 4096 -p 256KiB" self.assertTrue(os.path.exists(image_path), "%s image %s doesn't exist" % (itype, image_path)) + def test_image_maxsize_success(self): + """ + Summary: Check if the image built is below maximum size if set + Expected: image is built, size below the limit and no error are reported + Product: oe-core + Author: Charles-Antoine Couret + """ + image = 'core-image-minimal' + + config = """ +IMAGE_FSTYPES += "ext4" +IMAGE_FILE_MAXSIZE:ext4 = "300000" +""" + self.write_config(config) + + res = bitbake(image) + bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image) + + link_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "%s.%s" % (bb_vars['IMAGE_LINK_NAME'], "ext4")) + image_path = os.path.realpath(link_path) + # check if result image is in deploy directory + self.assertTrue(os.path.exists(link_path), + "%s image %s does not exist" % ("ext4", link_path)) + # check if result image size is below than maximum value + self.assertTrue(os.stat(image_path).st_size / 1024 <= 300000) + # No error during execution + self.assertEqual(res.status, 0) + + def test_image_maxsize_failure(self): + """ + Summary: Check if the image built with size above limit is triggering error + Expected: the image size is above limit and triggers error + Product: oe-core + Author: Charles-Antoine Couret + """ + image = 'core-image-minimal' + + config = """ +IMAGE_FSTYPES += "ext4" +IMAGE_FILE_MAXSIZE:ext4 = "1000" +""" + self.write_config(config) + + res = bitbake(image, ignore_status=True) + bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image) + + link_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "%s.%s" % (bb_vars['IMAGE_LINK_NAME'], "ext4")) + # check if result image is not generated + self.assertFalse(os.path.exists(link_path), + "%s image %s exists" % ("ext4", link_path)) + # Error triggered during execution + self.assertNotEqual(res.status, 0) + def test_useradd_static(self): config = """ USERADDEXTENSION = "useradd-staticids"