Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #bash script for building the g3u kernel from source
- DEFCONFIG="new_defconfig"
- CORECOUNT="2"
- PARAMS=""
- function build {
- DATE_START=$(date +"%s")
- make $DEFCONFIG
- make -j$CORECOUNT $PARAMS
- DATE_END=$(date +"%s")
- DIFF=$(($DATE_END - $DATE_START))
- echo "Time: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
- echo
- }
- function clean {
- rm ./out/*.ko
- rm ./out/*.img
- rm ./out/zImage
- make clean && make mrproper
- }
- function pull {
- git pull
- }
- function push {
- git push
- }
- function commit {
- echo "Adding files... please wait."
- echo "If you have a lot of files, this could take a while."
- git add -A
- while read -p "What should your commit messge be?" commitmsg
- do
- case "$commitmsg" in
- * )
- git commit -a -m $commitmsg
- while read -p "should we also push to git? (y/n)" push
- do
- case "$push" in
- y|Y )
- push
- break
- ;;
- * )
- break
- ;;
- break
- ;;
- }
- function makebootimg {
- cp ./arch/arm/boot/zImage ./out/zImage
- cd ./out/
- ./mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x3100000 --cmdline 'no_console_suspend=1 console=null' -o boot.img
- #also copy all the module files
- cd ../
- find ./ -name "*.ko" -type f -exec cp {} ./out/ \;
- }
- function options {
- echo "options:
- clean --> cleans the build enviroment
- build --> builds with the specified amount of cores and defconfig
- push --> push updates to git
- pull --> pull updates from git
- commit --> commit to git and (when specified) push to git
- makeimg --> make the generated zImage into an actual boot.img"
- }
- options while read -p "What do you want to do? " cchoice do case "$cchoice" in
- clean )
- clean
- echo
- echo "All Cleaned now."
- break
- ;;
- build )
- build
- makebootimg
- break
- ;;
- pull )
- pull
- break
- ;;
- makeimg )
- makebootimg
- break
- ;;
- push )
- push
- break
- ;;
- commit )
- commit
- break
- ;;
- * )
- echo
- echo "Invalid try again!"
- options
- ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement