@@ -43,58 +43,11 set -x | |||
|
43 | 43 | # Raspberry Pi model configuration |
|
44 | 44 | RPI_MODEL=${RPI_MODEL:=2} |
|
45 | 45 | |
|
46 | #bcm2708-rpi-0-w.dtb (Used for Pi 0 and PI 0W) | |
|
47 | RPI0_DTB_FILE=${RPI0_DTB_FILE:=bcm2708-rpi-0-w.dtb} | |
|
48 | RPI0_UBOOT_CONFIG=${RPI0_UBOOT_CONFIG:=rpi_defconfig} | |
|
49 | ||
|
50 | #bcm2708-rpi-b.dtb (Used for Pi 1 model A and B) | |
|
51 | RPI1_DTB_FILE=${RPI1_DTB_FILE:=bcm2708-rpi-b.dtb} | |
|
52 | RPI1_UBOOT_CONFIG=${RPI1_UBOOT_CONFIG:=rpi_defconfig} | |
|
53 | ||
|
54 | #bcm2708-rpi-b-plus.dtb (Used for Pi 1 model B+ and A+) | |
|
55 | RPI1P_DTB_FILE=${RPI1P_DTB_FILE:=bcm2708-rpi-b-plus.dtb} | |
|
56 | RPI1P_UBOOT_CONFIG=${RPI1P_UBOOT_CONFIG:=rpi_defconfig} | |
|
57 | ||
|
58 | #bcm2709-rpi-2-b.dtb (Used for Pi 2 model B) | |
|
59 | RPI2_DTB_FILE=${RPI2_DTB_FILE:=bcm2709-rpi-2-b.dtb} | |
|
60 | RPI2_UBOOT_CONFIG=${RPI2_UBOOT_CONFIG:=rpi_2_defconfig} | |
|
61 | ||
|
62 | #bcm2710-rpi-3-b.dtb (Used for Pi 3 model B) | |
|
63 | RPI3_DTB_FILE=${RPI3_DTB_FILE:=bcm2710-rpi-3-b.dtb} | |
|
64 | RPI3_UBOOT_CONFIG=${RPI3_UBOOT_CONFIG:=rpi_3_32b_defconfig} | |
|
65 | ||
|
66 | #bcm2710-rpi-3-b-plus.dtb (Used for Pi 3 model B+) | |
|
67 | RPI3P_DTB_FILE=${RPI3P_DTB_FILE:=bcm2710-rpi-3-b-plus.dtb} | |
|
68 | RPI3P_UBOOT_CONFIG=${RPI3P_UBOOT_CONFIG:=rpi_3_32b_defconfig} | |
|
69 | ||
|
70 | 46 | # Debian release |
|
71 |
RELEASE=${RELEASE:= |
|
|
72 | KERNEL_ARCH=${KERNEL_ARCH:=arm} | |
|
73 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} | |
|
74 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} | |
|
75 | COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2} | |
|
76 | if [ "$KERNEL_ARCH" = "arm64" ] ; then | |
|
77 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig} | |
|
78 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} | |
|
79 | fi | |
|
80 | ||
|
81 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then | |
|
82 | #RASPBERRY PI 1, PI ZERO, PI ZERO W, AND COMPUTE MODULE DEFAULT Kernel BUILD CONFIGURATION | |
|
83 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig} | |
|
84 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} | |
|
85 | else | |
|
86 | #RASPBERRY PI 2, PI 3, PI 3+, AND COMPUTE MODULE 3 DEFAULT Kernel BUILD CONFIGURATION | |
|
87 | #https://www.raspberrypi.org/documentation/linux/kernel/building.md | |
|
88 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} | |
|
89 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} | |
|
90 | fi | |
|
47 | RELEASE=${RELEASE:=buster} | |
|
91 | 48 | |
|
92 | if [ "$RELEASE_ARCH" = "arm64" ] ; then | |
|
93 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static} | |
|
94 | else | |
|
95 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} | |
|
96 | fi | |
|
97 | KERNEL_BRANCH=${KERNEL_BRANCH:=""} | |
|
49 | #Kernel Branch | |
|
50 | KERNEL_BRANCH=${KERNEL_BRANCH:="rpi-4.14.y"} | |
|
98 | 51 | |
|
99 | 52 | # URLs |
|
100 | 53 | KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} |
@@ -128,6 +81,7 WLAN_FIRMWARE_DIR="${R}/lib/firmware/brcm" | |||
|
128 | 81 | RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} |
|
129 | 82 | |
|
130 | 83 | # General settings |
|
84 | SET_ARCH=${SET_ARCH} | |
|
131 | 85 | HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}} |
|
132 | 86 | PASSWORD=${PASSWORD:=raspberry} |
|
133 | 87 | USER_PASSWORD=${USER_PASSWORD:=raspberry} |
@@ -208,12 +162,6 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} | |||
|
208 | 162 | KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false} |
|
209 | 163 | KERNEL_CCACHE=${KERNEL_CCACHE:=false} |
|
210 | 164 | |
|
211 | if [ "$KERNEL_ARCH" = "arm64" ] ; then | |
|
212 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} | |
|
213 | else | |
|
214 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} | |
|
215 | fi | |
|
216 | ||
|
217 | 165 | # Kernel compilation from source directory settings |
|
218 | 166 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} |
|
219 | 167 | KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false} |
@@ -253,35 +201,98 COMPILER_PACKAGES="" | |||
|
253 | 201 | |
|
254 | 202 | set +x |
|
255 | 203 | |
|
256 | # Set Raspberry Pi model specific configuration | |
|
257 | if [ "$RPI_MODEL" = 0 ] ; then | |
|
258 | DTB_FILE=${RPI0_DTB_FILE} | |
|
259 | UBOOT_CONFIG=${RPI0_UBOOT_CONFIG} | |
|
260 | elif [ "$RPI_MODEL" = 1 ] ; then | |
|
261 | DTB_FILE=${RPI1_DTB_FILE} | |
|
262 | UBOOT_CONFIG=${RPI1_UBOOT_CONFIG} | |
|
263 | elif [ "$RPI_MODEL" = 1P ] ; then | |
|
264 | DTB_FILE=${RPI1P_DTB_FILE} | |
|
265 | UBOOT_CONFIG=${RPI1P_UBOOT_CONFIG} | |
|
266 | elif [ "$RPI_MODEL" = 2 ] ; then | |
|
267 | DTB_FILE=${RPI2_DTB_FILE} | |
|
268 | UBOOT_CONFIG=${RPI2_UBOOT_CONFIG} | |
|
269 | elif [ "$RPI_MODEL" = 3 ] ; then | |
|
270 | DTB_FILE=${RPI3_DTB_FILE} | |
|
271 | UBOOT_CONFIG=${RPI3_UBOOT_CONFIG} | |
|
272 | elif [ "$RPI_MODEL" = 3P ] ; then | |
|
273 |
DTB_FILE=${ |
|
|
274 |
UBOOT_CONFIG=${ |
|
|
204 | #make script easier and more stable to use with convenient setup switch. Just setup SET_ARCH and RPI_MODEL and your good to go! | |
|
205 | if [ -n "$SET_ARCH" ] | |
|
206 | echo "Setting Architecture specific settings" | |
|
207 | ################################## | |
|
208 | # 64 bit config | |
|
209 | ################################## | |
|
210 | if [ "$SET_ARCH" = 64 ] && ([ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]); then | |
|
211 | echo "64 bit mode selected - Setting up enviroment" | |
|
212 | # 64 bit depended settings | |
|
213 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static} | |
|
214 | KERNEL_ARCH=${KERNEL_ARCH:=arm64} | |
|
215 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} | |
|
216 | RELEASE_ARCH=${RELEASE_ARCH:=arm64} | |
|
217 | CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-} | |
|
218 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" | |
|
219 | ||
|
220 | # RPI 3 serie specific settings | |
|
221 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} | |
|
222 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig} | |
|
223 | ||
|
224 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig} | |
|
225 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} | |
|
275 | 226 | else |
|
227 | echo "error: Only Raspberry PI 3 and 3B+ support 64bit" | |
|
228 | exit 1 | |
|
229 | fi | |
|
230 | ||
|
231 | ################################## | |
|
232 | # 32 bit config | |
|
233 | ################################## | |
|
234 | if [ "$SET_ARCH" = 32 ] ; then | |
|
235 | echo "32 bit mode selected - Setting up enviroment" | |
|
236 | #General 32bit configuration | |
|
237 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} | |
|
238 | KERNEL_ARCH=${KERNEL_ARCH:=arm} | |
|
239 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} | |
|
240 | ||
|
241 | #Raspberry setting grouped by board compability | |
|
242 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then | |
|
243 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel" | |
|
244 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig} | |
|
245 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} | |
|
246 | RELEASE_ARCH=${RELEASE_ARCH:=armel} | |
|
247 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img} | |
|
248 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-} | |
|
249 | elif [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |
|
250 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" | |
|
251 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} | |
|
252 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} | |
|
253 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} | |
|
254 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} | |
|
255 | fi | |
|
256 | ||
|
257 | #Device specific configuration | |
|
258 | case "$RPI_MODEL" in | |
|
259 | 0) | |
|
260 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb} ;; | |
|
261 | 1) | |
|
262 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb} ;; | |
|
263 | 1P) | |
|
264 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb} ;; | |
|
265 | 2) | |
|
266 | DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb} | |
|
267 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig} | |
|
268 | #Precompiled Kernel rpi2 | |
|
269 | COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2} | |
|
270 | ;; | |
|
271 | 3) | |
|
272 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} | |
|
273 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_32b_defconfig} | |
|
274 | ;; | |
|
275 | 3P | |
|
276 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} | |
|
277 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_32b_defconfig} | |
|
278 | ;; | |
|
279 | *) | |
|
276 | 280 | echo "error: Raspberry Pi model ${RPI_MODEL} is not supported!" |
|
277 | 281 | exit 1 |
|
282 | ;; | |
|
283 | esac | |
|
284 | fi | |
|
285 | else | |
|
286 | echo "error: Please set '32' or '64' as value for SET_ARCH" | |
|
287 | exit 1 | |
|
278 | 288 | fi |
|
279 | 289 | |
|
280 | 290 | # Check if the internal wireless interface is supported by the RPi model |
|
281 | 291 | if [ "$ENABLE_WIRELESS" = true ] && ([ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 2 ]); then |
|
282 | ||
|
283 | 292 | echo "error: The selected Raspberry Pi model has no internal wireless interface" |
|
284 | 293 | exit 1 |
|
294 | else | |
|
295 | echo "Raspberry Pi model" | |
|
285 | 296 | fi |
|
286 | 297 | |
|
287 | 298 | # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported |
@@ -292,26 +303,6 if [ ! -z "$DISABLE_UNDERVOLT_WARNINGS" ] ; then | |||
|
292 | 303 | fi |
|
293 | 304 | fi |
|
294 | 305 | |
|
295 | # Build RPi2/3 Linux kernel if required by Debian release | |
|
296 | if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then | |
|
297 | BUILD_KERNEL=true | |
|
298 | fi | |
|
299 | ||
|
300 | # Add packages required for kernel cross compilation | |
|
301 | if [ "$BUILD_KERNEL" = true ] ; then | |
|
302 | if [ "$KERNEL_ARCH" = "arm" ] ; then | |
|
303 | if [ "$RELEASE_ARCH" = "armel" ]; then | |
|
304 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel" | |
|
305 | fi | |
|
306 | if [ "$RELEASE_ARCH" = "armhf" ]; then | |
|
307 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" | |
|
308 | fi | |
|
309 | if [ "$RELEASE_ARCH" = "arm64" ]; then | |
|
310 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" | |
|
311 | fi | |
|
312 | fi | |
|
313 | fi | |
|
314 | ||
|
315 | 306 | # Add libncurses5 to enable kernel menuconfig |
|
316 | 307 | if [ "$KERNEL_MENUCONFIG" = true ] ; then |
|
317 | 308 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses5-dev" |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant