##// END OF EJS Templates
Added Raspberry Pi 3 model support
drtyhlpr -
r94:2ce085c56493
parent child
Show More
@@ -1,318 +1,335
1 # rpi2-gen-image
1 # rpi23-gen-image
2 2 ## Introduction
3 `rpi2-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for the Raspberry 2 (RPi2) computer. The script at this time supports the bootstrapping of the Debian releases "jessie" and "stretch".
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 releases "jessie" and "stretch". Raspberry Pi 3 images are currently generated for 32-bit mode only.
4 4
5 5 ## Build dependencies
6 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.
7 7
8 8 ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git```
9 9
10 10 ## Command-line parameters
11 The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi2-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 `rpi2-gen-image.sh` script.
11 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.
12 12
13 13 #####Command-line examples:
14 14 ```shell
15 ENABLE_UBOOT=true ./rpi2-gen-image.sh
16 ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi2-gen-image.sh
17 ENABLE_WM=xfce4 ENABLE_FBTURBO=true ENABLE_MINBASE=true ./rpi2-gen-image.sh
18 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi2-gen-image.sh
19 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image.sh
20 ENABLE_MINBASE=true ./rpi2-gen-image.sh
21 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi2-gen-image.sh
22 BUILD_KERNEL=true KERNELSRC_DIR=/tmp/linux ./rpi2-gen-image.sh
23 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi2-gen-image.sh
24 ENABLE_CRYPTFS=true CRYPTFS_PASSWORD=changeme EXPANDROOT=false ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi2-gen-image.sh
25 RELEASE=stretch BUILD_KERNEL=true ./rpi2-gen-image.sh
15 ENABLE_UBOOT=true ./rpi23-gen-image.sh
16 ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi23-gen-image.sh
17 ENABLE_WM=xfce4 ENABLE_FBTURBO=true ENABLE_MINBASE=true ./rpi23-gen-image.sh
18 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi23-gen-image.sh
19 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi23-gen-image.sh
20 ENABLE_MINBASE=true ./rpi23-gen-image.sh
21 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi23-gen-image.sh
22 BUILD_KERNEL=true KERNELSRC_DIR=/tmp/linux ./rpi23-gen-image.sh
23 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi23-gen-image.sh
24 ENABLE_CRYPTFS=true CRYPTFS_PASSWORD=changeme EXPANDROOT=false ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi23-gen-image.sh
25 RELEASE=stretch BUILD_KERNEL=true ./rpi23-gen-image.sh
26 RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNEL=true ./rpi23-gen-image.sh
27 RELEASE=stretch RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNEL=true ./rpi23-gen-image.sh
26 28 ```
27 29
28 30 #### APT settings:
29 31 ##### `APT_SERVER`="ftp.debian.org"
30 32 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.
31 33
32 34 ##### `APT_PROXY`=""
33 35 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.
34 36
35 37 ##### `APT_INCLUDES`=""
36 38 A comma separated list of additional packages to be installed during bootstrapping.
37 39
38 40 #### General system settings:
41 ##### `RPI_MODEL`=2
42 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.
43
39 44 ##### `RELEASE`="jessie"
40 45 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.
41 46
42 ##### `HOSTNAME`="rpi2-jessie"
47 ##### `HOSTNAME`="rpi${RPI_MODEL}-${RELEASE}"
43 48 Set system host name. It's recommended that the host name is unique in the corresponding subnet.
44 49
45 50 ##### `PASSWORD`="raspberry"
46 51 Set system `root` password. The same password is used for the created user `pi`. It's **STRONGLY** recommended that you choose a custom password.
47 52
48 53 ##### `DEFLOCAL`="en_US.UTF-8"
49 54 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`.
50 55
51 56 ##### `TIMEZONE`="Europe/Berlin"
52 57 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.
53 58
54 59 ##### `EXPANDROOT`=true
55 60 Expand the root partition and filesystem automatically on first boot.
56 61
57 62 #### Keyboard settings:
58 63 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.
59 64
60 65 ##### `XKB_MODEL`=""
61 66 Set the name of the model of your keyboard type.
62 67
63 68 ##### `XKB_LAYOUT`=""
64 69 Set the supported keyboard layout(s).
65 70
66 71 ##### `XKB_VARIANT`=""
67 72 Set the supported variant(s) of the keyboard layout(s).
68 73
69 74 ##### `XKB_OPTIONS`=""
70 75 Set extra xkb configuration options.
71 76
72 77 #### Networking settings (DHCP):
73 78 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`.`
74 79
75 80 #####`ENABLE_DHCP`=true
76 81 Set the system to use DHCP. This requires an DHCP server.
77 82
78 83 #### Networking settings (static):
79 84 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`.
80 85
81 86 #####`NET_ADDRESS`=""
82 87 Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24".
83 88
84 89 #####`NET_GATEWAY`=""
85 90 Set the IP address for the default gateway.
86 91
87 92 #####`NET_DNS_1`=""
88 93 Set the IP address for the first DNS server.
89 94
90 95 #####`NET_DNS_2`=""
91 96 Set the IP address for the second DNS server.
92 97
93 98 #####`NET_DNS_DOMAINS`=""
94 99 Set the default DNS search domains to use for non fully qualified host names.
95 100
96 101 #####`NET_NTP_1`=""
97 102 Set the IP address for the first NTP server.
98 103
99 104 #####`NET_NTP_2`=""
100 105 Set the IP address for the second NTP server.
101 106
102 107 #### Basic system features:
103 108 ##### `ENABLE_CONSOLE`=true
104 Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system.
109 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.
105 110
106 111 ##### `ENABLE_IPV6`=true
107 112 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
108 113
109 114 ##### `ENABLE_SSHD`=true
110 115 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.
111 116
112 117 ##### `ENABLE_NONFREE`=false
113 118 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.
114 119
120 ##### `ENABLE_WIRELESS`=false
121 Download and install the required non-free closed-source firmware binary blob that is required to run the internal wireless interface of the Rasberry Pi model 3. This parameter is ignored if the specified `RPI_MODEL` is not 3.
122
115 123 ##### `ENABLE_RSYSLOG`=true
116 124 If set to false, disable and uninstall rsyslog (so logs will be available only
117 125 in journal files)
118 126
119 127 ##### `ENABLE_SOUND`=true
120 128 Enable sound hardware and install Advanced Linux Sound Architecture.
121 129
122 130 ##### `ENABLE_HWRANDOM`=true
123 131 Enable Hardware Random Number Generator. Strong random numbers are important for most network based communications that use encryption. It's recommended to be enabled.
124 132
125 133 ##### `ENABLE_MINGPU`=false
126 134 Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU.
127 135
128 136 ##### `ENABLE_DBUS`=true
129 137 Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled.
130 138
131 139 ##### `ENABLE_XORG`=false
132 140 Install Xorg open-source X Window System.
133 141
134 142 ##### `ENABLE_WM`=""
135 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 `rpi2-gen-image.sh` script has been tested with the following list of window managers: `blackbox`, `openbox`, `fluxbox`, `jwm`, `dwm`, `xfce4`, `awesome`.
143 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`.
136 144
137 145 #### Advanced system features:
138 146 ##### `ENABLE_MINBASE`=false
139 147 Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB.
140 148
141 149 ##### `ENABLE_REDUCE`=false
142 150 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
143 151
144 152 ##### `ENABLE_UBOOT`=false
145 Replace default RPi2 second stage bootloader (bootcode.bin) with U-Boot bootloader. U-Boot can boot images via the network using the BOOTP/TFTP protocol.
153 Replace the default RPi2/3 second stage bootloader (bootcode.bin) with U-Boot bootloader. U-Boot can boot images via the network using the BOOTP/TFTP protocol.
146 154
147 155 ##### `ENABLE_FBTURBO`=false
148 156 Install and enable the hardware accelerated Xorg video driver `fbturbo`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling.
149 157
150 158 ##### `ENABLE_IPTABLES`=false
151 159 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
152 160
153 161 ##### `ENABLE_USER`=true
154 162 Create non-root user with password raspberry. Unless overridden with `USER_NAME`=user, username will be `pi`.
155 163
156 164 ##### `USER_NAME`=pi
157 165 Non-root user to create. Ignored if `ENABLE_USER`=false
158 166
159 167 ##### `ENABLE_ROOT`=true
160 168 Set root user password so root login will be enabled
161 169
162 170 ##### `ENABLE_ROOT_SSH`=true
163 171 Enable password root login via SSH. May be a security risk with default
164 172 password, use only in trusted environments.
165 173
166 174 ##### `ENABLE_HARDNET`=false
167 175 Enable IPv4/IPv6 network stack hardening settings.
168 176
169 177 ##### `ENABLE_SPLITFS`=false
170 178 Enable having root partition on an USB drive by creating two image files: one for the `/boot/firmware` mount point, and another for `/`.
171 179
172 180 ##### `CHROOT_SCRIPTS`=""
173 181 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.
174 182
175 183 ##### `ENABLE_INITRAMFS`=false
176 184 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.
177 185
178 186 ##### `ENABLE_IFNAMES`=true
179 187 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 release `stretch` is used.
180 188
181 189 #### Kernel compilation:
182 190 ##### `BUILD_KERNEL`=false
183 Build and install the latest RPi2 Linux kernel. Currently only the default RPi2 kernel configuration is used.
191 Build and install the latest RPi2/3 Linux kernel. Currently only the default RPi2/3 kernel configuration is used.
184 192
185 193 ##### `KERNEL_REDUCE`=false
186 194 Reduce the size of the generated kernel by removing unwanted device, network and filesystem drivers (experimental).
187 195
188 196 ##### `KERNEL_THREADS`=1
189 197 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.
190 198
191 199 ##### `KERNEL_HEADERS`=true
192 200 Install kernel headers with built kernel.
193 201
194 202 ##### `KERNEL_MENUCONFIG`=false
195 203 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
196 204
197 205 ##### `KERNEL_REMOVESRC`=true
198 206 Remove all kernel sources from the generated OS image after it was built and installed.
199 207
200 208 ##### `KERNELSRC_DIR`=""
201 209 Path to a directory of [RaspberryPi Linux kernel sources](https://github.com/raspberrypi/linux) that will be copied, configured, build and installed inside the chroot.
202 210
203 211 ##### `KERNELSRC_CLEAN`=false
204 212 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.
205 213
206 214 ##### `KERNELSRC_CONFIG`=true
207 215 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.
208 216
209 217 ##### `KERNELSRC_PREBUILT`=false
210 218 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` and `KERNEL_MENUCONFIG` are ignored and no kernel compilation tasks are performed.
211 219
212 220 ##### `FIRMWAREDIR`=""
213 221 The directory 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.
214 222
215 223 #### Reduce disk usage:
216 224 The following list of parameters is ignored if `ENABLE_REDUCE`=false.
217 225
218 226 ##### `REDUCE_APT`=true
219 227 Configure APT to use compressed package repository lists and no package caching files.
220 228
221 229 ##### `REDUCE_DOC`=true
222 230 Remove all doc files (harsh). Configure APT to not include doc files on future `apt-get` package installations.
223 231
224 232 ##### `REDUCE_MAN`=true
225 233 Remove all man pages and info files (harsh). Configure APT to not include man pages on future `apt-get` package installations.
226 234
227 235 ##### `REDUCE_VIM`=false
228 236 Replace `vim-tiny` package by `levee` a tiny vim clone.
229 237
230 238 ##### `REDUCE_BASH`=false
231 239 Remove `bash` package and switch to `dash` shell (experimental).
232 240
233 241 ##### `REDUCE_HWDB`=true
234 242 Remove PCI related hwdb files (experimental).
235 243
236 244 ##### `REDUCE_SSHD`=true
237 245 Replace `openssh-server` with `dropbear`.
238 246
239 247 ##### `REDUCE_LOCALE`=true
240 248 Remove all `locale` translation files.
241 249
242 250 #### Encrypted root partition:
243 251
244 252 ##### `ENABLE_CRYPTFS`=false
245 253 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.
246 254
247 255 ##### `CRYPTFS_PASSWORD`=""
248 256 Set password of the encrypted root partition. This parameter is mandatory if `ENABLE_CRYPTFS`=true.
249 257
250 258 ##### `CRYPTFS_MAPPING`="secure"
251 259 Set name of dm-crypt managed device-mapper mapping.
252 260
253 261 ##### `CRYPTFS_CIPHER`="aes-xts-plain64:sha512"
254 262 Set cipher specification string. `aes-xts*` ciphers are strongly recommended.
255 263
256 264 ##### `CRYPTFS_XTSKEYSIZE`=512
257 265 Sets key size in bits. The argument has to be a multiple of 8.
258 266
259 267 ## Understanding the script
260 268 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:
261 269
262 270 | Script | Description |
263 271 | --- | --- |
264 272 | `10-bootstrap.sh` | Debootstrap basic system |
265 273 | `11-apt.sh` | Setup APT repositories |
266 274 | `12-locale.sh` | Setup Locales and keyboard settings |
267 | `13-kernel.sh` | Build and install RPi2 Kernel |
275 | `13-kernel.sh` | Build and install RPi2/3 Kernel |
268 276 | `20-networking.sh` | Setup Networking |
269 277 | `21-firewall.sh` | Setup Firewall |
270 278 | `30-security.sh` | Setup Users and Security settings |
271 279 | `31-logging.sh` | Setup Logging |
272 280 | `41-uboot.sh` | Build and Setup U-Boot |
273 281 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
274 282 | `50-firstboot.sh` | First boot actions |
275 283 | `99-reduce.sh` | Reduce the disk space usage |
276 284
277 285 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.
278 286
279 287 | Directory | Description |
280 288 | --- | --- |
281 289 | `apt` | APT management configuration files |
282 | `boot` | Boot and RPi2 configuration files |
290 | `boot` | Boot and RPi2/3 configuration files |
283 291 | `dpkg` | Package Manager configuration |
284 292 | `etc` | Configuration files and rc scripts |
285 293 | `firstboot` | Scripts that get executed on first boot |
286 294 | `initramfs` | Initramfs scripts |
287 295 | `iptables` | Firewall configuration files |
288 296 | `locales` | Locales configuration |
289 297 | `modules` | Kernel Modules configuration |
290 298 | `mount` | Fstab configuration |
291 299 | `network` | Networking configuration files |
292 300 | `sysctl.d` | Swapping and Network Hardening configuration |
293 301 | `xorg` | fbturbo Xorg driver configuration |
294 302
295 303 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`.
296 304
297 305 Scripts in the custom.d directory will be executed after all other installation is complete but before the image is created.
298 306
299 307 ## Logging of the bootstrapping process
300 All information related to the bootstrapping process and the commands executed by the `rpi2-gen-image.sh` script can easily be saved into a logfile. The common shell command `script` can be used for this purpose:
308 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:
301 309
302 310 ```shell
303 script -c 'APT_SERVER=ftp.de.debian.org ./rpi2-gen-image.sh' ./build.log
311 script -c 'APT_SERVER=ftp.de.debian.org ./rpi23-gen-image.sh' ./build.log
304 312 ```
305 313
306 314 ## Flashing the image file
307 After the image file was successfully created by the `rpi2-gen-image.sh` script it can be copied to the microSD card that will be used by the RPi2 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`.
315 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`.
308 316
309 317 #####Flashing examples:
310 318 ```shell
311 319 bmaptool copy ./images/jessie/2015-12-13-debian-jessie.img /dev/mmcblk0
312 320 dd bs=4M if=./images/jessie/2015-12-13-debian-jessie.img of=/dev/mmcblk0
313 321 ```
314 322 If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, then the `-root` one on the USB drive:
315 323 ```shell
316 324 bmaptool copy ./images/jessie/2015-12-13-debian-jessie-frmw.img /dev/mmcblk0
317 325 bmaptool copy ./images/jessie/2015-12-13-debian-jessie-root.img /dev/sdc
318 326 ```
327
328 ## External links and references
329 * [Debian worldwide mirror sites](https://www.debian.org/mirror/list)
330 * [Official Raspberry Pi Firmware on github](https://github.com/raspberrypi/firmware)
331 * [Official Raspberry Pi Kernel on github](https://github.com/raspberrypi/linux)
332 * [U-BOOT git repository](http://git.denx.de/?p=u-boot.git;a=summary)
333 * [Xorg DDX driver fbturbo](https://github.com/ssvb/xf86-video-fbturbo)
334 * [RPi3 Wireless interface firmware](https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm80211/brcm)
335 * [Collabora RPi2 Kernel precompiled](https://repositories.collabora.co.uk/debian/)
@@ -1,51 +1,51
1 1 #
2 2 # Setup APT repositories
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Install and setup APT proxy configuration
9 9 if [ -z "$APT_PROXY" ] ; then
10 install_readonly files/apt/10proxy "${ETCDIR}/apt/apt.conf.d/10proxy"
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" "${ETCDIR}/apt/apt.conf.d/10proxy"
10 install_readonly files/apt/10proxy "${ETC_DIR}/apt/apt.conf.d/10proxy"
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" "${ETC_DIR}/apt/apt.conf.d/10proxy"
12 12 fi
13 13
14 14 if [ "$BUILD_KERNEL" = false ] ; then
15 15 # Install APT pinning configuration for flash-kernel package
16 install_readonly files/apt/flash-kernel "${ETCDIR}/apt/preferences.d/flash-kernel"
16 install_readonly files/apt/flash-kernel "${ETC_DIR}/apt/preferences.d/flash-kernel"
17 17
18 18 # Install APT sources.list
19 install_readonly files/apt/sources.list "${ETCDIR}/apt/sources.list"
20 echo "deb ${COLLABORA_URL} ${RELEASE} rpi2" >> "${ETCDIR}/apt/sources.list"
19 install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list"
20 echo "deb ${COLLABORA_URL} ${RELEASE} rpi2" >> "${ETC_DIR}/apt/sources.list"
21 21
22 22 # Upgrade collabora package index and install collabora keyring
23 23 chroot_exec apt-get -qq -y update
24 24 chroot_exec apt-get -qq -y --force-yes install collabora-obs-archive-keyring
25 25 else # BUILD_KERNEL=true
26 26 # Install APT sources.list
27 install_readonly files/apt/sources.list "${ETCDIR}/apt/sources.list"
27 install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list"
28 28
29 29 # Use specified APT server and release
30 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "${ETCDIR}/apt/sources.list"
31 sed -i "s/ jessie/ ${RELEASE}/" "${ETCDIR}/apt/sources.list"
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 32 fi
33 33
34 34 # Allow the installation of non-free Debian packages
35 35 if [ "$ENABLE_NONFREE" = true ] ; then
36 sed -i "s/ contrib/ contrib non-free/" "${ETCDIR}/apt/sources.list"
36 sed -i "s/ contrib/ contrib non-free/" "${ETC_DIR}/apt/sources.list"
37 37 fi
38 38
39 39 # Upgrade package index and update all installed packages and changed dependencies
40 40 chroot_exec apt-get -qq -y update
41 41 chroot_exec apt-get -qq -y -u dist-upgrade
42 42
43 43 if [ -d packages ] ; then
44 44 for package in packages/*.deb ; do
45 45 cp $package ${R}/tmp
46 46 chroot_exec dpkg --unpack /tmp/$(basename $package)
47 47 done
48 48 fi
49 49 chroot_exec apt-get -qq -y -f install
50 50
51 51 chroot_exec apt-get -qq -y check
@@ -1,58 +1,58
1 1 #
2 2 # Setup Locales and keyboard settings
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Install and setup timezone
9 echo ${TIMEZONE} > "${ETCDIR}/timezone"
9 echo ${TIMEZONE} > "${ETC_DIR}/timezone"
10 10 chroot_exec dpkg-reconfigure -f noninteractive tzdata
11 11
12 12 # Install and setup default locale and keyboard configuration
13 13 if [ $(echo "$APT_INCLUDES" | grep ",locales") ] ; then
14 14 # Set locale choice in debconf db, even though dpkg-reconfigure ignores and overwrites them due to some bug
15 15 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685957
16 16 # ... so we have to set locales manually
17 17 if [ "$DEFLOCAL" = "en_US.UTF-8" ] ; then
18 18 chroot_exec echo "locales locales/locales_to_be_generated multiselect ${DEFLOCAL} UTF-8" | debconf-set-selections
19 19 else
20 20 # en_US.UTF-8 should be available anyway : https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_reconfiguration_of_the_locale
21 21 chroot_exec echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, ${DEFLOCAL} UTF-8" | debconf-set-selections
22 sed -i "/en_US.UTF-8/s/^#//" "${ETCDIR}/locale.gen"
22 sed -i "/en_US.UTF-8/s/^#//" "${ETC_DIR}/locale.gen"
23 23 fi
24 24
25 sed -i "/${DEFLOCAL}/s/^#//" "${ETCDIR}/locale.gen"
25 sed -i "/${DEFLOCAL}/s/^#//" "${ETC_DIR}/locale.gen"
26 26 chroot_exec echo "locales locales/default_environment_locale select ${DEFLOCAL}" | debconf-set-selections
27 27 chroot_exec locale-gen
28 28 chroot_exec update-locale LANG="${DEFLOCAL}"
29 29
30 30 # Install and setup default keyboard configuration
31 31 if [ "$XKB_MODEL" != "" ] ; then
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETCDIR}/default/keyboard"
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETC_DIR}/default/keyboard"
33 33 fi
34 34 if [ "$XKB_LAYOUT" != "" ] ; then
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETCDIR}/default/keyboard"
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETC_DIR}/default/keyboard"
36 36 fi
37 37 if [ "$XKB_VARIANT" != "" ] ; then
38 sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKB_VARIANT}\"/" "${ETCDIR}/default/keyboard"
38 sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKB_VARIANT}\"/" "${ETC_DIR}/default/keyboard"
39 39 fi
40 40 if [ "$XKB_OPTIONS" != "" ] ; then
41 sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKB_OPTIONS}\"/" "${ETCDIR}/default/keyboard"
41 sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKB_OPTIONS}\"/" "${ETC_DIR}/default/keyboard"
42 42 fi
43 43 chroot_exec dpkg-reconfigure -f noninteractive keyboard-configuration
44 44
45 45 # Install and setup font console
46 46 case "${DEFLOCAL}" in
47 47 *UTF-8)
48 sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' "${ETCDIR}/default/console-setup"
48 sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' "${ETC_DIR}/default/console-setup"
49 49 ;;
50 50 *)
51 sed -i 's/^CHARMAP.*/CHARMAP="guess"/' "${ETCDIR}/default/console-setup"
51 sed -i 's/^CHARMAP.*/CHARMAP="guess"/' "${ETC_DIR}/default/console-setup"
52 52 ;;
53 53 esac
54 54 chroot_exec dpkg-reconfigure -f noninteractive console-setup
55 55 else # (no locales were installed)
56 56 # Install POSIX default locale
57 install_readonly files/locales/locale "${ETCDIR}/default/locale"
57 install_readonly files/locales/locale "${ETC_DIR}/default/locale"
58 58 fi
@@ -1,299 +1,306
1 1 #
2 # Build and Setup RPi2 Kernel
2 # Build and Setup RPi2/3 Kernel
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Fetch and build latest raspberry kernel
9 9 if [ "$BUILD_KERNEL" = true ] ; then
10 10 # Setup source directory
11 11 mkdir -p "${R}/usr/src"
12 12
13 13 # Copy existing kernel sources into chroot directory
14 14 if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then
15 15 # Copy kernel sources
16 16 cp -r "${KERNELSRC_DIR}" "${R}/usr/src"
17 17
18 18 # Clean the kernel sources
19 19 if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then
20 make -C "${KERNELDIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
20 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
21 21 fi
22 22 else # KERNELSRC_DIR=""
23 23 # Fetch current raspberrypi kernel sources
24 24 git -C "${R}/usr/src" clone --depth=1 "${KERNEL_URL}"
25 25 fi
26 26
27 27 # Calculate optimal number of kernel building threads
28 28 if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then
29 29 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
30 30 fi
31 31
32 32 # Configure and build kernel
33 33 if [ "$KERNELSRC_PREBUILT" = false ] ; then
34 34 # Remove device, network and filesystem drivers from kernel configuration
35 35 if [ "$KERNEL_REDUCE" = true ] ; then
36 make -C "${KERNELDIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
36 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
37 37 sed -i\
38 38 -e "s/\(^CONFIG_SND.*\=\).*/\1n/"\
39 39 -e "s/\(^CONFIG_SOUND.*\=\).*/\1n/"\
40 40 -e "s/\(^CONFIG_AC97.*\=\).*/\1n/"\
41 41 -e "s/\(^CONFIG_VIDEO_.*\=\).*/\1n/"\
42 42 -e "s/\(^CONFIG_MEDIA_TUNER.*\=\).*/\1n/"\
43 43 -e "s/\(^CONFIG_DVB.*\=\)[ym]/\1n/"\
44 44 -e "s/\(^CONFIG_REISERFS.*\=\).*/\1n/"\
45 45 -e "s/\(^CONFIG_JFS.*\=\).*/\1n/"\
46 46 -e "s/\(^CONFIG_XFS.*\=\).*/\1n/"\
47 47 -e "s/\(^CONFIG_GFS2.*\=\).*/\1n/"\
48 48 -e "s/\(^CONFIG_OCFS2.*\=\).*/\1n/"\
49 49 -e "s/\(^CONFIG_BTRFS.*\=\).*/\1n/"\
50 50 -e "s/\(^CONFIG_HFS.*\=\).*/\1n/"\
51 51 -e "s/\(^CONFIG_JFFS2.*\=\)[ym]/\1n/"\
52 52 -e "s/\(^CONFIG_UBIFS.*\=\).*/\1n/"\
53 53 -e "s/\(^CONFIG_SQUASHFS.*\=\)[ym]/\1n/"\
54 54 -e "s/\(^CONFIG_W1.*\=\)[ym]/\1n/"\
55 55 -e "s/\(^CONFIG_HAMRADIO.*\=\).*/\1n/"\
56 56 -e "s/\(^CONFIG_CAN.*\=\).*/\1n/"\
57 57 -e "s/\(^CONFIG_IRDA.*\=\).*/\1n/"\
58 58 -e "s/\(^CONFIG_BT_.*\=\).*/\1n/"\
59 59 -e "s/\(^CONFIG_WIMAX.*\=\)[ym]/\1n/"\
60 60 -e "s/\(^CONFIG_6LOWPAN.*\=\).*/\1n/"\
61 61 -e "s/\(^CONFIG_IEEE802154.*\=\).*/\1n/"\
62 62 -e "s/\(^CONFIG_NFC.*\=\).*/\1n/"\
63 63 -e "s/\(^CONFIG_FB_TFT=.*\=\).*/\1n/"\
64 64 -e "s/\(^CONFIG_TOUCHSCREEN.*\=\).*/\1n/"\
65 65 -e "s/\(^CONFIG_USB_GSPCA_.*\=\).*/\1n/"\
66 66 -e "s/\(^CONFIG_DRM.*\=\).*/\1n/"\
67 "${KERNELDIR}/.config"
67 "${KERNEL_DIR}/.config"
68 68 fi
69 69
70 70 if [ "$KERNELSRC_CONFIG" = true ] ; then
71 71 # Load default raspberry kernel configuration
72 make -C "${KERNELDIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
72 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
73 73
74 74 # Start menu-driven kernel configuration (interactive)
75 75 if [ "$KERNEL_MENUCONFIG" = true ] ; then
76 make -C "${KERNELDIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
76 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
77 77 fi
78 78 fi
79 79
80 80 # Cross compile kernel and modules
81 make -C "${KERNELDIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" zImage modules dtbs
81 make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" zImage modules dtbs
82 82 fi
83 83
84 84 # Check if kernel compilation was successful
85 if [ ! -r "${KERNELDIR}/arch/${KERNEL_ARCH}/boot/zImage" ] ; then
85 if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" ] ; then
86 86 echo "error: kernel compilation failed! (zImage not found)"
87 87 cleanup
88 88 exit 1
89 89 fi
90 90
91 91 # Install kernel modules
92 92 if [ "$ENABLE_REDUCE" = true ] ; then
93 make -C "${KERNELDIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
93 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
94 94 else
95 make -C "${KERNELDIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
95 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
96 96
97 97 # Install kernel firmware
98 make -C "${KERNELDIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
98 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
99 99 fi
100 100
101 101 # Install kernel headers
102 102 if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then
103 make -C "${KERNELDIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
103 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
104 104 fi
105 105
106 106 # Prepare boot (firmware) directory
107 mkdir "${BOOTDIR}"
107 mkdir "${BOOT_DIR}"
108 108
109 109 # Get kernel release version
110 KERNEL_VERSION=`cat "${KERNELDIR}/include/config/kernel.release"`
110 KERNEL_VERSION=`cat "${KERNEL_DIR}/include/config/kernel.release"`
111 111
112 112 # Copy kernel configuration file to the boot directory
113 install_readonly "${KERNELDIR}/.config" "${R}/boot/config-${KERNEL_VERSION}"
113 install_readonly "${KERNEL_DIR}/.config" "${R}/boot/config-${KERNEL_VERSION}"
114 114
115 115 # Copy dts and dtb device tree sources and binaries
116 mkdir "${BOOTDIR}/overlays"
117 install_readonly "${KERNELDIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "${BOOTDIR}/"
118 install_readonly "${KERNELDIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "${BOOTDIR}/overlays/"
119 install_readonly "${KERNELDIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOTDIR}/overlays/README"
116 mkdir "${BOOT_DIR}/overlays"
117 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "${BOOT_DIR}/"
118 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "${BOOT_DIR}/overlays/"
119 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README"
120 120
121 121 if [ "$ENABLE_UBOOT" = false ] ; then
122 122 # Convert and copy zImage kernel to the boot directory
123 "${KERNELDIR}/scripts/mkknlimg" "${KERNELDIR}/arch/${KERNEL_ARCH}/boot/zImage" "${BOOTDIR}/${KERNEL_IMAGE}"
123 "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" "${BOOT_DIR}/${KERNEL_IMAGE}"
124 124 else
125 125 # Copy zImage kernel to the boot directory
126 install_readonly "${KERNELDIR}/arch/${KERNEL_ARCH}/boot/zImage" "${BOOTDIR}/${KERNEL_IMAGE}"
126 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" "${BOOT_DIR}/${KERNEL_IMAGE}"
127 127 fi
128 128
129 129 # Remove kernel sources
130 130 if [ "$KERNEL_REMOVESRC" = true ] ; then
131 rm -fr "${KERNELDIR}"
131 rm -fr "${KERNEL_DIR}"
132 132 fi
133 133
134 if [ -n "$FIRMWAREDIR" ] && [ -d "$FIRMWAREDIR" ] ; then
134 if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then
135 135 # Install boot binaries from local directory
136 cp ${FIRMWAREDIR}/boot/bootcode.bin ${BOOTDIR}/bootcode.bin
137 cp ${FIRMWAREDIR}/boot/fixup.dat ${BOOTDIR}/fixup.dat
138 cp ${FIRMWAREDIR}/boot/fixup_cd.dat ${BOOTDIR}/fixup_cd.dat
139 cp ${FIRMWAREDIR}/boot/fixup_x.dat ${BOOTDIR}/fixup_x.dat
140 cp ${FIRMWAREDIR}/boot/start.elf ${BOOTDIR}/start.elf
141 cp ${FIRMWAREDIR}/boot/start_cd.elf ${BOOTDIR}/start_cd.elf
142 cp ${FIRMWAREDIR}/boot/start_x.elf ${BOOTDIR}/start_x.elf
136 cp ${RPI_FIRMWARE_DIR}/boot/bootcode.bin ${BOOT_DIR}/bootcode.bin
137 cp ${RPI_FIRMWARE_DIR}/boot/fixup.dat ${BOOT_DIR}/fixup.dat
138 cp ${RPI_FIRMWARE_DIR}/boot/fixup_cd.dat ${BOOT_DIR}/fixup_cd.dat
139 cp ${RPI_FIRMWARE_DIR}/boot/fixup_x.dat ${BOOT_DIR}/fixup_x.dat
140 cp ${RPI_FIRMWARE_DIR}/boot/start.elf ${BOOT_DIR}/start.elf
141 cp ${RPI_FIRMWARE_DIR}/boot/start_cd.elf ${BOOT_DIR}/start_cd.elf
142 cp ${RPI_FIRMWARE_DIR}/boot/start_x.elf ${BOOT_DIR}/start_x.elf
143 143 else
144 144 # Install latest boot binaries from raspberry/firmware github
145 wget -q -O "${BOOTDIR}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin"
146 wget -q -O "${BOOTDIR}/fixup.dat" "${FIRMWARE_URL}/fixup.dat"
147 wget -q -O "${BOOTDIR}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat"
148 wget -q -O "${BOOTDIR}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat"
149 wget -q -O "${BOOTDIR}/start.elf" "${FIRMWARE_URL}/start.elf"
150 wget -q -O "${BOOTDIR}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf"
151 wget -q -O "${BOOTDIR}/start_x.elf" "${FIRMWARE_URL}/start_x.elf"
145 wget -q -O "${BOOT_DIR}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin"
146 wget -q -O "${BOOT_DIR}/fixup.dat" "${FIRMWARE_URL}/fixup.dat"
147 wget -q -O "${BOOT_DIR}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat"
148 wget -q -O "${BOOT_DIR}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat"
149 wget -q -O "${BOOT_DIR}/start.elf" "${FIRMWARE_URL}/start.elf"
150 wget -q -O "${BOOT_DIR}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf"
151 wget -q -O "${BOOT_DIR}/start_x.elf" "${FIRMWARE_URL}/start_x.elf"
152 152 fi
153 153
154 154 else # BUILD_KERNEL=false
155 155 # Kernel installation
156 156 chroot_exec apt-get -qq -y --no-install-recommends install linux-image-"${COLLABORA_KERNEL}" raspberrypi-bootloader-nokernel
157 157
158 158 # Install flash-kernel last so it doesn't try (and fail) to detect the platform in the chroot
159 159 chroot_exec apt-get -qq -y install flash-kernel
160 160
161 161 # Check if kernel installation was successful
162 162 VMLINUZ="$(ls -1 ${R}/boot/vmlinuz-* | sort | tail -n 1)"
163 163 if [ -z "$VMLINUZ" ] ; then
164 164 echo "error: kernel installation failed! (/boot/vmlinuz-* not found)"
165 165 cleanup
166 166 exit 1
167 167 fi
168 168 # Copy vmlinuz kernel to the boot directory
169 install_readonly "${VMLINUZ}" "${BOOTDIR}/${KERNEL_IMAGE}"
169 install_readonly "${VMLINUZ}" "${BOOT_DIR}/${KERNEL_IMAGE}"
170 170 fi
171 171
172 172 # Setup firmware boot cmdline
173 173 if [ "$ENABLE_SPLITFS" = true ] ; then
174 174 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
175 175 else
176 176 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
177 177 fi
178 178
179 179 # Add encrypted root partition to cmdline.txt
180 180 if [ "$ENABLE_CRYPTFS" = true ] ; then
181 181 if [ "$ENABLE_SPLITFS" = true ] ; then
182 182 CMDLINE=$(echo ${CMDLINE} | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/")
183 183 else
184 184 CMDLINE=$(echo ${CMDLINE} | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/")
185 185 fi
186 186 fi
187 187
188 188 # Add serial console support
189 189 if [ "$ENABLE_CONSOLE" = true ] ; then
190 190 CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"
191 191 fi
192 192
193 193 # Remove IPv6 networking support
194 194 if [ "$ENABLE_IPV6" = false ] ; then
195 195 CMDLINE="${CMDLINE} ipv6.disable=1"
196 196 fi
197 197
198 198 # Automatically assign predictable network interface names
199 199 if [ "$ENABLE_IFNAMES" = false ] ; then
200 200 CMDLINE="${CMDLINE} net.ifnames=0"
201 201 else
202 202 CMDLINE="${CMDLINE} net.ifnames=1"
203 203 fi
204 204
205 205 # Set init to systemd if required by Debian release
206 206 if [ "$RELEASE" = "stretch" ] ; then
207 207 CMDLINE="${CMDLINE} init=/bin/systemd"
208 208 fi
209 209
210 210 # Install firmware boot cmdline
211 echo "${CMDLINE}" > "${BOOTDIR}/cmdline.txt"
211 echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt"
212 212
213 213 # Install firmware config
214 install_readonly files/boot/config.txt "${BOOTDIR}/config.txt"
214 install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt"
215 215
216 216 # Setup minimal GPU memory allocation size: 16MB (no X)
217 217 if [ "$ENABLE_MINGPU" = true ] ; then
218 echo "gpu_mem=16" >> "${BOOTDIR}/config.txt"
218 echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt"
219 219 fi
220 220
221 221 # Setup boot with initramfs
222 222 if [ "$ENABLE_INITRAMFS" = true ] ; then
223 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOTDIR}/config.txt"
223 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt"
224 fi
225
226 # Disable RPi3 Bluetooth and restore ttyAMA0 serial device
227 if [ "$RPI_MODEL" = 3 ] ; then
228 if [ "$ENABLE_CONSOLE" = true ] ; then
229 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt"
230 fi
224 231 fi
225 232
226 233 # Create firmware configuration and cmdline symlinks
227 234 ln -sf firmware/config.txt "${R}/boot/config.txt"
228 235 ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt"
229 236
230 237 # Install and setup kernel modules to load at boot
231 238 mkdir -p "${R}/lib/modules-load.d/"
232 239 install_readonly files/modules/rpi2.conf "${R}/lib/modules-load.d/rpi2.conf"
233 240
234 241 # Load hardware random module at boot
235 242 if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then
236 243 sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${R}/lib/modules-load.d/rpi2.conf"
237 244 fi
238 245
239 246 # Load sound module at boot
240 247 if [ "$ENABLE_SOUND" = true ] ; then
241 248 sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${R}/lib/modules-load.d/rpi2.conf"
242 249 fi
243 250
244 251 # Install kernel modules blacklist
245 mkdir -p "${ETCDIR}/modprobe.d/"
246 install_readonly files/modules/raspi-blacklist.conf "${ETCDIR}/modprobe.d/raspi-blacklist.conf"
252 mkdir -p "${ETC_DIR}/modprobe.d/"
253 install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf"
247 254
248 255 # Install and setup fstab
249 install_readonly files/mount/fstab "${ETCDIR}/fstab"
256 install_readonly files/mount/fstab "${ETC_DIR}/fstab"
250 257
251 258 # Add usb/sda disk root partition to fstab
252 259 if [ "$ENABLE_SPLITFS" = true ] && [ "$ENABLE_CRYPTFS" = false ] ; then
253 sed -i "s/mmcblk0p2/sda1/" "${ETCDIR}/fstab"
260 sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/fstab"
254 261 fi
255 262
256 263 # Add encrypted root partition to fstab and crypttab
257 264 if [ "$ENABLE_CRYPTFS" = true ] ; then
258 265 # Replace fstab root partition with encrypted partition mapping
259 sed -i "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING}/" "${ETCDIR}/fstab"
266 sed -i "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING}/" "${ETC_DIR}/fstab"
260 267
261 268 # Add encrypted partition to crypttab and fstab
262 install_readonly files/mount/crypttab "${ETCDIR}/crypttab"
263 echo "${CRYPTFS_MAPPING} /dev/mmcblk0p2 none luks" >> "${ETCDIR}/crypttab"
269 install_readonly files/mount/crypttab "${ETC_DIR}/crypttab"
270 echo "${CRYPTFS_MAPPING} /dev/mmcblk0p2 none luks" >> "${ETC_DIR}/crypttab"
264 271
265 272 if [ "$ENABLE_SPLITFS" = true ] ; then
266 273 # Add usb/sda disk to crypttab
267 sed -i "s/mmcblk0p2/sda1/" "${ETCDIR}/crypttab"
274 sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/crypttab"
268 275 fi
269 276 fi
270 277
271 278 # Generate initramfs file
272 279 if [ "$ENABLE_INITRAMFS" = true ] ; then
273 280 if [ "$ENABLE_CRYPTFS" = true ] ; then
274 281 # Include initramfs scripts to auto expand encrypted root partition
275 282 if [ "$EXPANDROOT" = true ] ; then
276 install_exec files/initramfs/expand_encrypted_rootfs "${ETCDIR}/initramfs-tools/scripts/init-premount/expand_encrypted_rootfs"
277 install_exec files/initramfs/expand-premount "${ETCDIR}/initramfs-tools/scripts/local-premount/expand-premount"
278 install_exec files/initramfs/expand-tools "${ETCDIR}/initramfs-tools/hooks/expand-tools"
283 install_exec files/initramfs/expand_encrypted_rootfs "${ETC_DIR}/initramfs-tools/scripts/init-premount/expand_encrypted_rootfs"
284 install_exec files/initramfs/expand-premount "${ETC_DIR}/initramfs-tools/scripts/local-premount/expand-premount"
285 install_exec files/initramfs/expand-tools "${ETC_DIR}/initramfs-tools/hooks/expand-tools"
279 286 fi
280 287
281 288 # Disable SSHD inside initramfs
282 printf "#\n# DROPBEAR: [ y | n ]\n#\n\nDROPBEAR=n\n" >> "${ETCDIR}/initramfs-tools/initramfs.conf"
289 printf "#\n# DROPBEAR: [ y | n ]\n#\n\nDROPBEAR=n\n" >> "${ETC_DIR}/initramfs-tools/initramfs.conf"
283 290
284 291 # Dummy mapping required by mkinitramfs
285 292 echo "0 1 crypt $(echo ${CRYPTFS_CIPHER} | cut -d ':' -f 1) ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0 7:0 4096" | chroot_exec dmsetup create "${CRYPTFS_MAPPING}"
286 293
287 294 # Generate initramfs with encrypted root partition support
288 295 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
289 296
290 297 # Remove dummy mapping
291 298 chroot_exec cryptsetup close "${CRYPTFS_MAPPING}"
292 299 else
293 300 # Generate initramfs without encrypted root partition support
294 301 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
295 302 fi
296 303 fi
297 304
298 305 # Install sysctl.d configuration files
299 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETCDIR}/sysctl.d/81-rpi-vm.conf"
306 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf"
@@ -1,83 +1,93
1 1 #
2 2 # Setup Networking
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Install and setup hostname
9 install_readonly files/network/hostname "${ETCDIR}/hostname"
10 sed -i "s/^rpi2-jessie/${HOSTNAME}/" "${ETCDIR}/hostname"
9 install_readonly files/network/hostname "${ETC_DIR}/hostname"
10 sed -i "s/^rpi2-jessie/${HOSTNAME}/" "${ETC_DIR}/hostname"
11 11
12 12 # Install and setup hosts
13 install_readonly files/network/hosts "${ETCDIR}/hosts"
14 sed -i "s/rpi2-jessie/${HOSTNAME}/" "${ETCDIR}/hosts"
13 install_readonly files/network/hosts "${ETC_DIR}/hosts"
14 sed -i "s/rpi2-jessie/${HOSTNAME}/" "${ETC_DIR}/hosts"
15 15
16 16 # Setup hostname entry with static IP
17 17 if [ "$NET_ADDRESS" != "" ] ; then
18 18 NET_IP=$(echo "${NET_ADDRESS}" | cut -f 1 -d'/')
19 sed -i "s/^127.0.1.1/${NET_IP}/" "${ETCDIR}/hosts"
19 sed -i "s/^127.0.1.1/${NET_IP}/" "${ETC_DIR}/hosts"
20 20 fi
21 21
22 22 # Remove IPv6 hosts
23 23 if [ "$ENABLE_IPV6" = false ] ; then
24 sed -i -e "/::[1-9]/d" -e "/^$/d" "${ETCDIR}/hosts"
24 sed -i -e "/::[1-9]/d" -e "/^$/d" "${ETC_DIR}/hosts"
25 25 fi
26 26
27 27 # Install hint about network configuration
28 install_readonly files/network/interfaces "${ETCDIR}/network/interfaces"
28 install_readonly files/network/interfaces "${ETC_DIR}/network/interfaces"
29 29
30 30 # Install configuration for interface eth0
31 install_readonly files/network/eth.network "${ETCDIR}/systemd/network/eth.network"
31 install_readonly files/network/eth.network "${ETC_DIR}/systemd/network/eth.network"
32 32
33 33 if [ "$ENABLE_DHCP" = true ] ; then
34 34 # Enable DHCP configuration for interface eth0
35 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETCDIR}/systemd/network/eth.network"
35 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETC_DIR}/systemd/network/eth.network"
36 36
37 37 # Set DHCP configuration to IPv4 only
38 38 if [ "$ENABLE_IPV6" = false ] ; then
39 sed -i "s/DHCP=.*/DHCP=v4/" "${ETCDIR}/systemd/network/eth.network"
39 sed -i "s/DHCP=.*/DHCP=v4/" "${ETC_DIR}/systemd/network/eth.network"
40 40 fi
41 41
42 42 else # ENABLE_DHCP=false
43 43 # Set static network configuration for interface eth0
44 44 sed -i\
45 45 -e "s|DHCP=.*|DHCP=no|"\
46 46 -e "s|Address=\$|Address=${NET_ADDRESS}|"\
47 47 -e "s|Gateway=\$|Gateway=${NET_GATEWAY}|"\
48 48 -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_1}|"\
49 49 -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_2}|"\
50 50 -e "s|Domains=\$|Domains=${NET_DNS_DOMAINS}|"\
51 51 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\
52 52 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\
53 "${ETCDIR}/systemd/network/eth.network"
53 "${ETC_DIR}/systemd/network/eth.network"
54 54 fi
55 55
56 56 # Remove empty settings from network configuration
57 sed -i "/.*=\$/d" "${ETCDIR}/systemd/network/eth.network"
57 sed -i "/.*=\$/d" "${ETC_DIR}/systemd/network/eth.network"
58 58
59 59 # Move systemd network configuration if required by Debian release
60 60 if [ "$RELEASE" = "stretch" ] ; then
61 mv -v "${ETCDIR}/systemd/network/eth.network" "${LIBDIR}/systemd/network/10-eth.network"
62 rm -fr "${ETCDIR}/systemd/network"
61 mv -v "${ETC_DIR}/systemd/network/eth.network" "${LIB_DIR}/systemd/network/10-eth.network"
62 rm -fr "${ETC_DIR}/systemd/network"
63 63 fi
64 64
65 65 # Enable systemd-networkd service
66 66 chroot_exec systemctl enable systemd-networkd
67 67
68 68 # Install host.conf resolver configuration
69 install_readonly files/network/host.conf "${ETCDIR}/host.conf"
69 install_readonly files/network/host.conf "${ETC_DIR}/host.conf"
70 70
71 71 # Enable network stack hardening
72 72 if [ "$ENABLE_HARDNET" = true ] ; then
73 73 # Install sysctl.d configuration files
74 install_readonly files/sysctl.d/82-rpi-net-hardening.conf "${ETCDIR}/sysctl.d/82-rpi-net-hardening.conf"
74 install_readonly files/sysctl.d/82-rpi-net-hardening.conf "${ETC_DIR}/sysctl.d/82-rpi-net-hardening.conf"
75 75
76 76 # Setup resolver warnings about spoofed addresses
77 sed -i "s/^# spoof warn/spoof warn/" "${ETCDIR}/host.conf"
77 sed -i "s/^# spoof warn/spoof warn/" "${ETC_DIR}/host.conf"
78 78 fi
79 79
80 80 # Enable time sync
81 81 if [ "NET_NTP_1" != "" ] ; then
82 82 chroot_exec systemctl enable systemd-timesyncd.service
83 83 fi
84
85 # Download the firmware binary blob required to use the RPi3 wireless interface
86 if [ "$ENABLE_WIRELESS" = true ] ; then
87 if [ ! -d ${WLAN_FIRMWARE_DIR} ] ; then
88 mkdir -p ${WLAN_FIRMWARE_DIR}
89 fi
90
91 wget -q -O "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin"
92 wget -q -O "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt"
93 fi
@@ -1,44 +1,44
1 1 #
2 2 # Setup Firewall
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 if [ "$ENABLE_IPTABLES" = true ] ; then
9 9 # Create iptables configuration directory
10 mkdir -p "${ETCDIR}/iptables"
10 mkdir -p "${ETC_DIR}/iptables"
11 11
12 12 # Install iptables systemd service
13 install_readonly files/iptables/iptables.service "${ETCDIR}/systemd/system/iptables.service"
13 install_readonly files/iptables/iptables.service "${ETC_DIR}/systemd/system/iptables.service"
14 14
15 15 # Install flush-table script called by iptables service
16 install_exec files/iptables/flush-iptables.sh "${ETCDIR}/iptables/flush-iptables.sh"
16 install_exec files/iptables/flush-iptables.sh "${ETC_DIR}/iptables/flush-iptables.sh"
17 17
18 18 # Install iptables rule file
19 install_readonly files/iptables/iptables.rules "${ETCDIR}/iptables/iptables.rules"
19 install_readonly files/iptables/iptables.rules "${ETC_DIR}/iptables/iptables.rules"
20 20
21 21 # Reload systemd configuration and enable iptables service
22 22 chroot_exec systemctl daemon-reload
23 23 chroot_exec systemctl enable iptables.service
24 24
25 25 if [ "$ENABLE_IPV6" = true ] ; then
26 26 # Install ip6tables systemd service
27 install_readonly files/iptables/ip6tables.service "${ETCDIR}/systemd/system/ip6tables.service"
27 install_readonly files/iptables/ip6tables.service "${ETC_DIR}/systemd/system/ip6tables.service"
28 28
29 29 # Install ip6tables file
30 install_exec files/iptables/flush-ip6tables.sh "${ETCDIR}/iptables/flush-ip6tables.sh"
30 install_exec files/iptables/flush-ip6tables.sh "${ETC_DIR}/iptables/flush-ip6tables.sh"
31 31
32 install_readonly files/iptables/ip6tables.rules "${ETCDIR}/iptables/ip6tables.rules"
32 install_readonly files/iptables/ip6tables.rules "${ETC_DIR}/iptables/ip6tables.rules"
33 33
34 34 # Reload systemd configuration and enable iptables service
35 35 chroot_exec systemctl daemon-reload
36 36 chroot_exec systemctl enable ip6tables.service
37 37 fi
38 38 fi
39 39
40 40 if [ "$ENABLE_SSHD" = false ] ; then
41 41 # Remove SSHD related iptables rules
42 sed -i "/^#/! {/SSH/ s/^/# /}" "${ETCDIR}/iptables/iptables.rules" 2> /dev/null
43 sed -i "/^#/! {/SSH/ s/^/# /}" "${ETCDIR}/iptables/ip6tables.rules" 2> /dev/null
42 sed -i "/^#/! {/SSH/ s/^/# /}" "${ETC_DIR}/iptables/iptables.rules" 2> /dev/null
43 sed -i "/^#/! {/SSH/ s/^/# /}" "${ETC_DIR}/iptables/ip6tables.rules" 2> /dev/null
44 44 fi
@@ -1,33 +1,33
1 1 #
2 2 # Setup users and security settings
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Generate crypt(3) password string
9 9 ENCRYPTED_PASSWORD=`mkpasswd -m sha-512 "${PASSWORD}"`
10 10
11 11 # Setup default user
12 12 if [ "$ENABLE_USER" = true ] ; then
13 13 chroot_exec adduser --gecos $USER_NAME --add_extra_groups \
14 14 --disabled-password $USER_NAME
15 15 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_PASSWORD}" $USER_NAME
16 16 fi
17 17
18 18 # Setup root password or not
19 19 if [ "$ENABLE_ROOT" = true ] ; then
20 20 chroot_exec usermod -p "${ENCRYPTED_PASSWORD}" root
21 21
22 22 if [ "$ENABLE_ROOT_SSH" = true ] ; then
23 sed -i "s|[#]*PermitRootLogin.*|PermitRootLogin yes|g" "${ETCDIR}/ssh/sshd_config"
23 sed -i "s|[#]*PermitRootLogin.*|PermitRootLogin yes|g" "${ETC_DIR}/ssh/sshd_config"
24 24 fi
25 25 else
26 26 # Set no root password to disable root login
27 27 chroot_exec usermod -p \'!\' root
28 28 fi
29 29
30 30 # Enable serial console systemd style
31 31 if [ "$ENABLE_CONSOLE" = true ] ; then
32 32 chroot_exec systemctl enable serial-getty\@ttyAMA0.service
33 33 fi
@@ -1,13 +1,13
1 1 #
2 2 # Setup Logging
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Disable rsyslog
9 9 if [ "$ENABLE_RSYSLOG" = false ] ; then
10 sed -i "s|[#]*ForwardToSyslog=yes|ForwardToSyslog=no|g" "${ETCDIR}/systemd/journald.conf"
10 sed -i "s|[#]*ForwardToSyslog=yes|ForwardToSyslog=no|g" "${ETC_DIR}/systemd/journald.conf"
11 11 chroot_exec systemctl disable rsyslog
12 12 chroot_exec apt-get -qq -y --force-yes purge rsyslog
13 13 fi
@@ -1,68 +1,68
1 1 #
2 2 # Build and Setup U-Boot
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Install gcc/c++ build environment inside the chroot
9 9 if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then
10 10 COMPILER_PACKAGES=$(chroot_exec apt-get -s install ${COMPILER_PACKAGES} | grep "^Inst " | awk -v ORS=" " '{ print $2 }')
11 11 chroot_exec apt-get -q -y --force-yes --no-install-recommends install ${COMPILER_PACKAGES}
12 12 fi
13 13
14 14 # Fetch and build U-Boot bootloader
15 15 if [ "$ENABLE_UBOOT" = true ] ; then
16 16 # Fetch U-Boot bootloader sources
17 17 git -C "${R}/tmp" clone "${UBOOT_URL}"
18 18
19 19 # Build and install U-Boot inside chroot
20 20 chroot_exec make -C /tmp/u-boot/ ${UBOOT_CONFIG} all
21 21
22 22 # Copy compiled bootloader binary and set config.txt to load it
23 23 install_exec "${R}/tmp/u-boot/tools/mkimage" "${R}/usr/sbin/mkimage"
24 install_readonly "${R}/tmp/u-boot/u-boot.bin" "${BOOTDIR}/u-boot.bin"
25 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "${BOOTDIR}/config.txt"
24 install_readonly "${R}/tmp/u-boot/u-boot.bin" "${BOOT_DIR}/u-boot.bin"
25 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "${BOOT_DIR}/config.txt"
26 26
27 27 # Install and setup U-Boot command file
28 install_readonly files/boot/uboot.mkimage "${BOOTDIR}/uboot.mkimage"
29 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOTDIR}/uboot.mkimage)" > "${BOOTDIR}/uboot.mkimage"
28 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
29 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
30 30
31 31 if [ "$ENABLE_INITRAMFS" = true ] ; then
32 32 # Convert generated initramfs for U-Boot using mkimage
33 33 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -T ramdisk -C none -n "initramfs-${KERNEL_VERSION}" -d "/boot/firmware/initramfs-${KERNEL_VERSION}" "/boot/firmware/initramfs-${KERNEL_VERSION}.uboot"
34 34
35 35 # Remove original initramfs file
36 rm -f "${BOOTDIR}/initramfs-${KERNEL_VERSION}"
36 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
37 37
38 38 # Configure U-Boot to load generated initramfs
39 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOTDIR}/uboot.mkimage)" > "${BOOTDIR}/uboot.mkimage"
40 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOTDIR}/uboot.mkimage"
39 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
40 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
41 41 else # ENABLE_INITRAMFS=false
42 42 # Remove initramfs from U-Boot mkfile
43 sed -i '/.*initramfs.*/d' "${BOOTDIR}/uboot.mkimage"
43 sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage"
44 44
45 45 if [ "$BUILD_KERNEL" = false ] ; then
46 46 # Remove dtbfile from U-Boot mkfile
47 sed -i '/.*dtbfile.*/d' "${BOOTDIR}/uboot.mkimage"
48 printf "\nbootz \${kernel_addr_r}" >> "${BOOTDIR}/uboot.mkimage"
47 sed -i '/.*dtbfile.*/d' "${BOOT_DIR}/uboot.mkimage"
48 printf "\nbootz \${kernel_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
49 49 else
50 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOTDIR}/uboot.mkimage"
50 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
51 51 fi
52 52 fi
53 53
54 # Set mkfile to use dtb file
55 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOTDIR}/uboot.mkimage"
54 # Set mkfile to use the correct dtb file
55 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
56 56
57 57 # Set mkfile to use kernel image
58 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOTDIR}/uboot.mkimage"
58 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage"
59 59
60 60 # Remove all leading blank lines
61 sed -i "/./,\$!d" "${BOOTDIR}/uboot.mkimage"
61 sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage"
62 62
63 63 # Generate U-Boot bootloader image
64 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n RPi2 -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
64 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "RPi${RPI_MODEL}" -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
65 65
66 66 # Remove U-Boot sources
67 67 rm -fr "${R}/tmp/u-boot"
68 68 fi
@@ -1,49 +1,49
1 1 #
2 2 # First boot actions
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Prepare rc.firstboot script
9 cat files/firstboot/10-begin.sh > "${ETCDIR}/rc.firstboot"
9 cat files/firstboot/10-begin.sh > "${ETC_DIR}/rc.firstboot"
10 10
11 11 # Ensure openssh server host keys are regenerated on first boot
12 12 if [ "$ENABLE_SSHD" = true ] ; then
13 cat files/firstboot/21-generate-ssh-keys.sh >> "${ETCDIR}/rc.firstboot"
13 cat files/firstboot/21-generate-ssh-keys.sh >> "${ETC_DIR}/rc.firstboot"
14 14 fi
15 15
16 16 # Prepare filesystem auto expand
17 17 if [ "$EXPANDROOT" = true ] ; then
18 18 if [ "$ENABLE_CRYPTFS" = false ] ; then
19 cat files/firstboot/22-expandroot.sh >> "${ETCDIR}/rc.firstboot"
19 cat files/firstboot/22-expandroot.sh >> "${ETC_DIR}/rc.firstboot"
20 20 else
21 21 # Regenerate initramfs to remove encrypted root partition auto expand
22 cat files/firstboot/23-regenerate-initramfs.sh >> "${ETCDIR}/rc.firstboot"
22 cat files/firstboot/23-regenerate-initramfs.sh >> "${ETC_DIR}/rc.firstboot"
23 23 fi
24 24 fi
25 25
26 26 # Ensure that dbus machine-id exists
27 cat files/firstboot/24-generate-machineid.sh >> "${ETCDIR}/rc.firstboot"
27 cat files/firstboot/24-generate-machineid.sh >> "${ETC_DIR}/rc.firstboot"
28 28
29 29 # Create /etc/resolv.conf symlink
30 cat files/firstboot/25-create-resolv-symlink.sh >> "${ETCDIR}/rc.firstboot"
30 cat files/firstboot/25-create-resolv-symlink.sh >> "${ETC_DIR}/rc.firstboot"
31 31
32 32 # Configure automatic network interface names
33 33 if [ "$ENABLE_IFNAMES" = true ] ; then
34 cat files/firstboot/26-config-ifnames.sh >> "${ETCDIR}/rc.firstboot"
34 cat files/firstboot/26-config-ifnames.sh >> "${ETC_DIR}/rc.firstboot"
35 35 fi
36 36
37 37 # Finalize rc.firstboot script
38 cat files/firstboot/99-finish.sh >> "${ETCDIR}/rc.firstboot"
39 chmod +x "${ETCDIR}/rc.firstboot"
38 cat files/firstboot/99-finish.sh >> "${ETC_DIR}/rc.firstboot"
39 chmod +x "${ETC_DIR}/rc.firstboot"
40 40
41 41 # Install default rc.local if it does not exist
42 if [ ! -f "${ETCDIR}/rc.local" ] ; then
43 install_exec files/etc/rc.local "${ETCDIR}/rc.local"
42 if [ ! -f "${ETC_DIR}/rc.local" ] ; then
43 install_exec files/etc/rc.local "${ETC_DIR}/rc.local"
44 44 fi
45 45
46 46 # Add rc.firstboot script to rc.local
47 sed -i '/exit 0/d' "${ETCDIR}/rc.local"
48 echo /etc/rc.firstboot >> "${ETCDIR}/rc.local"
49 echo exit 0 >> "${ETCDIR}/rc.local"
47 sed -i '/exit 0/d' "${ETC_DIR}/rc.local"
48 echo /etc/rc.firstboot >> "${ETC_DIR}/rc.local"
49 echo exit 0 >> "${ETC_DIR}/rc.local"
@@ -1,80 +1,80
1 1 #
2 2 # Reduce system disk usage
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 # Reduce the image size by various operations
9 9 if [ "$ENABLE_REDUCE" = true ] ; then
10 10 if [ "$REDUCE_APT" = true ] ; then
11 11 # Install dpkg configuration file
12 12 if [ "$REDUCE_DOC" = true ] || [ "$REDUCE_MAN" = true ] ; then
13 install_readonly files/dpkg/01nodoc "${ETCDIR}/dpkg/dpkg.cfg.d/01nodoc"
13 install_readonly files/dpkg/01nodoc "${ETC_DIR}/dpkg/dpkg.cfg.d/01nodoc"
14 14 fi
15 15
16 16 # Install APT configuration files
17 install_readonly files/apt/02nocache "${ETCDIR}/apt/apt.conf.d/02nocache"
18 install_readonly files/apt/03compress "${ETCDIR}/apt/apt.conf.d/03compress"
19 install_readonly files/apt/04norecommends "${ETCDIR}/apt/apt.conf.d/04norecommends"
17 install_readonly files/apt/02nocache "${ETC_DIR}/apt/apt.conf.d/02nocache"
18 install_readonly files/apt/03compress "${ETC_DIR}/apt/apt.conf.d/03compress"
19 install_readonly files/apt/04norecommends "${ETC_DIR}/apt/apt.conf.d/04norecommends"
20 20
21 21 # Remove APT cache files
22 22 rm -fr "${R}/var/cache/apt/pkgcache.bin"
23 23 rm -fr "${R}/var/cache/apt/srcpkgcache.bin"
24 24 fi
25 25
26 26 # Remove all doc files
27 27 if [ "$REDUCE_DOC" = true ] ; then
28 28 find "${R}/usr/share/doc" -depth -type f ! -name copyright | xargs rm || true
29 29 find "${R}/usr/share/doc" -empty | xargs rmdir || true
30 30 fi
31 31
32 32 # Remove all man pages and info files
33 33 if [ "$REDUCE_MAN" = true ] ; then
34 34 rm -rf "${R}/usr/share/man" "${R}/usr/share/groff" "${R}/usr/share/info" "${R}/usr/share/lintian" "${R}/usr/share/linda" "${R}/var/cache/man"
35 35 fi
36 36
37 37 # Remove all locale translation files
38 38 if [ "$REDUCE_LOCALE" = true ] ; then
39 39 find "${R}/usr/share/locale" -mindepth 1 -maxdepth 1 ! -name 'en' | xargs rm -r
40 40 fi
41 41
42 42 # Remove hwdb PCI device classes (experimental)
43 43 if [ "$REDUCE_HWDB" = true ] ; then
44 44 rm -fr "/lib/udev/hwdb.d/20-pci-*"
45 45 fi
46 46
47 47 # Replace bash shell by dash shell (experimental)
48 48 if [ "$REDUCE_BASH" = true ] ; then
49 49 echo "Yes, do as I say!" | chroot_exec apt-get purge -qq -y --force-yes bash
50 50 chroot_exec update-alternatives --install /bin/bash bash /bin/dash 100
51 51 fi
52 52
53 53 # Remove sound utils and libraries
54 54 if [ "$ENABLE_SOUND" = false ] ; then
55 55 chroot_exec apt-get -qq -y --force-yes purge alsa-utils libsamplerate0 libasound2 libasound2-data
56 56 fi
57 57
58 58 # Re-install tools for managing kernel moduless
59 59 if [ "$RELEASE" = "jessie" ] ; then
60 60 chroot_exec apt-get -qq -y --force-yes install module-init-tools
61 61 fi
62 62
63 63 # Remove GPU kernels
64 64 if [ "$ENABLE_MINGPU" = true ] ; then
65 rm -f "${BOOTDIR}/start.elf"
66 rm -f "${BOOTDIR}/fixup.dat"
67 rm -f "${BOOTDIR}/start_x.elf"
68 rm -f "${BOOTDIR}/fixup_x.dat"
65 rm -f "${BOOT_DIR}/start.elf"
66 rm -f "${BOOT_DIR}/fixup.dat"
67 rm -f "${BOOT_DIR}/start_x.elf"
68 rm -f "${BOOT_DIR}/fixup_x.dat"
69 69 fi
70 70
71 71 # Remove kernel and initrd from /boot (already in /boot/firmware)
72 72 if [ "$BUILD_KERNEL" = false ] ; then
73 73 rm -f "${R}/boot/vmlinuz-*"
74 74 rm -f "${R}/boot/initrd.img-*"
75 75 fi
76 76
77 77 # Clean APT list of repositories
78 78 rm -fr "${R}/var/lib/apt/lists/*"
79 79 chroot_exec apt-get -qq -y update
80 80 fi
@@ -1,15 +1,15
1 1 # Set device tree fdtfile
2 2 setenv dtbfile bcm2709-rpi-2-b.dtb
3 3
4 # Tell Linux that it is booting on a Raspberry Pi2
4 # Tell Linux that it is booting on a Raspberry Pi2/3
5 5 setenv machid 0x00000c42
6 6
7 7 # Save these changes to u-boot's environment
8 8 saveenv
9 9
10 10 # Load the existing Linux kernel into RAM
11 11 fatload mmc 0:1 ${kernel_addr_r} kernel7.img
12 12 fatload mmc 0:1 ${fdt_addr_r} ${dtbfile}
13 13 fatload mmc 0:1 ${ramdisk_addr_r} ${initramfs}
14 14
15 15 # Boot the kernel we have just loaded
@@ -1,3 +1,3
1 # File generated by rpi2-gen-image
1 # File generated by rpi23-gen-image
2 2 LANG=C
3 3 LC_ALL=C
@@ -1,44 +1,44
1 # This file contains utility functions used by rpi2-gen-image.sh
1 # This file contains utility functions used by rpi23-gen-image.sh
2 2
3 3 cleanup (){
4 4 set +x
5 5 set +e
6 6
7 7 # Identify and kill all processes still using files
8 8 echo "killing processes using mount point ..."
9 9 fuser -k "${R}"
10 10 sleep 3
11 11 fuser -9 -k -v "${R}"
12 12
13 13 # Clean up temporary .password file
14 14 if [ -r ".password" ] ; then
15 15 shred -zu .password
16 16 fi
17 17
18 18 # Clean up all temporary mount points
19 19 echo "removing temporary mount points ..."
20 20 umount -l "${R}/proc" 2> /dev/null
21 21 umount -l "${R}/sys" 2> /dev/null
22 22 umount -l "${R}/dev/pts" 2> /dev/null
23 23 umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null
24 24 umount "$BUILDDIR/mount" 2> /dev/null
25 25 cryptsetup close "${CRYPTFS_MAPPING}" 2> /dev/null
26 26 losetup -d "$ROOT_LOOP" 2> /dev/null
27 27 losetup -d "$FRMW_LOOP" 2> /dev/null
28 28 trap - 0 1 2 3 6
29 29 }
30 30
31 31 chroot_exec() {
32 32 # Exec command in chroot
33 33 LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot ${R} $*
34 34 }
35 35
36 36 install_readonly() {
37 37 # Install file with user read-only permissions
38 38 install -o root -g root -m 644 $*
39 39 }
40 40
41 41 install_exec() {
42 42 # Install file with root exec permissions
43 43 install -o root -g root -m 744 $*
44 44 }
@@ -1,541 +1,570
1 1 #!/bin/sh
2 2
3 3 ########################################################################
4 # rpi2-gen-image.sh 2015-2016
4 # rpi23-gen-image.sh 2015-2016
5 5 #
6 # Advanced Debian "jessie" and "stretch" bootstrap script for RPi2
6 # Advanced Debian "jessie" and "stretch" bootstrap script for RPi2/3
7 7 #
8 8 # This program is free software; you can redistribute it and/or
9 9 # modify it under the terms of the GNU General Public License
10 10 # as published by the Free Software Foundation; either version 2
11 11 # of the License, or (at your option) any later version.
12 12 #
13 13 # Copyright (C) 2015 Jan Wagner <mail@jwagner.eu>
14 14 #
15 15 # Big thanks for patches and enhancements by 10+ github contributors!
16 16 ########################################################################
17 17
18 18 # Are we running as root?
19 19 if [ "$(id -u)" -ne "0" ] ; then
20 20 echo "error: this script must be executed with root privileges!"
21 21 exit 1
22 22 fi
23 23
24 24 # Check if ./functions.sh script exists
25 25 if [ ! -r "./functions.sh" ] ; then
26 26 echo "error: './functions.sh' required script not found!"
27 27 exit 1
28 28 fi
29 29
30 30 # Load utility functions
31 31 . ./functions.sh
32 32
33 33 # Introduce settings
34 34 set -e
35 echo -n -e "\n#\n# RPi2 Bootstrap Settings\n#\n"
35 echo -n -e "\n#\n# RPi2/3 Bootstrap Settings\n#\n"
36 36 set -x
37 37
38 # Raspberry Pi model configuration
39 RPI_MODEL=${RPI_MODEL:=2}
40 RPI2_DTB_FILE=${RPI2_DTB_FILE:=bcm2709-rpi-2-b.dtb}
41 RPI2_UBOOT_CONFIG=${RPI2_UBOOT_CONFIG:=rpi_2_defconfig}
42 RPI3_DTB_FILE=${RPI3_DTB_FILE:=bcm2710-rpi-3-b.dtb}
43 RPI3_UBOOT_CONFIG=${RPI3_UBOOT_CONFIG:=rpi_3_32b_defconfig}
44
38 45 # Debian release
39 46 RELEASE=${RELEASE:=jessie}
40 47 KERNEL_ARCH=${KERNEL_ARCH:=arm}
41 48 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
42 49 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
43 50 COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2}
44 51 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
45 52 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img}
46 DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb}
47 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig}
48 53 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
49 54
50 55 # URLs
51 56 KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
52 57 FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot}
58 WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm}
53 59 COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian}
54 60 FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
55 61 UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git}
56 62
57 63 # Build directories
58 64 BASEDIR="$(pwd)/images/${RELEASE}"
59 65 BUILDDIR="${BASEDIR}/build"
60 66
61 67 # Chroot directories
62 68 R="${BUILDDIR}/chroot"
63 ETCDIR="${R}/etc"
64 LIBDIR="${R}/lib"
65 BOOTDIR="${R}/boot/firmware"
66 KERNELDIR="${R}/usr/src/linux"
69 ETC_DIR="${R}/etc"
70 LIB_DIR="${R}/lib"
71 BOOT_DIR="${R}/boot/firmware"
72 KERNEL_DIR="${R}/usr/src/linux"
73 WLAN_FIRMWARE_DIR="${R}/lib/firmware/brcm"
67 74
68 75 # Firmware directory: Blank if download from github
69 FIRMWAREDIR=${FIRMWAREDIR:=""}
70
71 # Packages for gcc/c++ inside the chroot
72 COMPILER_PACKAGES=${COMPILER_PACKAGES:="linux-compiler-gcc-4.8-arm g++ make bc"}
76 RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
73 77
74 78 # General settings
75 HOSTNAME=${HOSTNAME:=rpi2-${RELEASE}}
79 HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}}
76 80 PASSWORD=${PASSWORD:=raspberry}
77 81 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
78 82 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
79 83 EXPANDROOT=${EXPANDROOT:=true}
80 84
81 85 # Keyboard settings
82 86 XKB_MODEL=${XKB_MODEL:=""}
83 87 XKB_LAYOUT=${XKB_LAYOUT:=""}
84 88 XKB_VARIANT=${XKB_VARIANT:=""}
85 89 XKB_OPTIONS=${XKB_OPTIONS:=""}
86 90
87 91 # Network settings (DHCP)
88 92 ENABLE_DHCP=${ENABLE_DHCP:=true}
89 93
90 94 # Network settings (static)
91 95 NET_ADDRESS=${NET_ADDRESS:=""}
92 96 NET_GATEWAY=${NET_GATEWAY:=""}
93 97 NET_DNS_1=${NET_DNS_1:=""}
94 98 NET_DNS_2=${NET_DNS_2:=""}
95 99 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
96 100 NET_NTP_1=${NET_NTP_1:=""}
97 101 NET_NTP_2=${NET_NTP_2:=""}
98 102
99 103 # APT settings
100 104 APT_PROXY=${APT_PROXY:=""}
101 105 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
102 106
103 107 # Feature settings
104 108 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
105 109 ENABLE_IPV6=${ENABLE_IPV6:=true}
106 110 ENABLE_SSHD=${ENABLE_SSHD:=true}
107 111 ENABLE_NONFREE=${ENABLE_NONFREE:=false}
112 ENABLE_WIRELESS=${ENABLE_WIRELESS:=false}
108 113 ENABLE_SOUND=${ENABLE_SOUND:=true}
109 114 ENABLE_DBUS=${ENABLE_DBUS:=true}
110 115 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
111 116 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
112 117 ENABLE_XORG=${ENABLE_XORG:=false}
113 118 ENABLE_WM=${ENABLE_WM:=""}
114 119 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
115 120 ENABLE_USER=${ENABLE_USER:=true}
116 121 USER_NAME=${USER_NAME:="pi"}
117 122 ENABLE_ROOT=${ENABLE_ROOT:=false}
118 123 ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
119 124
120 125 # Advanced settings
121 126 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
122 127 ENABLE_REDUCE=${ENABLE_REDUCE:=false}
123 128 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
124 129 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
125 130 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
126 131 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
127 132 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
128 133 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
129 134 ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
130 135
131 136 # Kernel compilation settings
132 137 BUILD_KERNEL=${BUILD_KERNEL:=false}
133 138 KERNEL_REDUCE=${KERNEL_REDUCE:=false}
134 139 KERNEL_THREADS=${KERNEL_THREADS:=1}
135 140 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
136 141 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
137 142 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
138 143
139 144 # Kernel compilation from source directory settings
140 145 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
141 146 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
142 147 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
143 148 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
144 149
145 150 # Reduce disk usage settings
146 151 REDUCE_APT=${REDUCE_APT:=true}
147 152 REDUCE_DOC=${REDUCE_DOC:=true}
148 153 REDUCE_MAN=${REDUCE_MAN:=true}
149 154 REDUCE_VIM=${REDUCE_VIM:=false}
150 155 REDUCE_BASH=${REDUCE_BASH:=false}
151 156 REDUCE_HWDB=${REDUCE_HWDB:=true}
152 157 REDUCE_SSHD=${REDUCE_SSHD:=true}
153 158 REDUCE_LOCALE=${REDUCE_LOCALE:=true}
154 159
155 160 # Encrypted filesystem settings
156 161 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
157 162 CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""}
158 163 CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"}
159 164 CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"}
160 165 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
161 166
162 167 # Stop the Crypto Wars
163 168 DISABLE_FBI=${DISABLE_FBI:=false}
164 169
165 170 # Chroot scripts directory
166 171 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
167 172
168 173 # Packages required in the chroot build environment
169 174 APT_INCLUDES=${APT_INCLUDES:=""}
170 175 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils"
171 176
172 177 # Packages required for bootstrapping
173 178 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git"
174 179 MISSING_PACKAGES=""
175 180
176 181 set +x
177 182
178 # Build latest RPi2 Linux kernel if required by Debian release
179 if [ "$RELEASE" = "stretch" ] ; then
183 # Set Raspberry Pi model specific configuration
184 if [ "$RPI_MODEL" = 2 ] ; then
185 DTB_FILE=${RPI2_DTB_FILE}
186 UBOOT_CONFIG=${RPI2_UBOOT_CONFIG}
187 elif [ "$RPI_MODEL" = 3 ] ; then
188 DTB_FILE=${RPI3_DTB_FILE}
189 UBOOT_CONFIG=${RPI3_UBOOT_CONFIG}
180 190 BUILD_KERNEL=true
181 COMPILER_PACKAGES=$(echo $COMPILER_PACKAGES | sed s/-4.8-arm/-5-arm/)
191 else
192 echo "error: Raspberry Pi model ${RPI_MODEL} is not supported!"
193 exit 1
194 fi
195
196 # Check if the internal wireless interface is supported by the RPi model
197 if [ "$ENABLE_WIRELESS" = true ] && [ "$RPI_MODEL" != 3 ] ; then
198 echo "error: The selected Raspberry Pi model has no internal wireless interface"
199 exit 1
200 fi
201
202 # Set compiler packages and build RPi2/3 Linux kernel if required by Debian release
203 if [ "$RELEASE" = "jessie" ] ; then
204 COMPILER_PACKAGES="linux-compiler-gcc-4.8-arm g++ make bc"
205 elif [ "$RELEASE" = "stretch" ] ; then
206 COMPILER_PACKAGES="linux-compiler-gcc-5-arm g++ make bc"
207 BUILD_KERNEL=true
208 else
209 echo "error: Debian release ${RELEASE} is not supported!"
210 exit 1
182 211 fi
183 212
184 213 # Add packages required for kernel cross compilation
185 214 if [ "$BUILD_KERNEL" = true ] ; then
186 215 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
187 216 fi
188 217
189 218 # Add libncurses5 to enable kernel menuconfig
190 219 if [ "$KERNEL_MENUCONFIG" = true ] ; then
191 220 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses5-dev"
192 221 fi
193 222
194 223 # Stop the Crypto Wars
195 224 if [ "$DISABLE_FBI" = true ] ; then
196 225 ENABLE_CRYPTFS=true
197 226 fi
198 227
199 228 # Add cryptsetup package to enable filesystem encryption
200 229 if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
201 230 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup"
202 231 APT_INCLUDES="${APT_INCLUDES},cryptsetup"
203 232
204 233 if [ -z "$CRYPTFS_PASSWORD" ] ; then
205 234 echo "error: no password defined (CRYPTFS_PASSWORD)!"
206 235 exit 1
207 236 fi
208 237 ENABLE_INITRAMFS=true
209 238 fi
210 239
211 240 # Add initramfs generation tools
212 241 if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
213 242 APT_INCLUDES="${APT_INCLUDES},initramfs-tools"
214 243 fi
215 244
216 245 # Check if all required packages are installed on the build system
217 246 for package in $REQUIRED_PACKAGES ; do
218 247 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
219 248 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
220 249 fi
221 250 done
222 251
223 252 # Ask if missing packages should get installed right now
224 253 if [ -n "$MISSING_PACKAGES" ] ; then
225 254 echo "the following packages needed by this script are not installed:"
226 255 echo "$MISSING_PACKAGES"
227 256
228 257 echo -n "\ndo you want to install the missing packages right now? [y/n] "
229 258 read confirm
230 259 [ "$confirm" != "y" ] && exit 1
231 260 fi
232 261
233 262 # Make sure all required packages are installed
234 263 apt-get -qq -y install ${REQUIRED_PACKAGES}
235 264
236 265 # Check if ./bootstrap.d directory exists
237 266 if [ ! -d "./bootstrap.d/" ] ; then
238 267 echo "error: './bootstrap.d' required directory not found!"
239 268 exit 1
240 269 fi
241 270
242 271 # Check if ./files directory exists
243 272 if [ ! -d "./files/" ] ; then
244 273 echo "error: './files' required directory not found!"
245 274 exit 1
246 275 fi
247 276
248 277 # Check if specified KERNELSRC_DIR directory exists
249 278 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
250 279 echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!"
251 280 exit 1
252 281 fi
253 282
254 283 # Check if specified CHROOT_SCRIPTS directory exists
255 284 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
256 285 echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
257 286 exit 1
258 287 fi
259 288
260 289 # Check if specified device mapping already exists (will be used by cryptsetup)
261 290 if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then
262 291 echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding"
263 292 exit 1
264 293 fi
265 294
266 295 # Don't clobber an old build
267 296 if [ -e "$BUILDDIR" ] ; then
268 297 echo "error: directory ${BUILDDIR} already exists, not proceeding"
269 298 exit 1
270 299 fi
271 300
272 301 # Setup chroot directory
273 302 mkdir -p "${R}"
274 303
275 304 # Check if build directory has enough of free disk space >512MB
276 305 if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "524288" ] ; then
277 306 echo "error: ${BUILDDIR} not enough space left to generate the output image!"
278 307 exit 1
279 308 fi
280 309
281 310 set -x
282 311
283 312 # Call "cleanup" function on various signals and errors
284 313 trap cleanup 0 1 2 3 6
285 314
286 315 # Add required packages for the minbase installation
287 316 if [ "$ENABLE_MINBASE" = true ] ; then
288 317 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown"
289 318 fi
290 319
291 320 # Add required locales packages
292 321 if [ "$DEFLOCAL" != "en_US.UTF-8" ] ; then
293 322 APT_INCLUDES="${APT_INCLUDES},locales,keyboard-configuration,console-setup"
294 323 fi
295 324
296 325 # Add parted package, required to get partprobe utility
297 326 if [ "$EXPANDROOT" = true ] ; then
298 327 APT_INCLUDES="${APT_INCLUDES},parted"
299 328 fi
300 329
301 330 # Add dbus package, recommended if using systemd
302 331 if [ "$ENABLE_DBUS" = true ] ; then
303 332 APT_INCLUDES="${APT_INCLUDES},dbus"
304 333 fi
305 334
306 335 # Add iptables IPv4/IPv6 package
307 336 if [ "$ENABLE_IPTABLES" = true ] ; then
308 337 APT_INCLUDES="${APT_INCLUDES},iptables"
309 338 fi
310 339
311 340 # Add openssh server package
312 341 if [ "$ENABLE_SSHD" = true ] ; then
313 342 APT_INCLUDES="${APT_INCLUDES},openssh-server"
314 343 fi
315 344
316 345 # Add alsa-utils package
317 346 if [ "$ENABLE_SOUND" = true ] ; then
318 347 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
319 348 fi
320 349
321 350 # Add rng-tools package
322 351 if [ "$ENABLE_HWRANDOM" = true ] ; then
323 352 APT_INCLUDES="${APT_INCLUDES},rng-tools"
324 353 fi
325 354
326 355 # Add fbturbo video driver
327 356 if [ "$ENABLE_FBTURBO" = true ] ; then
328 357 # Enable xorg package dependencies
329 358 ENABLE_XORG=true
330 359 fi
331 360
332 361 # Add user defined window manager package
333 362 if [ -n "$ENABLE_WM" ] ; then
334 363 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
335 364
336 365 # Enable xorg package dependencies
337 366 ENABLE_XORG=true
338 367 fi
339 368
340 369 # Add xorg package
341 370 if [ "$ENABLE_XORG" = true ] ; then
342 371 APT_INCLUDES="${APT_INCLUDES},xorg"
343 372 fi
344 373
345 374 # Replace selected packages with smaller clones
346 375 if [ "$ENABLE_REDUCE" = true ] ; then
347 376 # Add levee package instead of vim-tiny
348 377 if [ "$REDUCE_VIM" = true ] ; then
349 378 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
350 379 fi
351 380
352 381 # Add dropbear package instead of openssh-server
353 382 if [ "$REDUCE_SSHD" = true ] ; then
354 383 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/openssh-server/dropbear/")"
355 384 fi
356 385 fi
357 386
358 387 # Configure kernel sources if no KERNELSRC_DIR
359 388 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
360 389 KERNELSRC_CONFIG=true
361 390 fi
362 391
363 392 # Configure reduced kernel
364 393 if [ "$KERNEL_REDUCE" = true ] ; then
365 394 KERNELSRC_CONFIG=false
366 395 fi
367 396
368 397 # Execute bootstrap scripts
369 398 for SCRIPT in bootstrap.d/*.sh; do
370 399 head -n 3 "$SCRIPT"
371 400 . "$SCRIPT"
372 401 done
373 402
374 403 ## Execute custom bootstrap scripts
375 404 if [ -d "custom.d" ] ; then
376 405 for SCRIPT in custom.d/*.sh; do
377 406 . "$SCRIPT"
378 407 done
379 408 fi
380 409
381 410 # Execute custom scripts inside the chroot
382 411 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
383 412 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
384 413 chroot_exec /bin/bash -x <<'EOF'
385 414 for SCRIPT in /chroot_scripts/* ; do
386 415 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
387 416 $SCRIPT
388 417 fi
389 418 done
390 419 EOF
391 420 rm -rf "${R}/chroot_scripts"
392 421 fi
393 422
394 423 # Remove apt-utils
395 424 if [ "$RELEASE" = "jessie" ] ; then
396 425 chroot_exec apt-get purge -qq -y --force-yes apt-utils
397 426 fi
398 427
399 428 # Generate required machine-id
400 429 MACHINE_ID=$(dbus-uuidgen)
401 430 echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id"
402 echo -n "${MACHINE_ID}" > "${ETCDIR}/machine-id"
431 echo -n "${MACHINE_ID}" > "${ETC_DIR}/machine-id"
403 432
404 433 # APT Cleanup
405 434 chroot_exec apt-get -y clean
406 435 chroot_exec apt-get -y autoclean
407 436 chroot_exec apt-get -y autoremove
408 437
409 438 # Unmount mounted filesystems
410 439 umount -l "${R}/proc"
411 440 umount -l "${R}/sys"
412 441
413 442 # Clean up directories
414 443 rm -rf "${R}/run/*"
415 444 rm -rf "${R}/tmp/*"
416 445
417 446 # Clean up files
418 rm -f "${ETCDIR}/ssh/ssh_host_*"
419 rm -f "${ETCDIR}/dropbear/dropbear_*"
420 rm -f "${ETCDIR}/apt/sources.list.save"
421 rm -f "${ETCDIR}/resolvconf/resolv.conf.d/original"
422 rm -f "${ETCDIR}/*-"
423 rm -f "${ETCDIR}/apt/apt.conf.d/10proxy"
424 rm -f "${ETCDIR}/resolv.conf"
447 rm -f "${ETC_DIR}/ssh/ssh_host_*"
448 rm -f "${ETC_DIR}/dropbear/dropbear_*"
449 rm -f "${ETC_DIR}/apt/sources.list.save"
450 rm -f "${ETC_DIR}/resolvconf/resolv.conf.d/original"
451 rm -f "${ETC_DIR}/*-"
452 rm -f "${ETC_DIR}/apt/apt.conf.d/10proxy"
453 rm -f "${ETC_DIR}/resolv.conf"
425 454 rm -f "${R}/root/.bash_history"
426 455 rm -f "${R}/var/lib/urandom/random-seed"
427 456 rm -f "${R}/initrd.img"
428 457 rm -f "${R}/vmlinuz"
429 458 rm -f "${R}${QEMU_BINARY}"
430 459
431 460 # Calculate size of the chroot directory in KB
432 461 CHROOT_SIZE=$(expr `du -s "${R}" | awk '{ print $1 }'`)
433 462
434 463 # Calculate the amount of needed 512 Byte sectors
435 464 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
436 465 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
437 466 ROOT_OFFSET=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS})
438 467
439 468 # The root partition is EXT4
440 469 # This means more space than the actual used space of the chroot is used.
441 470 # As overhead for journaling and reserved blocks 25% are added.
442 471 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 25) \* 1024 \/ 512)
443 472
444 473 # Calculate required image size in 512 Byte sectors
445 474 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
446 475
447 476 # Prepare date string for image file name
448 477 DATE="$(date +%Y-%m-%d)"
449 478
450 479 # Prepare image file
451 480 if [ "$ENABLE_SPLITFS" = true ] ; then
452 481 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=${TABLE_SECTORS}
453 482 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
454 483 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=${TABLE_SECTORS}
455 484 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
456 485
457 486 # Write firmware/boot partition tables
458 487 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" 2> /dev/null <<EOM
459 488 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
460 489 EOM
461 490
462 491 # Write root partition table
463 492 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}-root.img" 2> /dev/null <<EOM
464 493 ${TABLE_SECTORS},${ROOT_SECTORS},83
465 494 EOM
466 495
467 496 # Setup temporary loop devices
468 497 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-frmw.img)"
469 498 ROOT_LOOP="$(losetup -o 1M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-root.img)"
470 499 else # ENABLE_SPLITFS=false
471 500 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
472 501 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
473 502
474 503 # Write partition table
475 504 sfdisk -q -L -uS -f "$BASEDIR/${DATE}-debian-${RELEASE}.img" 2> /dev/null <<EOM
476 505 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
477 506 ${ROOT_OFFSET},${ROOT_SECTORS},83
478 507 EOM
479 508
480 509 # Setup temporary loop devices
481 510 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
482 511 ROOT_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
483 512 fi
484 513
485 514 if [ "$ENABLE_CRYPTFS" = true ] ; then
486 515 # Create dummy ext4 fs
487 516 mkfs.ext4 "$ROOT_LOOP"
488 517
489 518 # Setup password keyfile
490 519 echo -n ${CRYPTFS_PASSWORD} > .password
491 520 chmod 600 .password
492 521
493 522 # Initialize encrypted partition
494 523 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
495 524
496 525 # Open encrypted partition and setup mapping
497 526 cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}"
498 527
499 528 # Secure delete password keyfile
500 529 shred -zu .password
501 530
502 531 # Update temporary loop device
503 532 ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}"
504 533
505 534 # Wipe encrypted partition (encryption cipher is used for randomness)
506 535 dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count=$(blockdev --getsz "${ROOT_LOOP}")
507 536 fi
508 537
509 538 # Build filesystems
510 539 mkfs.vfat "$FRMW_LOOP"
511 540 mkfs.ext4 "$ROOT_LOOP"
512 541
513 542 # Mount the temporary loop devices
514 543 mkdir -p "$BUILDDIR/mount"
515 544 mount "$ROOT_LOOP" "$BUILDDIR/mount"
516 545
517 546 mkdir -p "$BUILDDIR/mount/boot/firmware"
518 547 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
519 548
520 549 # Copy all files from the chroot to the loop device mount point directory
521 550 rsync -a "${R}/" "$BUILDDIR/mount/"
522 551
523 552 # Unmount all temporary loop devices and mount points
524 553 cleanup
525 554
526 555 # Create block map file(s) of image(s)
527 556 if [ "$ENABLE_SPLITFS" = true ] ; then
528 557 # Create block map files for "bmaptool"
529 558 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img"
530 559 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-root.img"
531 560
532 561 # Image was successfully created
533 562 echo "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
534 563 echo "$BASEDIR/${DATE}-debian-${RELEASE}-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
535 564 else
536 565 # Create block map file for "bmaptool"
537 566 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}.img"
538 567
539 568 # Image was successfully created
540 569 echo "$BASEDIR/${DATE}-debian-${RELEASE}.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
541 570 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant