openwrt/package/boot
Christian Lamparter 82c8c38a5c apm821xx: prepare WNDR4700 for 6.6 - add preliminary u-boot-env access
With the default BUILD_BOT configuration on a linux 6.6 kernel,
the WNDR4700's kernel no longer fits into the alloted ~3.5MiB,
even with LZMA compression.

Bigger kernels are possible, but there's a problem with Netgear's
"bootcmd":

> if loadn_dniimg 0 0x180000 0x4e0000 && chk_dniimg 0x4e0000; then nand read 0x800000 0x180000 0x20000;bootm 0x500000 - 0x800040;else fw_recovery; fi"

This loads the dni-image starting offset 0x180000 from the NAND
flash (which is the DTB partition) to 0x4e0000 in the RAM. It then
checks whenever the provided image is "valid". If it is then it
reads the DTB again to 0x800000 in the RAM and starts the extraction
and boot process. (If the image wasn't valid then it starts the
automated firmware recovery).

The issues here are that first: the kernel image gets "squeezed"
between 0x500040 and 0x7fffff... And second, the decompressor
only has area 0x0 - 0x500000 for decompression.

Hence the image now requires to update the bootcmd by providing
new values (which have been successfully tested with the original
Netgear WNDR4700 v1.0.0.56 firmware) for the RAM locations and
make full use of the fact that loadn_dniimg loads the DTB as well.

This needs to be done only once. Just connect a serial adapter to
interface with uboot and overwrite (and save) the new bootcmd.

WARNING: The serial port needs a TTL/RS-232 3.3v level converter!

Steps:
 0. Power-off the WNDR4700
 1. Connect the serial interface (you need to open the WNDR4700)
 2. Power-up the WNDR4700
 3. Monitor the boot-sequence and hit "Enter"-key when it says:

  "Hit any key to stop autoboot" (Be quick, you have a ~2 second window)

 4. in the Prompt enter the following commands (copy & paste)

 setenv bootcmd "if loadn_dniimg 0 0x180000 0xce0000 && chk_dniimg 0xce0000; then bootm 0xd00000 - 0xce0040;else fw_recovery; fi"
 saveenv
 run bootcmd

Note: This new bootcmd will also unbrick devices that were bricked
by the bigger 4.19-6.1 kernels.

Note2: This method was tested with a WNDR4700. A big kernel with most
debug features enabled on v6.6.22 measured 4.30 MiB when compressed
with lzma. The uncompressed kernel is 12.34 MiB. This is over the 3 MiB,
the device reserves for the kernel... But it booted! For bigger kernels,
the device needs repartitioning of the the ubi partition due to the
kernel+dtb not fitting into the partition.

Note3: For initramfs development. I would advice to load the initramfs
images to 0x800000 (or higher). i.e.: tftp 800000 wndr4700.bin

Note4: the fw_recovery uboot command to transfer the factory image to
the flash still works.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2024-04-05 09:26:26 +02:00
..
apex boot/apex: Restore the APEX boot loader 2023-10-20 13:26:45 +02:00
arm-trusted-firmware-bcm63xx treewide: replace AUTORELEASE with real PKG_RELEASE 2023-05-18 11:35:29 +02:00
arm-trusted-firmware-mediatek treewide: update PKG_MIRROR_HASH after APK version schema 2024-03-25 09:32:48 +01:00
arm-trusted-firmware-mvebu arm-trusted-firmware-mvebu: bump to v2.9 2023-08-26 00:11:48 +02:00
arm-trusted-firmware-rockchip arm-trusted-firmware-rockchip: Update to 2.10 2024-01-20 21:11:22 +01:00
arm-trusted-firmware-sunxi arm-trusted-firmware-sunxi: Update to 2.10 2023-12-20 10:53:48 +08:00
arm-trusted-firmware-tools arm-trusted-firmware-tools: fix build on macOS/Darwin 2023-08-12 16:45:47 +02:00
at91bootstrap treewide: Add extra CPE identifier 2023-09-25 23:06:33 +02:00
fconfig treewide: unify OpenWrt hosted source via @OPENWRT 2021-02-05 12:00:24 -10:00
grub2 grub2: opt-out of gc-sections usage 2023-07-14 23:56:58 +02:00
imx-bootlets imx-bootlets: refresh patches 2021-02-24 16:15:02 +01:00
kexec-tools kexec-tools: update to 2.0.28 2024-02-06 12:10:05 +01:00
kobs-ng kobs-ng: update dependencies after 'imx6' -> 'imx' rename 2021-11-03 12:45:40 +01:00
mt7623n-preloader mt7623n-preloader: remove mt7622-preloader 2021-02-28 04:12:23 +00:00
opensbi treewide: update PKG_MIRROR_HASH after APK version schema 2024-03-25 09:32:48 +01:00
rkbin treewide: update PKG_MIRROR_HASH after APK version schema 2024-03-25 09:32:48 +01:00
tfa-layerscape tfa-layerscape: fix fiptool's build 2023-05-20 23:20:48 +02:00
uboot-armsr uboot-armsr: add support for QEMU armv7/armv8 2023-06-10 21:50:22 +02:00
uboot-at91 treewide: replace AUTORELEASE with real PKG_RELEASE 2023-05-18 11:35:29 +02:00
uboot-bcm53xx uboot-bcm53xx: bump to 2024.01 2024-01-20 19:38:20 +01:00
uboot-bcm4908 treewide: update PKG_MIRROR_HASH after APK version schema 2024-03-25 09:32:48 +01:00
uboot-d1 uboot-d1: cleanup Makefile 2024-02-29 17:06:04 +01:00
uboot-envtools apm821xx: prepare WNDR4700 for 6.6 - add preliminary u-boot-env access 2024-04-05 09:26:26 +02:00
uboot-fritz4040 treewide: update PKG_MIRROR_HASH after APK version schema 2024-03-25 09:32:48 +01:00
uboot-imx treewide: replace AUTORELEASE with real PKG_RELEASE 2023-05-18 11:35:29 +02:00
uboot-kirkwood kirkwood: add support for Netgear Stora (MS2000/2110) NAS 2024-03-17 00:19:22 +01:00
uboot-lantiq treewide: replace AUTORELEASE with real PKG_RELEASE 2023-05-18 11:35:29 +02:00
uboot-layerscape package: layerscape: change loadaddr address 2023-05-28 20:22:23 +02:00
uboot-mediatek uboot-mediatek: add Netcore N60 support 2024-03-29 22:53:53 +01:00
uboot-mvebu uboot-mvebu: armada 388 clearfog: support additional ddr configurations 2023-10-22 10:52:40 +02:00
uboot-mxs mxs: rework image generation 2023-06-30 19:24:52 +02:00
uboot-omap treewide: replace AUTORELEASE with real PKG_RELEASE 2023-05-18 11:35:29 +02:00
uboot-oxnas treewide: replace AUTORELEASE with real PKG_RELEASE 2023-05-18 11:35:29 +02:00
uboot-rockchip uboot-rockchip: add Radxa E25 board support 2024-03-23 07:55:43 +01:00
uboot-sifiveu uboot-sifiveu: use intree dtc explicitly 2023-11-26 19:44:56 +01:00
uboot-sunxi sunxi: add support for Orange Pi Zero 3 2024-03-26 21:56:57 +01:00
uboot-tegra treewide: replace AUTORELEASE with real PKG_RELEASE 2023-05-18 11:35:29 +02:00
uboot-zynq uboot-zynq: build with zynq generic subtarget 2022-12-25 11:55:53 +01:00