lantiq: add /lib/lantiq.sh and make hotplug handlers use it
authorJohn Crispin <john@openwrt.org>
Sat, 12 Nov 2011 23:40:16 +0000 (23:40 +0000)
committerJohn Crispin <john@openwrt.org>
Sat, 12 Nov 2011 23:40:16 +0000 (23:40 +0000)
SVN-Revision: 29003

target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
target/linux/lantiq/base-files/lib/lantiq.sh [new file with mode: 0644]

index e2dfc163119c87b3c592770399b66cf60448d387..ad5652a7fcc01d7e80a068f90602fac9543406f4 100644 (file)
@@ -24,9 +24,11 @@ rt2x00_eeprom_extract() {
 
 [ -e /lib/firmware/$FIRMWARE ] && exit 0
 
+. /lib/lantiq.sh
+
 case "$FIRMWARE" in
 "RT2860.eeprom" )
-       local board=$(grep ^machine /proc/cpuinfo | sed "s/machine.*: \(.*\) - .*/\1/g")
+       local board=$(lantiq_board_name)
        case $board in
        ARV7525PW)
                rt2x00_eeprom_extract "board_config" 1040 272
diff --git a/target/linux/lantiq/base-files/lib/lantiq.sh b/target/linux/lantiq/base-files/lib/lantiq.sh
new file mode 100644 (file)
index 0000000..75e8ac2
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+lantiq_soc_name() {
+       grep ^system /proc/cpuinfo | sed "s/system type.*: \(.*\)/\1/g"
+}
+
+lantiq_board_name() {
+       grep ^machine /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g"
+}