build.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/bash
  2. ##################################################################
  3. ## ##
  4. ## SPDX-License-Identifier: GPL-2.0-or-later ##
  5. ## ##
  6. ## Copyright (C) 2018-2022 Starfive Technology ##
  7. ## ##
  8. ## Author: jason zhou <jason.zhou@starfivetech.com> ##
  9. ## ##
  10. ##################################################################
  11. COLOR_NORMAL="\033[0m"
  12. COLOR_GREEN="\033[1;32m"
  13. COLOR_YELLOW="\033[1;33m"
  14. COLOR_RED="\033[1;31m"
  15. COLOR_GREY="\033[1;30m"
  16. printf ${COLOR_GREEN}
  17. printf "JH7110 Build Script"
  18. echo $0 $1
  19. #default
  20. cpu_numb_input="1"
  21. #real cpu number
  22. num=`cat /proc/cpuinfo | grep "processor" | wc -l`
  23. if [ $1 ]
  24. then
  25. #cmdline para input cpu processor number
  26. echo $1
  27. cpu_numb_input=$1
  28. else
  29. printf "please input the cpu number to perform concurrent build, choose 1 ~ $num:\n"
  30. read cpu_numb_input
  31. fi
  32. if (( $cpu_numb_input > $num ))
  33. then
  34. echo "input > $num error, exit"
  35. exit 1
  36. fi
  37. if (( $cpu_numb_input < 1 ))
  38. then
  39. echo "input < 1 error, exit"
  40. exit 1
  41. fi
  42. printf ${COLOR_NORMAL}
  43. # clean all including rootfs
  44. #rm -rf work/
  45. # clean kernel built
  46. #make clean
  47. tag=`git describe`
  48. echo "make -j$cpu_numb_input > build.$tag.log"
  49. make -j$cpu_numb_input | tee build.$tag.log
  50. if (( $? > 0 ))
  51. then
  52. echo "build failed! exit!"
  53. exit 1
  54. fi
  55. echo "./build_soft_3rdpart.sh >> build.$tag.log"
  56. ./build_soft_3rdpart.sh | tee -a build.$tag.log
  57. if (( $? > 0 ))
  58. then
  59. echo "build 3rd part software failed! exit!"
  60. exit 1
  61. fi
  62. echo "rm initramfs, than rebuild"
  63. rm -rf work/initramfs.cpio.gz | tee -a build.$tag.log
  64. echo "make -j$cpu_numb_input >> build.$tag.log"
  65. make -j$cpu_numb_input | tee -a build.$tag.log
  66. if (( $? > 0 ))
  67. then
  68. echo "build failed! exit!"
  69. exit 1
  70. else
  71. echo "build images success!!!"
  72. fi
  73. echo ""
  74. echo "Rootfs & Kernel version string:" | tee -a build.$tag.log
  75. strings work/image.fit | grep "JH7110_51" | tee -a build.$tag.log
  76. echo ""
  77. echo "u-boot version string:" | tee -a build.$tag.log
  78. strings work/u-boot/u-boot.bin | grep "JH7110_51" | tee -a build.$tag.log