/
makeimage.sh
executable file
·66 lines (57 loc) · 1.39 KB
/
makeimage.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
#!/bin/bash
set -o nounset
set -o errexit
# config
zipfile="xluco-smp600.zip"
# functions start
InitialCleanup() {
echo "=> Initial cleanup"
if [ -e $zipfile ]; then rm -f $zipfile; echo " >>>Removing old zip"; fi;
FinalCleanup
}
MakeKernel() {
echo "=> Building Kernel"
cd ../kernel_smp600
export USE_CCACHE=1
export CCACHE_COMPILERCHECK=content
export INSTALL_MOD_STRIP=1
make mrproper
make xluco_defconfig
make -j5
cd ../build_smp600
}
MakeRamdisk() {
echo "=> Packing the ramdisk"
./mkbootfs ../ramdisk_smp600 | xz -6 -Ccrc32 > ramdisk.xz
}
MakeBootImg() {
echo "=> Making boot.img"
cp ../kernel_smp600/arch/arm/boot/zImage .
./mkbootimg --kernel zImage --ramdisk ramdisk.xz -o boot.img
}
MakeZip() {
echo "=> Making zip"
mv boot.img ./zip/
cd zip/
zip -r -9 $zipfile *
mv $zipfile ../
cd ..
}
FinalCleanup() {
if [ -e zip/boot.img ]; then rm -f zip/boot.img; echo " >>>Removing old boot.img"; fi;
if [ -e ramdisk.xz ]; then rm -f ramdisk.xz; echo " >>>Removing old ramdisk"; fi;
if [ -e zImage ]; then rm -f zImage; echo " >>>Removing old zImage"; fi;
}
# functions end
STARTTIME=$(date +%s.%N)
InitialCleanup
MakeKernel
MakeRamdisk
MakeBootImg
MakeZip
echo "=> Final cleanup"
FinalCleanup
ENDTIME=$(date +%s.%N)
ELAPSEDTIME=$(echo "$ENDTIME - $STARTTIME" | bc)
echo "=> Done in $ELAPSEDTIME seconds!"
exit 0