1#!/bin/sh 2# Based on gabors ralink wisoc implementation. 3 4rt2x00_eeprom_die() { 5 echo "rt2x00 eeprom: " "$*" 6 exit 1 7} 8 9rt2x00_eeprom_extract() { 10 local part=$1 11 local offset=$2 12 local count=$3 13 local mtd 14 15 . /lib/functions.sh 16 17 mtd=$(find_mtd_part $part) 18 [ -n "$mtd" ] || \ 19 rt2x00_eeprom_die "no mtd device found for partition $part" 20 21 dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count || \ 22 rt2x00_eeprom_die "failed to extract from $mtd" 23} 24 25[ -e /lib/firmware/$FIRMWARE ] && exit 0 26 27. /lib/brcm63xx.sh 28 29board=$(brcm63xx_board_name) 30 31case "$FIRMWARE" in 32"rt2x00.eeprom" ) 33 case $board in 34 hg556a_c) 35 rt2x00_eeprom_extract "cal_data" 130560 512 36 ;; 37 hg622 |\ 38 hg655b) 39 rt2x00_eeprom_extract "cal_data" 0 512 40 ;; 41 *) 42 rt2x00_eeprom_die "board $board is not supported yet" 43 ;; 44 esac 45 ;; 46esac 47