diff options
author | Martin Kennedy <hurricos@gmail.com> | 2021-12-22 13:08:33 -0500 |
---|---|---|
committer | Christian Lamparter <chunkeey@gmail.com> | 2022-02-19 19:20:29 +0100 |
commit | cfe79f2eb8b3c874f3d1a4441b8a60af32169974 (patch) | |
tree | 1b45d2a486d041eb17205250a48fd153c07f3ca0 /target/linux/mpc85xx/files | |
parent | fbb8e1ef45fa3ebb10e653cdb14465508541350d (diff) | |
download | upstream-cfe79f2eb8b3c874f3d1a4441b8a60af32169974.tar.gz upstream-cfe79f2eb8b3c874f3d1a4441b8a60af32169974.tar.bz2 upstream-cfe79f2eb8b3c874f3d1a4441b8a60af32169974.zip |
mpc85xx: Patch HiveAP 330 u-boot to fix boot
When Kernel 5.10 was enabled for mpc85xx, the kernel once again became too
large upon decompression (>7MB or so) to decompress itself on boot (see
FS#4110[1]).
There have been many attempts to fix booting from a compressed kernel on
the HiveAP-330:
- b683f1c36d8a ("mpc85xx: Use gzip compressed kernel on HiveAP-330")
- 98089bb8ba82 ("mpc85xx: Use uncompressed kernel on the HiveAP-330")
- 26cb167a5ca7 ("mpc85xx: Fix Aerohive HiveAP-330 initramfs image")
We can no longer compress the kernel due to size, and the stock bootloader
does not support any other types of compression. Since an uncompressed
kernel no longer fits in the 8MiB kernel partition at 0x2840000, we need to
patch u-boot to autoboot by running variable which isn't set by the
bootloader on each autoboot.
This commit repartitions the HiveAP, requiring a new COMPAT_VERSION,
and uses the DEVICE_COMPAT_MESSAGE to guide the user to patch u-boot,
which changes the variable run on boot to be `owrt_boot`; the user can
then set the value of that variable appropriately.
The following has been documented in the device's OpenWrt wiki page:
<https://openwrt.org/toh/aerohive/hiveap-330>. Please look there
first/too for more information.
The from-stock and upgrade from a previous installation now becomes:
0) setup a network with a dhcp server and a tftp server at serverip
(192.168.1.101) with the initramfs image in the servers root directory.
1) Hook into UART (9600 baud) and enter U-Boot. You may need to enter
a password of administrator or AhNf?d@ta06 if prompted. If the password
doesn't work. Try reseting the device by pressing and holding the reset
button with the stock OS.
2) Once in U-Boot, set the new owrt_boot and tftp+boot the initramfs image:
Use copy and paste!
# fw_setenv owrt_boot 'setenv bootargs \"console=ttyS0,$baudrate\";bootm 0xEC040000 - 0xEC000000'
# save
# dhcp
# setenv bootargs console=ttyS0,$baudrate
# tftpboot 0x1000000 192.168.1.101:openwrt-mpc85xx-p1020-aerohive_hiveap-330-initramfs-kernel.bin
# bootm
3) Once openwrt booted:
carefully copy and paste this into the root shell. One step at a time
# 3.0 install kmod-mtd-rw from the internet and load it
opkg update; opkg install kmod-mtd-rw
insmod mtd-rw i_want_a_brick=y
# 3.1 create scripts that modifies uboot
cat <<- "EOF" > /tmp/uboot-update.sh
. /lib/functions/system.sh
cp "/dev/mtd$(find_mtd_index 'u-boot')" /tmp/uboot
cp /tmp/uboot /tmp/uboot_patched
ofs=$(strings -n80 -td < /tmp/uboot | grep '^ [0-9]* setenv bootargs.*cp\.l' | cut -f2 -d' ')
for off in $ofs; do
printf "run owrt_boot; " | dd of=/tmp/uboot_patched bs=1 seek=${off} conv=notrunc
done
md5sum /tmp/uboot*
EOF
# 3.2 run the script to do the modification
sh /tmp/uboot-update.sh
# verify that /tmp/uboot and /tmp/uboot_patched are good
#
# my uboot was: (is printed during boot)
# U-Boot 2009.11 (Jan 12 2017 - 00:27:25), Build: jenkins-HiveOS-Honolulu_AP350_Rel-245
#
# d84b45a2e8aca60d630fbd422efc6b39 /tmp/uboot
# 6dc420f24c2028b9cf7f0c62c0c7f692 /tmp/uboot_patched
# 98ebc7e7480ce9148cd2799357a844b0 /tmp/uboot-update.sh <-- just for reference
# 3.3 this produces the /tmp/u-boot_patched file.
mtd write /tmp/uboot_patched u-boot
3) scp over the sysupgrade file to /tmp/ and run sysupgrade to flash OpenWrt:
sysupgrade -n /tmp/openwrt-mpc85xx-p1020-aerohive_hiveap-330-squashfs-sysupgrade.bin
4) after the reboot, you are good to go.
Other notes:
- Note that after this sysupgrade, the AP will be unavailable for 7 minutes
to reformat flash. The tri-color LED does not blink in any way to
indicate this, though there is no risk in interrupting this process,
other than the jffs2 reformat being reset.
- Add a uci-default to fix the compat version. This will prevent updates
from previous versions without going through the installation process.
- Enable CONFIG_MTD_SPLIT_UIMAGE_FW and adjust partitioning to combine
the kernel and rootfs into a single dts partition to maximize storage
space, though in practice the kernel can grow no larger than 16MiB due
to constraints of the older mpc85xx u-boot platform.
- Because of that limit, KERNEL_SIZE has been raised to 16m.
- A .tar.gz of the u-boot source for the AP330 (a.k.a. Goldengate) can
be found here[2].
- The stock-jffs2 partition is also removed to make more space -- this
is possible only now that it is no longer split away from the rootfs.
- the console-override is gone. The device will now get the console
through the bootargs. This has the advantage that you can set a different
baudrate in uboot and the linux kernel will stick with it!
- due to the repartitioning, the partition layout and names got a makeover.
- the initramfs+fdt method is now combined into a MultiImage initramfs.
The separate fdt download is no longer needed.
- added uboot-envtools to the mpc85xx target. All targets have uboot and
this way its available in the initramfs.
[1]: https://bugs.openwrt.org/index.php?do=details&task_id=4110
[2]: magnet:?xt=urn:btih:e53b27006979afb632af5935fa0f2affaa822a59
Tested-by: Martin Kennedy <hurricos@gmail.com>
Signed-off-by: Martin Kennedy <hurricos@gmail.com>
(rewrote parts of the commit message, Initramfs-MultiImage,
dropped bootargs-override, added wiki entry + link, uboot-envtools)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/mpc85xx/files')
-rw-r--r-- | target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts index 9eb6e2613a..359b123bc6 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts @@ -22,10 +22,6 @@ label-mac-device = &enet0; }; - chosen { - bootargs-override = "console=ttyS0,9600"; - }; - memory { device_type = "memory"; }; @@ -47,36 +43,41 @@ #address-cells = <1>; #size-cells = <1>; + firmware@0 { + reg = <0x0 0x3f00000>; + label = "firmware"; + /* + * This unknown/invalid compatible prevents + * openwrt's mtdsplit_fit to go off a tangent if it + * finds a magic value inside the uncompressed kernel + * at a blocksized aligned place. + */ + compatible = "areohive,hiveap-330-image"; + }; + partition@0 { reg = <0x0 0x40000>; label = "dtb"; }; partition@40000 { - reg = <0x40000 0x40000>; - label = "initrd"; - }; - - partition@80000 { - reg = <0x80000 0x27c0000>; - label = "rootfs"; - }; - - partition@2840000 { - reg = <0x2840000 0x800000>; + compatible = "openwrt,uimage", "denx,uimage"; + reg = <0x40000 0x3ec0000>; label = "kernel"; }; - partition@3040000 { - reg = <0x3040000 0xec0000>; - label = "stock-jffs2"; - read-only; - }; - - hwinfo: partition@3f00000 { + partition@3f00000 { reg = <0x3f00000 0x20000>; label = "hw-info"; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_hwinfo_0: macaddr@0 { + reg = <0x0 0x6>; + }; }; partition@3f20000 { @@ -101,11 +102,6 @@ label = "u-boot"; read-only; }; - - firmware@0 { - reg = <0x0 0x3040000>; - label = "firmware"; - }; }; }; }; @@ -242,13 +238,3 @@ }; }; /include/ "fsl/p1020si-post.dtsi" - -&hwinfo { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_hwinfo_0: macaddr@0 { - reg = <0x0 0x6>; - }; -}; |