[LEDE-DEV] Nand flash partitions

Daniel Golle daniel at makrotopia.org
Sun Jun 12 08:27:52 PDT 2016


Hi Hauke,

On Sun, Jun 12, 2016 at 03:23:58PM +0200, Hauke Mehrtens wrote:
> Hi Daniel,
> 
> I work on creating an OpenWrt image which I can just flash over an UGW
> (Lantiq's/Intel's OpenWrt distribution) distribution with the normal
> U-Boot. Then you do not have to touch the bootloader or the flash layout
> and can just run OpenWrt. UGW is mostly focused on NAND flash based
> devices. The partition layout for one device is shown in [0], the size
> of the system_sw partition differs depending on the nand flash size and
> contains an UBI layer. A partition ending with A or B means there are
> two versions and when we upgrade only one is replaced and the other is
> used for a backup. U-Boot says which partition to use with some kernel
> command line parameters.

I guess we got to consider that as given conditions not subject to
discussions (eg. whether it wouldn't be nicer to pass such things
by the bootloader patching the device-tree like it does to pass
the mac address of embedded ethernet interfaces).

> 
> The UBI layer contains a kernelA, kernelB, rootfsA, rootfsB, firmwareA,
> firmwareB and data_vol partition.
> 
> Can I change your UBI patches in a way that they accept a name for the
> rootfs partition from the kernel command line? Are you planing to
> upstream them or can I try?

Of course, that's why I do Free Software, so everyone can reuse and
remix everything :)
Also, feel free to suggest whatever you believe is suitable for
inclusion upstream.

With regard to the UBI patches in OpenWrt my approach was quite
idealistic when assuming that U-Boot on recent platforms will come with
modern features like device-tree and FIT enabled, store it's
environment redundantly in UBI volumes, ...
However, as my goal was to revive some ox820 based NAS devices and I
was willing to chain-load my own U-Boot I could then use all those
great and useful features (and that was back in 2013).
Recently the slightly older Oxford OX810SE has been included in Linus'
git tree, see

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=84316f4ef141cfee1e8ccd1b5749998eba2496ee

I'm thus planning to re-base the remaining parts needed for the OX820
on that once it has been completed. I reckon any upstreaming of rootfs-
auto-mount hackery will from my side only happen afterwards.

I kinda wonder why you need to have an additional cmdline parameter as
you can just use ubiblock=... and rootfs=... to explicitely specifify
the rootfs which will then not be chosen automatically, see

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#l27

To use data_vol in addition to rootfs_data is unrelated to UBI, see

https://git.lede-project.org/?p=project/fstools.git;a=blob;f=mount_root.c;h=6e06b45806e5e05ae660f7692a6a1585bd220ef4;hb=HEAD#l34

and all that requires some work for sysupgrade, but that you are surely
aware of...

I'm looking forward to your patches. Generally, I'd be glad if you
create new patches on top when it comes to cmdline-related stuff,
as I believe that there are many ways to achieve that and using the
kernel cmdline is just one of many options...
I already sent the ubifs-related part upstream long ago, see

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/ubifs?id=90bea5a3f0bf680b87b90516f3c231997f4b8f3b

This was in order to allow probing whether rootfs is a single
read-write UBIFS volume in

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


Cheers

Daniel


> 
> Hauke
> 
> 
> [0] UGW partition setup:
> 
> partition at 0 {
> 	label = "uboot";
> 	reg = <0x00000 0x100000>; /* 1024 KB */
> };
> 
> partition at 100000 {
> 	label = "uboot_env";
> 	reg = <0x100000 0x40000>; /* 256 KB */
> };
> 
> partition at 140000 {
> 	label = "ubootconfigB";
> 	reg = <0x140000 0x40000>; /* 256 KB */
> };
> 
> partition at 180000 {
> 	label = "gphyfirmware";
> 	reg = <0x180000 0x40000>; /* 256 KB */
> };
> 
> partition at 1c0000 {
> 	label = "system_sw";
> 	reg = <0x1c0000 0xc800000>;
> };
> 
> partition at c9c0000 {
> 	label = "calibration";
> 	reg = <0xc9c0000 0x100000>;
> };
> 
> partition at cac0000 {
> 	label = "res";
> 	reg = <0xcac0000 0x13540000>;
> };



More information about the Lede-dev mailing list