Hi
This is my patches for using NAND + UBI + UBIFS with legacy kernel and latest u-boot
Tested on Cubieboard-1 and Cubietruck.
U-Boot:
- read-only support for now - i.e. all write/erase ops are locked
Kernel:
- pooling events - need to convert to interrupts+completions
ToDo:
- make led support
NAND layout - driver will create two MTD partitions:
mtd0 - with name "SPL" - 1024K rounded up to eraseblock size.
mtd1 - with name "UBI" - all other space excluding last 4 erseblocks - for bad block table.
For using with u-boot need to create ubi volume named "boot" with id=0. This volume must contain /boot/* files.
For other files I use in tests all free space with volume name "root" and id=1 but this is not critical.
I used this as module and include in ramdisk - add to /etc/initramfs-tools/modules next lines:
sunxi_nand
ubi mtd=1 <- this is which mtd attach at boot
ubifs
In /boot/boot.cmd should be changed:
in bootargs: root=ubi0:root rootwait rootfstype=ubifs
boot images:
ubifsload ${fdt_addr_r} script.bin
ubifsload ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
ubifsload ${kernel_addr_r} zImage
in /etc/fstab
ubi0:root / ubifs defaults,noatime 0 0
ubi0:boot /boot ubifs defaults,noatime 0 0
Kernel configuration:
CONFIG_MTD=m
CONFIG_MTD_CHAR=m
CONFIG_MTD_NAND_IDS=m
CONFIG_MTD_NAND_ECC=m
CONFIG_MTD_NAND=m
CONFIG_MTD_NAND_SUNXI_NAND=m
CONFIG_MTD_UBI=m
CONFIG_MTD_UBI_WL_THRESHOLD=256 <- for MLC NAND
CONFIG_MTD_UBI_BEB_RESERVE=1
In U-Boot config only need to set
CONFIG_NAND_SUNXI_ALT=y
All other things (MTD, UBI, UBIFS) will be included automatically.
PS Sorry for my English
kernel-nand.patch.gz
uboot-nand.patch.gz