Root/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom

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

Archive Download this file



interactive