andrewz1 Posted December 7, 2016 Posted December 7, 2016 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
hararmbian Posted December 15, 2016 Posted December 15, 2016 So, with this patch I can boot the latest u-boot using legacy kernel 3.4.x ? If it is, then it's the one that I've been searching all along. Will try it if I have a chance...and post the result.
andrewz1 Posted January 7, 2017 Author Posted January 7, 2017 So, with this patch I can boot the latest u-boot using legacy kernel 3.4.x ? Yes, I tested with latest u-boot on Cubieboard-1 and Cubietruck (A20). Two my cubietruck boards have bad flash chips, but I replaced it by another one from old USB flash dongle. After this all works fine.
Recommended Posts