Skip to contentSkip to conversation

ARM: omap3: evm: Fix distro bootcmd

PATCH New Derald D. Woods 2 participants 5 messages Jan 21, 2018 – Jan 28, 2018

lore
Share & tools
lore
#0 lore raw

cover ARM: omap3: evm: Fix distro bootcmd

This series fixes an omap3_evm boot hang on master. It contains a patch to "config_distro_bootcmd.h" which allows board defined UBI partition and volume names. This is used by omap3_evm to eliminate some lines of code.

Derald D. Woods (2):
distro bootcmd: Allow board defined UBI partition and volume names
ARM: omap3: evm: Fix distro bootcmd UBIFS and MMC support

 include/config_distro_bootcmd.h | 15 +++++---
 include/configs/omap3_evm.h     | 80 +++++++++++++----------------------------
 2 files changed, 35 insertions(+), 60 deletions(-)
Signature · 1 line
2.16.0
#1 lore raw

PATCH 1/2 distro bootcmd: Allow board defined UBI partition and volume names

This commit allows overriding the default assumption that the boot UBI MTD partition is named 'UBI' and the UBI volume is 'boot'. A board desiring to use a legacy or alternative NAND layout can now define the following two extra environment variables:

bootubipart=<some_ubi_partition_name>
bootubivol=<some_ubi_volume_name>

EXAMPLE:

[include/configs/some_board.h] ---8<------------------------------------------------------------------- [...]

	#include <config_distro_defaults.h>

	#define MEM_LAYOUT_ENV_SETTINGS \
		DEFAULT_LINUX_BOOT_ENV

	#define BOOT_TARGET_DEVICES(func) \
		func(UBIFS, ubifs, 0)

	#include <config_distro_bootcmd.h>
[...]
	#define CONFIG_EXTRA_ENV_SETTINGS \
		MEM_LAYOUT_ENV_SETTINGS \
		"bootubivol=rootfs\0" \
		"bootubipart=rootfs\0" \
		BOOTENV

[...] ---8<-------------------------------------------------------------------

---
 include/config_distro_bootcmd.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
include/config_distro_bootcmd.h +10 -5
index 5c469a23fa..f567cebd38 100644
@@ -71,10 +71,15 @@
 #ifdef CONFIG_CMD_UBIFS
 #define BOOTENV_SHARED_UBIFS \
 	"ubifs_boot=" \
-		"if ubi part UBI && ubifsmount ubi${devnum}:boot; then "  \
-			"setenv devtype ubi; "                            \
-			"setenv bootpart 0; "                             \
-			"run scan_dev_for_boot; "                         \
+		"env exists bootubipart || " \
+			"env set bootubipart UBI; " \
+		"env exists bootubivol || " \
+			"env set bootubivol boot; " \
+		"if ubi part ${bootubipart} && " \
+			"ubifsmount ubi${devnum}:${bootubivol}; " \
+		"then " \
+			"setenv devtype ubi; " \
+			"run scan_dev_for_boot; " \
 		"fi\0"
 #define BOOTENV_DEV_UBIFS	BOOTENV_DEV_BLKDEV
 #define BOOTENV_DEV_NAME_UBIFS	BOOTENV_DEV_NAME_BLKDEV
@@ -125,7 +130,7 @@
 			"${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; "      \
 		"if fdt addr ${fdt_addr_r}; then "                        \
 			"bootefi ${kernel_addr_r} ${fdt_addr_r};"         \
-		"else "                                                    \
+		"else "                                                   \
 			"bootefi ${kernel_addr_r} ${fdtcontroladdr};"     \
 		"fi\0"                                                    \
 	\
Signature · 1 line
2.16.0
#2 lore raw

PATCH 1/2 distro bootcmd: Allow board defined UBI partition and volume names

Quoted 11 lines · Derald D. Woods

This commit allows overriding the default assumption that the boot UBI MTD partition is named 'UBI' and the UBI volume is 'boot'. A board desiring to use a legacy or alternative NAND layout can now define the following two extra environment variables:

bootubipart=<some_ubi_partition_name>
bootubivol=<some_ubi_volume_name>

EXAMPLE:

[include/configs/some_board.h]

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180128/bfa80b85/attachment.sig>
#3 lore raw

PATCH 2/2 ARM: omap3: evm: Fix distro bootcmd UBIFS and MMC support

In reply to Derald D. Woods

The omap3_evm board does not boot when commit:
a47ca2cf67 ("ARM: omap3: evm: Add kernel image loading from UBIFS and EXT4")
is applied after commit:

    3dde8f2037 ("Merge git://git.denx.de/u-boot-mmc")

This commit reduces the CONFIG_EXTRA_ENV_SETTINGS size and better leverages the existing distro bootcmd infrastructure.

- Use updated UBIFS support from config_distro_bootcmd.h
- Use LEGACY_MMC naming found in am335x_evm.h and ti_omap4_common.h
- Remove extra environment content that is no longer needed

[MMC(0:1)/extlinux/extlinux.conf] ---8<------------------------------------------------------------------- default omap3-evm-mmc-fat
label omap3-evm-mmc-fat
kernel /zImage
fdt /omap3-evm.dtb
append console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait
---8<-------------------------------------------------------------------

[MMC(0:2)/boot/extlinux/extlinux.conf] ---8<------------------------------------------------------------------- default omap3-evm-mmc-ext4
label omap3-evm-mmc-ext4
kernel /boot/zImage
fdt /boot/omap3-evm.dtb
append console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait
---8<-------------------------------------------------------------------

[NAND(ubi0:rootfs)/boot/extlinux/extlinux.conf] ---8<-------------------------------------------------------------------
default omap3-evm-nand-ubifs
label omap3-evm-nand-ubifs
kernel /boot/zImage
fdt /boot/omap3-evm.dtb
append console=ttyO0,115200n8 root=ubi0:rootfs rw ubi.mtd=rootfs noinitrd rootfstype=ubifs rootwait
---8<-------------------------------------------------------------------

Fixes a47ca2cf67 ("ARM: omap3: evm: Add kernel image loading from UBIFS and EXT4")
---
 include/configs/omap3_evm.h | 80 ++++++++++++++-------------------------------
 1 file changed, 25 insertions(+), 55 deletions(-)
include/configs/omap3_evm.h +25 -55
index 3ecfdbb3ce..c329d97528 100644
@@ -89,43 +89,24 @@
 #define MEM_LAYOUT_ENV_SETTINGS \
 	DEFAULT_LINUX_BOOT_ENV
 
-#if defined(CONFIG_NAND) && defined(CONFIG_CMD_UBI)
-/* NAND boot with uImage from NAND 'kernel' partition */
 #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
 	"bootcmd_" #devtypel #instance "=" \
 	"run nandboot\0"
 #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
 	#devtypel #instance " "
 
-/* NAND boot with zImage from UBIFS '/boot/zImage' */
-#define BOOTENV_DEV_UBIFS_NAND(devtypeu, devtypel, instance) \
+#define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
 	"bootcmd_" #devtypel #instance "=" \
-	"run nandbootubifs\0"
-#define BOOTENV_DEV_NAME_UBIFS_NAND(devtypeu, devtypel, instance) \
-	#devtypel #instance " "
-#endif /* CONFIG_NAND && CONFIG_CMD_UBI */
-
-/* MMC boot with uImage from MMC 0:2 '/boot/uImage' */
-#define BOOTENV_DEV_UIMAGE_MMC(devtypeu, devtypel, instance) \
-	"bootcmd_" #devtypel #instance "=" \
-		"setenv mmcdev " #instance"; " \
-		"run mmcboot\0"
-#define BOOTENV_DEV_NAME_UIMAGE_MMC(devtypeu, devtypel, instance) \
-	#devtypel #instance " "
-
-/* MMC boot with zImage from MMC 0:2 '/boot/zImage' */
-#define BOOTENV_DEV_ZIMAGE_MMC(devtypeu, devtypel, instance) \
-	"bootcmd_" #devtypel #instance "=" \
-		"setenv mmcdev " #instance"; " \
-		"run mmcbootz\0"
-#define BOOTENV_DEV_NAME_ZIMAGE_MMC(devtypeu, devtypel, instance) \
+	"setenv mmcdev " #instance "; " \
+	"setenv bootpart " #instance ":${mmcpart} ; " \
+	"run mmcboot\0"
+#define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
 	#devtypel #instance " "
 
 #define BOOT_TARGET_DEVICES(func) \
 	func(MMC, mmc, 0) \
-	func(ZIMAGE_MMC, zimage_mmc, 0) \
-	func(UIMAGE_MMC, uimage_mmc, 0) \
-	func(UBIFS_NAND, ubifs_nand, 0) \
+	func(LEGACY_MMC, legacy_mmc, 0) \
+	func(UBIFS, ubifs, 0) \
 	func(NAND, nand, 0)
 
 #include <config_distro_bootcmd.h>
@@ -138,9 +119,13 @@
 	"fdt_high=0xffffffff\0" \
 	"bootdir=/boot\0" \
 	"bootenv=uEnv.txt\0" \
+	"bootfile=zImage\0" \
+	"bootubivol=rootfs\0" \
+	"bootubipart=rootfs\0" \
 	"optargs=\0" \
 	"mmcdev=0\0" \
 	"mmcpart=2\0" \
+	"bootpart=${mmcdev}:${mmcpart}\0" \
 	"console=ttyO0,115200n8\0" \
 	"mmcargs=setenv bootargs console=${console} " \
 		"${mtdparts} " \
@@ -153,7 +138,7 @@
 		"root=ubi0:rootfs rw ubi.mtd=rootfs noinitrd " \
 		"rootfstype=ubifs rootwait\0" \
 	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
-	"ext4bootenv=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootdir}/${bootenv}\0" \
+	"ext4bootenv=ext4load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootenv}\0" \
 	"importbootenv=echo Importing environment from mmc ...; " \
 		"env import -t ${loadaddr} ${filesize}\0" \
 	"mmcbootenv=mmc dev ${mmcdev}; " \
@@ -165,39 +150,24 @@
 				"run uenvcmd; " \
 			"fi; " \
 		"fi\0" \
-	"loaduimage=setenv bootfile uImage; " \
-		"ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
-	"loadzimage=setenv bootfile zImage; " \
-		"ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
-	"loaddtb=ext4load mmc ${mmcdev}:${mmcpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
-	"loadubizimage=setenv bootfile zImage; " \
-		"ubifsload ${loadaddr} ${bootdir}/${bootfile}\0" \
-	"loadubidtb=ubifsload ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"loadimage=ext4load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+	"loaddtb=ext4load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
 	"mmcboot=run mmcbootenv; " \
-		"if run loaduimage && run loaddtb; then " \
-			"echo Booting ${bootdir}/${bootfile} from mmc ${mmcdev}:${mmcpart} ...; " \
+		"if run loadimage && run loaddtb; then " \
+			"echo Booting ${bootdir}/${bootfile} from mmc ${bootpart} ...; " \
 			"run mmcargs; " \
-			"bootm ${loadaddr} - ${fdtaddr}; " \
-		"fi\0" \
-	"mmcbootz=run mmcbootenv; " \
-		"if run loadzimage && run loaddtb; then " \
-			"echo Booting ${bootdir}/${bootfile} from mmc ${mmcdev}:${mmcpart} ...; " \
-			"run mmcargs; " \
-			"bootz ${loadaddr} - ${fdtaddr}; " \
+			"if test ${bootfile} = uImage; then " \
+				"bootm ${loadaddr} - ${fdtaddr}; " \
+			"fi; " \
+			"if test ${bootfile} = zImage; then " \
+				"bootz ${loadaddr} - ${fdtaddr}; " \
+			"fi; " \
 		"fi\0" \
 	"nandboot=" \
-		"nand read ${loadaddr} kernel; " \
-		"nand read ${fdtaddr} dtb; " \
-		"echo Booting uImage from NAND MTD 'kernel' partition ...; " \
-		"run nandargs; " \
-		"bootm ${loadaddr} - ${fdtaddr}\0" \
-	"nandbootubifs=" \
-		"ubi part rootfs; " \
-		"ubifsmount ubi0:rootfs; " \
-		"if run loadubizimage && run loadubidtb; then " \
-			"echo Booting ${bootdir}/${bootfile} from NAND ubi0:rootfs ...; " \
+		"if nand read ${loadaddr} kernel && nand read ${fdtaddr} dtb; then " \
+			"echo Booting uImage from NAND MTD 'kernel' partition ...; " \
 			"run nandargs; " \
-			"bootz ${loadaddr} - ${fdtaddr}; " \
+			"bootm ${loadaddr} - ${fdtaddr}; " \
 		"fi\0" \
 	BOOTENV
 
Signature · 1 line
2.16.0
#4 lore raw

PATCH 2/2 ARM: omap3: evm: Fix distro bootcmd UBIFS and MMC support

Quoted 5 lines · Derald D. Woods

The omap3_evm board does not boot when commit:
a47ca2cf67 ("ARM: omap3: evm: Add kernel image loading from UBIFS and EXT4")
is applied after commit:

    3dde8f2037 ("Merge git://git.denx.de/u-boot-mmc")
Quoted 8 lines

This commit reduces the CONFIG_EXTRA_ENV_SETTINGS size and better leverages the existing distro bootcmd infrastructure.

- Use updated UBIFS support from config_distro_bootcmd.h
- Use LEGACY_MMC naming found in am335x_evm.h and ti_omap4_common.h
- Remove extra environment content that is no longer needed

[MMC(0:1)/extlinux/extlinux.conf]

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180128/668b4f1c/attachment.sig>