Boot U-Boot from UBI volume
- Boot U-Boot from UBI volume
- Wolfgang Denk <email@example.com>
For reliable booting from NAND flash, it would be desirable if already the boot loader was protected by wear-leveling mechanisms such as available by latest UBI technology.
However, for most SoCs, the ROM boot loader (IPL - Initial Program Loader) and/or available on-chip memory limit loading from NAND to some 4...30 kB, which is enough for a small boot loader (SPL -Secondary Program Loader), but not enough for a standard UBI implementation.
To work around this, we suggest to use a 3 stage boot loader setup:
- 1st Stage: U-Boot SPL (small: fits in 4...30 KiB restrictions)
- 2nd Stage: limited U-Boot (TPL) with UBI support (medium sized: fits together with the SPL in the first NAND block, which is guaranteed to be defect-free. On tyical 2 KiB page NAND devices we have a block size of 128 kB, which allows for ~ 100 KiB for the TPL)
- 3rd Stage: Full-blown U-Boot loaded from UBI volume (or other payload)
By placing both the SPL and the TPL (Tertiary Program Loader) in the first NAND block, we can reliably load the "real" paylod from an UBI volume.
As in recent versions of U-Boot it will be possible to dynamically switch between loading U-Boot or other image(s) (for example, a Linux kernel and a device tree blob) as third stage, thus providing fast and reliable boot into application mode, while still providing the flexibility and powerful features of standard U-Boot for service and maintenance.
As part of this project, the UBI/UBIFS code base in U-Boot should be updated: the UBI code in U-Boot is based on the Linux v2.6.26 (July 2008), and the UBIFS code is based on the Linux v2.6.28 (December 2008). Many fixes and feature-enhancements have been added since that are important for improved reliability.
- 1) Port latest Linux UBI & UBIFS code to U-Boot, test on NAND and NOR platforms, at least ARM and PowerPC ----> 7...9 man-days
- 2) Implement and test 3-stage boot strategy with U-Boot in UBI volume support on ARM based target ----> 3...5 man-days
- Total: ~12 man-days.
Stefan Roese (acting UBI custodian for U-Boot)
In theory part 1 could be omitted, but when asking to boot from a UBI volume, you are concerned about reliability - in which case you will also want to have the fixes and enhancements of the UBI/UBIFS code of the last 3 years.