2
0

mkits-qsdk-ipq-image.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env bash
  2. #
  3. # Licensed under the terms of the GNU GPL License version 2 or later.
  4. # Author: Piotr Dymacz <pepe2k@gmail.com>, based on mkits.sh.
  5. #
  6. # Qualcomm SDK (QSDK) sysupgrade compatible images for IPQ40xx, IPQ806x
  7. # and IPQ807x use FIT format together with 'dumpimage' tool from U-Boot
  8. # for verifying and extracting them. Based on 'images' sections names,
  9. # corresponding mtd partitions are flashed.
  10. # This is a simple script for generating FIT images tree source files,
  11. # compatible with the QSDK sysupgrade format. Resulting images can be
  12. # used for initial (factory -> libreCMC) installation and would work
  13. # both in CLI and GUI. The script is also universal in a way it allows
  14. # to include as many sections as needed.
  15. #
  16. usage() {
  17. echo "Usage: `basename $0` output img0_name img0_file [[img1_name img1_file] ...]"
  18. exit 1
  19. }
  20. # We need at least 3 arguments
  21. [ "$#" -lt 3 ] && usage
  22. # Target output file
  23. OUTPUT="$1"; shift
  24. # Create a default, fully populated DTS file
  25. echo "\
  26. /dts-v1/;
  27. / {
  28. description = \"libreCMC factory image\";
  29. #address-cells = <1>;
  30. images {" > ${OUTPUT}
  31. while [ -n "$1" -a -n "$2" ]; do
  32. [ -f "$2" ] || usage
  33. name="$1"; shift
  34. file="$1"; shift
  35. echo \
  36. " ${name} {
  37. description = \"${name}\";
  38. data = /incbin/(\"${file}\");
  39. type = \"Firmware\";
  40. arch = \"ARM\";
  41. compression = \"none\";
  42. hash@1 {
  43. algo = \"crc32\";
  44. };
  45. };" >> ${OUTPUT}
  46. done
  47. echo \
  48. " };
  49. };" >> ${OUTPUT}