mikrotik-caldata.sh 647 B

123456789101112131415161718192021
  1. # Copyright (C) 2019 Robert Marko <[email protected]>
  2. # Copyright (C) 2019 Roger Pueyo Centelles <[email protected]>
  3. #
  4. # Helper function to extract MAC addresses and calibration data for MikroTik
  5. #
  6. mikrotik_caldata_extract() {
  7. local part=$1
  8. local offset=$(($2))
  9. local count=$(($3))
  10. local mtd
  11. local erdfile="/lib/firmware/erd.bin"
  12. mtd=$(find_mtd_chardev $part)
  13. [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
  14. rbextract -e $mtd $erdfile
  15. dd if=$erdfile of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
  16. caldata_die "failed to extract calibration data from $mtd"
  17. }