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 81197C433EF for ; Thu, 23 Jun 2022 16:09:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E2953842F7; Thu, 23 Jun 2022 18:09:32 +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="dfhWwYuf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AA3D384300; Thu, 23 Jun 2022 18:09:31 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (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 47DAD8425C for ; Thu, 23 Jun 2022 18:09:28 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 77BB361EAD; Thu, 23 Jun 2022 16:09:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65FCEC3411B; Thu, 23 Jun 2022 16:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656000565; bh=KFHM25NPlOi3RPC6L2Vhg3vzVVoBi8UHK1vq9qrSlvw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dfhWwYufwAPPcWSZl8prYXHgH3kg872ZKvAGbyyLVb5hcZuE0BmWILwNpMij9hAMC 6rlTxVjHDhkTdtrnsDZM4lQMXN6/jZP18Gaq+mH265XVmI9c8WbY/r/x2cN+s98den gzzQbrlNygYQPfzsWN9pJwIfb/dbl93kV73tTLxpFiPykNHaD/xGsnFOmz/jyCESp8 uborQ6HNu+F5+DDQYWTuek2dV7j4dIEE58GI9Tmhmq0KD3vJ5eQ2L15DwVBa/umgxt QOC4xgFXnEtE5ZW1tgPc+0ClAGo0O2rPgmXsYjG1izEChuMjS+S1Sz2P8S7KZNEIpR WjKwBQfFiYkJg== Received: by pali.im (Postfix) id 4127F79F; Thu, 23 Jun 2022 18:09:22 +0200 (CEST) Date: Thu, 23 Jun 2022 18:09:22 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Simon Glass , Sjoerd Simons , Govindaraji Sivanantham , Hiremath Gireesh , Marcel Ziswiler , Frieder Schrempf , Parthiban Nallathambi , Navin Sankar Velliangiri , "Derald D. Woods" , Martyn Welch , Patrick Delaunay , Patrice Chotard Cc: u-boot@lists.denx.de Subject: Re: [PATCH] distroboot: Fix ubifs Message-ID: <20220623160922.ntaj3p4echi7tvs6@pali> References: <20220531083236.18968-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220531083236.18968-1-pali@kernel.org> User-Agent: NeoMutt/20180716 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 On Tuesday 31 May 2022 10:32:36 Pali Rohár wrote: > Fix multiple issues in ubifs distroboot code: > > U-Boot supports attaching only one MTD device as UBI at the time. So > always call 'ubifsmount ubi0:${bootubivol}' for mounting UBI volume > ${bootubivol}. Usage of 'ubi${devnum}' is incorrect as 'ubi part' > command attach MTD device always as UBI device ubi0. > > Set distroboot ${bootfstype} variable to ubifs in ubifs_boot command. > Distroboot scripts require ${bootfstype} variable to be properly set and it > is already set for all other boot types. > > Set distroboot ${distro_bootpart} variable to ${bootubivol} value. UBI > device does not have partitions, but has volumes. Distroboot scripts > require something to be set in ${distro_bootpart} variable, so set it to > the UBI volume which is currently mounted by ubifs. > > Set distroboot ${devnum} variable to fixed string "ubi0". ubifs code > differs from the other partition code that it requires "ubi" prefix before > number. > > Explicitly unmount ubifs volume after loading all data from it. This allows > to detach UBI device from MTD device. > > Move definition of MTD device with UBI and UBI volume with ubifs filesystem > from global env variables ${bootubipart} and ${bootubivol} into the > distroboot "func" macro, defined in board include config files. UBIFS > distroboot macros then set ${bootubipart} and ${bootubivol} local variables > for compatibility with existing distroboot scripts. > > This last change allows to define more UBIFS target devices and make it > clear what is boot MTD/UBI device. > > All board include config files are adjusted to use this new scheme of > specifying boot MTD/UBI device. > > Signed-off-by: Pali Rohár > --- > CI test passed on https://github.com/u-boot/u-boot/pull/179 > --- PING? > include/config_distro_bootcmd.h | 27 ++++++++++++++++----------- > include/configs/am335x_guardian.h | 3 +-- > include/configs/colibri-imx6ull.h | 1 - > include/configs/colibri_imx7.h | 1 - > include/configs/kontron-sl-mx6ul.h | 2 +- > include/configs/mys_6ulx.h | 2 +- > include/configs/npi_imx6ull.h | 2 +- > include/configs/omap3_beagle.h | 4 +--- > include/configs/omap3_evm.h | 4 +--- > include/configs/pcl063.h | 2 +- > include/configs/stm32mp15_common.h | 2 +- > include/configs/uniphier.h | 2 +- > 12 files changed, 25 insertions(+), 27 deletions(-) > > diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h > index c55023889cab..c6e9c497413d 100644 > --- a/include/config_distro_bootcmd.h > +++ b/include/config_distro_bootcmd.h > @@ -70,18 +70,23 @@ > #ifdef CONFIG_CMD_UBIFS > #define BOOTENV_SHARED_UBIFS \ > "ubifs_boot=" \ > - "env exists bootubipart || " \ > - "env set bootubipart UBI; " \ > - "env exists bootubivol || " \ > - "env set bootubivol boot; " \ > "if ubi part ${bootubipart} && " \ > - "ubifsmount ubi${devnum}:${bootubivol}; " \ > + "ubifsmount ubi0:${bootubivol}; " \ > "then " \ > "devtype=ubi; " \ > + "devnum=ubi0; " \ > + "bootfstype=ubifs; " \ > + "distro_bootpart=${bootubivol}; " \ > "run scan_dev_for_boot; " \ > + "ubifsumount; " \ > "fi\0" > -#define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV > -#define BOOTENV_DEV_NAME_UBIFS BOOTENV_DEV_NAME_BLKDEV > +#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \ > + "bootcmd_ubifs" #instance "=" \ > + "bootubipart=" #bootubipart "; " \ > + "bootubivol=" #bootubivol "; " \ > + "run ubifs_boot\0" > +#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \ > + #devtypel #instance " " > #else > #define BOOTENV_SHARED_UBIFS > #define BOOTENV_DEV_UBIFS \ > @@ -411,13 +416,13 @@ > BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE > #endif > > -#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \ > - BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance) > +#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance, ...) \ > + BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance, ## __VA_ARGS__) > #define BOOTENV_BOOT_TARGETS \ > "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0" > > -#define BOOTENV_DEV(devtypeu, devtypel, instance) \ > - BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance) > +#define BOOTENV_DEV(devtypeu, devtypel, instance, ...) \ > + BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance, ## __VA_ARGS__) > #define BOOTENV \ > BOOTENV_SHARED_HOST \ > BOOTENV_SHARED_MMC \ > diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h > index b92703205cde..340715dad5c6 100644 > --- a/include/configs/am335x_guardian.h > +++ b/include/configs/am335x_guardian.h > @@ -29,7 +29,7 @@ > "ramdisk_addr_r=0x88080000\0" \ > > #define BOOT_TARGET_DEVICES(func) \ > - func(UBIFS, ubifs, 0) > + func(UBIFS, ubifs, 0, UBI, rootfs) > > #define AM335XX_BOARD_FDTFILE "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" > > @@ -54,7 +54,6 @@ > GUARDIAN_DEFAULT_PROD_ENV \ > "autoload=no\0" \ > "backlight_brightness=50\0" \ > - "bootubivol=rootfs\0" \ > "distro_bootcmd=" \ > "setenv rootflags \"bulk_read,chk_data_crc\"; " \ > "setenv ethact usb_ether; " \ > diff --git a/include/configs/colibri-imx6ull.h b/include/configs/colibri-imx6ull.h > index 9e5212acb2ee..a0a0e1767fe0 100644 > --- a/include/configs/colibri-imx6ull.h > +++ b/include/configs/colibri-imx6ull.h > @@ -91,7 +91,6 @@ > UBI_BOOTCMD \ > UBOOT_UPDATE \ > "boot_script_dhcp=boot.scr\0" \ > - "bootubipart=ubi\0" \ > "console=ttymxc0\0" \ > "defargs=user_debug=30\0" \ > "fdt_board=eval-v3\0" \ > diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h > index 3dba7bcef258..3cad17777975 100644 > --- a/include/configs/colibri_imx7.h > +++ b/include/configs/colibri_imx7.h > @@ -131,7 +131,6 @@ > UBOOT_UPDATE \ > "boot_file=zImage\0" \ > "boot_script_dhcp=boot.scr\0" \ > - "bootubipart=ubi\0" \ > "console=ttymxc0\0" \ > "defargs=\0" \ > "fdt_board=eval-v3\0" \ > diff --git a/include/configs/kontron-sl-mx6ul.h b/include/configs/kontron-sl-mx6ul.h > index 7bc402d578e8..b4808d2bbf75 100644 > --- a/include/configs/kontron-sl-mx6ul.h > +++ b/include/configs/kontron-sl-mx6ul.h > @@ -45,7 +45,7 @@ > #define BOOT_TARGET_DEVICES(func) \ > func(MMC, mmc, 1) \ > func(MMC, mmc, 0) \ > - func(UBIFS, ubifs, 0) \ > + func(UBIFS, ubifs, 0, UBI, boot) \ > func(USB, usb, 0) \ > func(PXE, pxe, na) \ > func(DHCP, dhcp, na) > diff --git a/include/configs/mys_6ulx.h b/include/configs/mys_6ulx.h > index 6801fc109eae..663820177a3e 100644 > --- a/include/configs/mys_6ulx.h > +++ b/include/configs/mys_6ulx.h > @@ -59,7 +59,7 @@ > > #define BOOT_TARGET_DEVICES(func) \ > func(MMC, mmc, 0) \ > - func(UBIFS, ubifs, 0) \ > + func(UBIFS, ubifs, 0, UBI, boot) \ > func(PXE, pxe, na) \ > func(DHCP, dhcp, na) > > diff --git a/include/configs/npi_imx6ull.h b/include/configs/npi_imx6ull.h > index c250fa650603..ebb887544e08 100644 > --- a/include/configs/npi_imx6ull.h > +++ b/include/configs/npi_imx6ull.h > @@ -67,7 +67,7 @@ > > #define BOOT_TARGET_DEVICES(func) \ > func(MMC, mmc, 0) \ > - func(UBIFS, ubifs, 0) \ > + func(UBIFS, ubifs, 0, UBI, boot) \ > func(PXE, pxe, na) \ > func(DHCP, dhcp, na) > > diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h > index 158773acedb9..f5da08cf3359 100644 > --- a/include/configs/omap3_beagle.h > +++ b/include/configs/omap3_beagle.h > @@ -65,7 +65,7 @@ > #define BOOT_TARGET_DEVICES(func) \ > func(MMC, mmc, 0) \ > func(LEGACY_MMC, legacy_mmc, 0) \ > - func(UBIFS, ubifs, 0) \ > + func(UBIFS, ubifs, 0, rootfs, rootfs) \ > func(NAND, nand, 0) > > #else /* !CONFIG_MTD_RAW_NAND */ > @@ -87,8 +87,6 @@ > "bootenv=uEnv.txt\0" \ > "bootfile=zImage\0" \ > "bootpart=0:2\0" \ > - "bootubivol=rootfs\0" \ > - "bootubipart=rootfs\0" \ > "usbtty=cdc_acm\0" \ > "mpurate=auto\0" \ > "buddy=none\0" \ > diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h > index eeb9ef8c741a..cc98e03096ab 100644 > --- a/include/configs/omap3_evm.h > +++ b/include/configs/omap3_evm.h > @@ -60,7 +60,7 @@ > #define BOOT_TARGET_DEVICES(func) \ > func(MMC, mmc, 0) \ > func(LEGACY_MMC, legacy_mmc, 0) \ > - func(UBIFS, ubifs, 0) \ > + func(UBIFS, ubifs, 0, rootfs, rootfs) \ > func(NAND, nand, 0) > > #else /* !CONFIG_MTD_RAW_NAND */ > @@ -88,8 +88,6 @@ > "bootenv=uEnv.txt\0" \ > "bootfile=zImage\0" \ > "bootpart=0:2\0" \ > - "bootubivol=rootfs\0" \ > - "bootubipart=rootfs\0" \ > "optargs=\0" \ > "nandroot=ubi0:rootfs ubi.mtd=rootfs rw noinitrd\0" \ > "nandrootfstype=ubifs rootwait\0" \ > diff --git a/include/configs/pcl063.h b/include/configs/pcl063.h > index 31b7d07a24cd..c3f7e7eb2c4b 100644 > --- a/include/configs/pcl063.h > +++ b/include/configs/pcl063.h > @@ -71,7 +71,7 @@ > > #define BOOT_TARGET_DEVICES(func) \ > func(MMC, mmc, 0) \ > - func(UBIFS, ubifs, 0) \ > + func(UBIFS, ubifs, 0, UBI, boot) \ > func(PXE, pxe, na) \ > func(DHCP, dhcp, na) > > diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h > index 6b40cdb01779..68ea56e69c98 100644 > --- a/include/configs/stm32mp15_common.h > +++ b/include/configs/stm32mp15_common.h > @@ -77,7 +77,7 @@ > #endif > > #ifdef CONFIG_CMD_UBIFS > -#define BOOT_TARGET_UBIFS(func) func(UBIFS, ubifs, 0) > +#define BOOT_TARGET_UBIFS(func) func(UBIFS, ubifs, 0, UBI, boot) > #else > #define BOOT_TARGET_UBIFS(func) > #endif > diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h > index f813f88cdd7a..640a29067d85 100644 > --- a/include/configs/uniphier.h > +++ b/include/configs/uniphier.h > @@ -20,7 +20,7 @@ > #endif > > #ifdef CONFIG_CMD_UBIFS > -#define BOOT_TARGET_DEVICE_UBIFS(func) func(UBIFS, ubifs, 0) > +#define BOOT_TARGET_DEVICE_UBIFS(func) func(UBIFS, ubifs, 0, UBI, boot) > #else > #define BOOT_TARGET_DEVICE_UBIFS(func) > #endif > -- > 2.20.1 >