]> git.sur5r.net Git - u-boot/commitdiff
distro bootcmd: Allow board defined UBI partition and volume names
authorDerald D. Woods <woods.technical@gmail.com>
Sun, 21 Jan 2018 03:16:13 +0000 (21:16 -0600)
committerTom Rini <trini@konsulko.com>
Sun, 28 Jan 2018 17:27:29 +0000 (12:27 -0500)
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>
include/config_distro_bootcmd.h

index 5c469a23fa7098f8fb998f79566ac6524c0a52df..f567cebd381082bc4945d21f68f369bf62646c47 100644 (file)
 #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
                        "${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"                                                    \
        \