Go Down

Topic: working sysupgrade.bin for custom compiled firmware (OpenWRT 19.07) (Read 312 times) previous topic - next topic

core_cc

I've created a custom firmware for the Yun, but i needed to flash the kernel + rootfs seperately (manually from uboot, using tftp).
The sysupgrade.bin file that is cross-compiled, did not pass the test. There were 2 errors reported: no metadata could be found, and the image type was not supported (magic value incorrect).

I changed the arduino-yun definition in target/linux/ar71xx/image/generic.mk so the metadata gets appended (and also adjusted the mtdparts line),
and i changed target/linux/ar71xx/base-files/lib/upgrade/platform.sh to include my new magic number of my firmware,
but on the yun i want to upgrade (the yun with the original default old firmware), the sysupgrade does still not pass the test. That old yun's platform.sh does not have my magic number included in its test..

My current sysupgrade.bin passes the sysupgrade -T test.
But i'm wondering how my .bin can be used from anyone's luci web interface, without the need to first edit the lib/upgrade/platform.sh on their yun..

Anyone else had this chicken-egg problem?

core_cc

I checked how lede-yun (LEDE 17.11) checks the magic number.
Lede-yun checks a smaller portion of the magic number (just a 16b integer is checked, while openwrt checks a long int value).
The lede-yun would accept my sysupgrade.bin: the numbers match. 2705.

Unfortunately i don't have another original yun rev1 to flash/test (with still the original old firmware).
I had 10 old yuns, but they are all upgraded by now. I should have kept one of them original..

core_cc

The sysupgarde.bin appears to work well for the Yun.
You can use luci to flash the firmware.
The original Yun rev1, and the lede-yun on the Yun rev1 both verified the bin, and were able to flash it.
Both devices were upgraded successfully to OpenWRT 19.07, along with all the Yun specific stuff.

For this to work, i first had to update the bootloader to uboot 1.1.5.
after that, in uboot i also edited the mtdparts and bootm environment vars:
Quote
setenv mtdparts "spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro";
setenv bootcmd "run addboard; run addtty;run addparts; run addrootfs; bootm 0x9f050000";
saveenv;
..and then uboot is ready to accept any size kernel+rootfs (up to a combined size of max. 16000k)

3 tips for Arduino:
  • The kernel has moved: It starts at the lowest address, just after the uboot & uboot-env partitions. In this case, the kernel always starts at 0x9F050000, no matter what size the rootfs is, the address wouldn't change. In any future FW upgrades, you wouldn't have to edit that bootm anymore..
  • Also, the mtdparts does not have the kernel & rootfs sizes explicitely mentioned anymore. This makes it also easier for future FW upgrades, because also the mtdparts environment-var would remain the same. Sysupgrade still correctly puts the two bins in their expected spaces.
  • The nvram partition, on the yun.. ?



It's all working very well now..

Here's my single bin. Use at your own risk. cheers..
OpenWRT 19.07 sysupgrade.bin
..

Go Up