You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.8 KiB
Plaintext

#!/bin/sh
#
# Copyright (C) 2011-2015 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
. /lib/functions/lantiq.sh
board_config_update
annex="a"
lan_mac=""
wan_mac=""
board=$(board_name)
case "$board" in
alphanetworks,asl56026)
7 years ago
lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
wan_mac=$(mtd_get_mac_ascii uboot_env wanmac)
ucidef_add_switch "switch0"\
"2:lan" "3:lan" "6t@eth0"
;;
arcadyan,arv7519rw22)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x16)" 1)
ucidef_add_switch "switch0" \
"0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0"
;;
arcadyan,vg3503j)
lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
wan_mac=$(macaddr_add "$lan_mac" 1)
ucidef_add_switch "switch0" \
"2:lan:2" "4:lan:1" "6t@eth0"
;;
arcadyan,vgv7510kw22-brn|\
arcadyan,vgv7510kw22-nor)
annex="b"
wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2)
ucidef_add_switch "switch0" \
"2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0"
;;
arcadyan,vgv7519-brn|\
arcadyan,vgv7519-nor)
wan_mac=$(mtd_get_mac_binary board_config 0x16)
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
;;
lantiq: complete AVM FRITZ!Box 3370 support Rename the image and use a compatible string which indicates that only hardware revision 2 and higher is supported. It allows to use the wireless LED, as HWRev 1 uses GPIO#39 for the wireless LED and starting with HWRev 2 GPIO#35 is used for the wireless LED and GPIO#39 for IFX_GPIO_MODULE_EXTPHY_MDIO. The HWREV can be checked by connecting to the fritzbox right after power on via ftp: ftp> quote GETENV HWSubRevision Within the same HW revision 5 of the Fritz!Box 3370 different NAND flash chips are used. Usually it isn't a big deal but depending on the used NAND flash chip, the ECC calculation is done different (and incompatible of course). Boards with a Micron MT29F1G08ABADA NAND flash chip are using the NAND chip to calculate the ECC (on-die). Boards with a Hynix HY27UF081G2M NAND flash chip are doing the ECC calculation in software. Supporting both with a single DTS isn't possible. It might be possible to add a patch selecting the ECC mode dynamicaly based on the found NAND flash chip. But such a patch has no chance to get accepted upstream and most likely need to be touched with every kernel update. Instead two images are created. One for Micron NAND flash chip and one for Hynix NAND flash chip. So far no pattern is known to identify the used flash chip without opening the box. Add the power off GPIO. At least EVA version 2186 sets/keeps the GPIO as input, which will cause a reboot 30sec after power on. For boards with EVA version 2186 the installation is tricky as it has to be finished within the 30sec time frame. The EVA version can be checked by connecting to the fritzbox right after power on via ftp: ftp> quote GETENV urlader-version The ath9k eeprom/caldata is at a different and offset and stored in reverse order (from the last byte to the beginning) on the flash. Reverse the bits to bring the data into the format expected by the ath9k driver. Since the ath9k eeprom is stored in reverse order on flash, we can not use the mac address from the on flash eeprom. Get the MAC address from the tffs instead. Within the same HW revision 5 of the Fritz!Box 3370 both version of the vr9 SoC are used. During preparation of kernel 4.14 support, all devicetree source files were changed to load the vr9 v1.1 and vr9 v1.2 gphy firmware, which fixed the embedded phys for boards using the version 1.2 of the vr9 SoC. While at it, add a trigger to make use of the LAN LED. Setup the build-in switch and add a hint for LuCI two show the ports in order matching the labels on the case Add support for the second USB port and provide the volatage GPIOs. Use GPIO#21 as PCIe reset pin. The lan led is connected to GPIO#38. Name the rootfs partition ubi and remove the mtd/rootfs related kernel bootargs to use the OpenWrt autoprobing based on the partition name. Enable sysupgrade support to allow an upgrade from a running system. Since sysupgrade wasn't supported till now, drop image build code which was added to allow a sysupgrade from earlier OpenWrt versions. Build images that allow an (initial) installation via EVA bootloader. To install OpenWrt via Eva bootloader, within the first seconds after power on a ftp connection need to be established to the FRITZ!Box at 192.168.178.1 and the the following ftp commands need to be run: ftp> quote USER adam2 ftp> quote PASS adam2 ftp> binary ftp> debug ftp> passive ftp> quote SETENV linux_fs_start 0 ftp> quote MEDIA FLSH ftp> put /path/to/openwrt-lantiq-xrx200-FRITZ3370-eva-kernel.bin mtd1 ftp> put /path/to/openwrt-lantiq-xrx200-FRITZ3370-eva-filesystem.bin mtd0 Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
avm,fritz3370-rev2-hynix|\
avm,fritz3370-rev2-micron)
annex="b"
lantiq: complete AVM FRITZ!Box 3370 support Rename the image and use a compatible string which indicates that only hardware revision 2 and higher is supported. It allows to use the wireless LED, as HWRev 1 uses GPIO#39 for the wireless LED and starting with HWRev 2 GPIO#35 is used for the wireless LED and GPIO#39 for IFX_GPIO_MODULE_EXTPHY_MDIO. The HWREV can be checked by connecting to the fritzbox right after power on via ftp: ftp> quote GETENV HWSubRevision Within the same HW revision 5 of the Fritz!Box 3370 different NAND flash chips are used. Usually it isn't a big deal but depending on the used NAND flash chip, the ECC calculation is done different (and incompatible of course). Boards with a Micron MT29F1G08ABADA NAND flash chip are using the NAND chip to calculate the ECC (on-die). Boards with a Hynix HY27UF081G2M NAND flash chip are doing the ECC calculation in software. Supporting both with a single DTS isn't possible. It might be possible to add a patch selecting the ECC mode dynamicaly based on the found NAND flash chip. But such a patch has no chance to get accepted upstream and most likely need to be touched with every kernel update. Instead two images are created. One for Micron NAND flash chip and one for Hynix NAND flash chip. So far no pattern is known to identify the used flash chip without opening the box. Add the power off GPIO. At least EVA version 2186 sets/keeps the GPIO as input, which will cause a reboot 30sec after power on. For boards with EVA version 2186 the installation is tricky as it has to be finished within the 30sec time frame. The EVA version can be checked by connecting to the fritzbox right after power on via ftp: ftp> quote GETENV urlader-version The ath9k eeprom/caldata is at a different and offset and stored in reverse order (from the last byte to the beginning) on the flash. Reverse the bits to bring the data into the format expected by the ath9k driver. Since the ath9k eeprom is stored in reverse order on flash, we can not use the mac address from the on flash eeprom. Get the MAC address from the tffs instead. Within the same HW revision 5 of the Fritz!Box 3370 both version of the vr9 SoC are used. During preparation of kernel 4.14 support, all devicetree source files were changed to load the vr9 v1.1 and vr9 v1.2 gphy firmware, which fixed the embedded phys for boards using the version 1.2 of the vr9 SoC. While at it, add a trigger to make use of the LAN LED. Setup the build-in switch and add a hint for LuCI two show the ports in order matching the labels on the case Add support for the second USB port and provide the volatage GPIOs. Use GPIO#21 as PCIe reset pin. The lan led is connected to GPIO#38. Name the rootfs partition ubi and remove the mtd/rootfs related kernel bootargs to use the OpenWrt autoprobing based on the partition name. Enable sysupgrade support to allow an upgrade from a running system. Since sysupgrade wasn't supported till now, drop image build code which was added to allow a sysupgrade from earlier OpenWrt versions. Build images that allow an (initial) installation via EVA bootloader. To install OpenWrt via Eva bootloader, within the first seconds after power on a ftp connection need to be established to the FRITZ!Box at 192.168.178.1 and the the following ftp commands need to be run: ftp> quote USER adam2 ftp> quote PASS adam2 ftp> binary ftp> debug ftp> passive ftp> quote SETENV linux_fs_start 0 ftp> quote MEDIA FLSH ftp> put /path/to/openwrt-lantiq-xrx200-FRITZ3370-eva-kernel.bin mtd1 ftp> put /path/to/openwrt-lantiq-xrx200-FRITZ3370-eva-filesystem.bin mtd0 Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
wan_mac=$(macaddr_add "$lan_mac" 3)
ucidef_add_switch "switch0" \
"0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
;;
avm,fritz7360sl)
annex="b"
wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1)
ucidef_add_switch "switch0" \
"0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
;;
avm,fritz7362sl)
annex="b"
lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
wan_mac=$(fritz_tffs -n macdsl -i $(find_mtd_part "tffs (1)"))
ucidef_add_switch "switch0" \
"0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
;;
lantiq: add support for AVM FRITZ!Box 7412 Hardware: SoC: Lantiq VRX 220 CPU Cores: 2x MIPS 34Kc at 500 MHz RAM: 128 MiB 250 MHz Storage: 128 MiB NAND flash Ethernet: built-in Fast Ethernet switch, only port 2 is used Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas Modem: built-in A/VDSL2 modem DECT: Dialog SC14441 LEDs: 1 two-color, 4 one-color Buttons: 2 FXS: 1 port via TAE or RJ12 connector Everything except FXS/DECT works (no drivers for AVM's FXS implementation with SC14441). Installation: Use the eva_ramboot.py script to load an initramfs image on the device. Run it a few seconds after turning the device on. $ scripts/flashing eva_ramboot 192.168.178.1 bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7412-initramfs-kernel.bin If it fails to find the device try the ip address 169.254.120.1. (Firmware updates or the recovery tool apparently change it.) IMPORTANT: set lzma compression in ramdisk options, bootloader stalls when receiving uncompressed images. The device will load it in ram and boot it. You can reach it under the openwrt default ip address 192.168.1.1. Check if the key linux_fs_start is not set to 1 in tffs: $ fritz_tffs_nand -d /dev/mtd1 -n linux_fs_start If it is set to 1, the bootloader will select the wrong set of partitions. Restart the box and install an FritzOS upgrade or do a recovery. Afterwards start again at step 1. Run sysupgrade to persistently install OpenWRT. Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.de> Signed-off-by: Andy Binder <AndyBinder@gmx.de>
5 years ago
avm,fritz7412)
tffsdev=$(find_mtd_chardev "nand-tffs")
annex="b"
lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca -o)
wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o)
lantiq: add support for AVM FRITZ!Box 7412 Hardware: SoC: Lantiq VRX 220 CPU Cores: 2x MIPS 34Kc at 500 MHz RAM: 128 MiB 250 MHz Storage: 128 MiB NAND flash Ethernet: built-in Fast Ethernet switch, only port 2 is used Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas Modem: built-in A/VDSL2 modem DECT: Dialog SC14441 LEDs: 1 two-color, 4 one-color Buttons: 2 FXS: 1 port via TAE or RJ12 connector Everything except FXS/DECT works (no drivers for AVM's FXS implementation with SC14441). Installation: Use the eva_ramboot.py script to load an initramfs image on the device. Run it a few seconds after turning the device on. $ scripts/flashing eva_ramboot 192.168.178.1 bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7412-initramfs-kernel.bin If it fails to find the device try the ip address 169.254.120.1. (Firmware updates or the recovery tool apparently change it.) IMPORTANT: set lzma compression in ramdisk options, bootloader stalls when receiving uncompressed images. The device will load it in ram and boot it. You can reach it under the openwrt default ip address 192.168.1.1. Check if the key linux_fs_start is not set to 1 in tffs: $ fritz_tffs_nand -d /dev/mtd1 -n linux_fs_start If it is set to 1, the bootloader will select the wrong set of partitions. Restart the box and install an FritzOS upgrade or do a recovery. Afterwards start again at step 1. Run sysupgrade to persistently install OpenWRT. Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.de> Signed-off-by: Andy Binder <AndyBinder@gmx.de>
5 years ago
ucidef_set_interface_lan 'eth0'
;;
bt,homehub-v5a)
lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c)
wan_mac=$(macaddr_add "$lan_mac" 1)
ucidef_add_switch "switch0" \
"0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
;;
buffalo,wbmr-300hpd)
lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
wan_mac="$lan_mac"
ucidef_add_switch "switch0" \
"5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0"
;;
lantiq,easy80920-nand|\
lantiq,easy80920-nor)
lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
wan_mac=$(macaddr_add "$lan_mac" 1)
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
;;
netgear,dm200)
lan_mac=$(mtd_get_mac_binary ART 0x0)
wan_mac=$(macaddr_add "$lan_mac" 1)
ucidef_set_interface_lan 'eth0'
;;
tplink,tdw8970|\
tplink,tdw8980)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1)
ucidef_add_switch "switch0" \
"0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0"
;;
tplink,vr200|\
tplink,vr200v)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 0xf100)" 1)
ucidef_add_switch "switch0" \
"0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0"
;;
zyxel,p-2812hnu-f1|\
zyxel,p-2812hnu-f3)
lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
wan_mac=$(macaddr_add "$lan_mac" 1)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0"
;;
*)
ucidef_set_interface_lan 'eth0'
;;
esac
ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
if lantiq_is_vdsl_system; then
ucidef_add_vdsl_modem "$annex" "av"
else
ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
fi
ucidef_set_interface_wan "dsl0" "pppoe"
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
board_config_flush
exit 0