This repository was archived by the owner on Oct 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·87 lines (74 loc) · 1.9 KB
/
build.sh
File metadata and controls
executable file
·87 lines (74 loc) · 1.9 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
KERNEL_REPO=Monarudo_GPU_M7
ZIP_NAME=dlxj-4.4-sense5.5-kernel
if ! type "bbootimg" > /dev/null; then
echo 'bbootimg not found.'
exit 1
fi
# cd $KERNEL_REPO
# make -j2
# RET=$?
# if [ ! $RET -eq 0 ]; then
# echo 'Building kernel failed.'
# exit 1
# fi
#
# cd ..
# echo 'Kernel built successfully.'
if [ ! -d initramfs ]; then
echo "Error: directory 'initramfs' doesn't exist."
exit 1
fi
if [ ! -d tmp ]; then
mkdir tmp
elif [ -f tmp/initrd.img ]; then
echo 'Removing old initrd.img...'
rm tmp/initrd.img
fi
if [ ! -d tmp/initramfs ]; then
mkdir tmp/initramfs
else
echo 'Cleaning ramdisk working directory...'
rm -rf tmp/initramfs/*
fi
echo 'Writing new ramdisk to tmp/initrd.img...'
cp -R initramfs tmp/
cd tmp/initramfs
find . -name ".gitignore" -exec rm {} \;
find . -mindepth 1 | cpio -o -H newc | gzip > ../initrd.img
cd ../../
if [ ! -f tmp/initrd.img ]; then
echo 'Writing new ramdisk failed.'
exit 1
fi
if [ ! -d tmp/installer ]; then
mkdir tmp/installer
else
echo 'Removing old installer...'
rm -rf tmp/installer/*
fi
echo 'Building boot.img...'
bbootimg --create tmp/installer/boot.img -f bootimg.cfg -k $KERNEL_REPO/arch/arm/boot/zImage -r tmp/initrd.img
if [ ! -f tmp/installer/boot.img ]; then
echo 'Writing new boot.img failed.'
exit 1
fi
mkdir -p tmp/installer/META-INF/com/google/android/
echo 'Copying update-binary and scripts...'
cp installer_zip/update-binary tmp/installer/META-INF/com/google/android/
sed -e s/%NAME%/$ZIP_NAME/ < installer_zip/updater-script-template > tmp/installer/META-INF/com/google/android/updater-script
mkdir -p tmp/installer/system/lib/modules/
echo 'Copying modules...'
find $KERNEL_REPO -name *.ko -exec cp {} tmp/installer/system/lib/modules/ \;
echo 'Creating installer zip...'
cd tmp/installer
DATE=$(date +'%Y%m%d')
zip -r ../../$ZIP_NAME-$DATE.zip .
cd ..
RET=$?
if [ ! $RET -eq 0 ]; then
echo 'Creating zip file failed.'
exit 1
fi
echo 'Done!'
exit 0