2011-07-03 15:02:01 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
rt2x00_eeprom_die() {
|
|
|
|
echo "rt2x00 eeprom: " "$*"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
rt2x00_eeprom_extract() {
|
|
|
|
local part=$1
|
|
|
|
local offset=$2
|
|
|
|
local count=$3
|
|
|
|
local mtd
|
|
|
|
|
2012-12-19 16:07:50 +00:00
|
|
|
. /lib/functions.sh
|
2011-07-03 15:02:01 +00:00
|
|
|
|
|
|
|
mtd=$(find_mtd_part $part)
|
|
|
|
[ -n "$mtd" ] || \
|
|
|
|
rt2x00_eeprom_die "no mtd device found for partition $part"
|
|
|
|
|
2012-05-27 17:09:50 +00:00
|
|
|
dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
2011-07-03 15:02:01 +00:00
|
|
|
rt2x00_eeprom_die "failed to extract from $mtd"
|
|
|
|
}
|
|
|
|
|
2013-11-25 08:34:55 +00:00
|
|
|
FW="/lib/firmware/$FIRMWARE"
|
|
|
|
[ -e "$FW" ] && exit 0
|
2011-07-03 15:02:01 +00:00
|
|
|
|
2012-02-14 17:32:45 +00:00
|
|
|
. /lib/ramips.sh
|
|
|
|
|
|
|
|
board=$(ramips_board_name)
|
|
|
|
|
2011-07-03 15:02:01 +00:00
|
|
|
case "$FIRMWARE" in
|
2012-12-22 16:09:03 +00:00
|
|
|
"soc_wmac.eeprom")
|
2011-07-03 15:02:01 +00:00
|
|
|
case $board in
|
|
|
|
*)
|
2014-07-17 10:55:31 +00:00
|
|
|
rt2x00_eeprom_die "Please define mtd-eeprom in $board DTS file!"
|
2011-07-03 15:02:01 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2012-02-14 17:32:45 +00:00
|
|
|
|
|
|
|
"rt2x00pci_1_0.eeprom")
|
|
|
|
case $board in
|
2014-06-02 12:42:52 +00:00
|
|
|
cy-swr1100)
|
|
|
|
rt2x00_eeprom_extract "factory" 8192 512
|
|
|
|
;;
|
2015-01-08 20:26:02 +00:00
|
|
|
br-6475nd | rt-n56u | whr-600d | whr-1166d)
|
2013-06-30 21:03:48 +00:00
|
|
|
rt2x00_eeprom_extract "factory" 32768 512
|
2012-02-14 17:32:45 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2011-08-19 15:55:07 +00:00
|
|
|
esac
|