Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

10-rt2x00-eeprom

By: a guest on Apr 17th, 2012  |  syntax: Bash  |  size: 1.17 KB  |  hits: 94  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2. # based on gabors ralink wisoc implementation
  3.  
  4. rt2x00_eeprom_die() {
  5.         echo "rt2x00 eeprom: " "$*"
  6.         exit 1
  7. }
  8.  
  9. rt2x00_eeprom_extract() {
  10.         local part=$1
  11.         local offset=$2
  12.         local count=$3
  13.         local mtd
  14.  
  15.         . /etc/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/lantiq.sh
  28.  
  29. case "$FIRMWARE" in
  30. "RT3062.eeprom" )
  31.         local board=$(lantiq_board_name)
  32.  
  33.         case $board in
  34.         ARV752DPW22)
  35.                 rt2x00_eeprom_extract "board_config" 1040 272
  36.                 ;;
  37.         ARV752DPW22)
  38.                 rt2x00_eeprom_extract "board_config" 1040 4
  39.                 mv /lib/firmware/$FIRMWARE /lib/firmware/eeprom0
  40.                 dd if=/dev/mtd5 of=/lib/firmware/eeprom1 skip=22 bs=1 count=6
  41.                 dd if=/dev/mtd5 of=/lib/firmware/eeprom2 bs=1 skip=1050 count=262
  42.                 cat /lib/firmware/eeprom0 /lib/firmware/eeprom1 /lib/firmware/eeprom2 > /lib/firmware/$FIRMWARE
  43.                 rm /lib/firmware/eeprom*
  44.                 ;;
  45.         *)
  46.                 rt2x00_eeprom_die "board $board is not supported yet"
  47.                 ;;
  48.         esac
  49.         ;;
  50. esac