Commit 6e1364fe4558f248222a0223e06fd0e73e72bf0a

Authored by Derald D. Woods
Committed by Tom Rini
1 parent af2f44267f

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<-------------------------------------------------------------------

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>

Showing 1 changed file with 10 additions and 5 deletions Side-by-side Diff

include/config_distro_bootcmd.h
... ... @@ -71,10 +71,15 @@
71 71 #ifdef CONFIG_CMD_UBIFS
72 72 #define BOOTENV_SHARED_UBIFS \
73 73 "ubifs_boot=" \
74   - "if ubi part UBI && ubifsmount ubi${devnum}:boot; then " \
75   - "setenv devtype ubi; " \
76   - "setenv bootpart 0; " \
77   - "run scan_dev_for_boot; " \
  74 + "env exists bootubipart || " \
  75 + "env set bootubipart UBI; " \
  76 + "env exists bootubivol || " \
  77 + "env set bootubivol boot; " \
  78 + "if ubi part ${bootubipart} && " \
  79 + "ubifsmount ubi${devnum}:${bootubivol}; " \
  80 + "then " \
  81 + "setenv devtype ubi; " \
  82 + "run scan_dev_for_boot; " \
78 83 "fi\0"
79 84 #define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV
80 85 #define BOOTENV_DEV_NAME_UBIFS BOOTENV_DEV_NAME_BLKDEV
... ... @@ -125,7 +130,7 @@
125 130 "${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \
126 131 "if fdt addr ${fdt_addr_r}; then " \
127 132 "bootefi ${kernel_addr_r} ${fdt_addr_r};" \
128   - "else " \
  133 + "else " \
129 134 "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
130 135 "fi\0" \
131 136 \