| 1 | #!/bin/sh |
| 2 | |
| 3 | rt2x00_eeprom_die() { |
| 4 | echo "rt2x00 eeprom: " "$*" |
| 5 | exit 1 |
| 6 | } |
| 7 | |
| 8 | rt2x00_eeprom_extract() { |
| 9 | local part=$1 |
| 10 | local offset=$2 |
| 11 | local count=$3 |
| 12 | local mtd |
| 13 | |
| 14 | . /etc/functions.sh |
| 15 | |
| 16 | mtd=$(find_mtd_part $part) |
| 17 | [ -n "$mtd" ] || \ |
| 18 | rt2x00_eeprom_die "no mtd device found for partition $part" |
| 19 | |
| 20 | dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ |
| 21 | rt2x00_eeprom_die "failed to extract from $mtd" |
| 22 | } |
| 23 | |
| 24 | [ -e /lib/firmware/$FIRMWARE ] && exit 0 |
| 25 | |
| 26 | . /lib/ramips.sh |
| 27 | |
| 28 | board=$(ramips_board_name) |
| 29 | |
| 30 | case "$FIRMWARE" in |
| 31 | "RT288X.eeprom" | \ |
| 32 | "RT305X.eeprom" | \ |
| 33 | "RT3883.eeprom") |
| 34 | case $board in |
| 35 | dir-300-b1 | \ |
| 36 | dir-600-b1 | \ |
| 37 | dir-600-b2) |
| 38 | rt2x00_eeprom_extract "devdata" 16384 272 |
| 39 | ;; |
| 40 | |
| 41 | dap-1350) |
| 42 | rt2x00_eeprom_extract "devdata" 0 272 |
| 43 | ;; |
| 44 | |
| 45 | rt-n10-plus | \ |
| 46 | rt-g32-b1) |
| 47 | rt2x00_eeprom_extract "devconf" 0 272 |
| 48 | ;; |
| 49 | |
| 50 | f5d8235-v1 | \ |
| 51 | f5d8235-v2) |
| 52 | rt2x00_eeprom_extract "u-boot" 262144 272 |
| 53 | ;; |
| 54 | |
| 55 | 3g-6200n | \ |
| 56 | all0239-3g | \ |
| 57 | all0256n | \ |
| 58 | all5002 | \ |
| 59 | argus-atp52b | \ |
| 60 | bc2 | \ |
| 61 | carambola | \ |
| 62 | dir-615-h1 | \ |
| 63 | dir-620-a1 | \ |
| 64 | esr-9753 | \ |
| 65 | fonera20n | \ |
| 66 | freestation5 | \ |
| 67 | hw550-3g | \ |
| 68 | mofi3500-3gn | \ |
| 69 | pwh2004 | \ |
| 70 | nbg-419n | \ |
| 71 | nw718 | \ |
| 72 | omni-emb | \ |
| 73 | psr-680w | \ |
| 74 | rt-n15 | \ |
| 75 | rt-n56u | \ |
| 76 | sl-r7205 | \ |
| 77 | v11st-fe | \ |
| 78 | v22rw-2x2 | \ |
| 79 | w306r-v20 | \ |
| 80 | w502u | \ |
| 81 | wcr-150gn | \ |
| 82 | whr-g300n | \ |
| 83 | wl-330n | \ |
| 84 | wl-330n3g | \ |
| 85 | wl-351 | \ |
| 86 | wli-tx4-ag300n | \ |
| 87 | wr512-3gn | \ |
| 88 | wr6202 | \ |
| 89 | ur-336un | \ |
| 90 | xdxrn502j) |
| 91 | rt2x00_eeprom_extract "factory" 0 272 |
| 92 | ;; |
| 93 | |
| 94 | wl341v3) |
| 95 | rt2x00_eeprom_extract "board-nvram" 64880 272 |
| 96 | ;; |
| 97 | |
| 98 | *) |
| 99 | rt2x00_eeprom_die "board $board is not supported yet" |
| 100 | ;; |
| 101 | esac |
| 102 | ;; |
| 103 | |
| 104 | "rt2x00pci_1_0.eeprom") |
| 105 | case $board in |
| 106 | rt-n56u) |
| 107 | rt2x00_eeprom_extract "factory" 32768 272 |
| 108 | ;; |
| 109 | esac |
| 110 | ;; |
| 111 | esac |
| 112 | |