forked from RobertCNelson/stable-kernel
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_deb.sh
executable file
·116 lines (98 loc) · 2.47 KB
/
build_deb.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash -e
unset KERNEL_REL
unset KERNEL_PATCH
unset RC_KERNEL
unset RC_PATCH
unset BUILD
unset CC
unset GIT_MODE
unset NO_DEVTMPS
DIR=$PWD
mkdir -p ${DIR}/deploy/
DL_DIR=${DIR}/dl
mkdir -p ${DL_DIR}
function dl_kernel {
wget -c --directory-prefix=${DL_DIR} http://www.kernel.org/pub/linux/kernel/v2.6/linux-${KERNEL_REL}.tar.bz2
if [ "${KERNEL_PATCH}" ] ; then
if [ "${RC_PATCH}" ] ; then
wget -c --directory-prefix=${DL_DIR} http://www.kernel.org/pub/linux/kernel/v2.6/testing/${DL_PATCH}.bz2
else
wget -c --directory-prefix=${DL_DIR} http://www.kernel.org/pub/linux/kernel/v2.6/${DL_PATCH}.bz2
fi
fi
}
function extract_kernel {
echo "Cleaning Up"
rm -rfd ${DIR}/KERNEL || true
echo "Extracting: ${KERNEL_REL} Kernel"
tar xjf ${DL_DIR}/linux-${KERNEL_REL}.tar.bz2
mv linux-${KERNEL_REL} KERNEL
cd ${DIR}/KERNEL
if [ "${KERNEL_PATCH}" ] ; then
echo "Applying: ${KERNEL_PATCH} Patch"
bzcat ${DL_DIR}/patch-${KERNEL_PATCH}.bz2 | patch -s -p1
fi
cd ${DIR}/
}
function patch_kernel {
cd ${DIR}/KERNEL
export DIR GIT_MODE
/bin/bash -e ${DIR}/patch.sh
cd ${DIR}/
}
function copy_defconfig {
cd ${DIR}/KERNEL/
make ARCH=arm CROSS_COMPILE=${CC} distclean
if [ "${NO_DEVTMPS}" ] ; then
cp ${DIR}/patches/no_devtmps-defconfig .config
else
cp ${DIR}/patches/defconfig .config
fi
cd ${DIR}/
}
function make_menuconfig {
cd ${DIR}/KERNEL/
make ARCH=arm CROSS_COMPILE=${CC} menuconfig
if [ "${NO_DEVTMPS}" ] ; then
cp .config ${DIR}/patches/no_devtmps-defconfig
else
cp .config ${DIR}/patches/defconfig
fi
cd ${DIR}/
}
function make_deb {
cd ${DIR}/KERNEL/
echo "make ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=${CC} KDEB_PKGVERSION=${BUILDREV}${DISTRO} deb-pkg"
fakeroot make ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=${CC} KDEB_PKGVERSION=${BUILDREV}${DISTRO} deb-pkg
mv ${DIR}/*.deb ${DIR}/deploy/
cd ${DIR}
}
/bin/bash -e ${DIR}/tools/host_det.sh || { exit 1 ; }
if [ -e ${DIR}/system.sh ]; then
. system.sh
. version.sh
if [ "${IS_LUCID}" ] ; then
echo ""
echo "IS_LUCID setting in system.sh is Depreciated"
echo ""
fi
if [ "${NO_DEVTMPS}" ] ; then
echo ""
echo "Building for Debian Lenny & Ubuntu 9.04/9.10"
echo ""
else
echo ""
echo "Building for Debian Squeeze/Wheezy/Sid & Ubuntu 10.04/10.10/11.04"
echo ""
fi
dl_kernel
extract_kernel
patch_kernel
copy_defconfig
#make_menuconfig
make_deb
else
echo "Missing system.sh, please copy system.sh.sample to system.sh and edit as needed"
echo "cp system.sh.sample system.sh"
echo "gedit system.sh"
fi