##// END OF EJS Templates
Merge branch 'master' into func-as-nobody
drtyhlpr -
r176:f1d907267caa Fusion
parent child
Show More
@@ -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
@@ -23,7 +23,7 apt-get update
23 23 ## Command-line parameters
24 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 27 ```shell
28 28 ENABLE_UBOOT=true ./rpi23-gen-image.sh
29 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 43 ## Configuration template files
44 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 47 ```shell
48 48 CONFIG_TEMPLATE=rpi3stretch ./rpi23-gen-image.sh
49 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 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 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 72 ##### `RELEASE`="jessie"
70 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 78 ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE"
73 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 #### Keyboard settings:
98 #### Keyboard settings:
93 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 101 ##### `XKB_MODEL`=""
@@ -109,7 +115,7 Set extra xkb configuration options.
109 115 #### Networking settings (DHCP):
110 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 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 123 #### Networking settings (static):
118 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 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 130 Set the IP address for the default gateway.
125 131
126 #####`NET_DNS_1`=""
132 ##### `NET_DNS_1`=""
127 133 Set the IP address for the first DNS server.
128 134
129 #####`NET_DNS_2`=""
135 ##### `NET_DNS_2`=""
130 136 Set the IP address for the second DNS server.
131 137
132 #####`NET_DNS_DOMAINS`=""
138 ##### `NET_DNS_DOMAINS`=""
133 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 142 Set the IP address for the first NTP server.
137 143
138 #####`NET_NTP_2`=""
144 ##### `NET_NTP_2`=""
139 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 265 ##### `BUILD_KERNEL`=false
260 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.
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.
282
283 ##### `KERNEL_DEFCONFIG`="bcm2709_defconfig"
284 Sets the default config for kernel compiling.
285
262 286 ##### `KERNEL_REDUCE`=false
263 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 369 ##### `BASEDIR`=$(pwd)/images/${RELEASE}
346 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}
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.
372 ##### `IMAGE_NAME`=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}
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 375 ## Understanding the script
352 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 426 ## Flashing the image file
403 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 430 ```shell
407 431 bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie.img /dev/mmcblk0
408 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 436 bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-frmw.img /dev/mmcblk0
413 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 443 ## External links and references
417 444 * [Debian worldwide mirror sites](https://www.debian.org/mirror/list)
@@ -28,7 +28,7 fi
28 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 30 # Copy qemu emulator binary to chroot
31 install_exec "${QEMU_BINARY}" "${R}${QEMU_BINARY}"
31 install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}"
32 32
33 33 # Copy debian-archive-keyring.pgp
34 34 mkdir -p "${R}/usr/share/keyrings"
@@ -40,6 +40,10 fi
40 40 chroot_exec apt-get -qq -y update
41 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 47 if [ -d packages ] ; then
44 48 for package in packages/*.deb ; do
45 49 cp $package ${R}/tmp
@@ -24,8 +24,12 if [ "$BUILD_KERNEL" = true ] ; then
24 24 temp_dir=$(as_nobody mktemp -d)
25 25
26 26 # Fetch current RPi2/3 kernel sources
27 as_nobody git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}"
28
27 if [ -z "${KERNEL_BRANCH}" ] ; then
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 33 # Copy downloaded kernel sources
30 34 mv "${temp_dir}/linux" "${R}/usr/src/"
31 35
@@ -94,12 +98,12 if [ "$BUILD_KERNEL" = true ] ; then
94 98 fi
95 99
96 100 # Cross compile kernel and modules
97 make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" zImage modules dtbs
101 make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_BIN_IMAGE}" modules dtbs
98 102 fi
99 103
100 104 # Check if kernel compilation was successful
101 if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" ] ; then
102 echo "error: kernel compilation failed! (zImage not found)"
105 if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then
106 echo "error: kernel compilation failed! (kernel image not found)"
103 107 cleanup
104 108 exit 1
105 109 fi
@@ -130,16 +134,23 if [ "$BUILD_KERNEL" = true ] ; then
130 134
131 135 # Copy dts and dtb device tree sources and binaries
132 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 145 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "${BOOT_DIR}/overlays/"
135 146 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README"
136 147
137 148 if [ "$ENABLE_UBOOT" = false ] ; then
138 # Convert and copy zImage kernel to the boot directory
139 "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" "${BOOT_DIR}/${KERNEL_IMAGE}"
149 # Convert and copy kernel image to the boot directory
150 "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
140 151 else
141 # Copy zImage kernel to the boot directory
142 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" "${BOOT_DIR}/${KERNEL_IMAGE}"
152 # Copy kernel image to the boot directory
153 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
143 154 fi
144 155
145 156 # Remove kernel sources
@@ -56,6 +56,7 COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2}
56 56 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
57 57 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img}
58 58 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
59 KERNEL_BRANCH=${KERNEL_BRANCH:=""}
59 60
60 61 # URLs
61 62 KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
@@ -68,9 +69,14 UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git}
68 69 # Build directories
69 70 BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}
70 71 BUILDDIR="${BASEDIR}/build"
72
71 73 # Prepare date string for default image file name
72 74 DATE="$(date +%Y-%m-%d)"
73 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE}}
75 if [ -z "$KERNEL_BRANCH" ] ; then
76 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
77 else
78 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
79 fi
74 80
75 81 # Chroot directories
76 82 R="${BUILDDIR}/chroot"
@@ -160,6 +166,7 KERNEL_THREADS=${KERNEL_THREADS:=1}
160 166 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
161 167 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
162 168 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
169 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
163 170
164 171 # Kernel compilation from source directory settings
165 172 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
@@ -237,7 +244,11 fi
237 244
238 245 # Add packages required for kernel cross compilation
239 246 if [ "$BUILD_KERNEL" = true ] ; then
240 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
247 if [ "$KERNEL_ARCH" = "arm" ] ; then
248 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
249 else
250 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
251 fi
241 252 fi
242 253
243 254 # Add libncurses5 to enable kernel menuconfig
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant