From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C0F3C19F2A for ; Sun, 7 Aug 2022 19:04:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4D90183FB0; Sun, 7 Aug 2022 21:04:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="hAj7Zra/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA90883EF2; Sun, 7 Aug 2022 21:04:36 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BAA9783FB0 for ; Sun, 7 Aug 2022 21:04:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A3DCB80DC1; Sun, 7 Aug 2022 19:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E487AC433C1; Sun, 7 Aug 2022 19:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659899073; bh=YQCxsM4h/Kw88x1vKRDeJdrBKkFIaISFcI2VpL85zzE=; h=From:To:Cc:Subject:Date:From; b=hAj7Zra/ihqWl3d8ArZLK6er65FzSt3oE4Xr73XU49NyLUTmWT5w4uTa/fT4LwF7Y hTDCaLPc66GeTkvwvPzURO6wWcQO1emqPSS3Tge2H5AcyuL3w0nbUWzD7kMCMjbydU vqmjo3to1lXjrTCzrmzDzknr0pHjxlygN1tHynChCTdzNzj7CXZ6jm8U514ZSLN1kl 5Stt6wPFxvIRl4LWoZJkc7DztchYBJFl8x4asuJe4SYSCXxtsrikJDHEdI95vA5Bnk dNq27v9dCLdIZkv1ldsO/s5M0A7ZxnbLbTF9fpkSPbZmnTfNCaFX4cevWEhX3yznwx j62r1R5QX2rBg== Received: by pali.im (Postfix) id D352897B; Sun, 7 Aug 2022 21:04:29 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Tom Rini Cc: u-boot@lists.denx.de Subject: [PATCH] distroboot: ubifs: Add support for specifying UBI header offset Date: Sun, 7 Aug 2022 21:04:22 +0200 Message-Id: <20220807190422.20157-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Some UBI partitions may use non-standard UBI header offset. For attaching these UBI partitions it is required to pass second argument with offset to "ubi part" command. Therefore extend distroboot to allow specifying additional optional 6th argument with UBI header offset. This offset is set in new distroboot variable ${bootubioff} which may be used by distroboot script to e.g. properly pass this value to linux kernel command line for proper mounting of rootfs by kernel. This variable is set to empty string (cleared) when UBI header offset is not specified into distroboot BOOT_TARGET_DEVICES macro. Usage of helper macro BOOTENV_DEV_UBIFS_BOOTUBIOFF in this change is there as a type check. It ensures that in BOOT_TARGET_DEVICES macro was specified UBIFS func with either 5 or 6 arguments. If not then cpp throws compile error. Signed-off-by: Pali Rohár --- include/config_distro_bootcmd.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 4e0c23be5645..f28f6095da08 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -70,7 +70,7 @@ #ifdef CONFIG_CMD_UBIFS #define BOOTENV_SHARED_UBIFS \ "ubifs_boot=" \ - "if ubi part ${bootubipart} && " \ + "if ubi part ${bootubipart} ${bootubioff} && " \ "ubifsmount ubi0:${bootubivol}; " \ "then " \ "devtype=ubi; " \ @@ -80,12 +80,14 @@ "run scan_dev_for_boot; " \ "ubifsumount; " \ "fi\0" -#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \ +#define BOOTENV_DEV_UBIFS_BOOTUBIOFF(off) #off /* type check, throw error when called with more args */ +#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol, ...) \ "bootcmd_ubifs" #instance "=" \ "bootubipart=" #bootubipart "; " \ "bootubivol=" #bootubivol "; " \ + "bootubioff=" BOOTENV_DEV_UBIFS_BOOTUBIOFF(__VA_ARGS__) "; " \ "run ubifs_boot\0" -#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \ +#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, ...) \ #devtypel #instance " " #else #define BOOTENV_SHARED_UBIFS -- 2.20.1