openwrt/package/boot/uboot-envtools/files/apm821xx

36 lines
887 B
Plaintext
Raw Normal View History

[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
meraki,mr24)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4"
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x4000" "4"
;;
meraki,mx60)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "4"
;;
apm821xx: add support for the Netgear WNDAP620 and WNDAP660 This patch adds support for the Netgear WNDAP620 and WNDAP660, they are similar devices, but due to the LAN LED configuration, the switch setup and WIFI configuration each gets a different device target. Hardware Highlights WNDAP620: CPU: AMCC PowerPC APM82181 at 1000 MHz DRAM: 128 MB, 2 x 64 MiB DDR2 Hynix H5PS5162GF CPU: AMCC PowerPC APM82181 at 1000 MHz FLASH: 32 MiB, NAND SLC, Hynix HY27US08561A Ethernet: RealTek RTL8363SB 2x2-Port Switch PHY - Only 1 GBit Port (POE) Wifi: Atheros AR9380 minipcie - Dual-Band - 3x3:3 Serial: console port with RJ45 Interface (9600-N-8-1) LEDS: Power, LAN-Activity, dual color LAN-Linkspeed, 2.4GHz, 5GHz LEDs Button: Soft Reset Button Antennae: 3 internal dual-band antennae + 3 x RSMA for external antennaes Hardware Highlights WNDAP660: CPU: AMCC PowerPC APM82181 at 1000 MHz + 2 Heatsinks DRAM: 256 MB, 2 x 128 MiB DDR2 FLASH: 32 MiB, NAND SLC, Hynix HY27US08561A Ethernet: RealTek RTL8363SB 2x2-Port Switch PHY (POE) Wifi1: Atheros AR9380 minipcie - Dual-Band - 3x3:3 Wifi2: Atheros AR9380 minipcie - Dual-Band - 3x3:3 Serial: console port with RJ45 Interface (9600-N-8-1) LEDS: Power, LAN-Activity, 2x dual color LAN-Linkspeed, 2.4GHz, 5GHz LEDs Button: Soft Reset Button Antennae: 6 internal dual-band antennae + 3 x RSMA for external antennaes Flashing requirements: - needs a tftp server at 192.168.1.10/serverip. - special 8P8C(aka RJ45)<->D-SUB9 Console Cable ("Cisco Console Cable"). Note: Both WNDAP6x0 have a MAX3232 transceivers, hence no need for any separate CMOS/TTL level shifters. External Antenna: The antennae mux is controlled by GPIO 11 and GPIO14. Valid Configurations: = Config# = | = GPIO 11 = | = GPIO 14 = | ===== Description ===== 1. | 1 / High | 0 / Low | Use the internal antennae (default) 2. | 0 / Low | 1 / High | Use the external antennae The external antennaes are only meant for the 2.4 GHz band. One-way Flashing instructions via u-boot: 0. connect the serial cable to the RJ45 Console Port Note: This requires a poper RS232 and not a TTL/USB adaptor. 1. power up the AP and interrupt the u-boot process at 'Hit any key to stop autoboot' 2. setup serverip and ipaddr env settings Enter the following commands into the u-boot shell # setenv ipaddr 192.168.1.1 # setenv serverip 192.168.1.10 3. download the factory.img image to the AP Enter the following commands into the u-boot shell # tftp ${kernel_addr_r} openwrt-apm821xx-nand-netgear_wndap660-squashfs-factory.img 4. verfiy image integrity Enter the following commands into the u-boot shell # crc32 $fileaddr $filesize If the calculated crc32 checksum does not match, go back to step 3. 5. flash the image Enter the following commands into the u-boot shell # nand erase 0x110000 0x1bd0000 # nand write ${kernel_addr_r} 0x110000 ${filesize} 6. setup uboot environment Enter the following commands into the u-boot shell # setenv bootargs # setenv fileaddr # setenv filesize # setenv addroot 'setenv bootargs ${bootargs} root=/dev/ubiblock0_0' # setenv owrt_boot 'nboot ${kernel_addr_r} nand0 0x110000; run addroot; run addtty; bootm ${kernel_addr_r}' # setenv bootcmd 'run owrt_boot' # saveenv 7. boot # run bootcmd Booting initramfs instructions via u-boot: Follow steps 0 - 2 from above. 3. boot initramfs Enter the following commands into the u-boot shell # tftp ${kernel_addr_r} openwrt-apm821xx-nand-netgear_wndap660-initramfs-kernel.bin # run addtty # bootm ${kernel_addr_r} Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2018-10-17 20:37:38 +00:00
netgear,wndap620|\
netgear,wndap660)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4"
;;
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-03-23 10:26:23 +00:00
netgear,wndr4700)
ubootenv_add_uci_config "/dev/mtd0" "0x40000" "0x20000" "0x20000" "1"
ubootenv_add_uci_config "/dev/mtd0" "0x60000" "0x20000" "0x20000" "1"
;;
wd,mybooklive)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" "1"
ubootenv_add_uci_config "/dev/mtd1" "0x1000" "0x1000" "0x1000" "1"
;;
esac
config_load ubootenv
config_foreach ubootenv_add_app_config ubootenv
exit 0