Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #bash script for building the g3u kernel from source
  4. DEFCONFIG="new_defconfig"
  5. CORECOUNT="2"
  6. PARAMS=""
  7. function build {
  8. DATE_START=$(date +"%s")
  9. make $DEFCONFIG
  10. make -j$CORECOUNT $PARAMS
  11. DATE_END=$(date +"%s")
  12. DIFF=$(($DATE_END - $DATE_START))
  13. echo "Time: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
  14. echo
  15. }
  16. function clean {
  17. rm ./out/*.ko
  18. rm ./out/*.img
  19. rm ./out/zImage
  20. make clean && make mrproper
  21. }
  22. function pull {
  23. git pull
  24. }
  25. function push {
  26. git push
  27. }
  28. function commit {
  29. echo "Adding files... please wait."
  30. echo "If you have a lot of files, this could take a while."
  31. git add -A
  32. while read -p "What should your commit messge be?" commitmsg
  33. do
  34. case "$commitmsg" in
  35. * )
  36. git commit -a -m $commitmsg
  37. while read -p "should we also push to git? (y/n)" push
  38. do
  39. case "$push" in
  40. y|Y )
  41. push
  42. break
  43. ;;
  44. * )
  45. break
  46. ;;
  47. break
  48. ;;
  49. }
  50. function makebootimg {
  51. cp ./arch/arm/boot/zImage ./out/zImage
  52. cd ./out/
  53. ./mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x3100000 --cmdline 'no_console_suspend=1 console=null' -o boot.img
  54. #also copy all the module files
  55. cd ../
  56. find ./ -name "*.ko" -type f -exec cp {} ./out/ \;
  57. }
  58. function options {
  59. echo "options:
  60. clean --> cleans the build enviroment
  61. build --> builds with the specified amount of cores and defconfig
  62. push --> push updates to git
  63. pull --> pull updates from git
  64. commit --> commit to git and (when specified) push to git
  65. makeimg --> make the generated zImage into an actual boot.img"
  66. }
  67. options while read -p "What do you want to do? " cchoice do case "$cchoice" in
  68. clean )
  69. clean
  70. echo
  71. echo "All Cleaned now."
  72. break
  73. ;;
  74. build )
  75. build
  76. makebootimg
  77. break
  78. ;;
  79. pull )
  80. pull
  81. break
  82. ;;
  83. makeimg )
  84. makebootimg
  85. break
  86. ;;
  87. push )
  88. push
  89. break
  90. ;;
  91. commit )
  92. commit
  93. break
  94. ;;
  95. * )
  96. echo
  97. echo "Invalid try again!"
  98. options
  99. ;;
  100. esac
  101. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement