[U-Boot] [PATCHv7 6/7] igep00x0: UBIize

Enric Balletbo Serra
2016-01-25T07:26:23Z

Hi,

2016-01-25 7:39 GMT+01:00 Heiko Schocher <hs@denx.de>:
> Hello Enric, Ladislav,
>
> Am 22.01.2016 um 23:35 schrieb Enric Balletbo Serra:
>>
>> Hi Ladis,
>>
>> Many thanks for your work on this, see some comments below ...
>
>
> Sorry, pull request is sent with this patch, see:
>
> http://lists.denx.de/pipermail/u-boot/2016-January/239855.html
>
> @Ladislav: Please send changes in a follow up patch, thanks!
>
>
>
>> 2016-01-21 7:07 GMT+01:00 Heiko Schocher <hs@denx.de>:
>>>
>>> Hello Ladislav,
>>>
>>> Am 17.01.2016 um 04:16 schrieb Ladislav Michl:
>>>>
>>>>
>>>> Convert IGEP board to use UBI volumes for U-Boot, its environment and
>>>> kernel. With exception of first four sectors read by SoC boot
>>>> ROM whole NAND is UBI managed. As code is too big now, drop
>>>> CONFIG_SPL_EXT_SUPPORT to make it fit.
>>>>
>>>> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
>>>> ---
>>>> include/configs/omap3_igep00x0.h | 80
>>>> ++++++++++++++++++++++------------------
>>>> 1 file changed, 45 insertions(+), 35 deletions(-)
>>>
>>>
>>>
>>> Reviewed-by: Heiko Schocher <hs@denx.de>
>>>
>>> bye,
>>> Heiko
>>>
>>>>
>>>> diff --git a/include/configs/omap3_igep00x0.h
>>>> b/include/configs/omap3_igep00x0.h
>>>> index 5da6cfd..9afbcbe 100644
>>>> --- a/include/configs/omap3_igep00x0.h
>>>> +++ b/include/configs/omap3_igep00x0.h
>>>> @@ -74,6 +74,8 @@
>>>> #define CONFIG_CMD_CACHE
>>>> #ifdef CONFIG_BOOT_ONENAND
>>>> #define CONFIG_CMD_ONENAND /* ONENAND support */
>>>> +#else
>>>> +#define CONFIG_CMD_UBI
>>>> #endif
>>>> #define CONFIG_CMD_DHCP
>>>> #define CONFIG_CMD_PING
>>>> @@ -86,6 +88,10 @@
>>>> "stdout=serial\0" \
>>>> "stderr=serial\0"
>>>>
>>>> +#define ENV_MTD_SETTINGS \
>>>> + "mtdids=nand0=gpmc-nand.0\0" \
>>>> + "mtdparts=mtdparts=gpmc-nand.0:512k(SPL),-(UBI)\0"
>>>> +
>>
>>
>> I think this should be protected by CONFIG_BOOT_NAND, if is defined
>> CONFIG_BOOT_ONENAND the ENV_MTD_SETTINGS are wrong.
>
>
> Good point ...
>
>> Also, as we're changing the memory map, I'd like to change the
>> reserved space for SPL to 2M instead of 512k, so we cover all NAND
>> block sizes from (64KB to 512KB)
>
>
> I do not understand this, but I have no details about the hw ...
>

The ROM boot on OMAP reads the first 4 blocks searching for the SPL,
in production is a practice flash the SPL 4 times. OneNAND/NAND
devices can have different block sizes and the OMAP ROM boot supports
block sizes from 64KB to 512K. For IGEP boards in particular, at least
there are boards that have block size of 128K and 256K. What I would
meant here is set as default the mtdparts variable to reserve 2M for
SPL, just to cover all the cases.

mtdparts=mtdparts=gpmc-nand.0:2m(SPL),-(UBI)\0

>
>>>> #define MEM_LAYOUT_SETTINGS \
>>>> DEFAULT_LINUX_BOOT_ENV \
>>>> "scriptaddr=0x87E00000\0" \
>>>> @@ -96,36 +102,15 @@
>>>>
>>>> #include <config_distro_bootcmd.h>
>>>>
>>>> -
>>>> #define CONFIG_EXTRA_ENV_SETTINGS \
>>>> ENV_DEVICE_SETTINGS \
>>>> + ENV_MTD_SETTINGS \
>>>> MEM_LAYOUT_SETTINGS \
>>>> BOOTENV
>>>>
>>>> #endif
>>>>
>>>> /*
>>>> - * FLASH and environment organization
>>>> - */
>>>> -
>>>> -#ifdef CONFIG_BOOT_ONENAND
>>>> -#define CONFIG_SYS_ONENAND_BASE ONENAND_MAP
>>>> -
>>>> -#define ONENAND_ENV_OFFSET 0x260000 /* environment starts
>>>> here */
>>>> -
>>>> -#define CONFIG_ENV_IS_IN_ONENAND 1
>>>> -#define CONFIG_ENV_SIZE (512 << 10) /* Total
>>>> Size
>>>> Environment */
>>>> -#define CONFIG_ENV_ADDR ONENAND_ENV_OFFSET
>>>> -#endif
>>>> -
>>>> -#ifdef CONFIG_NAND
>>>> -#define CONFIG_ENV_OFFSET 0x260000 /* environment starts
>>>> here */
>>>> -#define CONFIG_ENV_IS_IN_NAND 1
>>>> -#define CONFIG_ENV_SIZE (512 << 10) /* Total
>>>> Size
>>>> Environment */
>>>> -#define CONFIG_ENV_ADDR NAND_ENV_OFFSET
>>>> -#endif
>>>> -
>>>> -/*
>>>> * SMSC911x Ethernet
>>>> */
>>>> #if defined(CONFIG_CMD_NET)
>>>> @@ -134,19 +119,50 @@
>>>> #define CONFIG_SMC911X_BASE 0x2C000000
>>>> #endif /* (CONFIG_CMD_NET) */
>>>>
>>>> +/*
>>>> + * FLASH and environment organization
>>>> + */
>>>> +#ifdef CONFIG_NAND
>>>> +#define CONFIG_SPL_UBI 1
>>>> +#define CONFIG_SPL_UBI_MAX_VOL_LEBS 256
>>>> +#define CONFIG_SPL_UBI_MAX_PEB_SIZE (256*1024)
>>>> +#define CONFIG_SPL_UBI_MAX_PEBS 4096
>>>> +#define CONFIG_SPL_UBI_VOL_IDS 8
>>>> +#define CONFIG_SPL_UBI_LOAD_MONITOR_ID 0
>>>> +#define CONFIG_SPL_UBI_LOAD_KERNEL_ID 3
>>>> +#define CONFIG_SPL_UBI_LOAD_ARGS_ID 4
>>>> +#define CONFIG_SPL_UBI_PEB_OFFSET 4
>>>> +#define CONFIG_SPL_UBI_VID_OFFSET 512
>>>> +#define CONFIG_SPL_UBI_LEB_START 2048
>>>> +#define CONFIG_SPL_UBI_INFO_ADDR 0x88080000
>>>> +
>>>> +#define CONFIG_ENV_IS_IN_UBI 1
>>>> +#define CONFIG_ENV_UBI_PART "UBI"
>>>> +#define CONFIG_ENV_UBI_VOLUME "config"
>>>> +#define CONFIG_ENV_UBI_VOLUME_REDUND "config_r"
>>>> +#define CONFIG_UBI_SILENCE_MSG 1
>>>> +#define CONFIG_UBIFS_SILENCE_MSG 1
>>>> +#else
>>>> +#define CONFIG_ENV_IS_NOWHERE
>>>> +#endif
>>>> +#define CONFIG_ENV_SIZE (32*1024)
>>>> +
>>>> +#define CONFIG_RBTREE
>>>> +#define CONFIG_MTD_PARTITIONS
>>>> +#define MTDIDS_DEFAULT "nand0=gpmc-nand.0"
>>>> +#define MTDPARTS_DEFAULT
>>>> "mtdparts=gpmc-nand.0:512k(SPL),-(UBI)"
>>>> +
>>
>>
>> Same comment as above.
>>
>>>> /* OneNAND boot config */
>>>> #ifdef CONFIG_BOOT_ONENAND
>>>> #define CONFIG_SPL_ONENAND_SUPPORT
>>>> -#define CONFIG_SYS_ONENAND_U_BOOT_OFFS 0x80000
>>>> #define CONFIG_SYS_ONENAND_PAGE_SIZE 2048
>>>> -#define CONFIG_SPL_ONENAND_LOAD_ADDR 0x80000
>>>> -#define CONFIG_SPL_ONENAND_LOAD_SIZE \
>>>> - (512 * 1024 - CONFIG_SPL_ONENAND_LOAD_ADDR)
>>>> -
>>>> +#define CONFIG_SYS_ONENAND_BASE ONENAND_MAP
>>>> +#define CONFIG_SYS_ONENAND_U_BOOT_OFFS 0x80000
>>>> #endif
>>>>
>>>> /* NAND boot config */
>>>> #ifdef CONFIG_NAND
>>>> +#define CONFIG_SPL_NAND_SUPPORT
>>>> #define CONFIG_SYS_NAND_BUSWIDTH_16BIT
>>>> #define CONFIG_SYS_NAND_5_ADDR_CYCLE
>>>> #define CONFIG_SYS_NAND_PAGE_COUNT 64
>>>> @@ -166,14 +182,8 @@
>>>> #define CONFIG_NAND_OMAP_ECCSCHEME
>>>> OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
>>>> #define CONFIG_NAND_OMAP_GPMC
>>>> #define CONFIG_BCH
>>>> -
>>>> -#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
>>>> -/* NAND: SPL falcon mode configs */
>>>> -#ifdef CONFIG_SPL_OS_BOOT
>>>> -#define CONFIG_CMD_SPL_NAND_OFS 0x240000
>>>> -#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000
>>>> -#define CONFIG_CMD_SPL_WRITE_SIZE 0x2000
>>>> -#endif
>>>> #endif
>>>>
>>>> +#undef CONFIG_SPL_EXT_SUPPORT
>>>> +
>>>> #endif /* __IGEP00X0_H */
>>>>
>>>
>>
>> About the new layout you propose the following, right?
>>
>> volume 0 is u-boot.img, 1 and 2 env, 3 kernel, 4 FDT, 5 rootfs (ubifs)
>>
>> It's not possible load the kernel and the FDT from the rootfs directly,
>> right?
>
>
> That would be nice, but for this we need UBIFS support in SPL.
> Patches are welcome ;-)
>

Hehe, yes, I think the problem is fit the ubifs into the SPL size.

>> BTW, I created the 5 volumes and copied the files to every volume but
>> I get following errors, do you know what I am missing?
>>
>> U-Boot SPL 2016.01-00358-g4efe05f (Jan 22 2016 - 17:16:04)
>> Trying to boot from NAND
>> UBI warning: LEB 0 of 1 is missing
>> UBI warning: Failed to load volume 3
>> UBI warning: LEB 0 of 1 is missing
>> UBI warning: Failed to load volume 3
>> UBI warning: Failed
>> Loading Linux failed, falling back to U-Boot.
>> UBI warning: LEB 0 of 1 is missing
>> UBI warning: Failed to load volume 0
>> UBI warning: LEB 0 of 1 is missing
>> UBI warning: Failed to load volume 0
>> UBI warning: Failed
>> SPL: failed to boot from all boot devices
>> ### ERROR ### Please RESET the board ###
>>
>> Thanks,
>> Enric
>
>
> bye,
> Heiko
>
> --
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany