@@ -1,6 +1,6 | |||||
1 | # rpi23-gen-image |
|
1 | # rpi23-gen-image | |
2 | ## Introduction |
|
2 | ## Introduction | |
3 |
`rpi23-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for Raspberry Pi 2 (RPi2) and Raspberry Pi 3 (RPi3) computers. The script at this time supports the bootstrapping of the Debian (armhf) releases |
|
3 | `rpi23-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for Raspberry Pi 2 (RPi2) and Raspberry Pi 3 (RPi3) computers. The script at this time supports the bootstrapping of the Debian (armhf) releases `stretch` and `buster`. Raspberry Pi 3 images are generated for 32-bit mode only. Raspberry Pi 3 64-bit images can be generated using custom configuration parameters (```templates/rpi3-stretch-arm64-4.11.y```). | |
4 |
|
4 | |||
5 | ## Build dependencies |
|
5 | ## Build dependencies | |
6 | The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user. |
|
6 | The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user. | |
@@ -9,16 +9,7 The following list of Debian packages must be installed on the build system beca | |||||
9 |
|
9 | |||
10 | It is recommended to configure the `rpi23-gen-image.sh` script to build and install the latest Raspberry Pi Linux kernel. For the RPi3 this is mandatory. Kernel compilation and linking will be performed on the build system using an ARM (armhf) cross-compiler toolchain. |
|
10 | It is recommended to configure the `rpi23-gen-image.sh` script to build and install the latest Raspberry Pi Linux kernel. For the RPi3 this is mandatory. Kernel compilation and linking will be performed on the build system using an ARM (armhf) cross-compiler toolchain. | |
11 |
|
11 | |||
12 |
The script has been tested using the default `crossbuild-essential-armhf` toolchain meta package on Debian Linux |
|
12 | The script has been tested using the default `crossbuild-essential-armhf` toolchain meta package on Debian Linux and `stretch` build systems. Please check the [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains) for further information. | |
13 |
|
||||
14 | If a Debian Linux `jessie` build system is used it will be required to add the [Debian Cross-toolchains repository](http://emdebian.org/tools/debian/) first: |
|
|||
15 |
|
||||
16 | ``` |
|
|||
17 | echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/crosstools.list |
|
|||
18 | sudo -u nobody wget -O - http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add - |
|
|||
19 | dpkg --add-architecture armhf |
|
|||
20 | apt-get update |
|
|||
21 | ``` |
|
|||
22 |
|
13 | |||
23 | ## Command-line parameters |
|
14 | ## Command-line parameters | |
24 | The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi23-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi23-gen-image.sh` script. |
|
15 | The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi23-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi23-gen-image.sh` script. | |
@@ -55,7 +46,7 CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh | |||||
55 | Set Debian packages server address. Choose a server from the list of Debian worldwide [mirror sites](https://www.debian.org/mirror/list). Using a nearby server will probably speed-up all required downloads within the bootstrapping process. |
|
46 | Set Debian packages server address. Choose a server from the list of Debian worldwide [mirror sites](https://www.debian.org/mirror/list). Using a nearby server will probably speed-up all required downloads within the bootstrapping process. | |
56 |
|
47 | |||
57 | ##### `APT_PROXY`="" |
|
48 | ##### `APT_PROXY`="" | |
58 | Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will speed-up the bootstrapping process because all required Debian packages will only be downloaded from the Debian mirror site once. |
|
49 | Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will speed-up the bootstrapping process because all required Debian packages will only be downloaded from the Debian mirror site once. If `apt-cacher-ng` is running on default `http://127.0.0.1:3142` it is autodetected and you don't need to set this. | |
59 |
|
50 | |||
60 | ##### `APT_INCLUDES`="" |
|
51 | ##### `APT_INCLUDES`="" | |
61 | A comma separated list of additional packages to be installed by debootstrap during bootstrapping. |
|
52 | A comma separated list of additional packages to be installed by debootstrap during bootstrapping. | |
@@ -76,8 +67,8 Specifiy the target Raspberry Pi hardware model. The script at this time support | |||||
76 | `3P` = Used for Pi 3 model B+ |
|
67 | `3P` = Used for Pi 3 model B+ | |
77 | `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` or `3P` is used. |
|
68 | `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` or `3P` is used. | |
78 |
|
69 | |||
79 |
##### `RELEASE`=" |
|
70 | ##### `RELEASE`="buster" | |
80 |
Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases |
|
71 | Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases "stretch" and "buster". `BUILD_KERNEL`=true will automatically be set if the Debian releases `stretch` or `buster` are used. | |
81 |
|
72 | |||
82 | ##### `RELEASE_ARCH`="armhf" |
|
73 | ##### `RELEASE_ARCH`="armhf" | |
83 | Set the desired Debian release architecture. |
|
74 | Set the desired Debian release architecture. |
@@ -19,7 +19,7 if [ "$ENABLE_MINBASE" = true ] ; then | |||||
19 | fi |
|
19 | fi | |
20 |
|
20 | |||
21 | # Base debootstrap (unpack only) |
|
21 | # Base debootstrap (unpack only) | |
22 |
http_proxy=${APT_PROXY} debootstrap |
|
22 | http_proxy=${APT_PROXY} debootstrap ${APT_EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" | |
23 |
|
23 | |||
24 | # Copy qemu emulator binary to chroot |
|
24 | # Copy qemu emulator binary to chroot | |
25 | install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" |
|
25 | install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" |
@@ -12,28 +12,12 if [ -z "$APT_PROXY" ] ; then | |||||
12 | fi |
|
12 | fi | |
13 |
|
13 | |||
14 | if [ "$BUILD_KERNEL" = false ] ; then |
|
14 | if [ "$BUILD_KERNEL" = false ] ; then | |
15 | # Install APT pinning configuration for flash-kernel package |
|
15 | echo "Downloading precompiled kernel" | |
16 | install_readonly files/apt/flash-kernel "${ETC_DIR}/apt/preferences.d/flash-kernel" |
|
16 | echo "error: not configured" | |
17 |
|
17 | exit 1; | ||
18 | # Install APT sources.list |
|
18 | # BUILD_KERNEL=true | |
19 | install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list" |
|
19 | else | |
20 | echo "deb ${COLLABORA_URL} ${RELEASE} rpi2" >> "${ETC_DIR}/apt/sources.list" |
|
20 | echo "No precompiled kernel repositories were added" | |
21 |
|
||||
22 | # Upgrade collabora package index and install collabora keyring |
|
|||
23 | chroot_exec apt-get -qq -y update |
|
|||
24 | chroot_exec apt-get -qq -y --allow-unauthenticated install collabora-obs-archive-keyring |
|
|||
25 | else # BUILD_KERNEL=true |
|
|||
26 | # Install APT sources.list |
|
|||
27 | install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list" |
|
|||
28 |
|
||||
29 | # Use specified APT server and release |
|
|||
30 | sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "${ETC_DIR}/apt/sources.list" |
|
|||
31 | sed -i "s/ jessie/ ${RELEASE}/" "${ETC_DIR}/apt/sources.list" |
|
|||
32 | fi |
|
|||
33 |
|
||||
34 | # Allow the installation of non-free Debian packages |
|
|||
35 | if [ "$ENABLE_NONFREE" = true ] ; then |
|
|||
36 | sed -i "s/ contrib/ contrib non-free/" "${ETC_DIR}/apt/sources.list" |
|
|||
37 | fi |
|
21 | fi | |
38 |
|
22 | |||
39 | # Upgrade package index and update all installed packages and changed dependencies |
|
23 | # Upgrade package index and update all installed packages and changed dependencies |
@@ -1,9 +1,8 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/bash | |
2 |
|
||||
3 | ######################################################################## |
|
2 | ######################################################################## | |
4 | # rpi23-gen-image.sh 2015-2017 |
|
3 | # rpi23-gen-image.sh 2015-2017 | |
5 | # |
|
4 | # | |
6 |
# Advanced Debian " |
|
5 | # Advanced Debian "stretch" and "buster" bootstrap script for RPi2/3 | |
7 | # |
|
6 | # | |
8 | # This program is free software; you can redistribute it and/or |
|
7 | # This program is free software; you can redistribute it and/or | |
9 | # modify it under the terms of the GNU General Public License |
|
8 | # modify it under the terms of the GNU General Public License | |
@@ -43,57 +42,10 set -x | |||||
43 | # Raspberry Pi model configuration |
|
42 | # Raspberry Pi model configuration | |
44 | RPI_MODEL=${RPI_MODEL:=2} |
|
43 | RPI_MODEL=${RPI_MODEL:=2} | |
45 |
|
44 | |||
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 | # Debian release |
|
45 | # Debian release | |
71 |
RELEASE=${RELEASE:= |
|
46 | RELEASE=${RELEASE:=buster} | |
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 |
|
47 | |||
81 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then |
|
48 | #Kernel Branch | |
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 |
|
|||
91 |
|
||||
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=${KERNEL_BRANCH:=""} | |
98 |
|
50 | |||
99 | # URLs |
|
51 | # URLs | |
@@ -103,7 +55,7 WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-no | |||||
103 | COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian} |
|
55 | COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian} | |
104 | FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} |
|
56 | FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} | |
105 | UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git} |
|
57 | UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git} | |
106 | VIDEOCORE_URL=${VIDEOCORE_URL=https://github.com/raspberrypi/userland} |
|
58 | VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland} | |
107 | BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git} |
|
59 | BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git} | |
108 |
|
60 | |||
109 | # Build directories |
|
61 | # Build directories | |
@@ -130,6 +82,7 WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm" | |||||
130 | RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} |
|
82 | RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} | |
131 |
|
83 | |||
132 | # General settings |
|
84 | # General settings | |
|
85 | SET_ARCH=${SET_ARCH:=32} | |||
133 | HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}} |
|
86 | HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}} | |
134 | PASSWORD=${PASSWORD:=raspberry} |
|
87 | PASSWORD=${PASSWORD:=raspberry} | |
135 | USER_PASSWORD=${USER_PASSWORD:=raspberry} |
|
88 | USER_PASSWORD=${USER_PASSWORD:=raspberry} | |
@@ -204,7 +157,7 ENABLE_IFNAMES=${ENABLE_IFNAMES:=true} | |||||
204 | DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=} |
|
157 | DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=} | |
205 |
|
158 | |||
206 | # Kernel compilation settings |
|
159 | # Kernel compilation settings | |
207 |
BUILD_KERNEL=${BUILD_KERNEL:= |
|
160 | BUILD_KERNEL=${BUILD_KERNEL:=true} | |
208 | KERNEL_REDUCE=${KERNEL_REDUCE:=false} |
|
161 | KERNEL_REDUCE=${KERNEL_REDUCE:=false} | |
209 | KERNEL_THREADS=${KERNEL_THREADS:=1} |
|
162 | KERNEL_THREADS=${KERNEL_THREADS:=1} | |
210 | KERNEL_HEADERS=${KERNEL_HEADERS:=true} |
|
163 | KERNEL_HEADERS=${KERNEL_HEADERS:=true} | |
@@ -213,12 +166,6 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} | |||||
213 | KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false} |
|
166 | KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false} | |
214 | KERNEL_CCACHE=${KERNEL_CCACHE:=false} |
|
167 | KERNEL_CCACHE=${KERNEL_CCACHE:=false} | |
215 |
|
168 | |||
216 | if [ "$KERNEL_ARCH" = "arm64" ] ; then |
|
|||
217 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} |
|
|||
218 | else |
|
|||
219 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} |
|
|||
220 | fi |
|
|||
221 |
|
||||
222 | # Kernel compilation from source directory settings |
|
169 | # Kernel compilation from source directory settings | |
223 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} |
|
170 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} | |
224 | KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false} |
|
171 | KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false} | |
@@ -269,36 +216,109 fi | |||||
269 | #Check if apt-cacher-ng has its default port open on and set APT_PROXY |
|
216 | #Check if apt-cacher-ng has its default port open on and set APT_PROXY | |
270 | if [ -n "$(lsof -i :3142)" ] ; then |
|
217 | if [ -n "$(lsof -i :3142)" ] ; then | |
271 | HTTP_PROXY=http://127.0.0.1:3142/ |
|
218 | HTTP_PROXY=http://127.0.0.1:3142/ | |
|
219 | fi | |||
|
220 | ||||
|
221 | #make script easier and more stable to use with convenient setup switch. Just setup SET_ARCH and RPI_MODEL and your good to go! | |||
|
222 | if [ -n "$SET_ARCH" ] ; then | |||
|
223 | echo "Setting Architecture specific settings" | |||
|
224 | ################################## | |||
|
225 | # 64 bit config | |||
|
226 | ################################## | |||
|
227 | if [ "$SET_ARCH" = 64 ] ; then | |||
|
228 | echo "64 bit mode selected - Setting up enviroment" | |||
|
229 | # 64 bit depended settings | |||
|
230 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static} | |||
|
231 | KERNEL_ARCH=${KERNEL_ARCH:=arm64} | |||
|
232 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} | |||
272 |
|
233 | |||
273 | # Set Raspberry Pi model specific configuration |
|
234 | if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |
274 | if [ "$RPI_MODEL" = 0 ] ; then |
|
235 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" | |
275 | DTB_FILE=${RPI0_DTB_FILE} |
|
236 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig} | |
276 | UBOOT_CONFIG=${RPI0_UBOOT_CONFIG} |
|
237 | RELEASE_ARCH=${RELEASE_ARCH:=arm64} | |
277 | elif [ "$RPI_MODEL" = 1 ] ; then |
|
238 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} | |
278 | DTB_FILE=${RPI1_DTB_FILE} |
|
239 | CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-} | |
279 | UBOOT_CONFIG=${RPI1_UBOOT_CONFIG} |
|
|||
280 | elif [ "$RPI_MODEL" = 1P ] ; then |
|
|||
281 | DTB_FILE=${RPI1P_DTB_FILE} |
|
|||
282 | UBOOT_CONFIG=${RPI1P_UBOOT_CONFIG} |
|
|||
283 | elif [ "$RPI_MODEL" = 2 ] ; then |
|
|||
284 | DTB_FILE=${RPI2_DTB_FILE} |
|
|||
285 | UBOOT_CONFIG=${RPI2_UBOOT_CONFIG} |
|
|||
286 | elif [ "$RPI_MODEL" = 3 ] ; then |
|
|||
287 | DTB_FILE=${RPI3_DTB_FILE} |
|
|||
288 | UBOOT_CONFIG=${RPI3_UBOOT_CONFIG} |
|
|||
289 | elif [ "$RPI_MODEL" = 3P ] ; then |
|
|||
290 | DTB_FILE=${RPI3P_DTB_FILE} |
|
|||
291 | UBOOT_CONFIG=${RPI3P_UBOOT_CONFIG} |
|
|||
292 | else |
|
240 | else | |
293 |
echo "error: Raspberry P |
|
241 | echo "error: Only Raspberry PI 3 and 3B+ support 64bit" | |
294 | exit 1 |
|
242 | exit 1 | |
295 | fi |
|
243 | fi | |
|
244 | fi | |||
296 |
|
245 | |||
297 | # Check if the internal wireless interface is supported by the RPi model |
|
246 | ################################## | |
298 | if [ "$ENABLE_WIRELESS" = true ] && ([ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 2 ]); then |
|
247 | # 32 bit config | |
|
248 | ################################## | |||
|
249 | if [ "$SET_ARCH" = 32 ] ; then | |||
|
250 | echo "32 bit mode selected - Setting up enviroment" | |||
|
251 | #General 32bit configuration | |||
|
252 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} | |||
|
253 | KERNEL_ARCH=${KERNEL_ARCH:=arm} | |||
|
254 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} | |||
|
255 | ||||
|
256 | #Raspberry setting grouped by board compability | |||
|
257 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then | |||
|
258 | echo "Setting settings for bcm2835 Raspberry PI boards" | |||
|
259 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel" | |||
|
260 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig} | |||
|
261 | RELEASE_ARCH=${RELEASE_ARCH:=armel} | |||
|
262 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img} | |||
|
263 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-} | |||
|
264 | fi | |||
|
265 | if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||
|
266 | echo "Setting settings for bcm2837 Raspberry PI boards" | |||
|
267 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" | |||
|
268 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} | |||
|
269 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} | |||
|
270 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} | |||
|
271 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} | |||
|
272 | fi | |||
|
273 | fi | |||
|
274 | #SET_ARCH not set | |||
|
275 | else | |||
|
276 | echo "error: Please set '32' or '64' as value for SET_ARCH" | |||
|
277 | exit 1 | |||
|
278 | fi | |||
|
279 | ||||
|
280 | #Device specific configuration and uboot-config | |||
|
281 | echo "Select DTB-File" | |||
|
282 | case "$RPI_MODEL" in | |||
|
283 | 0) | |||
|
284 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb} | |||
|
285 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} | |||
|
286 | ;; | |||
|
287 | 1) | |||
|
288 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb} | |||
|
289 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} | |||
|
290 | ;; | |||
|
291 | 1P) | |||
|
292 | DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb} | |||
|
293 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig} | |||
|
294 | ;; | |||
|
295 | 2) | |||
|
296 | DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb} | |||
|
297 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig} | |||
|
298 | ;; | |||
|
299 | 3) | |||
|
300 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} | |||
|
301 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig} | |||
|
302 | ;; | |||
|
303 | 3P) | |||
|
304 | DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb} | |||
|
305 | UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig} | |||
|
306 | ;; | |||
|
307 | *) | |||
|
308 | echo "error: Raspberry Pi model $RPI_MODEL is not supported!" | |||
|
309 | exit 1 | |||
|
310 | ;; | |||
|
311 | esac | |||
|
312 | echo "$DTB_FILE selected" | |||
299 |
|
313 | |||
|
314 | # Check if the internal wireless interface is supported by the RPi model | |||
|
315 | if [ "$ENABLE_WIRELESS" = true ] ; then | |||
|
316 | if [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 2 ] ; then | |||
300 | echo "error: The selected Raspberry Pi model has no internal wireless interface" |
|
317 | echo "error: The selected Raspberry Pi model has no internal wireless interface" | |
301 | exit 1 |
|
318 | exit 1 | |
|
319 | else | |||
|
320 | echo "Raspberry Pi $RPI_MODEL has WIFI support" | |||
|
321 | fi | |||
302 |
fi |
|
322 | fi | |
303 |
|
323 | |||
304 | # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported |
|
324 | # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported | |
@@ -309,11 +329,6 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then | |||||
309 | fi |
|
329 | fi | |
310 | fi |
|
330 | fi | |
311 |
|
331 | |||
312 | # Build RPi2/3 Linux kernel if required by Debian release |
|
|||
313 | if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then |
|
|||
314 | BUILD_KERNEL=true |
|
|||
315 | fi |
|
|||
316 |
|
||||
317 | # Add packages required for kernel cross compilation |
|
332 | # Add packages required for kernel cross compilation | |
318 | if [ "$BUILD_KERNEL" = true ] ; then |
|
333 | if [ "$BUILD_KERNEL" = true ] ; then | |
319 | if [ "$KERNEL_ARCH" = "arm" ] ; then |
|
334 | if [ "$KERNEL_ARCH" = "arm" ] ; then | |
@@ -536,10 +551,6 if [ "$ENABLE_REDUCE" = true ] ; then | |||||
536 | fi |
|
551 | fi | |
537 | fi |
|
552 | fi | |
538 |
|
553 | |||
539 | if [ "$RELEASE" != "jessie" ] ; then |
|
|||
540 | APT_INCLUDES="${APT_INCLUDES},libnss-systemd" |
|
|||
541 | fi |
|
|||
542 |
|
||||
543 | # Configure kernel sources if no KERNELSRC_DIR |
|
554 | # Configure kernel sources if no KERNELSRC_DIR | |
544 | if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then |
|
555 | if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then | |
545 | KERNELSRC_CONFIG=true |
|
556 | KERNELSRC_CONFIG=true | |
@@ -589,11 +600,6 fi | |||||
589 | # Remove c/c++ build environment from the chroot |
|
600 | # Remove c/c++ build environment from the chroot | |
590 | chroot_remove_cc |
|
601 | chroot_remove_cc | |
591 |
|
602 | |||
592 | # Remove apt-utils |
|
|||
593 | if [ "$RELEASE" = "jessie" ] ; then |
|
|||
594 | chroot_exec apt-get purge -qq -y --force-yes apt-utils |
|
|||
595 | fi |
|
|||
596 |
|
||||
597 | # Generate required machine-id |
|
603 | # Generate required machine-id | |
598 | MACHINE_ID=$(dbus-uuidgen) |
|
604 | MACHINE_ID=$(dbus-uuidgen) | |
599 | echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id" |
|
605 | echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id" |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant