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

60 lines
1.3 KiB
Plaintext
Raw Normal View History

#
# Copyright (C) 2016 LEDE
#
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
board=$(board_name)
ubootenv_mtdinfo () {
UBOOTENV_PART=$(cat /proc/mtd | grep APPSBLENV)
mtd_dev=$(echo $UBOOTENV_PART | awk '{print $1}' | sed 's/:$//')
mtd_size=$(echo $UBOOTENV_PART | awk '{print "0x"$2}')
mtd_erase=$(echo $UBOOTENV_PART | awk '{print "0x"$3}')
nor_flash=$(find /sys/bus/spi/devices/*/mtd -name ${mtd_dev})
if [ -n "$nor_flash" ]; then
ubootenv_size=$mtd_size
else
# size is fixed to 0x40000 in u-boot
ubootenv_size=0x40000
fi
sectors=$(( $ubootenv_size / $mtd_erase ))
echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
}
case "$board" in
ipq806x: add support for Askey RT4230W REV6 This adds support for the Askey RT4230W REV6 (Branded by Spectrum/Charter as RAC2V1K) At this time, there's no way to reinstall the stock firmware so don't install this on a router that's being rented. Specifications: Qualcomm IPQ8065 1 GB of RAM (DDR3) 512 MB Flash (NAND) 2x Wave 2 WiFi cards (QCA9984) 5x 10/100/1000 Mbps Ethernet (Switch: QCA8337) 1x LED (Controlled by a microcontroller that switches it between red and blue with different patterns) 1x USB 3.0 Type-A 12V DC Power Input UART header on PCB - pinout from top to bottom is RX, TX, GND, 5V Port settings are 115200n8 More information: https://forum.openwrt.org/t/askey-rac2v1k-support/15830 https://deviwiki.com/wiki/Askey_RAC2V1K To check what revision your router is, restore one of these config backups through the stock firmware to get ssh access then run "cat /proc/device-tree/model". https://forum.openwrt.org/t/askey-rac2v1k-support/15830/17 The revision number on the board doesn't seem to be very consistent so that's why this is needed. You can also run printenv in the uboot console and if machid is set to 177d, that means your router is rev6. Note: Don't install this if the router is being rented from an ISP. The defined partition layout is different from the OEM one and even if you changed the layout to match, backing up and restoring the OEM firmware breaks /overlay so nothing will save and the router will likely enter a bootloop. How to install: Method 1: Install without opening the case using SSH and tftp You'll need: RAC2V1K-SSH.zip: https://github.com/lmore377/openwrt-rt4230w/blob/master/RAC2V1K-SSH.zip initramfs and sysupgrade images Connect to one of the router's LAN ports Download the RAC2V1K-SSH.zip file and restore the config file that corresponds to your router's firmware (If you're firmware is newer than what's in the zip file, just restore the 1.1.16 file) After a reboot, you should be able to ssh into the router with username: "4230w" and password: "linuxbox" or "admin". Run the following commannds fw_setenv ipaddr 10.42.0.10 #IP of router, can be anything as long as it's in the same subnet as the server fw_setenv serverip 10.42.0.1# #IP of tftp server that's set up in next steps fw_setenv bootdelay 8 fw_setenv bootcmd "tftpboot initramfs.bin; bootm; bootipq" Don't reboot the router yet. Install and set up a tftp server on your computer Set a static ip on the ethernet interface of your computer (use this for serverip in the above commands) Rename the initramfs image to initramfs.bin, and host it with the tftp server Reboot the router. If you set up everything right, the router led should switch over to a slow blue glow which means openwrt is booted. If for some reason the file doesn't get loaded into ram properly, it should still boot to the OEM firmware. After openwrt boots, ssh into it and run these commands: fw_setenv bootcmd "setenv mtdids nand0=nand0 && setenv mtdparts mtdparts=nand0:0x1A000000@0x2400000(firmware) && ubi part firmware && ubi read 0x44000000 kernel 0x6e0000 && bootm" fw_setenv bootdelay 2 After openwrt boots up, figure out a way to get the sysupgrade file onto it (scp, custom build with usb kernel module included, wget, etc.) then flash it with sysupgrade. After it finishes flashing, it should reboot, the light should start flashing blue, then when the light starts "breathing" blue that means openwrt is booted. Method 2: Install with serial access (Do this if something fails and you can't boot after using method 1) You'll need: initramfs and sysupgrade images Serial access: https://openwrt.org/inbox/toh/askey/askey_rt4230w_rev6#opening_the_case Install and set up a tftp server Set a static ip on the ethernet interface of your computer Download the initramfs image, rename it to initramfs.bin, and host it with the tftp server Connect the wan port of the router to your computer Interrupt U-Boot and run these commands: setenv serverip 10.42.0.1 (You can use whatever ip you set for the computer) setenv ipaddr 10.42.0.10 (Can be any ip as long as it's in the same subnet) setenv bootcmd "setenv mtdids nand0=nand0 && set mtdparts mtdparts=nand0:0x1A000000@0x2400000(firmware) && ubi part firmware && ubi read 0x44000000 kernel 0x6e0000 && bootm" saveenv tftpboot initramfs.bin bootm After openwrt boots up, figure out a way to get the sysupgrade file onto it (scp, custom build with usb kernel module included, wget, etc.) then flash it with sysupgrade. After it finishes flashing, it should reboot, the light should start flashing blue, then when the light starts "breathing" blue that means openwrt is booted. Signed-off-by: Lauro Moreno <lmore377@gmail.com> [add entry in 5.10 patch, fix whitespace issues] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-28 21:59:47 +01:00
askey,rt4230w-rev6)
ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x40000" "0x20000"
;;
ipq806x: add Edgecore ECW5410 support This patch adds support for the Edgecore ECW5410 indoor AP. Specification: - SoC: Qualcomm Atheros IPQ8068 ARMv7 2x Cortex A-15 - RAM: 256MB(225 usable) DDR3 - NOR Flash: 16MB SPI NOR - NAND Flash: 128MB S34MS01G2 Parallel NAND - Ethernet: 2 x 1G via 2x AR8033 PHY-s connected directly to GMAC2 and GMAC3 via SGMII (802.3af POE IN on eth0) - USB: 1 x USB 3.0 SuperSpeed - WLAN: 2x QCA9994 AC Wawe 2 (1x 2GHz bgn, 1x 5GHz acn) - CC2540 BLE - UART console on RJ45 next to ethernet ports exposed. Its Cisco pin compatible, 115200 8n1 baud. Installation instructions: Through stock firmware or initramfs. 1.Connect to console 2. Login with root account, if password is unknown then interrupt the boot with f and reset it in failsafe. 3. Transfer factory image 4. Flash the image with ubiformat /dev/mtd1 -y -f <your factory image path> This will replace the rootfs2 with OpenWrt, if you are currently running from rootfs2 then simply change /dev/mtd1 to /dev/mtd0 Note Initramfs: 1. Connect to console 2. Transfer the image from TFTP server with tftpboot, or by using DHCP advertised image with dhcp command. 3. bootm 4. Run ubiformat /dev/mtd1 You need to interrupt the bootloader after rebooting and run: run altbootcmd This will switch your active rootfs partition to one you wrote to and boot from it. So if rootfs1 is active, then it will change it to rootfs2. This will format the rootfs2 partition, if your active partition is 2 then simply change /dev/mtd1 with /dev/mtd0 If you dont format the partition you will be writing too, then sysupgrade will find existing UBI rootfs and kernel volumes and update those. This will result in wrong ordering and OpenWrt will panic on boot. 5. Transfer sysupgrade image 6. Flash with sysupgrade -n. Note that sysupgrade will write the image to rootfs partition that is not currently in use. Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2020-09-07 12:43:37 +02:00
edgecore,ecw5410)
ubootenv_add_uci_config "/dev/mtd11" "0x0" "0x10000" "0x10000"
;;
linksys,ea7500-v1|\
linksys,ea8500)
ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x20000" "0x20000"
;;
netgear,r7800)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x040000" "0x20000"
;;
qcom,ipq8064-ap148|\
qcom,ipq8064-db149)
ubootenv_add_uci_config $(ubootenv_mtdinfo)
;;
ubnt,unifi-ac-hd|\
zyxel,nbg6817)
ubootenv_add_uci_config "/dev/mtdblock9" "0x0" "0x10000" "0x10000"
;;
esac
config_load ubootenv
config_foreach ubootenv_add_app_config ubootenv
exit 0