From dc145de4be7b737bd7e37f4a79fc6e36833691b9 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Mon, 17 Feb 2020 20:16:17 +0100 Subject: ath79: move mikrotik-caldata.sh to target base-files Mikrotik devices will be found in both generic and nand subtargets. The file mikrotik-caldata.sh, currently used in generic, contains a few lines of code that would need to be duplicated for nand support. Instead of duplicating it, move it to target base-files, as size impact is small and the maintenance gain should outweigh it. This is changed separately to make life easier for the people currently working on Mikrotik NAND support. Signed-off-by: Adrian Schmutzler --- .../base-files/lib/functions/mikrotik-caldata.sh | 21 +++++++++++++++++++++ .../base-files/lib/functions/mikrotik-caldata.sh | 21 --------------------- 2 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 target/linux/ath79/base-files/lib/functions/mikrotik-caldata.sh delete mode 100644 target/linux/ath79/generic/base-files/lib/functions/mikrotik-caldata.sh (limited to 'target') diff --git a/target/linux/ath79/base-files/lib/functions/mikrotik-caldata.sh b/target/linux/ath79/base-files/lib/functions/mikrotik-caldata.sh new file mode 100644 index 0000000000..9c4016ee5d --- /dev/null +++ b/target/linux/ath79/base-files/lib/functions/mikrotik-caldata.sh @@ -0,0 +1,21 @@ +# Copyright (C) 2019 Robert Marko +# Copyright (C) 2019 Roger Pueyo Centelles +# +# Helper function to extract MAC addresses and calibration data for MikroTik +# + +mikrotik_caldata_extract() { + local part=$1 + local offset=$(($2)) + local count=$(($3)) + local mtd + local erdfile="/lib/firmware/erd.bin" + + mtd=$(find_mtd_chardev $part) + [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" + + rbextract -e $mtd $erdfile + + dd if=$erdfile of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ + caldata_die "failed to extract calibration data from $mtd" +} diff --git a/target/linux/ath79/generic/base-files/lib/functions/mikrotik-caldata.sh b/target/linux/ath79/generic/base-files/lib/functions/mikrotik-caldata.sh deleted file mode 100644 index 9c4016ee5d..0000000000 --- a/target/linux/ath79/generic/base-files/lib/functions/mikrotik-caldata.sh +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (C) 2019 Robert Marko -# Copyright (C) 2019 Roger Pueyo Centelles -# -# Helper function to extract MAC addresses and calibration data for MikroTik -# - -mikrotik_caldata_extract() { - local part=$1 - local offset=$(($2)) - local count=$(($3)) - local mtd - local erdfile="/lib/firmware/erd.bin" - - mtd=$(find_mtd_chardev $part) - [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" - - rbextract -e $mtd $erdfile - - dd if=$erdfile of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ - caldata_die "failed to extract calibration data from $mtd" -} -- cgit v1.2.3