diff options
author | Roger Pueyo Centelles <roger.pueyo@guifi.net> | 2020-02-28 16:01:02 +0100 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-03-17 11:50:47 +0100 |
commit | a66eee63368eb5625b359244bfffc9b9eb921875 (patch) | |
tree | 6a76e6a9d54527f8a41b41fa80fbc40d30a240ee /target/linux/ath79/mikrotik/base-files/etc | |
parent | b78f61c336542a3658c3b1c595b3bb2810f93500 (diff) | |
download | upstream-a66eee63368eb5625b359244bfffc9b9eb921875.tar.gz upstream-a66eee63368eb5625b359244bfffc9b9eb921875.tar.bz2 upstream-a66eee63368eb5625b359244bfffc9b9eb921875.zip |
ath79: add mikrotik subtarget
This commit creates the ath79/mikrotik subtarget in order to support
MikroTik devices based on Qualcomm Atheros MIPS SoCs.
MikroTik devices need a couple of specific features: the split MiNOR
firmware MTD format, which is not used by other devices, and the 4k
sector erase size on SPI NOR storage, which can not be added to the
ath79/generic and ath79/nand subtargets now.
Additionally, the commit moves the two MikroTik devices already in
the generic and nand subtargets to this new one.
Tested on the RB922 board and the wAP AC router.
Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Diffstat (limited to 'target/linux/ath79/mikrotik/base-files/etc')
4 files changed, 106 insertions, 0 deletions
diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network new file mode 100644 index 0000000000..ee795c7496 --- /dev/null +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -0,0 +1,39 @@ +#!/bin/sh + +. /lib/functions/system.sh +. /lib/functions/uci-defaults.sh + +ath79_setup_interfaces() +{ + local board="$1" + + case "$board" in + mikrotik,routerboard-922uags-5hpacd|\ + mikrotik,routerboard-wap-g-5hact2hnd) + ucidef_set_interface_lan "eth0" + ;; + *) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ;; + esac +} + +ath79_setup_macs() +{ + local board="$1" + + case "$board" in + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac + [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac +} + +board_config_update +board=$(board_name) +ath79_setup_interfaces $board +ath79_setup_macs $board +board_config_flush + +exit 0 diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom new file mode 100644 index 0000000000..f5f88484b5 --- /dev/null +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -0,0 +1,22 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh +. /lib/functions/mikrotik-caldata.sh + +board=$(board_name) + +case "$FIRMWARE" in +"ath9k-eeprom-ahb-18100000.wmac.bin") + case $board in + mikrotik,routerboard-wap-g-5hact2hnd) + mikrotik_caldata_extract "art" 0x1000 0x440 + ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x10) +2) + ;; + *) + caldata_die "board $board is not supported yet" + ;; + esac + ;; +esac diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata new file mode 100644 index 0000000000..6eb9a93b75 --- /dev/null +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -0,0 +1,28 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh +. /lib/functions/mikrotik-caldata.sh + +board=$(board_name) + +case "$FIRMWARE" in +"ath10k/cal-pci-0000:00:00.0.bin") + case $board in + mikrotik,routerboard-wap-g-5hact2hnd) + mikrotik_caldata_extract "art" 0x5000 0x844 + ;; + esac + ;; +"ath10k/cal-pci-0000:01:00.0.bin") + case $board in + mikrotik,routerboard-922uags-5hpacd) + mikrotik_caldata_extract "art" 0x5000 0x844 + ;; + esac + ;; +*) + exit 1 + ;; +esac diff --git a/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration new file mode 100644 index 0000000000..1a7b371a99 --- /dev/null +++ b/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration @@ -0,0 +1,17 @@ +#!/bin/sh + +. /lib/functions.sh +. /lib/functions/migrations.sh + +board=$(board_name) +boardonly="${board##*,}" + +case "$board" in +mikrotik,*) + migrate_leds "^rb:=mikrotik:" + ;; +esac + +migrations_apply system + +exit 0 |