Hi Hauke, On Sun, May 08, 2016 at 11:22:13PM +0200, Hauke Mehrtens wrote: > Hi John, > > How does the Lantiq NAND sysupgrade stuff work?
I don't have much insight on Lantiq specifically, but I can tell you a bit about how John and I have integrated UBI support starting from OpenWrt SVN r41121... > > I see there are sysupgrade packages with a squasfs and a ubifs root file > system. Are both file systems still supported and needed? I see that > other targets only have a squasfs support. Both, ubifs (rw) and squashfs (ro+overlay) should work and are supported and selection of the root filesystem works automagically: - auto-attach UBI MTD device on boot: https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/patches-4.4/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch;h=8494064eb1e9ca0d47bc1a90d76a030f36cc7c7f;hb=HEADhttps://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/patches-4.4/490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch;h=8494064eb1e9ca0d47bc1a90d76a030f36cc7c7f;hb=HEAD - create ubiblock for squashfs and set ROOT_DEV: https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/patches-4.4/491-ubi-auto-create-ubiblock-device-for-rootfs.patch;h=da3111266a60e80cc01c0099a597e7299ba216fe;hb=HEAD https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/patches-4.4/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch;h=f55e8e3a4d12f3883de8f6805051ba7a97f688d6;hb=HEAD - try mounting ubifs rootfs on boot: https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/generic/patches-4.4/492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch;h=d21e6d21cefa11a966f8a249283162529d4cd7c9;hb=HEAD Well, NAND support on oxnas works pretty much the same as on lantiq. Unfortunately, the image generation code has still not been completely migrated to the new framework, especially on targets which were somehow using UBI in some way before we added sysupgrade support. So currently, there is a misconception that UBI and UBIFS are the same thing and some code existed before introducing https://git.lede-project.org/?p=source.git;a=blob;f=scripts/ubinize-image.sh;h=b87cbb48dc8cc004d754e3b9c8001beb5f111393;hb=HEAD and using it here https://git.lede-project.org/?p=source.git;a=blob;f=include/image.mk;h=9e342e0a42a793d73264d6a7e4fe464fdbe591ce;hb=HEAD#l194 However, somehow generating ubifs images still depends on the old-style using a static ubinize.cfg instead of ubinize-image.sh, so changing that is all needed to also get ubifs-rootfs images to be built for those targets which never used a static ubinize.cfg. > Do the devices with NAND flash all use UBI by default in the vendor > firmware or how is that initialized? No. Some use jffs2-nand, some use yaffs, some use UBI in some way or another. Some store the kernel (which may or may not include the read-only rootfs) directly on NAND, supposedly due to the lack of UBI support in their bootloader. Others even use a jffs2-nand filesystem to store their kernel and initramfs. Again others are using a seperate ubi partition with only a single ubifs filesystem which is used like the /boot partition on desktop systems... As NAND devices usually offer more space than needed, a whole jungle of built-in rescue-systems, dual-boot solutions and such has grown which makes things yet a bit harder to deal with. In the worst-cases, the only way is to first flash an image with initegrated initramfs in the vendors format and then use that to flash the final system using ubiformat and in some cases also make changes to the bootloader environment. As there usually is enough space, I like keeping that 'rescue' kernel+initramfs system on the flash and change the bootloader so it would fall-back on that in case *loading* the kernel from UBI fails, see: https://git.lede-project.org/?p=source.git;a=blob;f=package/boot/uboot-oxnas/files/include/configs/ox820.h;h=85ee3b4cd511d74bc50bb4abf22412a8f06b1a6b;hb=HEAD#l228 Some people reported successfully flashing an ubinized image via nandwrite, I'm not sure whether this is as reliable as using ubiformat. > > Is it needed to run padjffs2 on the squasfs root file system of the NAND No. Cheers Daniel _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev