[U-Boot] [PATCH 4/5] ARM: IGEP0033: Add support to boot from NAND.

Javier Martinez Canillas javier at dowhile0.org
Wed Aug 7 18:03:47 CEST 2013


On Thu, Jul 25, 2013 at 9:27 AM, Enric Balletbo i Serra
<eballetbo at gmail.com> wrote:
> From: Enric Balletbo i Serra <eballetbo at iseebcn.com>
>
> Add to the default environment the possibily to boot from NAND using
> a ubi rootfs. Also the partition scheme is set as follows:
>
>                   Start      Size
>     SPL         : 0x00000000 0x00080000 (512KiB)
>     U-Boot      : 0x00080000 0x00100000 (1MiB)
>     U-Boot Env  : 0x00180000 0x00020000 (128KiB)
>     File System : 0x001C0000 -
>
> The ubiboot script gets the kernel and the dtb file from the boot directory
> of the File System.
>
> Signed-off-by: Enric Balletbo i Serra <eballetbo at iseebcn.com>
> ---
>  include/configs/igep0033.h | 32 +++++++++++++++++++++++++++-----
>  1 file changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/include/configs/igep0033.h b/include/configs/igep0033.h
> index be210a5..3d08cfa 100644
> --- a/include/configs/igep0033.h
> +++ b/include/configs/igep0033.h
> @@ -62,6 +62,10 @@
>  #define CONFIG_CMD_UBI
>  #define CONFIG_CMD_UBIFS
>
> +/* Make the verbose messages from UBI stop printing */
> +#define CONFIG_UBI_SILENCE_MSG
> +#define CONFIG_UBIFS_SILENCE_MSG
> +
>  #define CONFIG_BOOTDELAY               1       /* negative for no autoboot */
>  #define CONFIG_ENV_VARS_UBOOT_CONFIG
>  #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> @@ -72,21 +76,34 @@
>         "bootfile=zImage\0" \
>         "dtbfile=am335x-base0033.dtb\0" \
>         "console=ttyO0,115200n8\0" \
> +       "mtdids=" MTDIDS_DEFAULT "\0" \
> +       "mtdparts=" MTDPARTS_DEFAULT "\0" \
>         "mmcdev=0\0" \
>         "mmcroot=/dev/mmcblk0p2 rw\0" \
> +       "ubiroot=ubi0:filesystem rw ubi.mtd=3,2048\0" \
>         "mmcrootfstype=ext4 rootwait\0" \
> +       "ubirootfstype=ubifs rootwait\0" \
>         "mmcargs=setenv bootargs console=${console} " \
>                 "root=${mmcroot} " \
>                 "rootfstype=${mmcrootfstype}\0" \
> +       "ubiargs=setenv bootargs console=${console} " \
> +               "root=${ubiroot} " \
> +               "rootfstype=${ubirootfstype}\0" \
>         "bootenv=uEnv.txt\0" \
>         "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
>         "importbootenv=echo Importing environment from mmc ...; " \
>                 "env import -t ${loadaddr} ${filesize}\0" \
>         "mmcload=load mmc ${mmcdev}:2 ${loadaddr} ${bootdir}/${bootfile}; " \
>                 "load mmc ${mmcdev}:2 ${dtbaddr} ${bootdir}/${dtbfile}\0" \
> +       "ubiload=ubi part filesystem 2048; ubifsmount ubi0; " \
> +               "ubifsload ${loadaddr} ${bootdir}/${bootfile}; " \
> +               "ubifsload ${dtbaddr} ${bootdir}/${dtbfile} \0" \
>         "mmcboot=echo Booting from mmc ...; " \
>                 "run mmcargs; " \
>                 "bootz ${loadaddr} - ${dtbaddr}\0" \
> +       "ubiboot=echo Booting from nand (ubifs) ...; " \
> +               "run ubiargs; run ubiload; " \
> +               "bootz ${loadaddr} - ${dtbaddr}\0" \
>
>  #define CONFIG_BOOTCOMMAND \
>         "mmc dev ${mmcdev}; if mmc rescan; then " \
> @@ -102,6 +119,8 @@
>                 "if run mmcload; then " \
>                         "run mmcboot;" \
>                 "fi;" \
> +       "else " \
> +               "run ubiboot;" \
>         "fi;" \
>
>  /* Max number of command args */
> @@ -181,18 +200,21 @@
>  #define CONFIG_SYS_MAX_NAND_DEVICE     1
>  #define CONFIG_SYS_NAND_ONFI_DETECTION 1
>  #define CONFIG_SYS_ENV_SECT_SIZE       (128 << 10)     /* 128 KiB */
> +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
>  #define CONFIG_ENV_IS_IN_NAND
> -#define CONFIG_ENV_OFFSET              0x260000 /* environment starts here */
> +#define CONFIG_ENV_OFFSET              0x180000 /* environment starts here */
> +#define CONFIG_ENV_ADDR_REDUND         (CONFIG_ENV_OFFSET + CONFIG_SYS_ENV_SECT_SIZE)
> +#define CONFIG_ENV_SIZE_REDUND         (CONFIG_ENV_SIZE)
>
>  #define CONFIG_MTD_PARTITIONS
>  #define CONFIG_MTD_DEVICE
>  #define CONFIG_RBTREE
>  #define CONFIG_LZO
>
> -#define MTDIDS_DEFAULT                 "nand0=nand"
> -#define MTDPARTS_DEFAULT               "mtdparts=nand:512k(SPL),"\
> -                                       "1m(U-Boot),128k(U-Boot Env),"\
> -                                       "5m(Kernel),-(File System)"
> +#define MTDIDS_DEFAULT                 "nand0=omap2-nand.0"
> +#define MTDPARTS_DEFAULT               "mtdparts=omap2-nand.0:512k(spl),"\
> +                                       "1m(uboot),256k(environment),"\
> +                                       "-(filesystem)"
>
>  /* Unsupported features */
>  #undef CONFIG_USE_IRQ
> --
> 1.8.1.2
>

Reviewed-by: Javier Martinez Canillas <javier at dowhile0.org>


More information about the U-Boot mailing list