forked from xxmustafacooTR/exynos-linux-stable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzip.sh
executable file
·74 lines (57 loc) · 1.7 KB
/
zip.sh
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
72
73
74
#!/bin/bash
. variables.sh
printf "Creating flashable zip...\n"
cp -R $BUILD_DIR/Kernel-aosp $BUILD_DIR/Kernel
cp -R $BUILD_DIR/Kernel-aosp-ksu $BUILD_DIR/Kernel-ksu
# Copy kernel and dtb to boot dir
if [ -f $BUILD_DIR/Kernel/crownlte/zImage ]; then
cp $BUILD_DIR/Kernel/crownlte/zImage $BOOT_DIR/split/kernel
else
printf "ERROR: file: $BUILD_DIR/Kernel/crownlte/zImage not found"
exit 1
fi
if [ -f $BUILD_DIR/Dtb/crownlte/dtb.img ]; then
cp $BUILD_DIR/Dtb/crownlte/dtb.img $BOOT_DIR/split/extra
else
printf "ERROR: file: $BUILD_DIR/Dtb/crownlte/dtb.img not found"
exit 1
fi
# Repack boot.img
cd $BOOT_DIR && repackimg
# Move boot.img to Kernel directory
if [ -f $BOOT_DIR/new-boot.img ]; then
mv $BOOT_DIR/new-boot.img $BUILD_DIR/empty-boot.img
else
printf "ERROR: file: $BOOT_DIR/new-boot.img not found"
exit 1
fi
# Copy resources and generate flashable zip
if [ -f $MOD_DIR/*.ko ]; then
cp MOD_DIR/*.ko $ZIP_DIR/modules/system/lib/modules
fi
if [ -d $BUILD_DIR ]; then
cp -R $BUILD_DIR/* $ZIP_DIR && cd $ZIP_DIR && ./zip.sh
# Create Output directory
if [ ! -d $OUT_DIR ]; then
mkdir -p $OUT_DIR
fi
# Move $ZIP_NAME.zip to Output directory
mv $ZIP_DIR/$ZIP_NAME.zip $OUT_DIR/$ZIP_NAME.zip
else
printf "ERROR: directory: $BUILD_DIR not found"
exit 1
fi
# Cleanup
rm -rf Dtb Dtb-erofs Kernel Kernel-ksu \
Kernel-stock Kernel-stock-ksu \
Kernel-aosp Kernel-aosp-ksu \
Kernel.tar Kernel.tar.zst \
empty-boot.img
rm $ZIP_DIR/modules/system/lib/modules/*.ko
cd $BOOT_DIR/split && \
rm extra && \
rm kernel && \
rm ramdisk.cpio
# Return to build directory
cd $CUR_DIR
printf "Flashable zip is ready at $OUT_DIR/$ZIP_NAME.zip\n"