I have custom compiled OpenWRT on an imx6ull based board, and it can now run but cannot save configurations. I think it may be an issue with the overlays. Do you have any suggestions for me?
The board uses 256MB of memory and 256MB of NAND FLASH. u-boot is the built-in version of the board, but I did not modify it because I did not know how to adapt it. I just compiled a runnable kernel, device tree, and rootfs based on the FLASH of the board.
1,The environment variables in uboot are set as follows:
board_rev=14X14
bootargs=console=ttymxc0,115200 ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs
bootcmd=nand read ${loadaddr} 0x600000 0xA00000;nand read ${fdt_addr} 0x1000000 0x100000;if test ${tee} = yes; then nand read ${tee_addr} 0x6000000 0x400000;bootm ${tee_addr} - ${fdt_addr};else bootz ${loadaddr} - ${fdt_addr};fi
bootcmd_mfg=run mfgtool_args;if iminfo ${initrd_addr}; then if test ${tee} = yes; then bootm ${tee_addr} ${initrd_addr} ${fdt_addr}; else bootz ${loadaddr} ${initrd_addr} ${fdt_addr}; fi; else echo "Run fastboot ..."; fastboot 0; fi;
bootdelay=1
console=ttymxc0
loadaddr=0x80800000
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused
mtdparts=mtdparts=gpmi-nand:5m(boot),1m(env),10m(kernel),1m(dtb),200m(rootfs),-(rootfs_data)
2,The flash partition configuration in the device tree is as follows:
&gpmi {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpmi_nand>;
nand-on-flash-bbt;
status = "okay";
fsl,use-minimum-ecc;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot@0 {
label = "boot";
reg = <0x00000000 0x00500000>; /* 5 MB */
};
env@500000 {
label = "env";
reg = <0x00500000 0x00100000>; /* 1 MB */
};
kernel@600000 {
label = "kernel";
reg = <0x00600000 0x00a00000>; /* 10 MB */
};
dtb@1000000 {
label = "dtb";
reg = <0x01000000 0x00100000>; /* 1 MB */
};
rootfs@1100000 {
label = "rootfs";
reg = <0x01100000 0x0c800000>; /* 200 MB c8*/
};
rootfs_data@d900000 {
label = "rootfs_data";
reg = <0x0d900000 0x02700000>; /* 39MB */
};
};
};
3,The makfile fragment in "target\Linux\imx\image\cortexa7.mk is as follows:
define Device/custom_imx6ull
FILESYSTEMS := squashfs ubifs
KERNEL_IN_UBI := 1
SOC := imx6ul
DEVICE_VENDOR := Custom
DEVICE_MODEL := IMX6ULL TESTER
DEVICE_DTS := imx6ull-custom
KERNEL_SIZE := 10240k
IMAGE_SIZE := 512000k
DTB_SIZE := 1024k
PAGESIZE := 2048
BLOCKSIZE := 128k
DEVICE_PACKAGES += firmware-sdma
MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB -c 2048
UBINIZE_OPTS := -E 5
KERNEL := kernel-bin
KERNEL_LOADADDR := 0x80008000
IMAGES += factory.img sysupgrade.bin
IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-dtb | pad-to $$$$(DTB_SIZE) | append-ubi
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += custom_imx6ull
4,The relevant parts output during the board startup process are as follows:
........
[ 0.000000] percpu: Embedded 12 pages/cpu s19709 r6172 d22351 u42151
[ 0.000000] Kernel command line: console=ttymxc0,115200 ubi.mtd=4 root=ubi0:rootfs rootfstype=ubifs
[ 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.272064] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.272100] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
........
[ 1.615988] random: crng init done
[ 1.674642] brd: module loaded
[ 1.703371] loop: module loaded
[ 1.718820] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
[ 1.725427] nand: Micron MT29F2G08ABAEAWP
[ 1.729468] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 1.738914] Bad block table found at page 131008, version 0x01
[ 1.745516] Bad block table found at page 130944, version 0x01
[ 1.751731] 6 fixed-partitions partitions found on MTD device gpmi-nand
[ 1.758515] Creating 6 MTD partitions on "gpmi-nand":
[ 1.763629] 0x000000000000-0x000000500000 : "boot"
[ 1.772104] 0x000000500000-0x000000600000 : "env"
[ 1.780555] 0x000000600000-0x000001000000 : "kernel"
[ 1.789381] 0x000001000000-0x000001100000 : "dtb"
[ 1.797933] 0x000001100000-0x00000d900000 : "rootfs"
[ 1.808432] mtd: setting mtd4 (rootfs) as root device
[ 1.813760] mtdsplit: no squashfs found in "rootfs"
[ 1.818928] 0x00000d900000-0x000010000000 : "rootfs_data"
[ 1.834080] gpmi-nand 1806000.nand-controller: driver registered.
.......
[ 2.452465] ubi0: default fastmap pool size: 80
[ 2.457271] ubi0: default fastmap WL pool size: 40
[ 2.462098] ubi0: attaching mtd4
[ 2.535229] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 2.738418] hub 1-1:1.0: USB hub found
[ 2.743600] hub 1-1:1.0: 4 ports detected
[ 2.868759] ubi0: scanning is finished
[ 2.884664] ubi0: attached mtd4 (name "rootfs", size 200 MiB)
[ 2.890649] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 2.897609] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 2.904430] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 2.911455] ubi0: good PEBs: 1600, bad PEBs: 0, corrupted PEBs: 0
[ 2.917611] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[ 2.924863] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 1744651925
[ 2.934061] ubi0: available PEBs: 0, total reserved PEBs: 1600, PEBs reserved for bad PEB handling: 40
[ 2.943941] ubi0: background thread "ubi_bgt0d" started, PID 578
[ 2.950772] clk: Disabling unused clocks
[ 2.957973] UBIFS (ubi0:1): Mounting in unauthenticated mode
[ 2.964165] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 580
[ 2.987432] UBIFS (ubi0:1): recovery needed
[ 3.003676] UBIFS (ubi0:1): recovery completed
[ 3.008546] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs"
[ 3.016065] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 3.026058] UBIFS (ubi0:1): FS size: 191606784 bytes (182 MiB, 1509 LEBs), max 2048 LEBs, journal size 9023488 bytes (8 MiB, 72 LEBs)
[ 3.038140] UBIFS (ubi0:1): reserved for root: 0 bytes (0 KiB)
[ 3.044005] UBIFS (ubi0:1): media format: w4/r0 (latest is w5/r0), UUID 2XXXX-46D8-XXXX-XXX7-48XXXXXXC, small LPT model
[ 3.057593] VFS: Mounted root (ubifs filesystem) on device 0:13.
.......
[ 3.359715] kmodloader: loading kernel modules from /etc/modules-boot.d/*
Cannot parse config file '/etc/fw_env.config': No such file or directory
Failed to find NVMEM device
[ 8.756570] mount_root: loading kmods from internal overlay
[ 8.788953] kmodloader: loading kernel modules from //etc/modules-boot.d/*
[ 8.799684] kmodloader: done loading kernel modules from //etc/modules-boot.d/*
[ 8.840819] mtdblock: MTD device 'rootfs' is NAND, please consider using UBI block devices instead.
[ 8.857743] mtdblock: MTD device 'rootfs_data' is NAND, please consider using UBI block devices instead.
[ 8.886032] mtdblock: MTD device 'rootfs_data' is NAND, please consider using UBI block devices instead.
[ 9.011308] block: attempting to load /tmp/overlay/upper/etc/config/fstab
[ 9.020027] block: unable to load configuration (fstab: Entry not found)
[ 9.027569] block: attempting to load /tmp/overlay/etc/config/fstab
[ 9.034385] block: unable to load configuration (fstab: Entry not found)
[ 9.041746] block: attempting to load /etc/config/fstab
[ 9.048621] block: unable to load configuration (fstab: Entry not found)
[ 9.055993] block: no usable configuration
[ 9.070234] block: attempting to load /etc/config/fstab
[ 9.076340] block: unable to load configuration (fstab: Entry not found)
[ 9.083402] block: no usable configuration
[ 9.090080] mount_root: no usable overlay filesystem found, using tmpfs overlay
[ 9.121181] urandom-seed: Seed file not found (/etc/urandom.seed)
......
[ 14.406014] kmodloader: done loading kernel modules from /etc/modules.d/*
[ 15.780366] urngd: v1.0.2 started.
[ 21.372192] mtdblock: MTD device 'rootfs' is NAND, please consider using UBI block devices instead.
[ 21.412060] mtdblock: MTD device 'rootfs_data' is NAND, please consider using UBI block devices instead.
[ 21.438936] mtdblock: MTD device 'rootfs_data' is NAND, please consider using UBI block devices instead.
.......
[ 89.342013] mtdblock: MTD device 'rootfs' is NAND, please consider using UBI block devices instead.
[ 89.435852] mtdblock: MTD device 'rootfs_data' is NAND, please consider using UBI block devices instead.
[ 89.496473] mtdblock: MTD device 'rootfs_data' is NAND, please consider using UBI block devices instead.
[ 94.671170] jffs2: notice: (2507) jffs2_build_xattr_subsystem: complete building xattr subsystem, 5 of xdatum (0 unchecked, 2 orphan) and 9 of xref (2 dead, 0 orphan) found.
[ 94.912945] overlayfs: upper fs does not support tmpfile.
Please press Enter to activate this console.
.......
#ls /overlay/upper/etc/
board.json config dropbear uci-defaults
# ls -al /overlay/work/work/\#23
c--------- 1 root root 0, 0 Apr 15 01:33 /overlay/work/work/#23
# cat /proc/mounts
ubi0:rootfs /rom ubifs rw,relatime,assert=read-only,ubi=0,vol=1 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,noatime 0 0
tmpfs /tmp/root tmpfs rw,noatime,mode=755 0 0
tmpfs /dev tmpfs rw,nosuid,noexec,noatime,size=512k,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,noatime,mode=600,ptmxmode=000 0 0
debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,noatime 0 0
bpffs /sys/fs/bpf bpf rw,nosuid,nodev,noexec,noatime,mode=700 0 0
mountd(pid2136) /tmp/run/blockd autofs rw,relatime,fd=7,pgrp=2136,timeout=30,minproto=5,maxproto=5,indirect 0 0
/dev/mtdblock5 /overlay jffs2 rw,noatime 0 0
overlayfs:/overlay / overlay rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work 0 0
# cat /proc/mtd
dev: size erasesize name
mtd0: 00500000 00020000 "boot"
mtd1: 00100000 00020000 "env"
mtd2: 00a00000 00020000 "kernel"
mtd3: 00100000 00020000 "dtb"
mtd4: 0c800000 00020000 "rootfs"
mtd5: 02700000 00020000 "rootfs_data"