-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathbuild_deb.sh
More file actions
executable file
·150 lines (124 loc) · 3.94 KB
/
build_deb.sh
File metadata and controls
executable file
·150 lines (124 loc) · 3.94 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/sh -e
# SPDX-FileCopyrightText: 2009 Robert Nelson <robertcnelson@gmail.com>
#
# SPDX-License-Identifier: MIT
DIR=$PWD
git_bin=$(which git)
mkdir -p "${DIR}/deploy/"
patch_kernel () {
cd "${DIR}/KERNEL" || exit
export DIR
/bin/bash -e "${DIR}/patch.sh" || { ${git_bin} add . ; exit 1 ; }
if [ ! -f "${DIR}/.yakbuild" ] ; then
if [ ! "${RUN_BISECT}" ] ; then
${git_bin} add --all
${git_bin} commit --allow-empty -a -m "${KERNEL_TAG}${BUILD} patchset"
fi
fi
cd "${DIR}/" || exit
}
copy_defconfig () {
cd "${DIR}/KERNEL" || exit
make ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" distclean
if [ ! -f "${DIR}/.yakbuild" ] ; then
make ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" "${config}"
cp -v .config "${DIR}/patches/ref_${config}"
cp -v "${DIR}/patches/defconfig" .config
else
make ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" rcn-ee_defconfig
fi
make ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" olddefconfig
cd "${DIR}/" || exit
}
make_menuconfig () {
cd "${DIR}/KERNEL" || exit
make ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" oldconfig
make ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" menuconfig
if [ ! -f "${DIR}/.yakbuild" ] ; then
cp -v .config "${DIR}/patches/defconfig"
fi
cd "${DIR}/" || exit
}
make_deb () {
cd "${DIR}/KERNEL" || exit
deb_distro=$(lsb_release -cs | sed 's/\//_/g')
if [ "x${deb_distro}" = "xn_a" ] ; then
deb_distro="unstable"
fi
build_opts="-j${CORES}"
build_opts="${build_opts} ARCH=${KERNEL_ARCH}"
build_opts="${build_opts} KBUILD_DEBARCH=${DEBARCH}"
build_opts="${build_opts} LOCALVERSION=${BUILD}"
build_opts="${build_opts} KDEB_CHANGELOG_DIST=${deb_distro}"
build_opts="${build_opts} KDEB_PKGVERSION=1${DISTRO}"
#Just use "linux-upstream"...
#https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/scripts/package/builddeb?id=3716001bcb7f5822382ac1f2f54226b87312cc6b
build_opts="${build_opts} KDEB_SOURCENAME=linux-upstream"
build_opts="${build_opts} KDEB_COMPRESS=xz"
build_opts="${build_opts} DEB_BUILD_PROFILES=pkg.linux-upstream.nokernelheaders"
echo "-----------------------------"
echo "make ${build_opts} CROSS_COMPILE="${CC}" bindeb-pkg"
echo "-----------------------------"
make ${build_opts} CROSS_COMPILE="${CC}" bindeb-pkg
mv "${DIR}"/*.buildinfo "${DIR}/deploy/" || true
mv "${DIR}"/*.changes "${DIR}/deploy/" || true
mv "${DIR}"/*.deb "${DIR}/deploy/" || true
KERNEL_UTS=$(cat "${DIR}/KERNEL/include/generated/utsrelease.h" | awk '{print $3}' | sed 's/\"//g' )
if [ "${DTBS_CHECK}" ] ; then
echo "-----------------------------"
echo "make -j4 ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" dtbs_check"
echo "-----------------------------"
make -j4 ARCH=${KERNEL_ARCH} CROSS_COMPILE="${CC}" dtbs_check
fi
cd "${DIR}/" || exit
}
if [ -f "${DIR}/.yakbuild" ] ; then
if [ -f "${DIR}/recipe.sh.sample" ] ; then
if [ ! -f "${DIR}/recipe.sh" ] ; then
cp -v "${DIR}/recipe.sh.sample" "${DIR}/recipe.sh"
fi
fi
fi
/bin/sh -e "${DIR}/tools/host_det.sh" || { exit 1 ; }
if [ ! -f "${DIR}/system.sh" ] ; then
cp -v "${DIR}/system.sh.sample" "${DIR}/system.sh"
fi
unset CC
unset LINUX_GIT
. "${DIR}/system.sh"
if [ -f "${DIR}/.yakbuild" ] ; then
. "${DIR}/recipe.sh"
fi
/bin/sh -e "${DIR}/scripts/gcc.sh" || { exit 1 ; }
. "${DIR}/.CC"
echo "CROSS_COMPILE=${CC}"
if [ -f /usr/bin/ccache ] ; then
echo "ccache [enabled]"
CC="ccache ${CC}"
fi
. "${DIR}/version.sh"
export LINUX_GIT
if [ ! "${CORES}" ] ; then
CORES=$(getconf _NPROCESSORS_ONLN)
fi
#unset FULL_REBUILD
FULL_REBUILD=1
if [ "${FULL_REBUILD}" ] ; then
/bin/sh -e "${DIR}/scripts/git.sh" || { exit 1 ; }
if [ "${RUN_BISECT}" ] ; then
/bin/sh -e "${DIR}/scripts/bisect.sh" || { exit 1 ; }
fi
patch_kernel
copy_defconfig
fi
if [ ! "${AUTO_BUILD}" ] ; then
make_menuconfig
fi
if [ -f "${DIR}/.yakbuild" ] ; then
BUILD=$(echo ${kernel_tag} | sed 's/[^-]*//'|| true)
fi
make_deb
echo "-----------------------------"
echo "Script Complete"
echo "${KERNEL_UTS}" > kernel_version
echo "-----------------------------"