mksunxi_fit_atf.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/sh
  2. #
  3. # script to generate FIT image source for 64-bit sunxi boards with
  4. # ARM Trusted Firmware and multiple device trees (given on the command line)
  5. #
  6. # usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
  7. [ -z "$BL31" ] && BL31="bl31.bin"
  8. if [ ! -f $BL31 ]; then
  9. echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
  10. echo "Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64" >&2
  11. BL31=/dev/null
  12. fi
  13. cat << __HEADER_EOF
  14. /dts-v1/;
  15. / {
  16. description = "Configuration to load ATF before U-Boot";
  17. #address-cells = <1>;
  18. images {
  19. uboot {
  20. description = "U-Boot (64-bit)";
  21. data = /incbin/("u-boot-nodtb.bin");
  22. type = "standalone";
  23. arch = "arm64";
  24. compression = "none";
  25. load = <0x4a000000>;
  26. };
  27. atf {
  28. description = "ARM Trusted Firmware";
  29. data = /incbin/("$BL31");
  30. type = "firmware";
  31. arch = "arm64";
  32. compression = "none";
  33. load = <0x44000>;
  34. entry = <0x44000>;
  35. };
  36. __HEADER_EOF
  37. cnt=1
  38. for dtname in $*
  39. do
  40. cat << __FDT_IMAGE_EOF
  41. fdt_$cnt {
  42. description = "$(basename $dtname .dtb)";
  43. data = /incbin/("$dtname");
  44. type = "flat_dt";
  45. compression = "none";
  46. };
  47. __FDT_IMAGE_EOF
  48. cnt=$((cnt+1))
  49. done
  50. cat << __CONF_HEADER_EOF
  51. };
  52. configurations {
  53. default = "config_1";
  54. __CONF_HEADER_EOF
  55. cnt=1
  56. for dtname in $*
  57. do
  58. cat << __CONF_SECTION_EOF
  59. config_$cnt {
  60. description = "$(basename $dtname .dtb)";
  61. firmware = "uboot";
  62. loadables = "atf";
  63. fdt = "fdt_$cnt";
  64. };
  65. __CONF_SECTION_EOF
  66. cnt=$((cnt+1))
  67. done
  68. cat << __ITS_EOF
  69. };
  70. };
  71. __ITS_EOF