##// END OF EJS Templates
bugs
Unknown -
r348:5eed4a04c472
parent child
Show More
@@ -1,310 +1,339
1 1 #
2 2 # Build and Setup RPi2/3 Kernel
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Fetch and build latest raspberry kernel
9 9 if [ "$BUILD_KERNEL" = true ] ; then
10 10 # Setup source directory
11 11 mkdir -p "${R}/usr/src/linux"
12 12
13 13 # Copy existing kernel sources into chroot directory
14 14 if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then
15 15 # Copy kernel sources and include hidden files
16 16 cp -r "${KERNELSRC_DIR}/". "${R}/usr/src/linux"
17 17
18 18 # Clean the kernel sources
19 19 if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then
20 20 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
21 21 fi
22 22 else # KERNELSRC_DIR=""
23 23 # Create temporary directory for kernel sources
24 24 temp_dir=$(as_nobody mktemp -d)
25 25
26 26 # Fetch current RPi2/3 kernel sources
27 27 if [ -z "${KERNEL_BRANCH}" ] ; then
28 28 as_nobody -H git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" linux
29 29 else
30 30 as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux
31 31 fi
32 32
33 33 # Copy downloaded kernel sources
34 34 cp -r "${temp_dir}/linux/"* "${R}/usr/src/linux/"
35 35
36 36 # Remove temporary directory for kernel sources
37 37 rm -fr "${temp_dir}"
38 38
39 39 # Set permissions of the kernel sources
40 40 chown -R root:root "${R}/usr/src"
41 41 fi
42 42
43 43 # Calculate optimal number of kernel building threads
44 44 if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then
45 45 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
46 46 fi
47 47
48 48 # Configure and build kernel
49 49 if [ "$KERNELSRC_PREBUILT" = false ] ; then
50 50 # Remove device, network and filesystem drivers from kernel configuration
51 51 if [ "$KERNEL_REDUCE" = true ] ; then
52 52 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
53 53 sed -i\
54 54 -e "s/\(^CONFIG_SND.*\=\).*/\1n/"\
55 55 -e "s/\(^CONFIG_SOUND.*\=\).*/\1n/"\
56 56 -e "s/\(^CONFIG_AC97.*\=\).*/\1n/"\
57 57 -e "s/\(^CONFIG_VIDEO_.*\=\).*/\1n/"\
58 58 -e "s/\(^CONFIG_MEDIA_TUNER.*\=\).*/\1n/"\
59 59 -e "s/\(^CONFIG_DVB.*\=\)[ym]/\1n/"\
60 60 -e "s/\(^CONFIG_REISERFS.*\=\).*/\1n/"\
61 61 -e "s/\(^CONFIG_JFS.*\=\).*/\1n/"\
62 62 -e "s/\(^CONFIG_XFS.*\=\).*/\1n/"\
63 63 -e "s/\(^CONFIG_GFS2.*\=\).*/\1n/"\
64 64 -e "s/\(^CONFIG_OCFS2.*\=\).*/\1n/"\
65 65 -e "s/\(^CONFIG_BTRFS.*\=\).*/\1n/"\
66 66 -e "s/\(^CONFIG_HFS.*\=\).*/\1n/"\
67 67 -e "s/\(^CONFIG_JFFS2.*\=\)[ym]/\1n/"\
68 68 -e "s/\(^CONFIG_UBIFS.*\=\).*/\1n/"\
69 69 -e "s/\(^CONFIG_SQUASHFS.*\=\)[ym]/\1n/"\
70 70 -e "s/\(^CONFIG_W1.*\=\)[ym]/\1n/"\
71 71 -e "s/\(^CONFIG_HAMRADIO.*\=\).*/\1n/"\
72 72 -e "s/\(^CONFIG_CAN.*\=\).*/\1n/"\
73 73 -e "s/\(^CONFIG_IRDA.*\=\).*/\1n/"\
74 74 -e "s/\(^CONFIG_BT_.*\=\).*/\1n/"\
75 75 -e "s/\(^CONFIG_WIMAX.*\=\)[ym]/\1n/"\
76 76 -e "s/\(^CONFIG_6LOWPAN.*\=\).*/\1n/"\
77 77 -e "s/\(^CONFIG_IEEE802154.*\=\).*/\1n/"\
78 78 -e "s/\(^CONFIG_NFC.*\=\).*/\1n/"\
79 79 -e "s/\(^CONFIG_FB_TFT=.*\=\).*/\1n/"\
80 80 -e "s/\(^CONFIG_TOUCHSCREEN.*\=\).*/\1n/"\
81 81 -e "s/\(^CONFIG_USB_GSPCA_.*\=\).*/\1n/"\
82 82 -e "s/\(^CONFIG_DRM.*\=\).*/\1n/"\
83 83 "${KERNEL_DIR}/.config"
84 84 fi
85 85
86 86 # GPL v2.0
87 87 #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh
88 88 if [ "$KERNEL_ZSWAP" = true ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
89 89 # enable ZSWAP support for better performance during large builds etc.
90 90 # requires activation via kernel parameter or sysfs
91 91 # see e.g. https://askubuntu.com/a/472227 for a summary of ZSWAP (vs ZRAM etc.)
92 92 # and e.g. https://wiki.archlinux.org/index.php/zswap for parameters etc.
93 93
94 set_kernel_config ZPOOL y "${KERNEL_DIR}/.config"
95 set_kernel_config ZSWAP y "${KERNEL_DIR}/.config"
96 set_kernel_config ZBUD y "${KERNEL_DIR}/.config"
97 set_kernel_config Z3FOLD y "${KERNEL_DIR}/.config"
98 set_kernel_config ZSMALLOC y "${KERNEL_DIR}/.config"
99 set_kernel_config PGTABLE_MAPPING y "${KERNEL_DIR}/.config"
94 set_kernel_config ZPOOL y "${KERNEL_DIR}"/.config
95 set_kernel_config ZSWAP y "${KERNEL_DIR}"/.config
96 set_kernel_config ZBUD y "${KERNEL_DIR}"/.config
97 set_kernel_config Z3FOLD y "${KERNEL_DIR}"/.config
98 set_kernel_config ZSMALLOC y "${KERNEL_DIR}"/.config
99 set_kernel_config PGTABLE_MAPPING y "${KERNEL_DIR}"/.config
100 100 fi
101 101
102 102 if [ "$KERNEL_VIRT" = true ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
103 103 # Submit PRs with edits targeting the _bottom_ of this file
104 104 # Please set modules where possible, rather than building in, and
105 105 # provide a short rationale comment for the changes made
106 106
107 107 # enable basic KVM support; see e.g.
108 108 # https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=210546&start=25#p1300453
109 109
110 set_kernel_config VIRTUALIZATION y "${KERNEL_DIR}/.config"
111 set_kernel_config KVM y "${KERNEL_DIR}/.config"
112 set_kernel_config VHOST_NET m "${KERNEL_DIR}/.config"
113 set_kernel_config VHOST_CROSS_ENDIAN_LEGACY y "${KERNEL_DIR}/.config"
110 set_kernel_config VIRTUALIZATION y "${KERNEL_DIR}"/.config
111 set_kernel_config KVM y "${KERNEL_DIR}"/.config
112 set_kernel_config VHOST_NET m "${KERNEL_DIR}"/.config
113 set_kernel_config VHOST_CROSS_ENDIAN_LEGACY y "${KERNEL_DIR}"/.config
114 fi
115
116 if [ "$KERNEL_NF" = true ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
117 # Netfilter Xtables support (required for ip_tables - should be enabled already)
118 set_kernel_config NETFILTER_XTABLES m "${KERNEL_DIR}"/.config"
119 # Netfilter nf_tables support
120 set_kernel_config NF_TABLES m "${KERNEL_DIR}"/.config"
121 set_kernel_config NFT_PAYLOAD m "${KERNEL_DIR}"/.config"
122 set_kernel_config NFT_EXTHDR m "${KERNEL_DIR}"/.config"
123 set_kernel_config NFT_META m "${KERNEL_DIR}"/.config"
124 set_kernel_config NFT_CT m "${KERNEL_DIR}"/.config"
125 set_kernel_config NFT_RBTREE m "${KERNEL_DIR}"/.config"
126 set_kernel_config NFT_HASH m "${KERNEL_DIR}"/.config"
127 set_kernel_config NFT_COUNTER m "${KERNEL_DIR}"/.config"
128 set_kernel_config NFT_LOG m "${KERNEL_DIR}"/.config"
129 set_kernel_config NFT_LIMIT m "${KERNEL_DIR}"/.config"
130 set_kernel_config NFT_NAT m "${KERNEL_DIR}"/.config"
131 set_kernel_config NFT_COMPAT m "${KERNEL_DIR}"/.config"
132 # IPv4 nf_tables support
133 set_kernel_config NF_TABLES_IPV4 m
134 set_kernel_config NFT_REJECT_IPV4 m
135 set_kernel_config NFT_CHAIN_ROUTE_IPV4 m
136 set_kernel_config NFT_CHAIN_NAT_IPV4 m
137 # IPv6 nf_tables support
138 set_kernel_config NF_TABLES_IPV6 m
139 set_kernel_config NFT_CHAIN_ROUTE_IPV6 m
140 set_kernel_config NFT_CHAIN_NAT_IPV6 m
141 # Ethernet Bridge nf_tables support
142 set_kernel_config NF_TABLES_BRIDGE m
114 143 fi
115 144
116 145 if [ "$KERNELSRC_CONFIG" = true ] ; then
117 146 # Load default raspberry kernel configuration
118 147 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
119 148
120 149 # Set kernel configuration parameters to enable qemu emulation
121 150 if [ "$ENABLE_QEMU" = true ] ; then
122 151 echo "CONFIG_FHANDLE=y" >> "${KERNEL_DIR}"/.config
123 152 echo "CONFIG_LBDAF=y" >> "${KERNEL_DIR}"/.config
124 153
125 154 if [ "$ENABLE_CRYPTFS" = true ] ; then
126 155 {
127 156 echo "CONFIG_EMBEDDED=y"
128 157 echo "CONFIG_EXPERT=y"
129 158 echo "CONFIG_DAX=y"
130 159 echo "CONFIG_MD=y"
131 160 echo "CONFIG_BLK_DEV_MD=y"
132 161 echo "CONFIG_MD_AUTODETECT=y"
133 162 echo "CONFIG_BLK_DEV_DM=y"
134 163 echo "CONFIG_BLK_DEV_DM_BUILTIN=y"
135 164 echo "CONFIG_DM_CRYPT=y"
136 165 echo "CONFIG_CRYPTO_BLKCIPHER=y"
137 166 echo "CONFIG_CRYPTO_CBC=y"
138 167 echo "CONFIG_CRYPTO_XTS=y"
139 168 echo "CONFIG_CRYPTO_SHA512=y"
140 169 echo "CONFIG_CRYPTO_MANAGER=y"
141 170 } >> ${KERNEL_DIR}/.config
142 171 fi
143 172 fi
144 173
145 174 # Copy custom kernel configuration file
146 175 if [ -n "$KERNELSRC_USRCONFIG" ] ; then
147 176 cp "$KERNELSRC_USRCONFIG" "${KERNEL_DIR}"/.config
148 177 fi
149 178
150 179 # Set kernel configuration parameters to their default values
151 180 if [ "$KERNEL_OLDDEFCONFIG" = true ] ; then
152 181 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig
153 182 fi
154 183
155 184 # Start menu-driven kernel configuration (interactive)
156 185 if [ "$KERNEL_MENUCONFIG" = true ] ; then
157 186 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
158 187 fi
159 188 fi
160 189
161 190 # Use ccache to cross compile the kernel
162 191 if [ "$KERNEL_CCACHE" = true ] ; then
163 192 cc="ccache ${CROSS_COMPILE}gcc"
164 193 else
165 194 cc="${CROSS_COMPILE}gcc"
166 195 fi
167 196
168 197 # Cross compile kernel and dtbs
169 198 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs
170 199
171 200 # Cross compile kernel modules
172 201 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
173 202 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules
174 203 fi
175 204 fi
176 205
177 206 # Check if kernel compilation was successful
178 207 if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then
179 208 echo "error: kernel compilation failed! (kernel image not found)"
180 209 cleanup
181 210 exit 1
182 211 fi
183 212
184 213 # Install kernel modules
185 214 if [ "$ENABLE_REDUCE" = true ] ; then
186 215 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
187 216 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
188 217 fi
189 218 else
190 219 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
191 220 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
192 221 fi
193 222
194 223 # Install kernel firmware
195 224 if [ "$(grep "^firmware_install:" "${KERNEL_DIR}/Makefile")" ] ; then
196 225 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
197 226 fi
198 227 fi
199 228
200 229 # Install kernel headers
201 230 if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then
202 231 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
203 232 fi
204 233 # make tar.gz kernel package - missing os bzw. modules
205 234 #** ** ** WARNING ** ** **
206 235 #Your architecture did not define any architecture-dependent files
207 236 #to be placed into the tarball. Please add those to ./scripts/package/buildtar .
208 237 # make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" targz-pkg
209 238
210 239 # Prepare boot (firmware) directory
211 240 mkdir "${BOOT_DIR}"
212 241
213 242 # Get kernel release version
214 243 KERNEL_VERSION=$(cat "${KERNEL_DIR}/include/config/kernel.release")
215 244
216 245 # Copy kernel configuration file to the boot directory
217 246 install_readonly "${KERNEL_DIR}/.config" "${R}/boot/config-${KERNEL_VERSION}"
218 247
219 248 # Prepare device tree directory
220 249 mkdir "${BOOT_DIR}/overlays"
221 250
222 251 # Ensure the proper .dtb is located
223 252 if [ "$KERNEL_ARCH" = "arm" ] ; then
224 253 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do
225 254 if [ -f "${dtb}" ] ; then
226 255 install_readonly "${dtb}" "${BOOT_DIR}/"
227 256 fi
228 257 done
229 258 else
230 259 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb ; do
231 260 if [ -f "${dtb}" ] ; then
232 261 install_readonly "${dtb}" "${BOOT_DIR}/"
233 262 fi
234 263 done
235 264 fi
236 265
237 266 # Copy compiled dtb device tree files
238 267 if [ -d "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays" ] ; then
239 268 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb ; do
240 269 if [ -f "${dtb}" ] ; then
241 270 install_readonly "${dtb}" "${BOOT_DIR}/overlays/"
242 271 fi
243 272 done
244 273
245 274 if [ -f "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" ] ; then
246 275 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README"
247 276 fi
248 277 fi
249 278
250 279 if [ "$ENABLE_UBOOT" = false ] ; then
251 280 # Convert and copy kernel image to the boot directory
252 281 "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
253 282 else
254 283 # Copy kernel image to the boot directory
255 284 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
256 285 fi
257 286
258 287 # Remove kernel sources
259 288 if [ "$KERNEL_REMOVESRC" = true ] ; then
260 289 rm -fr "${KERNEL_DIR}"
261 290 else
262 291 # Prepare compiled kernel modules
263 292 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
264 293 if [ "$(grep "^modules_prepare:" "${KERNEL_DIR}/Makefile")" ] ; then
265 294 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare
266 295 fi
267 296
268 297 # Create symlinks for kernel modules
269 298 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build"
270 299 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source"
271 300 fi
272 301 fi
273 302
274 303 else # BUILD_KERNEL=false
275 304 # echo " Install precompiled kernel..."
276 305 # echo "error: not implemented"
277 306 if [ "$KERNEL_ARCH" = arm64 ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
278 307 # Create temporary directory for dl
279 308 temp_dir=$(as_nobody mktemp -d)
280 309
281 310 # Fetch kernel dl
282 311 as_nobody wget -c "$RPI3_64_KERNEL_URL" "${temp_dir}"/kernel.tar.xz
283 312 #extract download
284 313 tar -xJf kernel.tar.xz -C "${R}"
285 314
286 315 # Remove temporary directory for kernel sources
287 316 rm -fr "${temp_dir}"
288 317
289 318 # Set permissions of the kernel sources
290 319 chown -R root:root "${R}/boot"
291 320 chown -R root:root "${R}/lib"
292 321 fi
293 322
294 323 # Check if kernel installation was successful
295 324 KERNEL="$(ls -1 "${R}"/boot/kernel* | sort | tail -n 1)"
296 325 if [ -z "$KERNEL" ] ; then
297 326 echo "error: kernel installation failed! (/boot/kernel* not found)"
298 327 cleanup
299 328 exit 1
300 329 fi
301 330
302 331 if [ "$SET_ARCH" = 64 ] ; then
303 332 echo "Using precompiled arm64 kernel"
304 333 else
305 334 echo "error: no precompiled arm64 (bcmrpi3) kernel found"
306 335 exit 1
307 336 # inset precompiled 64 bit kernel code here
308 337 fi
309 338 #fi build_kernel=true
310 339 fi
@@ -1,104 +1,104
1 1 # This file contains utility functions used by rpi23-gen-image.sh
2 2
3 3 cleanup (){
4 4 set +x
5 5 set +e
6 6
7 7 # Identify and kill all processes still using files
8 8 echo "killing processes using mount point ..."
9 9 fuser -k "${R}"
10 10 sleep 3
11 11 fuser -9 -k -v "${R}"
12 12
13 13 # Clean up temporary .password file
14 14 if [ -r ".password" ] ; then
15 15 shred -zu .password
16 16 fi
17 17
18 18 # Clean up all temporary mount points
19 19 echo "removing temporary mount points ..."
20 20 umount -l "${R}/proc" 2> /dev/null
21 21 umount -l "${R}/sys" 2> /dev/null
22 22 umount -l "${R}/dev/pts" 2> /dev/null
23 23 umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null
24 24 umount "$BUILDDIR/mount" 2> /dev/null
25 25 cryptsetup close "${CRYPTFS_MAPPING}" 2> /dev/null
26 26 losetup -d "$ROOT_LOOP" 2> /dev/null
27 27 losetup -d "$FRMW_LOOP" 2> /dev/null
28 28 trap - 0 1 2 3 6
29 29 }
30 30
31 31 chroot_exec() {
32 32 # Exec command in chroot
33 33 LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot ${R} $*
34 34 }
35 35
36 36 as_nobody() {
37 37 # Exec command as user nobody
38 38 sudo -E -u nobody LANG=C LC_ALL=C $*
39 39 }
40 40
41 41 install_readonly() {
42 42 # Install file with user read-only permissions
43 43 install -o root -g root -m 644 $*
44 44 }
45 45
46 46 install_exec() {
47 47 # Install file with root exec permissions
48 48 install -o root -g root -m 744 $*
49 49 }
50 50
51 51 use_template () {
52 52 # Test if configuration template file exists
53 53 if [ ! -r "./templates/${CONFIG_TEMPLATE}" ] ; then
54 54 echo "error: configuration template ${CONFIG_TEMPLATE} not found"
55 55 exit 1
56 56 fi
57 57
58 58 # Load template configuration parameters
59 59 . "./templates/${CONFIG_TEMPLATE}"
60 60 }
61 61
62 62 chroot_install_cc() {
63 63 # Install c/c++ build environment inside the chroot
64 64 if [ -z "${COMPILER_PACKAGES}" ] ; then
65 65 COMPILER_PACKAGES=$(chroot_exec apt-get -s install g++ make bc | grep "^Inst " | awk -v ORS=" " '{ print $2 }')
66 66
67 67 if [ "$RELEASE" = "jessie" ] ; then
68 68 chroot_exec apt-get -q -y --no-install-recommends install ${COMPILER_PACKAGES}
69 69 elif [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then
70 70 chroot_exec apt-get -q -y --allow-unauthenticated --no-install-recommends install ${COMPILER_PACKAGES}
71 71 fi
72 72 fi
73 73 }
74 74
75 75 chroot_remove_cc() {
76 76 # Remove c/c++ build environment from the chroot
77 77 if [ ! -z "${COMPILER_PACKAGES}" ] ; then
78 78 chroot_exec apt-get -qq -y --auto-remove purge ${COMPILER_PACKAGES}
79 79 COMPILER_PACKAGES=""
80 80 fi
81 81 }
82 82 #GPL v2.0
83 83 #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh
84 84 # edited with thir param
85 85 #start
86 86 set_kernel_config() {
87 87 # flag as $1, value to set as $2, config must exist at "./.config"
88 88 local TGT="CONFIG_${1}"
89 89 local REP="${2//\//\\/}"
90 if grep -q "^${TGT}[^_]" .config; then
90 if grep -q "^${TGT}[^_]" "${3}"; then
91 91 sed -i "s/^\(${TGT}=.*\|# ${TGT} is not set\)/${TGT}=${REP}/" "${3}"
92 92 else
93 93 echo "${TGT}=${2}" >> "${3}"
94 94 fi
95 95 }
96 96
97 97 unset_kernel_config() {
98 98 # unsets flag with the value of $1, config must exist at "./.config"
99 99 local TGT="CONFIG_${1}"
100 100 sed -i "s/^${TGT}=.*/# ${TGT} is not set/" "${2}"
101 101 }
102 102 #
103 103 #end
104 104 #
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant