It isn't that simple, "info" partition contains the mac address:
&info {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_info_8: macaddr@8 {
reg = <0x8 0x6>;
};
};
Try flashing an older Openwrt build and backup the important partitions just in case:
cd /tmp
# Ensure the mtd numbers are the correct by running:
cat /proc/mtd
# Backup the partitions
cat /dev/mtd0 > u-boot.bak
cat /dev/mtd5 > partition-table.bak
cat /dev/mtd6 > info.bak
cat /dev/mtd7 > config.bak
cat /dev/mtd8 > art.bak
tar -cvjf backup.tar.bz2 u-boot.bak partition-table.bak info.bak config.bak art.bak
# Now copy the file using SCP
# Also possible through http like this:
cd /www
ln -s /tmp/backup.tar.bz2
# Now get the file at http://openwrt_ip/backup.tar.bz2
If you want to restore them at any point, you can use this:
# First, transfer the backup file to /tmp the file using SCP, wget, etc
# Unpack the backup
cd /tmp
tar -xvf backup.tar.bz2
# Make all partitions writable!
opkg update && opkg install kmod-mtd-rw
insmod mtd-rw.ko i_want_a_brick=1
# Restore partitions
mtd write partition-table.bak partition-table
mtd write info.bak info
mtd write config.bak config
reboot
I tried this:
target/linux/ath79/dts/qca9558_tplink_rex5x.dtsi
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x020000>;
read-only;
};
partition@20000 {
compatible = "tplink,firmware";
label = "firmware";
reg = <0x020000 0x7d0000>;
};
art: partition@7f0000 {
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
};
};
};
};
ð0 {
status = "okay";
phy-handle = <&phy4>;
pll-data = <0xa6000000 0x00000101 0x00001616>;
};
&wmac {
status = "okay";
mtd-cal-data = <&art 0x1000>;
};
target/linux/ath79/image/generic-tp-link.mk
define Device/tplink_rex5x-v1
$(Device/tplink-safeloader)
SOC := qca9558
IMAGE_SIZE := 8000k
DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
endef
However the final image build still fails, complaining about file-system partition too big:
[mktplinkfw] firmware file "/home/user/stuff/openwrt-22.03/build_dir/target-mips_24kc_musl/linux-ath79_generic/tplink_re450-v1-kernel.bin.new" completed
7787+1 records in
7787+1 records out
3987214 bytes (4.0 MB, 3.8 MiB) copied, 0.0263872 s, 151 MB/s
7787+1 records in
7787+1 records out
3987214 bytes (4.0 MB, 3.8 MiB) copied, 0.0322814 s, 124 MB/s
file-system partition too big (more than 3735552 bytes): Success
file-system partition too big (more than 3795099 bytes): Success
cp: cannot stat '/home/user/stuff/openwrt-22.03/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-tplink_re450-v1-squashfs-factory.bin': No such file or directory
stat: cannot stat '/home/user/stuff/openwrt-22.03/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-tplink_re450-v1-squashfs-sysupgrade.bin': No such file or directory
bash: line 0: [: 8192000: unary operator expected
bash: 8: Bad file descriptor
Failed to open firmware file
sha256sum: /home/user/stuff/openwrt-22.03/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-tplink_re450-v1-squashfs-sysupgrade.bin: No such file or directory
cp: cannot stat '/home/user/stuff/openwrt-22.03/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-tplink_re450-v1-squashfs-sysupgrade.bin': No such file or directory
[mktplinkfw] firmware file "/home/user/stuff/openwrt-22.03/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-tplink_re450-v1-initramfs-kernel.bin.new" completed
So there's something else in the image build process limiting the final image size...probably around here:
target/linux/ath79/image/common-tp-link.mk
DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION
DEVICE_VARS += TPLINK_BOARD_ID TPLINK_HWREVADD TPLINK_HVERSION
define Device/tplink-v1
DEVICE_VENDOR := TP-Link
TPLINK_HWID := 0x0
TPLINK_HWREV := 0x1
TPLINK_HEADER_VERSION := 1
LOADER_TYPE := gz
KERNEL := kernel-bin | append-dtb | lzma
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v1-header
IMAGES += factory.bin
IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade | append-metadata
IMAGE/factory.bin := tplink-v1-image factory
endef
define Device/tplink-safeloader
$(Device/tplink-v1)
TPLINK_HWREV := 0x0
KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O
KERNEL_INITRAMFS := $$(KERNEL)
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
check-size | append-metadata
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
endef
However if I remove the wireless support to free up space:
target/linux/ath79/image/generic-tp-link.mk
define Device/tplink_rex5x-v1
$(Device/tplink-safeloader)
SOC := qca9558
IMAGE_SIZE := 8000k
# DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct
endef
define Device/tplink_re450-v1
$(Device/tplink_rex5x-v1)
DEVICE_MODEL := RE450
DEVICE_VARIANT := v1
TPLINK_BOARD_ID := RE450
SUPPORTED_DEVICES += re450
endef
TARGET_DEVICES += tplink_re450-v1
Clear the config:
rm .config
And re-create it in menuconfig, it compiles.
I have no idea whether wired networking will fail without the mac address field, or if it will fallback to a default value.
So I made three different builds, all without wifi (it's impossible to make it fit otherwise), test in this order!
Proceed at your own risk!
-
Original partitioning. If wired networking works, try next build.
-
Original partitioning, removing the mac fields from DTS, to see what happens without mac.
It's still safe as it won't modify the special partitions, in case unusable network/kernel panic you can still recover using uboot method.
If wired network still works, ensure to make a backup of the partitions and try next build.
-
Modded partitioning, where partition-table+config+info are removed from DTS and the firmware area is extended to use that space.
It could boot at first, but it's likely the special partitions will get wiped on first boot, when openwrt initializes the JFFS2 filesystem.
This can take few minutes (Wait until system led stops blinking), then the reported partition space in LuCi should report about 2MB free (Totally empirical).
Now this is the moment of true. Openwrt wiped all those partitions, and after the next reboot we'll finally see if u-boot takes care of these partitions or not.
If it keeps booting nicely, then it's probable that only the original FW use them.
-
kmod-mtd-rw is already included in these builds, so no need to use opkg update/install, only the insmod line!
https://anonfiles.com/V8vcm6C9y6/Openwrt_22.03_test_re450v1_zip