-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild_func
72 lines (65 loc) · 3.19 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
70
71
copy_ramdisk()
{
echo copy $RAMDISK_SRC_DIR to $(dirname $RAMDISK_TMP_DIR)
if [ -d $RAMDISK_TMP_DIR ]; then
rm -rf $RAMDISK_TMP_DIR
fi
cp -a $RAMDISK_SRC_DIR $(dirname $RAMDISK_TMP_DIR)
rm -rf $RAMDISK_TMP_DIR/.git
find $RAMDISK_TMP_DIR -name .gitkeep | xargs rm --force
find $RAMDISK_TMP_DIR -name .gitignore | xargs rm --force
if [ -f $RAMDISK_TMP_DIR/recovery_version ]; then
rm -f $RAMDISK_TMP_DIR/recovery_version
fi
}
make_boot_image()
{
echo "=== make_boot_image ==="
./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
# lzma < ${BIN_DIR}/ramdisk-${IMAGE_NAME}.cpio > ${BIN_DIR}/ramdisk-${IMAGE_NAME}.img
./release-tools/mkbootimg --cmdline "${KERNEL_CMDLINE}" --base ${KERNEL_BASEADDRESS} --pagesize ${KERNEL_PAGESIZE} --ramdisk_offset ${KERNEL_RAMDISK_OFFSET} --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
}
make_recovery_image()
{
echo "=== make_boot_image ==="
./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
# lzma < ${BIN_DIR}/ramdisk-${IMAGE_NAME}.cpio > ${BIN_DIR}/ramdisk-${IMAGE_NAME}.img
./release-tools/mkbootimg --cmdline "${KERNEL_CMDLINE} androidboot.selinux=permissive" --base ${KERNEL_BASEADDRESS} --pagesize ${KERNEL_PAGESIZE} --ramdisk_offset ${KERNEL_RAMDISK_OFFSET} --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
}
make_odin3_image()
{
echo "=== 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()
{
echo "=== 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
mkdir -p ./tmp/loki
cp $KERNEL_DIR/release-tools/loki/* ./tmp/loki/
cd tmp && zip -rq ../cwm.zip ./* && cd ../
SIGNAPK_DIR=$KERNEL_DIR/release-tools/signapk
java -jar $SIGNAPK_DIR/signapk.jar -w $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"
}