pack-uboot.sh 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. #
  3. # SPDX-License-Identifier: GPL-2.0
  4. function do_prepare()
  5. {
  6. export PATH=$EXTER/packages/pack-uboot/${BOARDFAMILY}/tools/:$PATH
  7. cp ${EXTER}/packages/pack-uboot/${BOARDFAMILY}/bin/* . -r
  8. cp sys_config/sys_config_${BOARD}.fex sys_config.fex
  9. }
  10. function do_ini_to_dts()
  11. {
  12. local DTC_COMPILER=$EXTER/packages/pack-uboot/${BOARDFAMILY}/tools/dtc
  13. [[ ! -f $DTC_COMPILER ]] && exit_with_error "Script_to_dts: Can not find dtc compiler."
  14. if [[ $BOARDFAMILY =~ sun50iw2|sun50iw6|sun50iw9 ]]; then
  15. #Disbale noisy checks
  16. local DTC_FLAGS="-W no-unit_address_vs_reg"
  17. if [[ $BOARDFAMILY =~ sun50iw2 ]]; then
  18. $DTC_COMPILER ${DTC_FLAGS} -O dtb -o ${BOARD}-u-boot.dtb -b 0 dts/${BOARD}-u-boot.dts >/dev/null 2>&1
  19. else
  20. $DTC_COMPILER -p 2048 ${DTC_FLAGS} -@ -O dtb -o ${BOARD}-u-boot.dtb -b 0 dts/${BOARD}-u-boot.dts >/dev/null 2>&1
  21. fi
  22. [[ $? -ne 0 ]] && exit_with_error "dtb: Conver script to dts failed."
  23. # It'is used for debug dtb
  24. $DTC_COMPILER ${DTC_FLAGS} -I dtb -O dts -o .${BOARD}-u-boot.dts ${BOARD}-u-boot.dtb >/dev/null 2>&1
  25. fi
  26. }
  27. function do_common()
  28. {
  29. unix2dos sys_config.fex > /dev/null 2>&1
  30. script sys_config.fex > /dev/null 2>&1
  31. cp ${PACKOUT_DIR}/${BOARD}-u-boot.dtb sunxi.fex
  32. [[ $BOARDFAMILY == sun50iw2 ]] && update_uboot_fdt u-boot.fex sunxi.fex u-boot.fex >/dev/null
  33. if [[ $BOARDFAMILY =~ sun50iw6|sun50iw9 ]]; then
  34. update_dtb sunxi.fex 4096 >/dev/null
  35. fi
  36. if [[ $BOARDFAMILY =~ sun50iw6|sun50iw2 ]]; then
  37. cp -f sys_config.bin config.fex
  38. update_scp scp.fex sunxi.fex > /dev/null 2>&1
  39. fi
  40. update_boot0 boot0_sdcard.fex sys_config.bin SDMMC_CARD > /dev/null
  41. if [[ $BOARDFAMILY =~ sun50iw6|sun50iw9 ]]; then
  42. update_uboot -no_merge u-boot.fex sys_config.bin > /dev/null
  43. elif [[ $BOARDFAMILY =~ sun50iw2 ]]; then
  44. update_uboot u-boot.fex sys_config.bin > /dev/null
  45. fi
  46. [[ $? -ne 0 ]] && exit_with_error "update u-boot run error"
  47. #pack boot package
  48. unix2dos boot_package.cfg > /dev/null 2>&1
  49. dragonsecboot -pack boot_package.cfg > /dev/null
  50. [[ $? -ne 0 ]] && exit_with_error "dragon pack error"
  51. #Here, will check if need to used multi config.fex or not
  52. if [[ $BOARDFAMILY == sun50iw2 ]]; then
  53. update_uboot_v2 u-boot.fex sys_config.bin ${CHIP_BOARD} 1>/dev/null 2>&1
  54. fi
  55. }
  56. do_pack_h3()
  57. {
  58. cp $BOOTDIR/boot0_sdcard_${CHIP}.bin ${PACK_OUT}
  59. cp $BOOTDIR/u-boot-${CHIP}.bin ${PACK_OUT}
  60. cp $SYS_CONFIG ${PACK_OUT}/sys_config.fex
  61. fex2bin sys_config.fex sys_config.bin
  62. update_boot0 boot0_sdcard_${CHIP}.bin sys_config.bin SDMMC_CARD >/dev/null 2>&1
  63. update_uboot u-boot-${CHIP}.bin sys_config.bin >/dev/null 2>&1
  64. cp boot0_sdcard_${CHIP}.bin $UBOOT_BIN/boot0_sdcard_${CHIP}.bin
  65. cp u-boot-${CHIP}.bin $UBOOT_BIN/u-boot-${CHIP}.bin
  66. cp sys_config.bin $UBOOT_BIN/script.bin_${BOARD}
  67. cp sys_config.bin $EXTER/chips/${CHIP}/script/script.bin_${BOARD}
  68. }
  69. pack_uboot()
  70. {
  71. PACKOUT_DIR=$SRC/.tmp/packout
  72. cd ${PACKOUT_DIR}
  73. do_prepare
  74. do_ini_to_dts
  75. do_common
  76. }