Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This is my usage information
- [ $# -eq 0 ] && { echo "Usage:
- $0 Kernel-name [Stock,CM,CM101]"; exit 1; }
- # This says if its a kernel compiled using *MY* defconfig :)
- # You may as well remove this
- #if [ $3 == "shabby" ];
- #then
- #DEFCONFIG=Shabbypenguin_d2-r530_defconfig
- #else
- #DEFCONFIG=cyanogen_d2-r530_defconfig
- #fi
- # These setup our build enviroment
- THREADS=$(expr 4 + $(grep processor /proc/cpuinfo | wc -l))
- MAKE="make -j${THREADS}"
- ARCH="ARCH=arm"
- CROSS="CROSS_COMPILE=/home/shabbypenguin/android/CM10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-"
- # Setup our directories now
- DIR=~/android/Kernels
- TOOLS=$DIR/tools
- KERNEL=$DIR/SGH-Krait
- PACK=$KERNEL/package
- OUT=$KERNEL/arch/arm/boot
- # These are extra variables designed to make things easier
- UPDATER=$TOOLS/Updater-Scripts/d2
- MODULES=$UPDATER/system/lib/modules
- KERNELNAME=$1
- KBUILD_BUILD_VERSION=$1
- export KBUILD_BUILD_VERSION
- # Set our Ramdisk locations
- STOCK=$DIR/Ramdisks/d2mtr
- CM=$DIR/Ramdisks/d2mtr-CM
- CM101=$DIR/Ramdisks/d2mtr-CM10-1
- # These are for mkbootimg
- PAGE=2048
- BASE=0x80200000
- RAMADDR=0x81500000
- CMDLINE='"androidboot.hardware=qcom user_debug=31 zcache"'
- # -----------------------------------------------------------------------------------------------
- # Dont mess with below here unless you know what you are doing
- # -----------------------------------------------------------------------------------------------
- export USE_CCACHE=1
- export $ARCH
- export $CROSS
- # This cleans out crud and makes new config
- #$MAKE clean
- #$MAKE mrproper
- rm -rf $MODULES
- rm -rf $PACK
- [ -d "$PACK" ] || mkdir "$PACK"
- [ -d "$MODULES" ] || mkdir -p "$MODULES"
- exec > >(tee $PACK/buildlog.txt) 2>&1
- $MAKE $DEFCONFIG
- # Finally making the kernel
- #$MAKE zImage
- #$MAKE modules
- # These move files to easier locations
- find -name '*.ko' -exec cp -av {} $MODULES/ \;
- # -----------------------------------------------------------------------------------------------
- # This part packs the img up :)
- # In order for this part to work you need the mkbootimg tools
- # -----------------------------------------------------------------------------------------------
- # This will base ramdisks location off $2
- if [ $2 == "Stock" ];
- then
- RAMDISK=$STOCK
- else
- if [ $2 == "CM" ];
- then
- RAMDISK=$CM
- else
- if [ $2 == "CM101" ];
- then
- RAMDISK=$CM101
- fi
- fi
- fi
- cd $PACK
- cp $OUT/zImage $PACK
- $TOOLS/mkbootfs $RAMDISK | gzip > $PACK/ramdisk.gz
- $TOOLS/mkbootimg --cmdline "$CMDLINE" --kernel $PACK/zImage --ramdisk $PACK/ramdisk.gz --pagesize $PAGE --base $BASE --ramdiskaddr $RAMADDR -o $PACK/boot.img
- rm -rf ramdisk.gz
- rm -rf zImage
- cp -R $UPDATER/* $PACK
- zip -r $KERNELNAME"-"$2".zip" * -x "*.txt"
- # -----------------------------------------------------------------------------------------------
- # All Done
- echo $KERNELNAME"-"$2 "was made!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement