forked from kbc-developers/kernel_samsung_exynos4412
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_func
70 lines (61 loc) · 2.51 KB
/
build_func
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
copy_ramdisk()
{
SRC_DIR=$1
DST_DIR=$2
echo copy $SRC_DIR to $(dirname $DST_DIR)
if [ -d $DST_DIR ]; then
rm -rf $DST_DIR
fi
cp -a $SRC_DIR $(dirname $DST_DIR)
rm -rf $DST_DIR/.git
find $DST_DIR -name .gitkeep | xargs rm --force
find $DST_DIR -name .gitignore | xargs rm --force
if [ -f $DST_DIR/recovery_version ]; then
rm -f $DST_DIR/recovery_version
fi
}
make_boot_image()
{
if [ "$USE_INITRAMFS" = 'y' ]; then
cp $BIN_DIR/kernel $BIN_DIR/$IMAGE_NAME.img
echo " $BIN_DIR/$IMAGE_NAME.img"
else
./release-tools/mkbootfs $RAMDISK_TMP_DIR > $BIN_DIR/ramdisk-$IMAGE_NAME.cpio
./release-tools/minigzip < $BIN_DIR/ramdisk-$IMAGE_NAME.cpio > $BIN_DIR/ramdisk-$IMAGE_NAME.img
./release-tools/mkbootimg --cmdline "console=ttySAC2,115200" --base $KERNEL_BASEADDRESS --pagesize 2048 --kernel $BIN_DIR/kernel --ramdisk $BIN_DIR/ramdisk-$IMAGE_NAME.img --output $BIN_DIR/$IMAGE_NAME.img
echo " $BIN_DIR/$IMAGE_NAME.img"
rm $BIN_DIR/ramdisk-$IMAGE_NAME.img
rm $BIN_DIR/ramdisk-$IMAGE_NAME.cpio
rm $BIN_DIR/kernel
fi
}
make_odin3_image()
{
tar cf $BUILD_LOCALVERSION-$IMAGE_NAME-odin.tar $IMAGE_NAME.img
md5sum -t $BUILD_LOCALVERSION-$IMAGE_NAME-odin.tar >> $BUILD_LOCALVERSION-$IMAGE_NAME-odin.tar
mv $BUILD_LOCALVERSION-$IMAGE_NAME-odin.tar $BUILD_LOCALVERSION-$IMAGE_NAME-odin.tar.md5
echo " $BIN_DIR/$BUILD_LOCALVERSION-$IMAGE_NAME-odin.tar.md5"
}
make_cwm_image()
{
if [ -d tmp ]; then
rm -rf tmp
fi
mkdir -p ./tmp/META-INF/com/google/android
cp $IMAGE_NAME.img ./tmp/
cp $KERNEL_DIR/release-tools/update-binary ./tmp/META-INF/com/google/android/
sed -e "s/@VERSION/$BUILD_LOCALVERSION/g" $KERNEL_DIR/release-tools/$TARGET_DEVICE/updater-script-$IMAGE_NAME.sed > ./tmp/META-INF/com/google/android/updater-script
cd tmp && zip -rq ../cwm.zip ./* && cd ../
SIGNAPK_DIR=$KERNEL_DIR/release-tools/signapk
java -jar $SIGNAPK_DIR/signapk.jar $SIGNAPK_DIR/testkey.x509.pem $SIGNAPK_DIR/testkey.pk8 cwm.zip $BUILD_LOCALVERSION-$IMAGE_NAME-signed.zip
rm cwm.zip
rm -rf tmp
echo " $BIN_DIR/$BUILD_LOCALVERSION-$IMAGE_NAME-signed.zip"
}
generate_initramfs()
{
echo generate to ./out/$TARGET_DEVICE/ramdisk.cpio
./release-tools/mkbootfs $BOOT_RAMDISK_TMP_DIR > ./out/$TARGET_DEVICE/ramdisk.cpio
echo generate to ./out/$TARGET_DEVICE/ramdisk-recovery.cpio
./release-tools/mkbootfs $RECO_RAMDISK_TMP_DIR > ./out/$TARGET_DEVICE/ramdisk-recovery.cpio
}