@@ -0,0 +1,15 | |||||
|
1 | # Configuration template file used by rpi23-gen-image.sh | |||
|
2 | # Debian Stretch using the Arm64 for kernel compilation and Debian distribution. | |||
|
3 | ||||
|
4 | RPI_MODEL=3 | |||
|
5 | RELEASE=stretch | |||
|
6 | BUILD_KERNEL=true | |||
|
7 | KERNEL_ARCH=arm64 | |||
|
8 | RELEASE_ARCH=arm64 | |||
|
9 | CROSS_COMPILE=aarch64-linux-gnu- | |||
|
10 | QEMU_BINARY=/usr/bin/qemu-aarch64-static | |||
|
11 | KERNEL_DEFCONFIG=bcmrpi3_defconfig | |||
|
12 | KERNEL_BIN_IMAGE=Image | |||
|
13 | KERNEL_IMAGE=kernel8.img | |||
|
14 | KERNEL_BRANCH=rpi-4.11.y | |||
|
15 | ENABLE_WIRELESS=true |
@@ -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 `jessie` and `stretch`. Raspberry Pi 3 images are |
|
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 `jessie` and `stretch`. 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. | |
@@ -23,7 +23,7 apt-get update | |||||
23 | ## Command-line parameters |
|
23 | ## 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. |
|
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. | |
25 |
|
25 | |||
26 | #####Command-line examples: |
|
26 | ##### Command-line examples: | |
27 | ```shell |
|
27 | ```shell | |
28 | ENABLE_UBOOT=true ./rpi23-gen-image.sh |
|
28 | ENABLE_UBOOT=true ./rpi23-gen-image.sh | |
29 | ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi23-gen-image.sh |
|
29 | ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi23-gen-image.sh | |
@@ -43,7 +43,7 RELEASE=stretch RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNE | |||||
43 | ## Configuration template files |
|
43 | ## Configuration template files | |
44 | To avoid long lists of command-line parameters and to help to store the favourite parameter configurations the `rpi23-gen-image.sh` script supports so called configuration template files (`CONFIG_TEMPLATE`=template). These are simple text files located in the `./templates` directory that contain the list of configuration parameters that will be used. New configuration template files can be added to the `./templates` directory. |
|
44 | To avoid long lists of command-line parameters and to help to store the favourite parameter configurations the `rpi23-gen-image.sh` script supports so called configuration template files (`CONFIG_TEMPLATE`=template). These are simple text files located in the `./templates` directory that contain the list of configuration parameters that will be used. New configuration template files can be added to the `./templates` directory. | |
45 |
|
45 | |||
46 | #####Command-line examples: |
|
46 | ##### Command-line examples: | |
47 | ```shell |
|
47 | ```shell | |
48 | CONFIG_TEMPLATE=rpi3stretch ./rpi23-gen-image.sh |
|
48 | CONFIG_TEMPLATE=rpi3stretch ./rpi23-gen-image.sh | |
49 | CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh |
|
49 | CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh | |
@@ -58,7 +58,10 Set Debian packages server address. Choose a server from the list of Debian worl | |||||
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. |
|
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. | |
59 |
|
59 | |||
60 | ##### `APT_INCLUDES`="" |
|
60 | ##### `APT_INCLUDES`="" | |
61 | A comma separated list of additional packages to be installed during bootstrapping. |
|
61 | A comma separated list of additional packages to be installed by debootstrap during bootstrapping. | |
|
62 | ||||
|
63 | ##### `APT_INCLUDES_LATE`="" | |||
|
64 | A comma separated list of additional packages to be installed by apt after bootstrapping and after APT sources are set up. This is useful for packages with pre-depends, which debootstrap do not handle well. | |||
62 |
|
65 | |||
63 | --- |
|
66 | --- | |
64 |
|
67 | |||
@@ -69,6 +72,9 Specifiy the target Raspberry Pi hardware model. The script at this time support | |||||
69 | ##### `RELEASE`="jessie" |
|
72 | ##### `RELEASE`="jessie" | |
70 | Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases "jessie" and "stretch". `BUILD_KERNEL`=true will automatically be set if the Debian release `stretch` is used. |
|
73 | Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases "jessie" and "stretch". `BUILD_KERNEL`=true will automatically be set if the Debian release `stretch` is used. | |
71 |
|
74 | |||
|
75 | ##### `RELEASE_ARCH`="armhf" | |||
|
76 | Set the desired Debian release architecture. | |||
|
77 | ||||
72 | ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE" |
|
78 | ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE" | |
73 | Set system host name. It's recommended that the host name is unique in the corresponding subnet. |
|
79 | Set system host name. It's recommended that the host name is unique in the corresponding subnet. | |
74 |
|
80 | |||
@@ -89,7 +95,7 Expand the root partition and filesystem automatically on first boot. | |||||
89 |
|
95 | |||
90 | --- |
|
96 | --- | |
91 |
|
97 | |||
92 |
#### |
|
98 | #### Keyboard settings: | |
93 | These options are used to configure keyboard layout in `/etc/default/keyboard` for console and Xorg. These settings can also be changed inside the running OS using the `dpkg-reconfigure keyboard-configuration` command. |
|
99 | These options are used to configure keyboard layout in `/etc/default/keyboard` for console and Xorg. These settings can also be changed inside the running OS using the `dpkg-reconfigure keyboard-configuration` command. | |
94 |
|
100 | |||
95 | ##### `XKB_MODEL`="" |
|
101 | ##### `XKB_MODEL`="" | |
@@ -109,7 +115,7 Set extra xkb configuration options. | |||||
109 | #### Networking settings (DHCP): |
|
115 | #### Networking settings (DHCP): | |
110 | This parameter is used to set up networking auto configuration in `/etc/systemd/network/eth.network`. The default location of network configuration files in the Debian `stretch` release was changed to `/lib/systemd/network`.` |
|
116 | This parameter is used to set up networking auto configuration in `/etc/systemd/network/eth.network`. The default location of network configuration files in the Debian `stretch` release was changed to `/lib/systemd/network`.` | |
111 |
|
117 | |||
112 | #####`ENABLE_DHCP`=true |
|
118 | ##### `ENABLE_DHCP`=true | |
113 | Set the system to use DHCP. This requires an DHCP server. |
|
119 | Set the system to use DHCP. This requires an DHCP server. | |
114 |
|
120 | |||
115 | --- |
|
121 | --- | |
@@ -117,25 +123,25 Set the system to use DHCP. This requires an DHCP server. | |||||
117 | #### Networking settings (static): |
|
123 | #### Networking settings (static): | |
118 | These parameters are used to set up a static networking configuration in `/etc/systemd/network/eth.network`. The following static networking parameters are only supported if `ENABLE_DHCP` was set to `false`. The default location of network configuration files in the Debian `stretch` release was changed to `/lib/systemd/network`. |
|
124 | These parameters are used to set up a static networking configuration in `/etc/systemd/network/eth.network`. The following static networking parameters are only supported if `ENABLE_DHCP` was set to `false`. The default location of network configuration files in the Debian `stretch` release was changed to `/lib/systemd/network`. | |
119 |
|
125 | |||
120 | #####`NET_ADDRESS`="" |
|
126 | ##### `NET_ADDRESS`="" | |
121 | Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24". |
|
127 | Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24". | |
122 |
|
128 | |||
123 | #####`NET_GATEWAY`="" |
|
129 | ##### `NET_GATEWAY`="" | |
124 | Set the IP address for the default gateway. |
|
130 | Set the IP address for the default gateway. | |
125 |
|
131 | |||
126 | #####`NET_DNS_1`="" |
|
132 | ##### `NET_DNS_1`="" | |
127 | Set the IP address for the first DNS server. |
|
133 | Set the IP address for the first DNS server. | |
128 |
|
134 | |||
129 | #####`NET_DNS_2`="" |
|
135 | ##### `NET_DNS_2`="" | |
130 | Set the IP address for the second DNS server. |
|
136 | Set the IP address for the second DNS server. | |
131 |
|
137 | |||
132 | #####`NET_DNS_DOMAINS`="" |
|
138 | ##### `NET_DNS_DOMAINS`="" | |
133 | Set the default DNS search domains to use for non fully qualified host names. |
|
139 | Set the default DNS search domains to use for non fully qualified host names. | |
134 |
|
140 | |||
135 | #####`NET_NTP_1`="" |
|
141 | ##### `NET_NTP_1`="" | |
136 | Set the IP address for the first NTP server. |
|
142 | Set the IP address for the first NTP server. | |
137 |
|
143 | |||
138 | #####`NET_NTP_2`="" |
|
144 | ##### `NET_NTP_2`="" | |
139 | Set the IP address for the second NTP server. |
|
145 | Set the IP address for the second NTP server. | |
140 |
|
146 | |||
141 | --- |
|
147 | --- | |
@@ -259,6 +265,24 Add SSH (v2) public key(s) from specified file to `authorized_keys` file to enab | |||||
259 | ##### `BUILD_KERNEL`=false |
|
265 | ##### `BUILD_KERNEL`=false | |
260 | Build and install the latest RPi2/3 Linux kernel. Currently only the default RPi2/3 kernel configuration is used. `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` is used. |
|
266 | Build and install the latest RPi2/3 Linux kernel. Currently only the default RPi2/3 kernel configuration is used. `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` is used. | |
261 |
|
267 | |||
|
268 | ##### `CROSS_COMPILE`="arm-linux-gnueabihf-" | |||
|
269 | This sets the cross compile enviornment for the compiler. | |||
|
270 | ||||
|
271 | ##### `KERNEL_ARCH`="arm" | |||
|
272 | This sets the kernel architecture for the compiler. | |||
|
273 | ||||
|
274 | ##### `KERNEL_IMAGE`="kernel7.img" | |||
|
275 | Name of the image file in the boot partition. If not set, `KERNEL_IMAGE` will be set to "kernel8.img" automatically if building for arm64. | |||
|
276 | ||||
|
277 | ##### `KERNEL_BRANCH`="" | |||
|
278 | Name of the requested branch from the GIT location for the RPi Kernel. Default is using the current default branch from the GIT site. | |||
|
279 | ||||
|
280 | ##### `QEMU_BINARY`="/usr/bin/qemu-arm-static" | |||
|
281 | Sets the QEMU enviornment for the Debian archive. If not set, `QEMU_BINARY` will be set to "/usr/bin/qemu-aarch64-static" automatically if building for arm64. | |||
|
282 | ||||
|
283 | ##### `KERNEL_DEFCONFIG`="bcm2709_defconfig" | |||
|
284 | Sets the default config for kernel compiling. If not set, `KERNEL_DEFCONFIG` will be set to "bcmrpi3\_defconfig" automatically if building for arm64. | |||
|
285 | ||||
262 | ##### `KERNEL_REDUCE`=false |
|
286 | ##### `KERNEL_REDUCE`=false | |
263 | Reduce the size of the generated kernel by removing unwanted device, network and filesystem drivers (experimental). |
|
287 | Reduce the size of the generated kernel by removing unwanted device, network and filesystem drivers (experimental). | |
264 |
|
288 | |||
@@ -345,8 +369,8 Sets key size in bits. The argument has to be a multiple of 8. | |||||
345 | ##### `BASEDIR`=$(pwd)/images/${RELEASE} |
|
369 | ##### `BASEDIR`=$(pwd)/images/${RELEASE} | |
346 | Set a path to a working directory used by the script to generate an image. |
|
370 | Set a path to a working directory used by the script to generate an image. | |
347 |
|
371 | |||
348 | ##### `IMAGE_NAME`=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE} |
|
372 | ##### `IMAGE_NAME`=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH} | |
349 | Set a filename for the output file(s). Note: the script will create $IMAGE_NAME.img if `ENABLE_SPLITFS`=false or $IMAGE_NAME-frmw.img and $IMAGE_NAME-root.img if `ENABLE_SPLITFS`=true. |
|
373 | Set a filename for the output file(s). Note: the script will create $IMAGE_NAME.img if `ENABLE_SPLITFS`=false or $IMAGE_NAME-frmw.img and $IMAGE_NAME-root.img if `ENABLE_SPLITFS`=true. Note 2: If the KERNEL_BRANCH is not set, the word "CURRENT" is used. | |
350 |
|
374 | |||
351 | ## Understanding the script |
|
375 | ## Understanding the script | |
352 | The functions of this script that are required for the different stages of the bootstrapping are split up into single files located inside the `bootstrap.d` directory. During the bootstrapping every script in this directory gets executed in lexicographical order: |
|
376 | The functions of this script that are required for the different stages of the bootstrapping are split up into single files located inside the `bootstrap.d` directory. During the bootstrapping every script in this directory gets executed in lexicographical order: | |
@@ -402,7 +426,7 script -c 'APT_SERVER=ftp.de.debian.org ./rpi23-gen-image.sh' ./build.log | |||||
402 | ## Flashing the image file |
|
426 | ## Flashing the image file | |
403 | After the image file was successfully created by the `rpi23-gen-image.sh` script it can be copied to the microSD card that will be used by the RPi2/3 computer. This can be performed by using the tools `bmaptool` or `dd`. Using `bmaptool` will probably speed-up the copy process because `bmaptool` copies more wisely than `dd`. |
|
427 | After the image file was successfully created by the `rpi23-gen-image.sh` script it can be copied to the microSD card that will be used by the RPi2/3 computer. This can be performed by using the tools `bmaptool` or `dd`. Using `bmaptool` will probably speed-up the copy process because `bmaptool` copies more wisely than `dd`. | |
404 |
|
428 | |||
405 | #####Flashing examples: |
|
429 | ##### Flashing examples: | |
406 | ```shell |
|
430 | ```shell | |
407 | bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie.img /dev/mmcblk0 |
|
431 | bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie.img /dev/mmcblk0 | |
408 | dd bs=4M if=./images/jessie/2017-01-23-rpi3-jessie.img of=/dev/mmcblk0 |
|
432 | dd bs=4M if=./images/jessie/2017-01-23-rpi3-jessie.img of=/dev/mmcblk0 | |
@@ -412,6 +436,9 If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, th | |||||
412 | bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-frmw.img /dev/mmcblk0 |
|
436 | bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-frmw.img /dev/mmcblk0 | |
413 | bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-root.img /dev/sdc |
|
437 | bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-root.img /dev/sdc | |
414 | ``` |
|
438 | ``` | |
|
439 | ## Weekly image builds | |||
|
440 | The image files are provided by JRWR'S I/O PORT and are built once a Sunday at midnight UTC! | |||
|
441 | * [Debian Stretch Raspberry Pi2/3 Weekly Image Builds](https://jrwr.io/doku.php?id=projects:debianpi) | |||
415 |
|
|
442 | ||
416 | ## External links and references |
|
443 | ## External links and references | |
417 |
|
|
444 | * [Debian worldwide mirror sites](https://www.debian.org/mirror/list) |
@@ -28,7 +28,7 fi | |||||
28 | http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" |
|
28 | http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" | |
29 |
|
29 | |||
30 | # Copy qemu emulator binary to chroot |
|
30 | # Copy qemu emulator binary to chroot | |
31 |
install |
|
31 | install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" | |
32 |
|
32 | |||
33 | # Copy debian-archive-keyring.pgp |
|
33 | # Copy debian-archive-keyring.pgp | |
34 | mkdir -p "${R}/usr/share/keyrings" |
|
34 | mkdir -p "${R}/usr/share/keyrings" |
@@ -40,6 +40,10 fi | |||||
40 | chroot_exec apt-get -qq -y update |
|
40 | chroot_exec apt-get -qq -y update | |
41 | chroot_exec apt-get -qq -y -u dist-upgrade |
|
41 | chroot_exec apt-get -qq -y -u dist-upgrade | |
42 |
|
42 | |||
|
43 | if [ "$APT_INCLUDES_LATE" ] ; then | |||
|
44 | chroot_exec apt-get -qq -y install $(echo $APT_INCLUDES_LATE |tr , ' ') | |||
|
45 | fi | |||
|
46 | ||||
43 | if [ -d packages ] ; then |
|
47 | if [ -d packages ] ; then | |
44 | for package in packages/*.deb ; do |
|
48 | for package in packages/*.deb ; do | |
45 | cp $package ${R}/tmp |
|
49 | cp $package ${R}/tmp |
@@ -21,11 +21,15 if [ "$BUILD_KERNEL" = true ] ; then | |||||
21 | fi |
|
21 | fi | |
22 | else # KERNELSRC_DIR="" |
|
22 | else # KERNELSRC_DIR="" | |
23 | # Create temporary directory for kernel sources |
|
23 | # Create temporary directory for kernel sources | |
24 |
temp_dir=$( |
|
24 | temp_dir=$(as_nobody mktemp -d) | |
25 |
|
25 | |||
26 | # Fetch current RPi2/3 kernel sources |
|
26 | # Fetch current RPi2/3 kernel sources | |
27 | sudo -u nobody git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" |
|
27 | if [ -z "${KERNEL_BRANCH}" ] ; then | |
28 |
|
28 | as_nobody -u nobody git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" | ||
|
29 | else | |||
|
30 | as_nobody -u nobody git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" | |||
|
31 | fi | |||
|
32 | ||||
29 | # Copy downloaded kernel sources |
|
33 | # Copy downloaded kernel sources | |
30 | mv "${temp_dir}/linux" "${R}/usr/src/" |
|
34 | mv "${temp_dir}/linux" "${R}/usr/src/" | |
31 |
|
35 | |||
@@ -94,12 +98,12 if [ "$BUILD_KERNEL" = true ] ; then | |||||
94 | fi |
|
98 | fi | |
95 |
|
99 | |||
96 | # Cross compile kernel and modules |
|
100 | # Cross compile kernel and modules | |
97 |
make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" |
|
101 | make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_BIN_IMAGE}" modules dtbs | |
98 | fi |
|
102 | fi | |
99 |
|
103 | |||
100 | # Check if kernel compilation was successful |
|
104 | # Check if kernel compilation was successful | |
101 |
if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/ |
|
105 | if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then | |
102 |
echo "error: kernel compilation failed! ( |
|
106 | echo "error: kernel compilation failed! (kernel image not found)" | |
103 | cleanup |
|
107 | cleanup | |
104 | exit 1 |
|
108 | exit 1 | |
105 | fi |
|
109 | fi | |
@@ -130,16 +134,23 if [ "$BUILD_KERNEL" = true ] ; then | |||||
130 |
|
134 | |||
131 | # Copy dts and dtb device tree sources and binaries |
|
135 | # Copy dts and dtb device tree sources and binaries | |
132 | mkdir "${BOOT_DIR}/overlays" |
|
136 | mkdir "${BOOT_DIR}/overlays" | |
133 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "${BOOT_DIR}/" |
|
137 | ||
|
138 | # Ensure the proper .dtb is located | |||
|
139 | if [ "$KERNEL_ARCH" = "arm" ] ; then | |||
|
140 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "${BOOT_DIR}/" | |||
|
141 | else | |||
|
142 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb "${BOOT_DIR}/" | |||
|
143 | fi | |||
|
144 | ||||
134 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "${BOOT_DIR}/overlays/" |
|
145 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "${BOOT_DIR}/overlays/" | |
135 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README" |
|
146 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README" | |
136 |
|
147 | |||
137 | if [ "$ENABLE_UBOOT" = false ] ; then |
|
148 | if [ "$ENABLE_UBOOT" = false ] ; then | |
138 |
# Convert and copy |
|
149 | # Convert and copy kernel image to the boot directory | |
139 |
"${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/ |
|
150 | "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" | |
140 | else |
|
151 | else | |
141 |
# Copy |
|
152 | # Copy kernel image to the boot directory | |
142 |
install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/ |
|
153 | install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" | |
143 | fi |
|
154 | fi | |
144 |
|
155 | |||
145 | # Remove kernel sources |
|
156 | # Remove kernel sources | |
@@ -149,8 +160,8 if [ "$BUILD_KERNEL" = true ] ; then | |||||
149 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare |
|
160 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare | |
150 |
|
161 | |||
151 | # Create symlinks for kernel modules |
|
162 | # Create symlinks for kernel modules | |
152 |
ln -sf |
|
163 | chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build" | |
153 |
ln -sf |
|
164 | chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source" | |
154 | fi |
|
165 | fi | |
155 |
|
166 | |||
156 | else # BUILD_KERNEL=false |
|
167 | else # BUILD_KERNEL=false |
@@ -17,16 +17,16 if [ "$BUILD_KERNEL" = true ] ; then | |||||
17 | cp ${RPI_FIRMWARE_DIR}/boot/start_x.elf ${BOOT_DIR}/start_x.elf |
|
17 | cp ${RPI_FIRMWARE_DIR}/boot/start_x.elf ${BOOT_DIR}/start_x.elf | |
18 | else |
|
18 | else | |
19 | # Create temporary directory for boot binaries |
|
19 | # Create temporary directory for boot binaries | |
20 |
temp_dir=$( |
|
20 | temp_dir=$(as_nobody mktemp -d) | |
21 |
|
21 | |||
22 | # Install latest boot binaries from raspberry/firmware github |
|
22 | # Install latest boot binaries from raspberry/firmware github | |
23 |
|
|
23 | as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin" | |
24 |
|
|
24 | as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat" | |
25 |
|
|
25 | as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat" | |
26 |
|
|
26 | as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat" | |
27 |
|
|
27 | as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf" | |
28 |
|
|
28 | as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf" | |
29 |
|
|
29 | as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf" | |
30 |
|
30 | |||
31 | # Move downloaded boot binaries |
|
31 | # Move downloaded boot binaries | |
32 | mv "${temp_dir}/"* "${BOOT_DIR}/" |
|
32 | mv "${temp_dir}/"* "${BOOT_DIR}/" |
@@ -89,11 +89,11 if [ "$ENABLE_WIRELESS" = true ] ; then | |||||
89 | fi |
|
89 | fi | |
90 |
|
90 | |||
91 | # Create temporary directory for firmware binary blob |
|
91 | # Create temporary directory for firmware binary blob | |
92 |
temp_dir=$( |
|
92 | temp_dir=$(as_nobody mktemp -d) | |
93 |
|
93 | |||
94 | # Fetch firmware binary blob |
|
94 | # Fetch firmware binary blob | |
95 |
|
|
95 | as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" | |
96 |
|
|
96 | as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" | |
97 |
|
97 | |||
98 | # Move downloaded firmware binary blob |
|
98 | # Move downloaded firmware binary blob | |
99 | mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" |
|
99 | mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" |
@@ -16,10 +16,10 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
16 | cp -r "${UBOOTSRC_DIR}" "${R}/tmp" |
|
16 | cp -r "${UBOOTSRC_DIR}" "${R}/tmp" | |
17 | else |
|
17 | else | |
18 | # Create temporary directory for U-Boot sources |
|
18 | # Create temporary directory for U-Boot sources | |
19 |
temp_dir=$( |
|
19 | temp_dir=$(as_nobody mktemp -d) | |
20 |
|
20 | |||
21 | # Fetch U-Boot sources |
|
21 | # Fetch U-Boot sources | |
22 |
|
|
22 | as_nobody git -C "${temp_dir}" clone "${UBOOT_URL}" | |
23 |
|
23 | |||
24 | # Copy downloaded U-Boot sources |
|
24 | # Copy downloaded U-Boot sources | |
25 | mv "${temp_dir}/u-boot" "${R}/tmp/" |
|
25 | mv "${temp_dir}/u-boot" "${R}/tmp/" |
@@ -15,10 +15,10 if [ "$ENABLE_FBTURBO" = true ] ; then | |||||
15 | cp -r "${FBTURBOSRC_DIR}" "${R}/tmp" |
|
15 | cp -r "${FBTURBOSRC_DIR}" "${R}/tmp" | |
16 | else |
|
16 | else | |
17 | # Create temporary directory for fbturbo sources |
|
17 | # Create temporary directory for fbturbo sources | |
18 |
temp_dir=$( |
|
18 | temp_dir=$(as_nobody mktemp -d) | |
19 |
|
19 | |||
20 | # Fetch fbturbo sources |
|
20 | # Fetch fbturbo sources | |
21 |
|
|
21 | as_nobody git -C "${temp_dir}" clone "${FBTURBO_URL}" | |
22 |
|
22 | |||
23 | # Move downloaded fbturbo sources |
|
23 | # Move downloaded fbturbo sources | |
24 | mv "${temp_dir}/xf86-video-fbturbo" "${R}/tmp/" |
|
24 | mv "${temp_dir}/xf86-video-fbturbo" "${R}/tmp/" |
@@ -33,6 +33,11 chroot_exec() { | |||||
33 | LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot ${R} $* |
|
33 | LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot ${R} $* | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
|
36 | as_nobody() { | |||
|
37 | # Exec command as user nobody | |||
|
38 | sudo -E -u nobody LANG=C LC_ALL=C $* | |||
|
39 | } | |||
|
40 | ||||
36 | install_readonly() { |
|
41 | install_readonly() { | |
37 | # Install file with user read-only permissions |
|
42 | # Install file with user read-only permissions | |
38 | install -o root -g root -m 644 $* |
|
43 | install -o root -g root -m 644 $* |
@@ -53,9 +53,19 KERNEL_ARCH=${KERNEL_ARCH:=arm} | |||||
53 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} |
|
53 | RELEASE_ARCH=${RELEASE_ARCH:=armhf} | |
54 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} |
|
54 | CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} | |
55 | COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2} |
|
55 | COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2} | |
56 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} |
|
56 | if [ "$KERNEL_ARCH" = "arm64" ] ; then | |
57 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} |
|
57 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig} | |
58 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} |
|
58 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} | |
|
59 | else | |||
|
60 | KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} | |||
|
61 | KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} | |||
|
62 | fi | |||
|
63 | if [ "$RELEASE_ARCH" = "arm64" ] ; then | |||
|
64 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static} | |||
|
65 | else | |||
|
66 | QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} | |||
|
67 | fi | |||
|
68 | KERNEL_BRANCH=${KERNEL_BRANCH:=""} | |||
59 |
|
69 | |||
60 | # URLs |
|
70 | # URLs | |
61 | KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} |
|
71 | KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} | |
@@ -68,9 +78,14 UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git} | |||||
68 | # Build directories |
|
78 | # Build directories | |
69 | BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}} |
|
79 | BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}} | |
70 | BUILDDIR="${BASEDIR}/build" |
|
80 | BUILDDIR="${BASEDIR}/build" | |
|
81 | ||||
71 | # Prepare date string for default image file name |
|
82 | # Prepare date string for default image file name | |
72 | DATE="$(date +%Y-%m-%d)" |
|
83 | DATE="$(date +%Y-%m-%d)" | |
73 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE}} |
|
84 | if [ -z "$KERNEL_BRANCH" ] ; then | |
|
85 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} | |||
|
86 | else | |||
|
87 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} | |||
|
88 | fi | |||
74 |
|
89 | |||
75 | # Chroot directories |
|
90 | # Chroot directories | |
76 | R="${BUILDDIR}/chroot" |
|
91 | R="${BUILDDIR}/chroot" | |
@@ -160,6 +175,11 KERNEL_THREADS=${KERNEL_THREADS:=1} | |||||
160 | KERNEL_HEADERS=${KERNEL_HEADERS:=true} |
|
175 | KERNEL_HEADERS=${KERNEL_HEADERS:=true} | |
161 | KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} |
|
176 | KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} | |
162 | KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} |
|
177 | KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} | |
|
178 | if [ "$KERNEL_ARCH" = "arm64" ] ; then | |||
|
179 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} | |||
|
180 | else | |||
|
181 | KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} | |||
|
182 | fi | |||
163 |
|
183 | |||
164 | # Kernel compilation from source directory settings |
|
184 | # Kernel compilation from source directory settings | |
165 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} |
|
185 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} | |
@@ -237,7 +257,11 fi | |||||
237 |
|
257 | |||
238 | # Add packages required for kernel cross compilation |
|
258 | # Add packages required for kernel cross compilation | |
239 | if [ "$BUILD_KERNEL" = true ] ; then |
|
259 | if [ "$BUILD_KERNEL" = true ] ; then | |
240 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" |
|
260 | if [ "$KERNEL_ARCH" = "arm" ] ; then | |
|
261 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" | |||
|
262 | else | |||
|
263 | REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" | |||
|
264 | fi | |||
241 | fi |
|
265 | fi | |
242 |
|
266 | |||
243 | # Add libncurses5 to enable kernel menuconfig |
|
267 | # Add libncurses5 to enable kernel menuconfig |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant