##// END OF EJS Templates
merging
vidal -
r223:3bbce0444084
parent child
Show More
@@ -1,454 +1,453
1 1 # rpi23-gen-image
2 2 ## Introduction
3 3
4 4 `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`, `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```).
5 5
6
7 6 ## Build dependencies
8 7 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 8
10 9 ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo```
11 10
12 11 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.
13 12
14 13 The script has been tested using the default `crossbuild-essential-armhf` toolchain meta package on Debian Linux `jessie` and `stretch` build systems. Please check the [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains) for further information.
15 14
16 15 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:
17 16
18 17 ```
19 18 echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/crosstools.list
20 19 sudo -u nobody wget -O - http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
21 20 dpkg --add-architecture armhf
22 21 apt-get update
23 22 ```
24 23
25 24 ## Command-line parameters
26 25 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.
27 26
28 27 ##### Command-line examples:
29 28 ```shell
30 29 ENABLE_UBOOT=true ./rpi23-gen-image.sh
31 30 ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi23-gen-image.sh
32 31 ENABLE_WM=xfce4 ENABLE_FBTURBO=true ENABLE_MINBASE=true ./rpi23-gen-image.sh
33 32 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi23-gen-image.sh
34 33 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi23-gen-image.sh
35 34 ENABLE_MINBASE=true ./rpi23-gen-image.sh
36 35 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi23-gen-image.sh
37 36 BUILD_KERNEL=true KERNELSRC_DIR=/tmp/linux ./rpi23-gen-image.sh
38 37 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi23-gen-image.sh
39 38 ENABLE_CRYPTFS=true CRYPTFS_PASSWORD=changeme EXPANDROOT=false ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi23-gen-image.sh
40 39 RELEASE=stretch BUILD_KERNEL=true ./rpi23-gen-image.sh
41 40 RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNEL=true ./rpi23-gen-image.sh
42 41 RELEASE=stretch RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNEL=true ./rpi23-gen-image.sh
43 42 ```
44 43
45 44 ## Configuration template files
46 45 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.
47 46
48 47 ##### Command-line examples:
49 48 ```shell
50 49 CONFIG_TEMPLATE=rpi3stretch ./rpi23-gen-image.sh
51 50 CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh
52 51 ```
53 52
54 53 ## Supported parameters and settings
55 54 #### APT settings:
56 55 ##### `APT_SERVER`="ftp.debian.org"
57 56 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.
58 57
59 58 ##### `APT_PROXY`=""
60 59 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.
61 60
62 61 ##### `APT_INCLUDES`=""
63 62 A comma separated list of additional packages to be installed by debootstrap during bootstrapping.
64 63
65 64 ##### `APT_INCLUDES_LATE`=""
66 65 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.
67 66
68 67 ---
69 68
70 69 #### General system settings:
71 70 ##### `RPI_MODEL`=2
72 71 Specifiy the target Raspberry Pi hardware model. The script at this time supports the Raspberry Pi models `2` and `3`. `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` is used.
73 72
74 73 ##### `RELEASE`="jessie"
75 74 Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases "jessie", "stretch" and "buster". `BUILD_KERNEL`=true will automatically be set if the Debian releases `stretch` or `buster` are used.
76 75
77 76 ##### `RELEASE_ARCH`="armhf"
78 77 Set the desired Debian release architecture.
79 78
80 79 ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE"
81 80 Set system host name. It's recommended that the host name is unique in the corresponding subnet.
82 81
83 82 ##### `PASSWORD`="raspberry"
84 83 Set system `root` password. It's **STRONGLY** recommended that you choose a custom password.
85 84
86 85 ##### `USER_PASSWORD`="raspberry"
87 86 Set password for the created non-root user `USER_NAME`=pi. Ignored if `ENABLE_USER`=false. It's **STRONGLY** recommended that you choose a custom password.
88 87
89 88 ##### `DEFLOCAL`="en_US.UTF-8"
90 89 Set default system locale. This setting can also be changed inside the running OS using the `dpkg-reconfigure locales` command. Please note that on using this parameter the script will automatically install the required packages `locales`, `keyboard-configuration` and `console-setup`.
91 90
92 91 ##### `TIMEZONE`="Europe/Berlin"
93 92 Set default system timezone. All available timezones can be found in the `/usr/share/zoneinfo/` directory. This setting can also be changed inside the running OS using the `dpkg-reconfigure tzdata` command.
94 93
95 94 ##### `EXPANDROOT`=true
96 95 Expand the root partition and filesystem automatically on first boot.
97 96
98 97 ---
99 98
100 99 #### Keyboard settings:
101 100 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.
102 101
103 102 ##### `XKB_MODEL`=""
104 103 Set the name of the model of your keyboard type.
105 104
106 105 ##### `XKB_LAYOUT`=""
107 106 Set the supported keyboard layout(s).
108 107
109 108 ##### `XKB_VARIANT`=""
110 109 Set the supported variant(s) of the keyboard layout(s).
111 110
112 111 ##### `XKB_OPTIONS`=""
113 112 Set extra xkb configuration options.
114 113
115 114 ---
116 115
117 116 #### Networking settings (DHCP):
118 117 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`.`
119 118
120 119 ##### `ENABLE_DHCP`=true
121 120 Set the system to use DHCP. This requires an DHCP server.
122 121
123 122 ---
124 123
125 124 #### Networking settings (static):
126 125 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`.
127 126
128 127 ##### `NET_ADDRESS`=""
129 128 Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24".
130 129
131 130 ##### `NET_GATEWAY`=""
132 131 Set the IP address for the default gateway.
133 132
134 133 ##### `NET_DNS_1`=""
135 134 Set the IP address for the first DNS server.
136 135
137 136 ##### `NET_DNS_2`=""
138 137 Set the IP address for the second DNS server.
139 138
140 139 ##### `NET_DNS_DOMAINS`=""
141 140 Set the default DNS search domains to use for non fully qualified host names.
142 141
143 142 ##### `NET_NTP_1`=""
144 143 Set the IP address for the first NTP server.
145 144
146 145 ##### `NET_NTP_2`=""
147 146 Set the IP address for the second NTP server.
148 147
149 148 ---
150 149
151 150 #### Basic system features:
152 151 ##### `ENABLE_CONSOLE`=true
153 152 Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2/3. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system.
154 153
155 154 ##### `ENABLE_I2C`=false
156 155 Enable I2C interface on the RPi2/3. Please check the [RPi2/3 pinout diagrams](http://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
157 156
158 157 ##### `ENABLE_SPI`=false
159 158 Enable SPI interface on the RPi2/3. Please check the [RPi2/3 pinout diagrams](http://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
160 159
161 160 ##### `ENABLE_IPV6`=true
162 161 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
163 162
164 163 ##### `ENABLE_SSHD`=true
165 164 Install and enable OpenSSH service. The default configuration of the service doesn't allow `root` to login. Please use the user `pi` instead and `su -` or `sudo` to execute commands as root.
166 165
167 166 ##### `ENABLE_NONFREE`=false
168 167 Allow the installation of non-free Debian packages that do not comply with the DFSG. This is required to install closed-source firmware binary blobs.
169 168
170 169 ##### `ENABLE_WIRELESS`=false
171 170 Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm80211/brcm) that is required to run the internal wireless interface of the Raspberry Pi model `3`. This parameter is ignored if the specified `RPI_MODEL` is not `3`.
172 171
173 172 ##### `ENABLE_RSYSLOG`=true
174 173 If set to false, disable and uninstall rsyslog (so logs will be available only
175 174 in journal files)
176 175
177 176 ##### `ENABLE_SOUND`=true
178 177 Enable sound hardware and install Advanced Linux Sound Architecture.
179 178
180 179 ##### `ENABLE_HWRANDOM`=true
181 180 Enable Hardware Random Number Generator. Strong random numbers are important for most network based communications that use encryption. It's recommended to be enabled.
182 181
183 182 ##### `ENABLE_MINGPU`=false
184 183 Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU.
185 184
186 185 ##### `ENABLE_DBUS`=true
187 186 Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled.
188 187
189 188 ##### `ENABLE_XORG`=false
190 189 Install Xorg open-source X Window System.
191 190
192 191 ##### `ENABLE_WM`=""
193 192 Install a user defined window manager for the X Window System. To make sure all X related package dependencies are getting installed `ENABLE_XORG` will automatically get enabled if `ENABLE_WM` is used. The `rpi23-gen-image.sh` script has been tested with the following list of window managers: `blackbox`, `openbox`, `fluxbox`, `jwm`, `dwm`, `xfce4`, `awesome`.
194 193
195 194 ---
196 195
197 196 #### Advanced system features:
198 197 ##### `ENABLE_MINBASE`=false
199 198 Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB.
200 199
201 200 ##### `ENABLE_REDUCE`=false
202 201 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
203 202
204 203 ##### `ENABLE_UBOOT`=false
205 204 Replace the default RPi2/3 second stage bootloader (bootcode.bin) with [U-Boot bootloader](http://git.denx.de/?p=u-boot.git;a=summary). U-Boot can boot images via the network using the BOOTP/TFTP protocol.
206 205
207 206 ##### `UBOOTSRC_DIR`=""
208 207 Path to a directory (`u-boot`) of [U-Boot bootloader sources](http://git.denx.de/?p=u-boot.git;a=summary) that will be copied, configured, build and installed inside the chroot.
209 208
210 209 ##### `ENABLE_FBTURBO`=false
211 210 Install and enable the [hardware accelerated Xorg video driver](https://github.com/ssvb/xf86-video-fbturbo) `fbturbo`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling.
212 211
213 212 ##### `FBTURBOSRC_DIR`=""
214 213 Path to a directory (`xf86-video-fbturbo`) of [hardware accelerated Xorg video driver sources](https://github.com/ssvb/xf86-video-fbturbo) that will be copied, configured, build and installed inside the chroot.
215 214
216 215 ##### `ENABLE_IPTABLES`=false
217 216 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
218 217
219 218 ##### `ENABLE_USER`=true
220 219 Create non-root user with password `USER_PASSWORD`=raspberry. Unless overridden with `USER_NAME`=user, username will be `pi`.
221 220
222 221 ##### `USER_NAME`=pi
223 222 Non-root user to create. Ignored if `ENABLE_USER`=false
224 223
225 224 ##### `ENABLE_ROOT`=false
226 225 Set root user password so root login will be enabled
227 226
228 227 ##### `ENABLE_HARDNET`=false
229 228 Enable IPv4/IPv6 network stack hardening settings.
230 229
231 230 ##### `ENABLE_SPLITFS`=false
232 231 Enable having root partition on an USB drive by creating two image files: one for the `/boot/firmware` mount point, and another for `/`.
233 232
234 233 ##### `CHROOT_SCRIPTS`=""
235 234 Path to a directory with scripts that should be run in the chroot before the image is finally built. Every executable file in this directory is run in lexicographical order.
236 235
237 236 ##### `ENABLE_INITRAMFS`=false
238 237 Create an initramfs that that will be loaded during the Linux startup process. `ENABLE_INITRAMFS` will automatically get enabled if `ENABLE_CRYPTFS`=true. This parameter will be ignored if `BUILD_KERNEL`=false.
239 238
240 239 ##### `ENABLE_IFNAMES`=true
241 240 Enable automatic assignment of predictable, stable network interface names for all local Ethernet, WLAN interfaces. This might create complex and long interface names. This parameter is only supported if the Debian releases `stretch` or `buster` are used.
242 241
243 242 ##### `DISABLE_UNDERVOLT_WARNINGS`=
244 243 Disable RPi2/3 under-voltage warnings and overlays. Setting the parameter to `1` will disable the warning overlay. Setting it to `2` will additionally allow RPi2/3 turbo mode when low-voltage is present.
245 244
246 245 ---
247 246
248 247 #### SSH settings:
249 248 ##### `SSH_ENABLE_ROOT`=false
250 249 Enable password root login via SSH. This may be a security risk with default password, use only in trusted environments. `ENABLE_ROOT` must be set to `true`.
251 250
252 251 ##### `SSH_DISABLE_PASSWORD_AUTH`=false
253 252 Disable password based SSH authentication. Only public key based SSH (v2) authentication will be supported.
254 253
255 254 ##### `SSH_LIMIT_USERS`=false
256 255 Limit the users that are allowed to login via SSH. Only allow user `USER_NAME`=pi and root if `SSH_ENABLE_ROOT`=true to login. This parameter will be ignored if `dropbear` SSH is used (`REDUCE_SSHD`=true).
257 256
258 257 ##### `SSH_ROOT_PUB_KEY`=""
259 258 Add SSH (v2) public key(s) from specified file to `authorized_keys` file to enable public key based SSH (v2) authentication of user `root`. The specified file can also contain multiple SSH (v2) public keys. SSH protocol version 1 is not supported. `ENABLE_ROOT` **and** `SSH_ENABLE_ROOT` must be set to `true`.
260 259
261 260 ##### `SSH_USER_PUB_KEY`=""
262 261 Add SSH (v2) public key(s) from specified file to `authorized_keys` file to enable public key based SSH (v2) authentication of user `USER_NAME`=pi. The specified file can also contain multiple SSH (v2) public keys. SSH protocol version 1 is not supported.
263 262
264 263 ---
265 264
266 265 #### Kernel compilation:
267 266 ##### `BUILD_KERNEL`=false
268 267 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.
269 268
270 269 ##### `CROSS_COMPILE`="arm-linux-gnueabihf-"
271 270 This sets the cross compile enviornment for the compiler.
272 271
273 272 ##### `KERNEL_ARCH`="arm"
274 273 This sets the kernel architecture for the compiler.
275 274
276 275 ##### `KERNEL_IMAGE`="kernel7.img"
277 276 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.
278 277
279 278 ##### `KERNEL_BRANCH`=""
280 279 Name of the requested branch from the GIT location for the RPi Kernel. Default is using the current default branch from the GIT site.
281 280
282 281 ##### `QEMU_BINARY`="/usr/bin/qemu-arm-static"
283 282 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.
284 283
285 284 ##### `KERNEL_DEFCONFIG`="bcm2709_defconfig"
286 285 Sets the default config for kernel compiling. If not set, `KERNEL_DEFCONFIG` will be set to "bcmrpi3\_defconfig" automatically if building for arm64.
287 286
288 287 ##### `KERNEL_REDUCE`=false
289 288 Reduce the size of the generated kernel by removing unwanted device, network and filesystem drivers (experimental).
290 289
291 290 ##### `KERNEL_THREADS`=1
292 291 Number of parallel kernel building threads. If the parameter is left untouched the script will automatically determine the number of CPU cores to set the number of parallel threads to speed the kernel compilation.
293 292
294 293 ##### `KERNEL_HEADERS`=true
295 294 Install kernel headers with built kernel.
296 295
297 296 ##### `KERNEL_MENUCONFIG`=false
298 297 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
299 298
300 299 ##### `KERNEL_REMOVESRC`=true
301 300 Remove all kernel sources from the generated OS image after it was built and installed.
302 301
303 302 ##### `KERNELSRC_DIR`=""
304 303 Path to a directory (`linux`) of [RaspberryPi Linux kernel sources](https://github.com/raspberrypi/linux) that will be copied, configured, build and installed inside the chroot.
305 304
306 305 ##### `KERNELSRC_CLEAN`=false
307 306 Clean the existing kernel sources directory `KERNELSRC_DIR` (using `make mrproper`) after it was copied to the chroot and before the compilation of the kernel has started. This parameter will be ignored if no `KERNELSRC_DIR` was specified or if `KERNELSRC_PREBUILT`=true.
308 307
309 308 ##### `KERNELSRC_CONFIG`=true
310 309 Run `make bcm2709_defconfig` (and optional `make menuconfig`) to configure the kernel sources before building. This parameter is automatically set to `true` if no existing kernel sources directory was specified using `KERNELSRC_DIR`. This parameter is ignored if `KERNELSRC_PREBUILT`=true.
311 310
312 311 ##### `KERNELSRC_USRCONFIG`=""
313 312 Copy own config file to kernel `.config`. If `KERNEL_MENUCONFIG`=true then running after copy.
314 313
315 314 ##### `KERNELSRC_PREBUILT`=false
316 315 With this parameter set to true the script expects the existing kernel sources directory to be already successfully cross-compiled. The parameters `KERNELSRC_CLEAN`, `KERNELSRC_CONFIG`, `KERNELSRC_USRCONFIG` and `KERNEL_MENUCONFIG` are ignored and no kernel compilation tasks are performed.
317 316
318 317 ##### `RPI_FIRMWARE_DIR`=""
319 318 The directory (`firmware`) containing a local copy of the firmware from the [RaspberryPi firmware project](https://github.com/raspberrypi/firmware). Default is to download the latest firmware directly from the project.
320 319
321 320 ---
322 321
323 322 #### Reduce disk usage:
324 323 The following list of parameters is ignored if `ENABLE_REDUCE`=false.
325 324
326 325 ##### `REDUCE_APT`=true
327 326 Configure APT to use compressed package repository lists and no package caching files.
328 327
329 328 ##### `REDUCE_DOC`=true
330 329 Remove all doc files (harsh). Configure APT to not include doc files on future `apt-get` package installations.
331 330
332 331 ##### `REDUCE_MAN`=true
333 332 Remove all man pages and info files (harsh). Configure APT to not include man pages on future `apt-get` package installations.
334 333
335 334 ##### `REDUCE_VIM`=false
336 335 Replace `vim-tiny` package by `levee` a tiny vim clone.
337 336
338 337 ##### `REDUCE_BASH`=false
339 338 Remove `bash` package and switch to `dash` shell (experimental).
340 339
341 340 ##### `REDUCE_HWDB`=true
342 341 Remove PCI related hwdb files (experimental).
343 342
344 343 ##### `REDUCE_SSHD`=true
345 344 Replace `openssh-server` with `dropbear`.
346 345
347 346 ##### `REDUCE_LOCALE`=true
348 347 Remove all `locale` translation files.
349 348
350 349 ---
351 350
352 351 #### Encrypted root partition:
353 352 ##### `ENABLE_CRYPTFS`=false
354 353 Enable full system encryption with dm-crypt. Setup a fully LUKS encrypted root partition (aes-xts-plain64:sha512) and generate required initramfs. The /boot directory will not be encrypted. This parameter will be ignored if `BUILD_KERNEL`=false. `ENABLE_CRYPTFS` is experimental. SSH-to-initramfs is currently not supported but will be soon - feel free to help.
355 354
356 355 ##### `CRYPTFS_PASSWORD`=""
357 356 Set password of the encrypted root partition. This parameter is mandatory if `ENABLE_CRYPTFS`=true.
358 357
359 358 ##### `CRYPTFS_MAPPING`="secure"
360 359 Set name of dm-crypt managed device-mapper mapping.
361 360
362 361 ##### `CRYPTFS_CIPHER`="aes-xts-plain64:sha512"
363 362 Set cipher specification string. `aes-xts*` ciphers are strongly recommended.
364 363
365 364 ##### `CRYPTFS_XTSKEYSIZE`=512
366 365 Sets key size in bits. The argument has to be a multiple of 8.
367 366
368 367 ---
369 368
370 369 #### Build settings:
371 370 ##### `BASEDIR`=$(pwd)/images/${RELEASE}
372 371 Set a path to a working directory used by the script to generate an image.
373 372
374 373 ##### `IMAGE_NAME`=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}
375 374 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.
376 375
377 376 ## Understanding the script
378 377 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:
379 378
380 379 | Script | Description |
381 380 | --- | --- |
382 381 | `10-bootstrap.sh` | Debootstrap basic system |
383 382 | `11-apt.sh` | Setup APT repositories |
384 383 | `12-locale.sh` | Setup Locales and keyboard settings |
385 384 | `13-kernel.sh` | Build and install RPi2/3 Kernel |
386 385 | `14-fstab.sh` | Setup fstab and initramfs |
387 386 | `15-rpi-config.sh` | Setup RPi2/3 config and cmdline |
388 387 | `20-networking.sh` | Setup Networking |
389 388 | `21-firewall.sh` | Setup Firewall |
390 389 | `30-security.sh` | Setup Users and Security settings |
391 390 | `31-logging.sh` | Setup Logging |
392 391 | `32-sshd.sh` | Setup SSH and public keys |
393 392 | `41-uboot.sh` | Build and Setup U-Boot |
394 393 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
395 394 | `50-firstboot.sh` | First boot actions |
396 395 | `99-reduce.sh` | Reduce the disk space usage |
397 396
398 397 All the required configuration files that will be copied to the generated OS image are located inside the `files` directory. It is not recommended to modify these configuration files manually.
399 398
400 399 | Directory | Description |
401 400 | --- | --- |
402 401 | `apt` | APT management configuration files |
403 402 | `boot` | Boot and RPi2/3 configuration files |
404 403 | `dpkg` | Package Manager configuration |
405 404 | `etc` | Configuration files and rc scripts |
406 405 | `firstboot` | Scripts that get executed on first boot |
407 406 | `initramfs` | Initramfs scripts |
408 407 | `iptables` | Firewall configuration files |
409 408 | `locales` | Locales configuration |
410 409 | `modules` | Kernel Modules configuration |
411 410 | `mount` | Fstab configuration |
412 411 | `network` | Networking configuration files |
413 412 | `sysctl.d` | Swapping and Network Hardening configuration |
414 413 | `xorg` | fbturbo Xorg driver configuration |
415 414
416 415 ## Custom packages and scripts
417 416 Debian custom packages, i.e. those not in the debian repositories, can be installed by placing them in the `packages` directory. They are installed immediately after packages from the repositories are installed. Any dependencies listed in the custom packages will be downloaded automatically from the repositories. Do not list these custom packages in `APT_INCLUDES`.
418 417
419 418 Scripts in the custom.d directory will be executed after all other installation is complete but before the image is created.
420 419
421 420 ## Logging of the bootstrapping process
422 421 All information related to the bootstrapping process and the commands executed by the `rpi23-gen-image.sh` script can easily be saved into a logfile. The common shell command `script` can be used for this purpose:
423 422
424 423 ```shell
425 424 script -c 'APT_SERVER=ftp.de.debian.org ./rpi23-gen-image.sh' ./build.log
426 425 ```
427 426
428 427 ## Flashing the image file
429 428 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`.
430 429
431 430 ##### Flashing examples:
432 431 ```shell
433 432 bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie.img /dev/mmcblk0
434 433 dd bs=4M if=./images/jessie/2017-01-23-rpi3-jessie.img of=/dev/mmcblk0
435 434 ```
436 435 If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, then the `-root` one on the USB drive:
437 436 ```shell
438 437 bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-frmw.img /dev/mmcblk0
439 438 bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-root.img /dev/sdc
440 439 ```
441 440 ## Weekly image builds
442 441 The image files are provided by JRWR'S I/O PORT and are built once a Sunday at midnight UTC!
443 442 * [Debian Stretch Raspberry Pi2/3 Weekly Image Builds](https://jrwr.io/doku.php?id=projects:debianpi)
444 443
445 444 ## External links and references
446 445 * [Debian worldwide mirror sites](https://www.debian.org/mirror/list)
447 446 * [Debian Raspberry Pi 2 Wiki](https://wiki.debian.org/RaspberryPi2)
448 447 * [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains)
449 448 * [Official Raspberry Pi Firmware on github](https://github.com/raspberrypi/firmware)
450 449 * [Official Raspberry Pi Kernel on github](https://github.com/raspberrypi/linux)
451 450 * [U-BOOT git repository](http://git.denx.de/?p=u-boot.git;a=summary)
452 451 * [Xorg DDX driver fbturbo](https://github.com/ssvb/xf86-video-fbturbo)
453 452 * [RPi3 Wireless interface firmware](https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm80211/brcm)
454 453 * [Collabora RPi2 Kernel precompiled](https://repositories.collabora.co.uk/debian/)
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant