Autosplit of firmware partitions with UBI

Hi,
Should autosplitting work with root on UBI? I've got a build that works fine as long as I explicitly list the root partition in DTS and label it "ubi", but when I try to autosplit the entire "firmware" partition instead, it doesn't work.
And by any chance does "rootfstype" affect autosplit? I did notice that my kernel config has CONFIG_CMDLINE="rootfstype=squashfs,jffs2" and I am wondering if that needs to be rootfstype=squashfs,ubifs instead. I'm leaning towards that not being an issue, but would like to be sure.

thanks!

I made a build for my own device (ramips) and copying other's work (obviously) but I am not sure what made everything work.

Here ismy DTS file as well as the "mt7621.mk"

/dts-v1/;

#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/{
	compatible = "dlink,dir-853-a3", "mediatek,mt7621-soc";
	model = "D-Link DIR-853 A3";

	aliases {
		led-boot = &led_power_amber;
		led-failsafe = &led_power_amber;
		led-running = &led_power_blue;
		led-upgrade = &led_power_amber;
		label-mac-device = &gmac0;
	};

	chosen {
		bootargs = "console=ttyS0,57600";
	};

	leds {
		compatible = "gpio-leds";

		wlan1 {
			label = "dir-853-a3:blue:wlan2g";
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
		};

		wlan0 {
			label = "dir-853-a3:blue:wlan5g";
			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
		};

		led_power_amber: power{
			label = "dir-853-a3:amber:power";
			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
		};

		led_power_blue: power2{
			label = "dir-853-a3:blue:power";
			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
		};

		net {
			label = "dir-853-a3:amber:internet";
			gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
		};

		net2 {
			label = "dir-853-a3:blue:internet";
			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
		};
		usb {
			label = "dir-853-a3:blue:usb";
			gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
			trigger-sources = <&xhci_ehci_port1>, <&ehci_port2>;
			linux,default-trigger = "usbport";
		};
	};

	keys {
		compatible = "gpio-keys";

		wps {
			label = "wps";
			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_WPS_BUTTON>;
		};

		wifi {
			label = "wifi";
			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RFKILL>;
		};

		reset {
			label = "reset";
			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
	};
};

&nand {
	status = "okay";

	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		partition@0 {
			label = "bootloader";
			reg = <0x0 0x80000>;
			read-only;
		};

		partition@80000 {
			label = "config";
			reg = <0x80000 0x80000>;
		};

		factory: partition@100000 {
			label = "factory";
			reg = <0x100000 0x40000>;
			read-only;
		};

		partition@140000 {
			label = "config2";
			reg = <0x140000 0x40000>;
			read-only;
		};

		partition@180000 {
			compatible = "ubootpad96,uimage";
			label = "firmware";
			reg = <0x180000 0x2800000>;
		};

		partition@2980000 {
			label = "private";
			reg = <0x2980000 0x2000000>;
		};

		partition@4980000 {
			label = "kernel2";
			reg = <0x4980000 0x2800000>;
		};

		partition@7180000 {
			label = "mydlink";
			reg = <0x7180000 0x600000>;
		};

		partition@7780000 {
			label = "reserved";
			reg = <0x7780000  0x800000>;
		};
	};
};

&pcie {
	status = "okay";
};

&pcie0 {
	mt76@0,0 {
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x0>;
	};
};

&gmac0 {
	mtd-mac-address = <&factory 0xe000>;
};

&switch0 {
	ports {
		port@0 {
			status = "okay";
			label = "lan4";
		};

		port@1 {
			status = "okay";
			label = "lan3";
		};

		port@2 {
			status = "okay";
			label = "lan2";
		};

		port@3 {
			status = "okay";
			label = "lan1";
		};

		port@4 {
			status = "okay";
			label = "wan";
			mtd-mac-address = <&factory 0xe006>;
		};
	};
};

&state_default {
	gpio {
		groups = "uart3", "jtag", "wdt";
		function = "gpio";
	};
};

define Device/dlink_dir-853-a3
	IMAGE_SIZE := 40960k
	UBINIZE_OPTS := -E 5
	BLOCKSIZE := 128k
	PAGESIZE := 2048
	KERNEL_SIZE := 4096k
	DEVICE_VENDOR := D-Link
	DEVICE_MODEL := DIR-853
	DEVICE_VARIANT := A3
	IMAGES += factory.bin
	KERNEL_INITRAMFS := $$(KERNEL) | ubootpad96
	DEVICE_PACKAGES :=  kmod-mt7615e kmod-usb3 kmod-usb-ledtrig-usbport wpad-basic
	IMAGE/default := append-kernel | ubootpad96 | pad-to $$$$(KERNEL_SIZE)|\
	append-ubi
	IMAGE/factory.bin := $$(IMAGE/default) append-rootfs | pad-rootfs |\
	check-size
	IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += dlink_dir-853-a3

And dmesg output

[    0.000000] Linux version 5.4.43 (karim@Matebook-Manjaro) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r13496-8c31afb978)) #0 SMP Fri Jun 5 20:03:26 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is D-Link DIR-853 A3
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] On node 0 totalpages: 65536
[    0.000000]   Normal zone: 576 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65536 pages, LIFO batch:15
[    0.000000] percpu: Embedded 18 pages/cpu s43248 r8192 d22288 u73728
[    0.000000] pcpu-alloc: s43248 r8192 d22288 u73728 alloc=18*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Writing ErrCtl register=0002270a
[    0.000000] Readback ErrCtl register=0002270a
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 250148K/262144K available (5886K kernel code, 310K rwdata, 1324K rodata, 1364K init, 239K bss, 11996K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 256
[    0.000000] random: get_random_bytes called from start_kernel+0x3b8/0x5c8 with crng_init=0
[    0.000000] CPU Clock: 880MHz
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.000009] sched_clock: 32 bits at 440MHz, resolution 2ns, wraps every 4880645118ns
[    0.015483] Calibrating delay loop... 583.68 BogoMIPS (lpj=1167360)
[    0.055836] pid_max: default: 32768 minimum: 301
[    0.065198] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.079605] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.097723] rcu: Hierarchical SRCU implementation.
[    0.107861] smp: Bringing up secondary CPUs ...
[    0.136308] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.136320] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.136333] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.136433] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.145056] Synchronize counters for CPU 1: done.
[    0.227348] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.227357] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.227364] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.227424] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.243606] Synchronize counters for CPU 2: done.
[    0.322596] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.322604] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.322611] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.322676] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.335266] Synchronize counters for CPU 3: done.
[    0.394880] smp: Brought up 1 node, 4 CPUs
[    0.407385] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.426703] futex hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.440646] pinctrl core: initialized pinctrl subsystem
[    0.452505] NET: Registered protocol family 16
[    0.473319] FPU Affinity set after 4712 emulations
[    0.492925] random: fast init done
[    0.499700] clocksource: Switched to clocksource GIC
[    0.553539] NET: Registered protocol family 2
[    0.562770] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.579307] TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.594497] TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.608671] TCP: Hash tables configured (established 2048 bind 2048)
[    0.621408] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.634302] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.648368] NET: Registered protocol family 1
[    0.656951] PCI: CLS 0 bytes, default 32
[    0.755632] 4 CPUs re-calibrate udelay(lpj = 1163264)
[    0.767237] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.791542] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.803021] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.824918] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.836379] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.847733] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.859609] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    0.873587] printk: console [ttyS0] disabled
[    0.882045] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 19, base_baud = 3125000) is a 16550A
[    0.899984] printk: console [ttyS0] enabled
[    0.916521] printk: bootconsole [early0] disabled
[    0.937546] mt7621-nand 1e003000.nand: Using programmed access timing: 31c07388
[    0.952401] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xf1
[    0.965085] nand: Winbond W29N01HV
[    0.971867] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.986949] mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits
[    0.999990] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[    1.014553] mt7621-nand 1e003000.nand: Using programmed access timing: 21005134
[    1.029119] Scanning device for bad blocks
[    1.686239] 9 fixed-partitions partitions found on MTD device mt7621-nand
[    1.699770] Creating 9 MTD partitions on "mt7621-nand":
[    1.710188] 0x000000000000-0x000000080000 : "bootloader"
[    1.722136] 0x000000080000-0x000000100000 : "config"
[    1.733194] 0x000000100000-0x000000140000 : "factory"
[    1.744446] 0x000000140000-0x000000180000 : "config2"
[    1.755700] 0x000000180000-0x000002980000 : "firmware"
[    1.777713] 2 ubootpad96-fw partitions found on MTD device firmware
[    1.790209] Creating 2 MTD partitions on "firmware":
[    1.800108] 0x000000000000-0x000000400000 : "kernel"
[    1.811163] 0x000000400000-0x000002800000 : "ubi"
[    1.821816] 0x000002980000-0x000004980000 : "private"
[    1.833157] 0x000004980000-0x000007180000 : "kernel2"
[    1.844552] 0x000007180000-0x000007780000 : "mydlink"
[    1.855852] 0x000007780000-0x000007f80000 : "reserved"
[    1.868654] libphy: Fixed MDIO Bus: probed
[    1.902027] libphy: mdio: probed
[    1.908708] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    1.922652] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 21
[    1.941505] mt7621-pci 1e140000.pcie: Parsing DT failed
[    1.954559] NET: Registered protocol family 10
[    1.965140] Segment Routing with IPv6
[    1.972570] NET: Registered protocol family 17
[    1.981757] 8021q: 802.1Q VLAN Support v1.8
[    1.992122] mt7530 mdio-bus:1f: MT7530 adapts as multi-chip module
[    2.840033] libphy: dsa slave smi: probed
[    2.859716] mt7530 mdio-bus:1f lan4 (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY]
[    2.887711] mt7530 mdio-bus:1f lan3 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[    2.915715] mt7530 mdio-bus:1f lan2 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[    2.943720] mt7530 mdio-bus:1f lan1 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[    2.971727] mt7530 mdio-bus:1f wan (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY]
[    3.035659] mt7530 mdio-bus:1f: configuring for fixed/rgmii link mode
[    3.659651] mt7530 mdio-bus:1f: Link is Up - 1Gbps/Full - flow control off
[    3.743684] DSA: tree 0 setup
[    3.749898] rt2880-pinmux pinctrl: pcie is already enabled
[    3.760844] mt7621-pci 1e140000.pcie: Error applying setting, reverse things back
[    3.775889] mt7621-pci-phy 1e149000.pcie-phy: PHY for 0xbe149000 (dual port = 1)
[    3.790821] mt7621-pci-phy 1e14a000.pcie-phy: PHY for 0xbe14a000 (dual port = 0)
[    3.905293] mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz
[    3.916408] mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz
[    4.027157] mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK)
[    4.041028] mt7621-pci 1e140000.pcie: pcie2 no card, disable it (RST & CLK)
[    4.054894] mt7621-pci 1e140000.pcie: PCIE0 enabled
[    4.064619] mt7621-pci 1e140000.pcie: PCI coherence region base: 0x60000000, mask/settings: 0xf0000002
[    4.083320] mt7621-pci 1e140000.pcie: PCI host bridge to bus 0000:00
[    4.095991] pci_bus 0000:00: root bus resource [io  0x1e160000-0x1e16ffff]
[    4.109684] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff]
[    4.123377] pci_bus 0000:00: root bus resource [bus 00-ff]
[    4.134344] pci 0000:00:00.0: [0e8d:0801] type 01 class 0x060400
[    4.146345] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x7fffffff]
[    4.158831] pci 0000:00:00.0: reg 0x14: [mem 0x00000000-0x0000ffff]
[    4.171384] pci 0000:00:00.0: supports D1
[    4.179370] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[    4.192182] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    4.208338] pci 0000:01:00.0: [14c3:7615] type 00 class 0x000280
[    4.220352] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit]
[    4.234038] pci 0000:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s x1 link at 0000:00:00.0 (capable of 4.000 Gb/s with 5 GT/s x1 link)
[    4.262802] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    4.273234] pci 0000:00:00.0:   bridge window [io  0x0000-0x0fff]
[    4.285373] pci 0000:00:00.0:   bridge window [mem 0x00000000-0x000fffff]
[    4.298894] pci 0000:00:00.0:   bridge window [mem 0x00000000-0x000fffff pref]
[    4.313287] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    4.326521] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    4.339698] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    4.353566] pci 0000:00:00.0: BAR 8: assigned [mem 0x60000000-0x600fffff]
[    4.367089] pci 0000:00:00.0: BAR 9: assigned [mem 0x60100000-0x601fffff pref]
[    4.381479] pci 0000:00:00.0: BAR 1: assigned [mem 0x60200000-0x6020ffff]
[    4.395005] pci 0000:00:00.0: BAR 7: assigned [io  0x1e160000-0x1e160fff]
[    4.408544] pci 0000:01:00.0: BAR 0: assigned [mem 0x60000000-0x600fffff 64bit]
[    4.423112] pci 0000:00:00.0: PCI bridge to [bus 01]
[    4.433004] pci 0000:00:00.0:   bridge window [io  0x1e160000-0x1e160fff]
[    4.446523] pci 0000:00:00.0:   bridge window [mem 0x60000000-0x600fffff]
[    4.460047] pci 0000:00:00.0:   bridge window [mem 0x60100000-0x601fffff pref]
[    4.475779] UBI: auto-attach mtd6
[    4.482401] ubi0: attaching mtd6
[    4.854509] ubi0: scanning is finished
[    4.884552] ubi0: attached mtd6 (name "ubi", size 36 MiB)
[    4.895336] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    4.909031] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    4.922546] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    4.936409] ubi0: good PEBs: 288, bad PEBs: 0, corrupted PEBs: 0
[    4.948369] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    4.962749] ubi0: max/mean erase counter: 3/1, WL threshold: 4096, image sequence number: 1591387406
[    4.980936] ubi0: available PEBs: 0, total reserved PEBs: 288, PEBs reserved for bad PEB handling: 20
[    4.999320] ubi0: background thread "ubi_bgt0d" started, PID 472
[    5.001768] block ubiblock0_0: created from ubi0:0(rootfs)
[    5.022259] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[    5.036136] hctosys: unable to open rtc device (rtc0)
[    5.054054] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    5.073033] Freeing unused kernel memory: 1364K
[    5.082115] This architecture does not have kernel memory protection.
[    5.094947] Run /sbin/init as init process
[    5.727736] init: Console is alive
[    5.734741] init: - watchdog -
[    6.518184] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    6.622380] usbcore: registered new interface driver usbfs
[    6.633450] usbcore: registered new interface driver hub
[    6.644217] usbcore: registered new device driver usb
[    6.668641] xhci-mtk 1e1c0000.xhci: 1e1c0000.xhci supply vbus not found, using dummy regulator
[    6.685972] xhci-mtk 1e1c0000.xhci: 1e1c0000.xhci supply vusb33 not found, using dummy regulator
[    6.703709] xhci-mtk 1e1c0000.xhci: xHCI Host Controller
[    6.714325] xhci-mtk 1e1c0000.xhci: new USB bus registered, assigned bus number 1
[    6.735822] xhci-mtk 1e1c0000.xhci: hcc params 0x01401198 hci version 0x96 quirks 0x0000000000210010
[    6.754124] xhci-mtk 1e1c0000.xhci: irq 20, io mem 0x1e1c0000
[    6.766840] hub 1-0:1.0: USB hub found
[    6.774419] hub 1-0:1.0: 2 ports detected
[    6.783030] xhci-mtk 1e1c0000.xhci: xHCI Host Controller
[    6.793677] xhci-mtk 1e1c0000.xhci: new USB bus registered, assigned bus number 2
[    6.808607] xhci-mtk 1e1c0000.xhci: Host supports USB 3.0 SuperSpeed
[    6.821480] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    6.838478] hub 2-0:1.0: USB hub found
[    6.846045] hub 2-0:1.0: 1 port detected
[    6.860164] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    6.880023] init: - preinit -
[    7.430075] mtk_soc_eth 1e100000.ethernet eth0: configuring for fixed/rgmii link mode
[    7.446223] mtk_soc_eth 1e100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[    7.463130] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    7.619154] random: jshn: uninitialized urandom read (4 bytes read)
[    7.686916] random: jshn: uninitialized urandom read (4 bytes read)
[    8.022339] random: jshn: uninitialized urandom read (4 bytes read)
[    8.291664] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode
[    8.331821] 8021q: adding VLAN 0 to HW filter on device lan1
[    8.672985] urandom_read: 4 callbacks suppressed
[    8.672997] random: procd: uninitialized urandom read (4 bytes read)
[   10.599675] mt7530 mdio-bus:1f lan1: Link is Up - 100Mbps/Full - flow control off
[   10.614631] IPv6: ADDRCONF(NETDEV_CHANGE): lan1: link becomes ready
[   12.855055] UBIFS (ubi0:1): Mounting in unauthenticated mode
[   12.866591] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 629
[   12.947429] UBIFS (ubi0:1): recovery needed
[   13.149316] UBIFS (ubi0:1): recovery completed
[   13.158351] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[   13.173948] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   13.193692] UBIFS (ubi0:1): FS size: 28823552 bytes (27 MiB, 227 LEBs), journal size 1396736 bytes (1 MiB, 11 LEBs)
[   13.214480] UBIFS (ubi0:1): reserved for root: 1361407 bytes (1329 KiB)
[   13.227660] UBIFS (ubi0:1): media format: w4/r0 (latest is w5/r0), UUID F608AA74-CD35-4E8D-A655-B9252B4886BB, small LPT model
[   13.258166] mount_root: switching to ubifs overlay
[   13.285118] overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off.
[   13.309791] urandom-seed: Seeding with /etc/urandom.seed
[   13.443667] mt7530 mdio-bus:1f lan1: Link is Down
[   13.678630] procd: - early -
[   13.684525] procd: - watchdog -
[   14.291804] procd: - watchdog -
[   14.298395] procd: - ubus -
[   14.399787] random: ubusd: uninitialized urandom read (4 bytes read)
[   14.463559] random: ubusd: uninitialized urandom read (4 bytes read)
[   14.477743] procd: - init -
[   14.964829] kmodloader: loading kernel modules from /etc/modules.d/*
[   14.994986] Loading modules backported from Linux version v5.7-rc3-0-g6a8b55ed4056
[   15.010101] Backport generated by backports.git v5.7-rc3-1-0-gc0c7d2bb
[   15.041366] xt_time: kernel timezone is -0000
[   15.179724] urngd: v1.0.2 started.
[   15.207105] mt7621-pci 1e140000.pcie: bus=1 slot=0 irq=23
[   15.217920] pci 0000:00:00.0: enabling device (0004 -> 0007)
[   15.229201] mt7615e 0000:01:00.0: enabling device (0000 -> 0002)
[   15.254907] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   15.272594] mt7615e 0000:01:00.0: HW/SW Version: 0x8a108a10, Build Time: 20180518100604a
[   15.272594] 
[   15.277862] PPP generic driver version 2.4.2
[   15.301493] NET: Registered protocol family 24
[   15.335086] kmodloader: done loading kernel modules from /etc/modules.d/*
[   15.357510] random: crng init done
[   15.610829] mt7615e 0000:01:00.0: N9 Firmware Version: 2.0, Build Time: 20200131181812
[   15.715257] mt7615e 0000:01:00.0: CR4 Firmware Version: _reserved_, Build Time: 20190121161307
[   20.651972] mtk_soc_eth 1e100000.ethernet eth0: Link is Down
[   20.670763] mtk_soc_eth 1e100000.ethernet eth0: configuring for fixed/rgmii link mode
[   20.687047] mtk_soc_eth 1e100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   20.763726] mt7530 mdio-bus:1f lan1: configuring for phy/gmii link mode
[   20.807981] 8021q: adding VLAN 0 to HW filter on device lan1
[   21.127868] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   21.140986] br-lan: port 1(lan1) entered blocking state
[   21.151433] br-lan: port 1(lan1) entered disabled state
[   21.183665] device lan1 entered promiscuous mode
[   21.192877] device eth0 entered promiscuous mode
[   21.635663] mt7530 mdio-bus:1f lan2: configuring for phy/gmii link mode
[   21.675837] 8021q: adding VLAN 0 to HW filter on device lan2
[   22.012118] br-lan: port 2(lan2) entered blocking state
[   22.022554] br-lan: port 2(lan2) entered disabled state
[   22.079664] device lan2 entered promiscuous mode
[   22.519661] mt7530 mdio-bus:1f lan3: configuring for phy/gmii link mode
[   22.559832] 8021q: adding VLAN 0 to HW filter on device lan3
[   22.896405] br-lan: port 3(lan3) entered blocking state
[   22.906841] br-lan: port 3(lan3) entered disabled state
[   22.987681] device lan3 entered promiscuous mode
[   23.427661] mt7530 mdio-bus:1f lan4: configuring for phy/gmii link mode
[   23.467836] 8021q: adding VLAN 0 to HW filter on device lan4
[   23.804120] br-lan: port 4(lan4) entered blocking state
[   23.814558] br-lan: port 4(lan4) entered disabled state
[   23.919708] device lan4 entered promiscuous mode
[   24.367661] mt7530 mdio-bus:1f wan: configuring for phy/gmii link mode
[   24.407836] 8021q: adding VLAN 0 to HW filter on device wan
[   24.744102] br-lan: port 5(wan) entered blocking state
[   24.754364] br-lan: port 5(wan) entered disabled state
[   24.891670] device wan entered promiscuous mode
[   25.296130] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[   25.940350] mt7530 mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control rx/tx
[   25.955431] br-lan: port 3(lan3) entered blocking state
[   25.965958] br-lan: port 3(lan3) entered forwarding state
[   26.027976] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   26.107770] mt7530 mdio-bus:1f lan2: Link is Up - 1Gbps/Full - flow control rx/tx
[   26.128411] br-lan: port 2(lan2) entered blocking state
[   26.138903] br-lan: port 2(lan2) entered forwarding state
[   26.303805] mt7530 mdio-bus:1f lan1: Link is Up - 100Mbps/Full - flow control off
[   26.322623] br-lan: port 1(lan1) entered blocking state
[   26.333124] br-lan: port 1(lan1) entered forwarding state
[   27.436827] br-lan: port 6(wlan0) entered blocking state
[   27.447831] br-lan: port 6(wlan0) entered disabled state
[   27.459289] device wlan0 entered promiscuous mode
[   27.767277] br-lan: port 7(wlan1) entered blocking state
[   27.777914] br-lan: port 7(wlan1) entered disabled state
[   27.789071] device wlan1 entered promiscuous mode
[   27.798776] br-lan: port 7(wlan1) entered blocking state
[   27.809413] br-lan: port 7(wlan1) entered forwarding state
[   28.405332] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
[   30.047502] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   30.060530] br-lan: port 6(wlan0) entered blocking state
[   30.071176] br-lan: port 6(wlan0) entered forwarding state
[   49.615824] br-lan: port 2(lan2) entered disabled state
[   49.643686] mt7530 mdio-bus:1f lan2: Link is Down
[   52.731687] mt7530 mdio-bus:1f lan2: Link is Up - 1Gbps/Full - flow control rx/tx
[   52.746666] br-lan: port 2(lan2) entered blocking state
[   52.757104] br-lan: port 2(lan2) entered forwarding state
[  143.631816] br-lan: port 3(lan3) entered disabled state
[  143.659687] mt7530 mdio-bus:1f lan3: Link is Down
[  153.915687] mt7530 mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control rx/tx
[  153.930668] br-lan: port 3(lan3) entered blocking state
[  153.941101] br-lan: port 3(lan3) entered forwarding state
[  156.943829] br-lan: port 3(lan3) entered disabled state
[  156.971687] mt7530 mdio-bus:1f lan3: Link is Down
[  159.035686] mt7530 mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control rx/tx
[  159.050663] br-lan: port 3(lan3) entered blocking state
[  159.061120] br-lan: port 3(lan3) entered forwarding state
[  161.039827] br-lan: port 3(lan3) entered disabled state
[  161.067684] mt7530 mdio-bus:1f lan3: Link is Down
[  164.155690] mt7530 mdio-bus:1f lan3: Link is Up - 1Gbps/Full - flow control rx/tx
[  164.170672] br-lan: port 3(lan3) entered blocking state
[  164.181123] br-lan: port 3(lan3) entered forwarding state

Interesting, so it did split a firmware partition on your device using compatible = "ubootpad96,uimage";
I am not familiar with ubootpad96, but will see if I can use that, if it causes auto-split to work.

You also made me think of something else. I've been testing my factory images mostly, but I'll try comparing with sysupgrade. I wonder if the factory images might be throwing off the autosplit code because they require an additional header be placed at the start of the image. I was careful to preserve proper kernel & rootfs image sizes & alignment, but I'll still verify.

ubootpad96 is specific to a couple of dlink devices (for the moment and its the work of another guy for the DIR-878). The code in mtdsplit is not even present in the official master. I doubt you can use it as for my case without it the image wont even boot (actually it gets overwritten by another image during the boot process of uboot).

You should check if anyone else has a similar device to yours and have a look at their DTS file and maybe someone is using mtdsplit.

This is the work I copied from https://github.com/openwrt/openwrt/pull/3029. It most certainly wouldnt apply to you.

I guess I need some help understanding append-ubi and/or how autosplit works and why it breaks my factory images.
My device requires a 20-byte MIPS "CSYS" header in order to accept an image as "factory." The CSYS header is an outside wrapper for the entire image, and it contains a checksum of the entire image, so it must be written last.
I create a factory image this way:

   IMAGE/factory.bin := append-kernel | pad-to 4194284 | append-ubi |\
      edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 |\
      check-size

(4194284 is the kernel size, 4MB, minus 20bytes for the CSYS header).
The resulting factory image has this layout, which looks great:

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             CSYS header, little endian, size: 1835008
20            0x14            uImage header, header size: 64 bytes, header CRC: 0x22712B77, created: 2020-05-25 22:16:25, image size: 2331211 bytes, Data Address: 0x80001000, Entry Point: 0x80001000, data CRC: 0x96544F23, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: "MIPS OpenWrt Linux-5.4.42"
84            0x54            LZMA compressed data, properties: 0x6D, dictionary size: 2097152 bytes, uncompressed size: 7357181 bytes
4194304       0x400000        UBI erase count header, version: 1, EC: 0x0, VID header offset: 0x800, data offset: 0x1000

Notice that the UBI magic appears at exactly 4MB into the image.

But this file won't actually boot with auto-split enabled. If instead I change the DTS such that there's explicit kernel and ubi partitions, and don't enable auto-split, it does work.
What about this could foil autosplit? Since I have a DTS solution that works, I don't consider it critical, but I'm curious.

EDIT: I guess it must be the pad-to... need to test without that.

So, it was indeed my use of pad-to that was breaking auto-splitting. Auto-split must look only at the next page (or erase block) boundary for the magic, and if it's not there, it fails. BUT, I wanted to pad the kernel portion of my firmware so that UBI could be aligned on an erase block boundary. So in the end, I'm just not going to use auto-splitting.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.