Skip to content
Snippets Groups Projects
Commit c74a6906 authored by Felix Fietkau's avatar Felix Fietkau
Browse files

ar71xx: scan nand ubi partition for ath9k eeprom files


The MR18 stores the ath9k eeprom values on the NAND.
This patch makes it possible to retrieve the images
from there.

Signed-off-by: default avatarChris R Blake <chrisrblake93@gmail.com>

SVN-Revision: 47948
parent 8e419479
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,23 @@ mtd_get_mac_binary() { ...@@ -41,6 +41,23 @@ mtd_get_mac_binary() {
dd bs=1 skip=$offset count=6 if=$part 2>/dev/null | hexdump -v -n 6 -e '5/1 "%02x:" 1/1 "%02x"' dd bs=1 skip=$offset count=6 if=$part 2>/dev/null | hexdump -v -n 6 -e '5/1 "%02x:" 1/1 "%02x"'
} }
mtd_get_mac_binary_ubi() {
local mtdname="$1"
local offset="$2"
. /lib/upgrade/nand.sh
local ubidev=$(nand_find_ubi $CI_UBIPART)
local part=$(nand_find_volume $ubidev $1)
if [ -z "$part" ]; then
echo "mtd_get_mac_binary: ubi volume $mtdname not found!" >&2
return
fi
hexdump -v -n 6 -s $offset -e '5/1 "%02x:" 1/1 "%02x"' /dev/$part 2>/dev/null
}
mtd_get_part_size() { mtd_get_part_size() {
local part_name=$1 local part_name=$1
local first dev size erasesize name local first dev size erasesize name
......
...@@ -25,6 +25,21 @@ ath9k_eeprom_extract() { ...@@ -25,6 +25,21 @@ ath9k_eeprom_extract() {
ath9k_eeprom_die "failed to extract from $mtd" ath9k_eeprom_die "failed to extract from $mtd"
} }
ath9k_ubi_eeprom_extract() {
local part=$1
local offset=$2
local count=$3
local ubidev=$(nand_find_ubi $CI_UBIPART)
local ubi
ubi=$(nand_find_volume $ubidev $part)
[ -n "$ubi" ] || \
ath9k_eeprom_die "no UBI volume found for $part"
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
ath9k_eeprom_die "failed to extract from $ubi"
}
ath9k_patch_firmware_mac() { ath9k_patch_firmware_mac() {
local mac=$1 local mac=$1
...@@ -39,6 +54,8 @@ case "$FIRMWARE" in ...@@ -39,6 +54,8 @@ case "$FIRMWARE" in
"soc_wmac.eeprom") "soc_wmac.eeprom")
case $board in case $board in
mr18) mr18)
. /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 4096 2048 ath9k_ubi_eeprom_extract "caldata" 4096 2048
else else
...@@ -61,6 +78,8 @@ case "$FIRMWARE" in ...@@ -61,6 +78,8 @@ case "$FIRMWARE" in
"pci_wmac0.eeprom") "pci_wmac0.eeprom")
case $board in case $board in
mr18) mr18)
. /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 20480 2048 ath9k_ubi_eeprom_extract "caldata" 20480 2048
else else
...@@ -82,6 +101,8 @@ case "$FIRMWARE" in ...@@ -82,6 +101,8 @@ case "$FIRMWARE" in
"pci_wmac1.eeprom") "pci_wmac1.eeprom")
case $board in case $board in
mr18) mr18)
. /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 36864 2048 ath9k_ubi_eeprom_extract "caldata" 36864 2048
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment