dsl_fs 846 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2014 OpenWrt.org
  3. . $IPKG_INSTROOT/lib/functions.sh
  4. START=30
  5. boot() {
  6. MTD=$(find_mtd_index dsl_fw)
  7. grep /lib/firmware/lantiq /proc/mounts && umount /lib/firmware/lantiq
  8. mkdir -p /lib/firmware/lantiq
  9. [ "$MTD" -gt 0 ] || return 0
  10. mount -t tmpfs none /lib/firmware/lantiq
  11. case "$(dd if=/dev/mtd$MTD bs=2 count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')" in
  12. 1985)
  13. mkdir -p /tmp/fw_mnt
  14. mount -t jffs2 /dev/mtdblock$MTD /tmp/fw_mnt
  15. cp -a /tmp/fw_mnt/*.bin /lib/firmware/lantiq/
  16. umount /tmp/fw_mnt
  17. rmdir /tmp/fw_mnt
  18. ;;
  19. 1f8b)
  20. tar xz -C /lib/firmware/lantiq < /dev/mtd$MTD
  21. ;;
  22. *)
  23. echo "No DSL firmware detected in /dev/mtd$MTD (dsl_fw)"
  24. return 0
  25. ;;
  26. esac
  27. [ -e /lib/firmware/vdsl.bin ] || ln -s /lib/firmware/lantiq/vr9_dsl_fw_annex_b.bin /lib/firmware/vdsl.bin
  28. }