##// END OF EJS Templates
-using --verbose and debug while creating cryptfs to give a hint by default...
Unknown -
r696:2f2cf24844e7 pull
parent child
Show More
@@ -1,551 +1,572
1 # rpi23-gen-image
1 # rpi23-gen-image
2 ## Introduction
2 ## Introduction
3 `rpi23-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for all Raspberry Pi computers. The script at this time supports the bootstrapping of the Debian (armhf/armel) releases `stretch` and `buster`. Raspberry Pi 0/1/2/3 images are generated for 32-bit mode only. Raspberry Pi 3 supports 64-bit images that can be generated using custom configuration parameters (```templates/rpi3-stretch-arm64-4.14.y```).
3 `rpi23-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for all Raspberry Pi computers. The script at this time supports the bootstrapping of the Debian (armhf/armel) releases `stretch` and `buster`. Raspberry Pi 0/1/2/3/4 images are generated for 32-bit mode only. Raspberry Pi 3 supports 64-bit images that can be generated using custom configuration parameters (```templates/rpi3-stretch-arm64-4.14.y```).
4
4
5 ## Build dependencies
5 ## Build dependencies
6 The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user.
6 The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user.
7
7
8 ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo```
8 ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo```
9
9
10 It is recommended to configure the `rpi23-gen-image.sh` script to build and install the latest Raspberry Pi Linux kernel. For the Raspberry 3 this is mandatory. Kernel compilation and linking will be performed on the build system using an ARM (armhf/armel) cross-compiler toolchain.
10 It is recommended to configure the `rpi23-gen-image.sh` script to build and install the latest Raspberry Pi Linux kernel. For the Raspberry 3 this is mandatory. Kernel compilation and linking will be performed on the build system using an ARM (armhf/armel/aarch64) cross-compiler toolchain.
11
11
12 The script has been tested using the default `crossbuild-essential-armhf` and `crossbuild-essential-armel` toolchain meta packages on Debian Linux `stretch` build systems. Please check the [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains) for further information.
12 The script has been tested using the default `crossbuild-essential-armhf` and `crossbuild-essential-armel` toolchain meta packages on Debian Linux `stretch` build systems. Please check the [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains) for further information.
13
13
14 ## Command-line parameters
14 ## Command-line parameters
15 The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi23-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi23-gen-image.sh` script.
15 The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi23-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi23-gen-image.sh` script.
16
16
17 ##### Command-line examples:
17 ##### Command-line examples:
18 ```shell
18 ```shell
19 ENABLE_UBOOT=true ./rpi23-gen-image.sh
19 ENABLE_UBOOT=true ./rpi23-gen-image.sh
20 ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi23-gen-image.sh
20 ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi23-gen-image.sh
21 ENABLE_WM=xfce4 ENABLE_FBTURBO=true ENABLE_MINBASE=true ./rpi23-gen-image.sh
21 ENABLE_WM=xfce4 ENABLE_FBTURBO=true ENABLE_MINBASE=true ./rpi23-gen-image.sh
22 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi23-gen-image.sh
22 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi23-gen-image.sh
23 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi23-gen-image.sh
23 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi23-gen-image.sh
24 ENABLE_MINBASE=true ./rpi23-gen-image.sh
24 ENABLE_MINBASE=true ./rpi23-gen-image.sh
25 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi23-gen-image.sh
25 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi23-gen-image.sh
26 BUILD_KERNEL=true KERNELSRC_DIR=/tmp/linux ./rpi23-gen-image.sh
26 BUILD_KERNEL=true KERNELSRC_DIR=/tmp/linux ./rpi23-gen-image.sh
27 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi23-gen-image.sh
27 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi23-gen-image.sh
28 ENABLE_CRYPTFS=true CRYPTFS_PASSWORD=changeme EXPANDROOT=false ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi23-gen-image.sh
28 ENABLE_CRYPTFS=true CRYPTFS_PASSWORD=changeme EXPANDROOT=false ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi23-gen-image.sh
29 RELEASE=stretch BUILD_KERNEL=true ./rpi23-gen-image.sh
29 RELEASE=stretch BUILD_KERNEL=true ./rpi23-gen-image.sh
30 RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNEL=true ./rpi23-gen-image.sh
30 RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNEL=true ./rpi23-gen-image.sh
31 RELEASE=stretch RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNEL=true ./rpi23-gen-image.sh
31 RELEASE=stretch RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNEL=true ./rpi23-gen-image.sh
32 ```
32 ```
33
33
34 ## Configuration template files
34 ## Configuration template files
35 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.
35 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.
36
36
37 ##### Command-line examples:
37 ##### Command-line examples:
38 ```shell
38 ```shell
39 CONFIG_TEMPLATE=rpi3stretch ./rpi23-gen-image.sh
39 CONFIG_TEMPLATE=rpi3stretch ./rpi23-gen-image.sh
40 CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh
40 CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh
41 ```
41 ```
42
42
43 ## Supported parameters and settings
43 ## Supported parameters and settings
44 #### APT settings:
44 #### APT settings:
45 ##### `APT_SERVER`="ftp.debian.org"
45 ##### `APT_SERVER`="ftp.debian.org"
46 Set Debian packages server address. Choose a server from the list of Debian worldwide [mirror sites](https://www.debian.org/mirror/list). Using a nearby server will probably speed-up all required downloads within the bootstrapping process.
46 Set Debian packages server address. Choose a server from the list of Debian worldwide [mirror sites](https://www.debian.org/mirror/list). Using a nearby server will probably speed-up all required downloads within the bootstrapping process.
47
47
48 ##### `APT_PROXY`=""
48 ##### `APT_PROXY`=""
49 Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will speed-up the bootstrapping process because all required Debian packages will only be downloaded from the Debian mirror site once. If `apt-cacher-ng` is running on default `http://127.0.0.1:3142` it is autodetected and you don't need to set this.
49 Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will speed-up the bootstrapping process because all required Debian packages will only be downloaded from the Debian mirror site once. If `apt-cacher-ng` is running on default `http://127.0.0.1:3142` it is autodetected and you don't need to set this.
50
50
51 ##### `KEEP_APT_PROXY`=false
51 ##### `KEEP_APT_PROXY`=false
52 Keep the APT_PROXY settings used in the bootsrapping process in the generated image.
52 Keep the APT_PROXY settings used in the bootsrapping process in the generated image.
53
53
54 ##### `APT_INCLUDES`=""
54 ##### `APT_INCLUDES`=""
55 A comma-separated list of additional packages to be installed by debootstrap during bootstrapping.
55 A comma-separated list of additional packages to be installed by debootstrap during bootstrapping.
56
56
57 ##### `APT_INCLUDES_LATE`=""
57 ##### `APT_INCLUDES_LATE`=""
58 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.
58 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.
59
59
60 ---
60 ---
61
61
62 #### General system settings:
62 #### General system settings:
63 ##### `SET_ARCH`=32
63 ##### `SET_ARCH`=32
64 Set Architecture to default 32bit. If you want to compile 64-bit (RPI3 or RPI3+) set it to `64`. This option will set every needed cross-compiler or board specific option for a successful build.
64 Set Architecture to default 32bit. If you want to compile 64-bit (RPI3/RPI3+/RPI4) set it to `64`. This option will set every needed cross-compiler or board specific option for a successful build.
65
65
66 ##### `RPI_MODEL`=2
66 ##### `RPI_MODEL`=2
67 Specify the target Raspberry Pi hardware model. The script at this time supports the following Raspberry Pi models:
67 Specify the target Raspberry Pi hardware model. The script at this time supports the following Raspberry Pi models:
68 - `0` = Raspberry Pi 0 and Raspberry Pi 0 W
68 - `0` = Raspberry Pi 0 and Raspberry Pi 0 W
69 - `1` = Raspberry Pi 1 model A and B
69 - `1` = Raspberry Pi 1 model A and B
70 - `1P` = Raspberry Pi 1 model B+ and A+
70 - `1P` = Raspberry Pi 1 model B+ and A+
71 - `2` = Raspberry Pi 2 model B
71 - `2` = Raspberry Pi 2 model B
72 - `3` = Raspberry Pi 3 model B
72 - `3` = Raspberry Pi 3 model B
73 - `3P` = Raspberry Pi 3 model B+
73 - `3P` = Raspberry Pi 3 model B+
74 - `4` = Raspberry Pi 4 model B
74
75
75 ##### `RELEASE`="buster"
76 ##### `RELEASE`="buster"
76 Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases `stretch` and `buster`.
77 Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases `stretch` and `buster`.
77
78
78 ##### `RELEASE_ARCH`="armhf"
79 ##### `RELEASE_ARCH`="armhf"
79 Set the desired Debian release architecture.
80 Set the desired Debian release architecture.
80
81
81 ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE"
82 ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE"
82 Set system hostname. It's recommended that the hostname is unique in the corresponding subnet.
83 Set system hostname. It's recommended that the hostname is unique in the corresponding subnet.
83
84
84 ##### `PASSWORD`="raspberry"
85 ##### `PASSWORD`="raspberry"
85 Set system `root` password. It's **STRONGLY** recommended that you choose a custom password.
86 Set system `root` password. It's **STRONGLY** recommended that you choose a custom password.
86
87
87 ##### `USER_PASSWORD`="raspberry"
88 ##### `USER_PASSWORD`="raspberry"
88 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.
89 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.
89
90
90 ##### `DEFLOCAL`="en_US.UTF-8"
91 ##### `DEFLOCAL`="en_US.UTF-8"
91 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`.
92 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`.
92
93
93 ##### `TIMEZONE`="Europe/Berlin"
94 ##### `TIMEZONE`="Europe/Berlin"
94 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.
95 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.
95
96
96 ##### `EXPANDROOT`=true
97 ##### `EXPANDROOT`=true
97 Expand the root partition and filesystem automatically on first boot.
98 Expand the root partition and filesystem automatically on first boot.
98
99
99 ##### `ENABLE_DPHYSSWAP`=true
100 ##### `ENABLE_DPHYSSWAP`=true
100 Enable swap. The size of the swapfile is chosen relative to the size of the root partition. It'll use the `dphys-swapfile` package for that.
101 Enable swap. The size of the swapfile is chosen relative to the size of the root partition. It'll use the `dphys-swapfile` package for that.
101
102
102 ##### `ENABLE_QEMU`=false
103 ##### `ENABLE_QEMU`=false
103 Generate kernel (`vexpress_defconfig`), file system image (`qcow2`) and DTB files that can be used for QEMU full system emulation (`vexpress-A15`). The output files are stored in the `$(pwd)/images/qemu` directory. You can find more information about running the generated image in the QEMU section of this readme file.
104 Generate kernel (`vexpress_defconfig`), file system image (`qcow2`) and DTB files that can be used for QEMU full system emulation (`vexpress-A15`). The output files are stored in the `$(pwd)/images/qemu` directory. You can find more information about running the generated image in the QEMU section of this readme file.
104
105
105 ---
106 ---
106
107
107 #### Keyboard settings:
108 #### Keyboard settings:
108 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.
109 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.
109
110
110 ##### `XKB_MODEL`=""
111 ##### `XKB_MODEL`=""
111 Set the name of the model of your keyboard type.
112 Set the name of the model of your keyboard type.
112
113
113 ##### `XKB_LAYOUT`=""
114 ##### `XKB_LAYOUT`=""
114 Set the supported keyboard layout(s).
115 Set the supported keyboard layout(s).
115
116
116 ##### `XKB_VARIANT`=""
117 ##### `XKB_VARIANT`=""
117 Set the supported variant(s) of the keyboard layout(s).
118 Set the supported variant(s) of the keyboard layout(s).
118
119
119 ##### `XKB_OPTIONS`=""
120 ##### `XKB_OPTIONS`=""
120 Set extra xkb configuration options.
121 Set extra xkb configuration options.
121
122
122 ---
123 ---
123
124
124 #### Networking settings (DHCP):
125 #### Networking settings (DHCP):
125 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`.`
126 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`.`
126
127
127 ##### `ENABLE_DHCP`=true
128 ##### `ENABLE_DHCP`=true
128 Set the system to use DHCP. This requires an DHCP server.
129 Set the system to use DHCP. This requires an DHCP server.
129
130
130 ---
131 ---
131
132
132 #### Networking settings (static):
133 #### Networking settings (static):
133 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`.
134 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`.
134
135
135 ##### `NET_ADDRESS`=""
136 ##### `NET_ADDRESS`=""
136 Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24".
137 Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24".
137
138
138 ##### `NET_GATEWAY`=""
139 ##### `NET_GATEWAY`=""
139 Set the IP address for the default gateway.
140 Set the IP address for the default gateway.
140
141
141 ##### `NET_DNS_1`=""
142 ##### `NET_DNS_1`=""
142 Set the IP address for the first DNS server.
143 Set the IP address for the first DNS server.
143
144
144 ##### `NET_DNS_2`=""
145 ##### `NET_DNS_2`=""
145 Set the IP address for the second DNS server.
146 Set the IP address for the second DNS server.
146
147
147 ##### `NET_DNS_DOMAINS`=""
148 ##### `NET_DNS_DOMAINS`=""
148 Set the default DNS search domains to use for non fully qualified hostnames.
149 Set the default DNS search domains to use for non fully qualified hostnames.
149
150
150 ##### `NET_NTP_1`=""
151 ##### `NET_NTP_1`=""
151 Set the IP address for the first NTP server.
152 Set the IP address for the first NTP server.
152
153
153 ##### `NET_NTP_2`=""
154 ##### `NET_NTP_2`=""
154 Set the IP address for the second NTP server.
155 Set the IP address for the second NTP server.
155
156
156 ---
157 ---
157
158
158 #### Basic system features:
159 #### Basic system features:
159 ##### `ENABLE_CONSOLE`=true
160 ##### `ENABLE_CONSOLE`=true
160 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. On RPI `0` `3` `3P` the CPU speed is locked at lowest speed.
161 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. On RPI `0` `3` `3P` the CPU speed is locked at lowest speed.
161
162
162 ##### `ENABLE_PRINTK`=false
163 ##### `ENABLE_PRINTK`=false
163 Enables printing kernel messages to konsole. printk is `3 4 1 3` as in raspbian.
164 Enables printing kernel messages to konsole. printk is `3 4 1 3` as in raspbian.
164
165
165 ##### `ENABLE_BLUETOOTH`=false
166 ##### `ENABLE_BLUETOOTH`=false
166 Enable onboard Bluetooth interface on the RPi0/3/3P. See: [Configuring the GPIO serial port on Raspbian jessie and stretch](https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/).
167 Enable onboard Bluetooth interface on the RPi0/3/3P. See: [Configuring the GPIO serial port on Raspbian jessie and stretch](https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/).
167
168
168 ##### `ENABLE_MINIUART_OVERLAY`=false
169 ##### `ENABLE_MINIUART_OVERLAY`=false
169 Enable Bluetooth to use this. Adds overlay to swap UART0 with UART1. Enabling (slower) Bluetooth and full speed serial console. - RPI `0` `3` `3P` have a fast `hardware UART0` (ttyAMA0) and a `mini UART1` (ttyS0)! RPI `1` `1P` `2` only have a `hardware UART0`. `UART0` is considered better, because is faster and more stable than `mini UART1`. By default the Bluetooth modem is mapped to the `hardware UART0` and `mini UART` is used for console. The `mini UART` is a problem for the serial console, because its baudrate depends on the CPU frequency, which is changing on runtime. Resulting in a volatile baudrate and thus in an unusable serial console.
170 Enable Bluetooth to use this. Adds overlay to swap UART0 with UART1. Enabling (slower) Bluetooth and full speed serial console. - RPI `0` `3` `3P` have a fast `hardware UART0` (ttyAMA0) and a `mini UART1` (ttyS0)! RPI `1` `1P` `2` only have a `hardware UART0`. `UART0` is considered better, because is faster and more stable than `mini UART1`. By default the Bluetooth modem is mapped to the `hardware UART0` and `mini UART` is used for console. The `mini UART` is a problem for the serial console, because its baudrate depends on the CPU frequency, which is changing on runtime. Resulting in a volatile baudrate and thus in an unusable serial console.
170
171
171 ##### `ENABLE_TURBO`=false
172 ##### `ENABLE_TURBO`=false
172 Enable Turbo mode. This setting locks cpu at the highest frequency. As setting ENABLE_CONSOLE=true locks RPI to lowest CPU speed, this is can be used additionally to lock cpu hat max speed. Need a good power supply and probably cooling for the Raspberry PI.
173 Enable Turbo mode. This setting locks cpu at the highest frequency. As setting ENABLE_CONSOLE=true locks RPI to lowest CPU speed, this is can be used additionally to lock cpu hat max speed. Need a good power supply and probably cooling for the Raspberry PI.
173
174
174 ##### `ENABLE_I2C`=false
175 ##### `ENABLE_I2C`=false
175 Enable I2C interface on the RPi 0/1/2/3. Please check the [RPi 0/1/2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
176 Enable I2C interface on the RPi 0/1/2/3. Please check the [RPi 0/1/2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
176
177
177 ##### `ENABLE_SPI`=false
178 ##### `ENABLE_SPI`=false
178 Enable SPI interface on the RPi 0/1/2/3. Please check the [RPi 0/1/2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
179 Enable SPI interface on the RPi 0/1/2/3. Please check the [RPi 0/1/2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
179
180
180 ##### `ENABLE_IPV6`=true
181 ##### `ENABLE_IPV6`=true
181 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
182 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
182
183
183 ##### `ENABLE_SSHD`=true
184 ##### `ENABLE_SSHD`=true
184 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.
185 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.
185
186
186 ##### `ENABLE_NONFREE`=false
187 ##### `ENABLE_NONFREE`=false
187 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.
188 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.
188
189
189 ##### `ENABLE_WIRELESS`=false
190 ##### `ENABLE_WIRELESS`=false
190 Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/raw/master/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`.
191 Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/raw/master/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`.
191
192
192 ##### `ENABLE_RSYSLOG`=true
193 ##### `ENABLE_RSYSLOG`=true
193 If set to false, disable and uninstall rsyslog (so logs will be available only in journal files)
194 If set to false, disable and uninstall rsyslog (so logs will be available only in journal files)
194
195
195 ##### `ENABLE_SOUND`=true
196 ##### `ENABLE_SOUND`=true
196 Enable sound hardware and install Advanced Linux Sound Architecture.
197 Enable sound hardware and install Advanced Linux Sound Architecture.
197
198
198 ##### `ENABLE_HWRANDOM`=true
199 ##### `ENABLE_HWRANDOM`=true
199 Enable Hardware Random Number Generator. Strong random numbers are important for most network-based communications that use encryption. It's recommended to be enabled.
200 Enable Hardware Random Number Generator. Strong random numbers are important for most network-based communications that use encryption. It's recommended to be enabled.
200
201
201 ##### `ENABLE_MINGPU`=false
202 ##### `ENABLE_MINGPU`=false
202 Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU.
203 Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU.
203
204
204 ##### `ENABLE_DBUS`=true
205 ##### `ENABLE_DBUS`=true
205 Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled.
206 Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled.
206
207
207 ##### `ENABLE_XORG`=false
208 ##### `ENABLE_XORG`=false
208 Install Xorg open-source X Window System.
209 Install Xorg open-source X Window System.
209
210
210 ##### `ENABLE_WM`=""
211 ##### `ENABLE_WM`=""
211 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`.
212 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`.
212
213
213 ##### `ENABLE_SYSVINIT`=false
214 ##### `ENABLE_SYSVINIT`=false
214 Support for halt,init,poweroff,reboot,runlevel,shutdown,telinit commands
215 Support for halt,init,poweroff,reboot,runlevel,shutdown,telinit commands
215
216
216 ---
217 ---
217
218
218 #### Advanced system features:
219 #### Advanced system features:
219 ##### `ENABLE_KEYGEN`=false
220 ##### `ENABLE_KEYGEN`=false
220 Recover your lost codec license
221 Recover your lost codec license
221
222
222 ##### `ENABLE_SYSTEMDSWAP`=false
223 ##### `ENABLE_SYSTEMDSWAP`=false
223 Enables [Systemd-swap service](https://github.com/Nefelim4ag/systemd-swap). Usefull if `KERNEL_ZSWAP` is enabled.
224 Enables [Systemd-swap service](https://github.com/Nefelim4ag/systemd-swap). Usefull if `KERNEL_ZSWAP` is enabled.
224
225
225 ##### `ENABLE_MINBASE`=false
226 ##### `ENABLE_MINBASE`=false
226 Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB.
227 Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB.
227
228
228 ##### `ENABLE_REDUCE`=false
229 ##### `ENABLE_REDUCE`=false
229 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
230 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
230
231
231 ##### `ENABLE_UBOOT`=false
232 ##### `ENABLE_UBOOT`=false
232 Replace the default RPi 0/1/2/3 second stage bootloader (bootcode.bin) with [U-Boot bootloader](https://git.denx.de/?p=u-boot.git;a=summary). U-Boot can boot images via the network using the BOOTP/TFTP protocol.
233 Replace the default RPi 0/1/2/3 second stage bootloader (bootcode.bin) with [U-Boot bootloader](https://git.denx.de/?p=u-boot.git;a=summary). U-Boot can boot images via the network using the BOOTP/TFTP protocol.
234 RPI4 needs tbd
233
235
234 ##### `UBOOTSRC_DIR`=""
236 ##### `UBOOTSRC_DIR`=""
235 Path to a directory (`u-boot`) of [U-Boot bootloader sources](https://git.denx.de/?p=u-boot.git;a=summary) that will be copied, configured, build and installed inside the chroot.
237 Path to a directory (`u-boot`) of [U-Boot bootloader sources](https://git.denx.de/?p=u-boot.git;a=summary) that will be copied, configured, build and installed inside the chroot.
236
238
237 ##### `ENABLE_FBTURBO`=false
239 ##### `ENABLE_FBTURBO`=false
238 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.
240 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.
239
241
240 ##### `FBTURBOSRC_DIR`=""
242 ##### `FBTURBOSRC_DIR`=""
241 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.
243 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.
242
244
243 ##### `ENABLE_VIDEOCORE`=false
245 ##### `ENABLE_VIDEOCORE`=false
244 Install and enable the [ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) `vcgencmd`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling.
246 Install and enable the [ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) `vcgencmd`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling.
245
247
246 ##### `VIDEOCORESRC_DIR`=""
248 ##### `VIDEOCORESRC_DIR`=""
247 Path to a directory (`userland`) of [ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot.
249 Path to a directory (`userland`) of [ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot.
248
250
249 ##### `ENABLE_NEXMON`=false
251 ##### `ENABLE_NEXMON`=false
250 Install and enable the [Source code for a C-based firmware patching framework for Broadcom/Cypress WiFi chips that enables you to write your own firmware patches, for example, to enable monitor mode with radiotap headers and frame injection](https://github.com/seemoo-lab/nexmon.git).
252 Install and enable the [Source code for a C-based firmware patching framework for Broadcom/Cypress WiFi chips that enables you to write your own firmware patches, for example, to enable monitor mode with radiotap headers and frame injection](https://github.com/seemoo-lab/nexmon.git).
251
253
252 ##### `NEXMONSRC_DIR`=""
254 ##### `NEXMONSRC_DIR`=""
253 Path to a directory (`nexmon`) of [Source code for ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot.
255 Path to a directory (`nexmon`) of [Source code for ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot.
254
256
255 ##### `ENABLE_IPTABLES`=false
257 ##### `ENABLE_IPTABLES`=false
256 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
258 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
257
259
258 ##### `ENABLE_USER`=true
260 ##### `ENABLE_USER`=true
259 Create non-root user with password `USER_PASSWORD`=raspberry. Unless overridden with `USER_NAME`=user, the username will be `pi`.
261 Create non-root user with password `USER_PASSWORD`=raspberry. Unless overridden with `USER_NAME`=user, the username will be `pi`.
260
262
261 ##### `USER_NAME`=pi
263 ##### `USER_NAME`=pi
262 Non-root user to create. Ignored if `ENABLE_USER`=false
264 Non-root user to create. Ignored if `ENABLE_USER`=false
263
265
264 ##### `ENABLE_ROOT`=false
266 ##### `ENABLE_ROOT`=false
265 Set root user password so root login will be enabled
267 Set root user password so root login will be enabled
266
268
267 ##### `ENABLE_HARDNET`=false
269 ##### `ENABLE_HARDNET`=false
268 Enable IPv4/IPv6 network stack hardening settings.
270 Enable IPv4/IPv6 network stack hardening settings.
269
271
270 ##### `ENABLE_SPLITFS`=false
272 ##### `ENABLE_SPLITFS`=false
271 Enable having root partition on an USB drive by creating two image files: one for the `/boot/firmware` mount point, and another for `/`.
273 Enable having root partition on an USB drive by creating two image files: one for the `/boot/firmware` mount point, and another for `/`.
272
274
273 ##### `CHROOT_SCRIPTS`=""
275 ##### `CHROOT_SCRIPTS`=""
274 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.
276 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.
275
277
276 ##### `ENABLE_INITRAMFS`=false
278 ##### `ENABLE_INITRAMFS`=false
277 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.
279 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.
278
280
279 ##### `ENABLE_IFNAMES`=true
281 ##### `ENABLE_IFNAMES`=true
280 Enable automatic assignment of predictable, stable network interface names for all local Ethernet, WLAN interfaces. This might create complex and long interface names.
282 Enable automatic assignment of predictable, stable network interface names for all local Ethernet, WLAN interfaces. This might create complex and long interface names.
281
283
282 ##### `ENABLE_SPLASH`=true
284 ##### `ENABLE_SPLASH`=true
283 Enable default Raspberry Pi boot up rainbow splash screen.
285 Enable default Raspberry Pi boot up rainbow splash screen.
284
286
285 ##### `ENABLE_LOGO`=true
287 ##### `ENABLE_LOGO`=true
286 Enable default Raspberry Pi console logo (image of four raspberries in the top left corner).
288 Enable default Raspberry Pi console logo (image of four raspberries in the top left corner).
287
289
288 ##### `ENABLE_SILENT_BOOT`=false
290 ##### `ENABLE_SILENT_BOOT`=false
289 Set the verbosity of console messages shown during boot up to a strict minimum.
291 Set the verbosity of console messages shown during boot up to a strict minimum.
290
292
291 ##### `DISABLE_UNDERVOLT_WARNINGS`=
293 ##### `DISABLE_UNDERVOLT_WARNINGS`=
292 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.
294 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.
293
295
294 ---
296 ---
295
297
296 #### SSH settings:
298 #### SSH settings:
297 ##### `SSH_ENABLE_ROOT`=false
299 ##### `SSH_ENABLE_ROOT`=false
298 Enable password-based root login via SSH. This may be a security risk with the default password set, use only in trusted environments. `ENABLE_ROOT` must be set to `true`.
300 Enable password-based root login via SSH. This may be a security risk with the default password set, use only in trusted environments. `ENABLE_ROOT` must be set to `true`.
299
301
300 ##### `SSH_DISABLE_PASSWORD_AUTH`=false
302 ##### `SSH_DISABLE_PASSWORD_AUTH`=false
301 Disable password-based SSH authentication. Only public key based SSH (v2) authentication will be supported.
303 Disable password-based SSH authentication. Only public key based SSH (v2) authentication will be supported.
302
304
303 ##### `SSH_LIMIT_USERS`=false
305 ##### `SSH_LIMIT_USERS`=false
304 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).
306 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).
305
307
306 ##### `SSH_ROOT_PUB_KEY`=""
308 ##### `SSH_ROOT_PUB_KEY`=""
307 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`.
309 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`.
308
310
309 ##### `SSH_USER_PUB_KEY`=""
311 ##### `SSH_USER_PUB_KEY`=""
310 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.
312 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.
311
313
312 ---
314 ---
313
315
314 #### Kernel compilation:
316 #### Kernel compilation:
315 ##### `BUILD_KERNEL`=true
317 ##### `BUILD_KERNEL`=true
316 Build and install the latest RPi 0/1/2/3 Linux kernel. Currently only the default RPi 0/1/2/3 kernel configuration is used.
318 Build and install the latest RPi 0/1/2/3/4 Linux kernel. The default RPi 0/1/2/3/ kernel configuration is used most of the time.
319 ENABLE_NEXMON - Changes Kernel Source to [https://github.com/Re4son/](Kali Linux Kernel)
320 Precompiled 32bit kernel for RPI0/1/2/3 by [https://github.com/hypriot/](hypriot)
321 Precompiled 64bit kernel for RPI3/4 by [https://github.com/sakaki-/](sakaki)
322
317
323
318 ##### `CROSS_COMPILE`="arm-linux-gnueabihf-"
324 ##### `CROSS_COMPILE`="arm-linux-gnueabihf-"
319 This sets the cross-compile environment for the compiler.
325 This sets the cross-compile environment for the compiler.
320
326
321 ##### `KERNEL_ARCH`="arm"
327 ##### `KERNEL_ARCH`="arm"
322 This sets the kernel architecture for the compiler.
328 This sets the kernel architecture for the compiler.
323
329
324 ##### `KERNEL_IMAGE`="kernel7.img"
330 ##### `KERNEL_IMAGE`="kernel7.img"
325 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.
331 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.
326
332
327 ##### `KERNEL_BRANCH`=""
333 ##### `KERNEL_BRANCH`=""
328 Name of the requested branch from the GIT location for the RPi Kernel. Default is using the current default branch from the GIT site.
334 Name of the requested branch from the GIT location for the RPi Kernel. Default is using the current default branch from the GIT site.
329
335
330 ##### `QEMU_BINARY`="/usr/bin/qemu-arm-static"
336 ##### `QEMU_BINARY`="/usr/bin/qemu-arm-static"
331 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.
337 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.
332
338
333 ##### `KERNEL_DEFCONFIG`="bcm2709_defconfig"
339 ##### `KERNEL_DEFCONFIG`="bcm2709_defconfig"
334 Sets the default config for kernel compiling. If not set, `KERNEL_DEFCONFIG` will be set to "bcmrpi3\_defconfig" automatically if building for arm64.
340 Sets the default config for kernel compiling. If not set, `KERNEL_DEFCONFIG` will be set to "bcmrpi3\_defconfig" automatically if building for arm64.
335
341
336 ##### `KERNEL_REDUCE`=false
342 ##### `KERNEL_REDUCE`=false
337 Reduce the size of the generated kernel by removing unwanted devices, network and filesystem drivers (experimental).
343 Reduce the size of the generated kernel by removing unwanted devices, network and filesystem drivers (experimental).
338
344
339 ##### `KERNEL_THREADS`=1
345 ##### `KERNEL_THREADS`=1
340 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.
346 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.
341
347
342 ##### `KERNEL_HEADERS`=true
348 ##### `KERNEL_HEADERS`=true
343 Install kernel headers with the built kernel.
349 Install kernel headers with the built kernel.
344
350
345 ##### `KERNEL_MENUCONFIG`=false
351 ##### `KERNEL_MENUCONFIG`=false
346 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
352 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
347
353
348 ##### `KERNEL_OLDDEFCONFIG`=false
354 ##### `KERNEL_OLDDEFCONFIG`=false
349 Run `make olddefconfig` to automatically set all new kernel configuration options to their recommended default values.
355 Run `make olddefconfig` to automatically set all new kernel configuration options to their recommended default values.
350
356
351 ##### `KERNEL_CCACHE`=false
357 ##### `KERNEL_CCACHE`=false
352 Compile the kernel using ccache. This speeds up kernel recompilation by caching previous compilations and detecting when the same compilation is being done again.
358 Compile the kernel using ccache. This speeds up kernel recompilation by caching previous compilations and detecting when the same compilation is being done again.
353
359
354 ##### `KERNEL_REMOVESRC`=true
360 ##### `KERNEL_REMOVESRC`=true
355 Remove all kernel sources from the generated OS image after it was built and installed.
361 Remove all kernel sources from the generated OS image after it was built and installed.
356
362
357 ##### `KERNELSRC_DIR`=""
363 ##### `KERNELSRC_DIR`=""
358 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.
364 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.
359
365
360 ##### `KERNELSRC_CLEAN`=false
366 ##### `KERNELSRC_CLEAN`=false
361 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.
367 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.
362
368
363 ##### `KERNELSRC_CONFIG`=true
369 ##### `KERNELSRC_CONFIG`=true
364 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.
370 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.
365
371
366 ##### `KERNELSRC_USRCONFIG`=""
372 ##### `KERNELSRC_USRCONFIG`=""
367 Copy own config file to kernel `.config`. If `KERNEL_MENUCONFIG`=true then running after copy.
373 Copy own config file to kernel `.config`. If `KERNEL_MENUCONFIG`=true then running after copy.
368
374
369 ##### `KERNELSRC_PREBUILT`=false
375 ##### `KERNELSRC_PREBUILT`=false
370 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.
376 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.
371
377
372 ##### `RPI_FIRMWARE_DIR`=""
378 ##### `RPI_FIRMWARE_DIR`=""
373 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.
379 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.
374
380
375 ##### `KERNEL_DEFAULT_GOV`="ONDEMAND"
381 ##### `KERNEL_DEFAULT_GOV`="ONDEMAND"
376 Set the default cpu governor at kernel compilation. Supported values are: PERFORMANCE POWERSAVE USERSPACE ONDEMAND CONSERVATIVE SCHEDUTIL
382 Set the default cpu governor at kernel compilation. Supported values are: PERFORMANCE POWERSAVE USERSPACE ONDEMAND CONSERVATIVE SCHEDUTIL
377
383
378 ##### `KERNEL_NF`=false
384 ##### `KERNEL_NF`=false
379 Enable Netfilter modules as kernel modules
385 Enable Netfilter modules as kernel modules
380
386
381 ##### `KERNEL_VIRT`=false
387 ##### `KERNEL_VIRT`=false
382 Enable Kernel KVM support (/dev/kvm)
388 Enable Kernel KVM support (/dev/kvm)
383
389
384 ##### `KERNEL_ZSWAP`=false
390 ##### `KERNEL_ZSWAP`=false
385 Enable Kernel Zswap support. Best use on high RAM load and mediocre CPU load usecases
391 Enable Kernel Zswap support. Best use on high RAM load and mediocre CPU load usecases
386
392
387 ##### `KERNEL_BPF`=true
393 ##### `KERNEL_BPF`=true
388 Allow attaching eBPF programs to a cgroup using the bpf syscall (CONFIG_BPF_SYSCALL CONFIG_CGROUP_BPF) [systemd compilations about it - File /lib/systemd/system/systemd-journald.server:36 configures an IP firewall (IPAddressDeny=all), but the local system does not support BPF/cgroup based firewalls]
394 Allow attaching eBPF programs to a cgroup using the bpf syscall (CONFIG_BPF_SYSCALL CONFIG_CGROUP_BPF) [systemd compilations about it - File /lib/systemd/system/systemd-journald.server:36 configures an IP firewall (IPAddressDeny=all), but the local system does not support BPF/cgroup based firewalls]
389
395
390 ##### `KERNEL_SECURITY`=false
396 ##### `KERNEL_SECURITY`=false
391 Enables Apparmor, integrity subsystem, auditing.
397 Enables Apparmor, integrity subsystem, auditing.
392
398
399 ##### `KERNEL_BTRFS`="false"
400 enable btrfs kernel support
401
402 ##### `KERNEL_POEHAT`="false"
403 enable Enable RPI POE HAT fan kernel support
404
405 ##### `KERNEL_NSPAWN`="false"
406 Enable per-interface network priority control - for systemd-nspawn
407
408 ##### `KERNEL_DHKEY`="true"
409 Diffie-Hellman operations on retained keys - required for >keyutils-1.6
410
393 ---
411 ---
394
412
395 #### Reduce disk usage:
413 #### Reduce disk usage:
396 The following list of parameters is ignored if `ENABLE_REDUCE`=false.
414 The following list of parameters is ignored if `ENABLE_REDUCE`=false.
397
415
398 ##### `REDUCE_APT`=true
416 ##### `REDUCE_APT`=true
399 Configure APT to use compressed package repository lists and no package caching files.
417 Configure APT to use compressed package repository lists and no package caching files.
400
418
401 ##### `REDUCE_DOC`=true
419 ##### `REDUCE_DOC`=true
402 Remove all doc files (harsh). Configure APT to not include doc files on future `apt-get` package installations.
420 Remove all doc files (harsh). Configure APT to not include doc files on future `apt-get` package installations.
403
421
404 ##### `REDUCE_MAN`=true
422 ##### `REDUCE_MAN`=true
405 Remove all man pages and info files (harsh). Configure APT to not include man pages on future `apt-get` package installations.
423 Remove all man pages and info files (harsh). Configure APT to not include man pages on future `apt-get` package installations.
406
424
407 ##### `REDUCE_VIM`=false
425 ##### `REDUCE_VIM`=false
408 Replace `vim-tiny` package by `levee` a tiny vim clone.
426 Replace `vim-tiny` package by `levee` a tiny vim clone.
409
427
410 ##### `REDUCE_BASH`=false
428 ##### `REDUCE_BASH`=false
411 Remove `bash` package and switch to `dash` shell (experimental).
429 Remove `bash` package and switch to `dash` shell (experimental).
412
430
413 ##### `REDUCE_HWDB`=true
431 ##### `REDUCE_HWDB`=true
414 Remove PCI related hwdb files (experimental).
432 Remove PCI related hwdb files (experimental).
415
433
416 ##### `REDUCE_SSHD`=true
434 ##### `REDUCE_SSHD`=true
417 Replace `openssh-server` with `dropbear`.
435 Replace `openssh-server` with `dropbear`.
418
436
419 ##### `REDUCE_LOCALE`=true
437 ##### `REDUCE_LOCALE`=true
420 Remove all `locale` translation files.
438 Remove all `locale` translation files.
421
439
422 ---
440 ---
423
441
424 #### Encrypted root partition:
442 #### Encrypted root partition:
425 ##### `ENABLE_CRYPTFS`=false
443 ##### `ENABLE_CRYPTFS`=false
426 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.
444 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.
427
445
428 ##### `CRYPTFS_PASSWORD`=""
446 ##### `CRYPTFS_PASSWORD`=""
429 Set password of the encrypted root partition. This parameter is mandatory if `ENABLE_CRYPTFS`=true.
447 Set password of the encrypted root partition. This parameter is mandatory if `ENABLE_CRYPTFS`=true.
430
448
431 ##### `CRYPTFS_MAPPING`="secure"
449 ##### `CRYPTFS_MAPPING`="secure"
432 Set name of dm-crypt managed device-mapper mapping.
450 Set name of dm-crypt managed device-mapper mapping.
433
451
434 ##### `CRYPTFS_CIPHER`="aes-xts-plain64:sha512"
452 ##### `CRYPTFS_CIPHER`="aes-xts-plain64"
435 Set cipher specification string. `aes-xts*` ciphers are strongly recommended.
453 Set cipher specification string. `aes-xts*` ciphers are strongly recommended.
436
454
455 ##### `CRYPTFS_HASH`=sha512
456 Hash function and size to be used
457
437 ##### `CRYPTFS_XTSKEYSIZE`=512
458 ##### `CRYPTFS_XTSKEYSIZE`=512
438 Sets key size in bits. The argument has to be a multiple of 8.
459 Sets key size in bits. The argument has to be a multiple of 8.
439
460
440 ##### `CRYPTFS_DROPBEAR`=false
461 ##### `CRYPTFS_DROPBEAR`=false
441 Enable Dropbear Initramfs support
462 Enable Dropbear Initramfs support
442
463
443 ##### `CRYPTFS_DROPBEAR_PUBKEY`=""
464 ##### `CRYPTFS_DROPBEAR_PUBKEY`=""
444 Provide path to dropbear Public RSA-OpenSSH Key
465 Provide path to dropbear Public RSA-OpenSSH Key
445
466
446 ---
467 ---
447
468
448 #### Build settings:
469 #### Build settings:
449 ##### `BASEDIR`=$(pwd)/images/${RELEASE}
470 ##### `BASEDIR`=$(pwd)/images/${RELEASE}
450 Set a path to a working directory used by the script to generate an image.
471 Set a path to a working directory used by the script to generate an image.
451
472
452 ##### `IMAGE_NAME`=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}
473 ##### `IMAGE_NAME`=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}
453 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.
474 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.
454
475
455 ## Understanding the script
476 ## Understanding the script
456 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:
477 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:
457
478
458 | Script | Description |
479 | Script | Description |
459 | --- | --- |
480 | --- | --- |
460 | `10-bootstrap.sh` | Debootstrap basic system |
481 | `10-bootstrap.sh` | Debootstrap basic system |
461 | `11-apt.sh` | Setup APT repositories |
482 | `11-apt.sh` | Setup APT repositories |
462 | `12-locale.sh` | Setup Locales and keyboard settings |
483 | `12-locale.sh` | Setup Locales and keyboard settings |
463 | `13-kernel.sh` | Build and install RPi 0/1/2/3 Kernel |
484 | `13-kernel.sh` | Build and install RPi 0/1/2/3 Kernel |
464 | `14-fstab.sh` | Setup fstab and initramfs |
485 | `14-fstab.sh` | Setup fstab and initramfs |
465 | `15-rpi-config.sh` | Setup RPi 0/1/2/3 config and cmdline |
486 | `15-rpi-config.sh` | Setup RPi 0/1/2/3 config and cmdline |
466 | `20-networking.sh` | Setup Networking |
487 | `20-networking.sh` | Setup Networking |
467 | `21-firewall.sh` | Setup Firewall |
488 | `21-firewall.sh` | Setup Firewall |
468 | `30-security.sh` | Setup Users and Security settings |
489 | `30-security.sh` | Setup Users and Security settings |
469 | `31-logging.sh` | Setup Logging |
490 | `31-logging.sh` | Setup Logging |
470 | `32-sshd.sh` | Setup SSH and public keys |
491 | `32-sshd.sh` | Setup SSH and public keys |
471 | `41-uboot.sh` | Build and Setup U-Boot |
492 | `41-uboot.sh` | Build and Setup U-Boot |
472 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
493 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
473 | `43-videocore.sh` | Build and Setup videocore libraries |
494 | `43-videocore.sh` | Build and Setup videocore libraries |
474 | `50-firstboot.sh` | First boot actions |
495 | `50-firstboot.sh` | First boot actions |
475 | `99-reduce.sh` | Reduce the disk space usage |
496 | `99-reduce.sh` | Reduce the disk space usage |
476
497
477 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.
498 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.
478
499
479 | Directory | Description |
500 | Directory | Description |
480 | --- | --- |
501 | --- | --- |
481 | `apt` | APT management configuration files |
502 | `apt` | APT management configuration files |
482 | `boot` | Boot and RPi 0/1/2/3 configuration files |
503 | `boot` | Boot and RPi 0/1/2/3 configuration files |
483 | `dpkg` | Package Manager configuration |
504 | `dpkg` | Package Manager configuration |
484 | `etc` | Configuration files and rc scripts |
505 | `etc` | Configuration files and rc scripts |
485 | `firstboot` | Scripts that get executed on first boot |
506 | `firstboot` | Scripts that get executed on first boot |
486 | `initramfs` | Initramfs scripts |
507 | `initramfs` | Initramfs scripts |
487 | `iptables` | Firewall configuration files |
508 | `iptables` | Firewall configuration files |
488 | `locales` | Locales configuration |
509 | `locales` | Locales configuration |
489 | `modules` | Kernel Modules configuration |
510 | `modules` | Kernel Modules configuration |
490 | `mount` | Fstab configuration |
511 | `mount` | Fstab configuration |
491 | `network` | Networking configuration files |
512 | `network` | Networking configuration files |
492 | `sysctl.d` | Swapping and Network Hardening configuration |
513 | `sysctl.d` | Swapping and Network Hardening configuration |
493 | `xorg` | fbturbo Xorg driver configuration |
514 | `xorg` | fbturbo Xorg driver configuration |
494
515
495 ## Custom packages and scripts
516 ## Custom packages and scripts
496 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`.
517 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`.
497
518
498 Scripts in the custom.d directory will be executed after all other installation is complete but before the image is created.
519 Scripts in the custom.d directory will be executed after all other installation is complete but before the image is created.
499
520
500 ## Logging of the bootstrapping process
521 ## Logging of the bootstrapping process
501 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:
522 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:
502
523
503 ```shell
524 ```shell
504 script -c 'APT_SERVER=ftp.de.debian.org ./rpi23-gen-image.sh' ./build.log
525 script -c 'APT_SERVER=ftp.de.debian.org ./rpi23-gen-image.sh' ./build.log
505 ```
526 ```
506
527
507 ## Flashing the image file
528 ## Flashing the image file
508 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 RPi 0/1/2/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`.
529 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 RPi 0/1/2/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`.
509
530
510 ##### Flashing examples:
531 ##### Flashing examples:
511 ```shell
532 ```shell
512 bmaptool copy ./images/buster/2017-01-23-rpi3-buster.img /dev/mmcblk0
533 bmaptool copy ./images/buster/2017-01-23-rpi3-buster.img /dev/mmcblk0
513 dd bs=4M if=./images/buster/2017-01-23-rpi3-buster.img of=/dev/mmcblk0
534 dd bs=4M if=./images/buster/2017-01-23-rpi3-buster.img of=/dev/mmcblk0
514 ```
535 ```
515 If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, then the `-root` one on the USB drive:
536 If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, then the `-root` one on the USB drive:
516 ```shell
537 ```shell
517 bmaptool copy ./images/buster/2017-01-23-rpi3-buster-frmw.img /dev/mmcblk0
538 bmaptool copy ./images/buster/2017-01-23-rpi3-buster-frmw.img /dev/mmcblk0
518 bmaptool copy ./images/buster/2017-01-23-rpi3-buster-root.img /dev/sdc
539 bmaptool copy ./images/buster/2017-01-23-rpi3-buster-root.img /dev/sdc
519 ```
540 ```
520
541
521 ## QEMU emulation
542 ## QEMU emulation
522 Start QEMU full system emulation:
543 Start QEMU full system emulation:
523 ```shell
544 ```shell
524 qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -kernel kernel7.img -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd ${IMAGE_NAME}.qcow2 -append "root=/dev/mmcblk0p2 rw rootfstype=ext4 console=tty1"
545 qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -kernel kernel7.img -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd ${IMAGE_NAME}.qcow2 -append "root=/dev/mmcblk0p2 rw rootfstype=ext4 console=tty1"
525 ```
546 ```
526
547
527 Start QEMU full system emulation and output to console:
548 Start QEMU full system emulation and output to console:
528 ```shell
549 ```shell
529 qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -kernel kernel7.img -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd ${IMAGE_NAME}.qcow2 -append "root=/dev/mmcblk0p2 rw rootfstype=ext4 console=ttyAMA0,115200 init=/bin/systemd" -serial stdio
550 qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -kernel kernel7.img -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd ${IMAGE_NAME}.qcow2 -append "root=/dev/mmcblk0p2 rw rootfstype=ext4 console=ttyAMA0,115200 init=/bin/systemd" -serial stdio
530 ```
551 ```
531
552
532 Start QEMU full system emulation with SMP and output to console:
553 Start QEMU full system emulation with SMP and output to console:
533 ```shell
554 ```shell
534 qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -smp cpus=2,maxcpus=2 -kernel kernel7.img -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd ${IMAGE_NAME}.qcow2 -append "root=/dev/mmcblk0p2 rw rootfstype=ext4 console=ttyAMA0,115200 init=/bin/systemd" -serial stdio
555 qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -smp cpus=2,maxcpus=2 -kernel kernel7.img -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd ${IMAGE_NAME}.qcow2 -append "root=/dev/mmcblk0p2 rw rootfstype=ext4 console=ttyAMA0,115200 init=/bin/systemd" -serial stdio
535 ```
556 ```
536
557
537 Start QEMU full system emulation with cryptfs, initramfs and output to console:
558 Start QEMU full system emulation with cryptfs, initramfs and output to console:
538 ```shell
559 ```shell
539 qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -kernel kernel7.img -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd ${IMAGE_NAME}.qcow2 -initrd "initramfs-${KERNEL_VERSION}" -append "root=/dev/mapper/secure cryptdevice=/dev/mmcblk0p2:secure rw rootfstype=ext4 console=ttyAMA0,115200 init=/bin/systemd" -serial stdio
560 qemu-system-arm -m 2048M -M vexpress-a15 -cpu cortex-a15 -kernel kernel7.img -no-reboot -dtb vexpress-v2p-ca15_a7.dtb -sd ${IMAGE_NAME}.qcow2 -initrd "initramfs-${KERNEL_VERSION}" -append "root=/dev/mapper/secure cryptdevice=/dev/mmcblk0p2:secure rw rootfstype=ext4 console=ttyAMA0,115200 init=/bin/systemd" -serial stdio
540 ```
561 ```
541
562
542 ## External links and references
563 ## External links and references
543 * [Debian worldwide mirror sites](https://www.debian.org/mirror/list)
564 * [Debian worldwide mirror sites](https://www.debian.org/mirror/list)
544 * [Debian Raspberry Pi 2 Wiki](https://wiki.debian.org/RaspberryPi2)
565 * [Debian Raspberry Pi 2 Wiki](https://wiki.debian.org/RaspberryPi2)
545 * [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains)
566 * [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains)
546 * [Official Raspberry Pi Firmware on github](https://github.com/raspberrypi/firmware)
567 * [Official Raspberry Pi Firmware on github](https://github.com/raspberrypi/firmware)
547 * [Official Raspberry Pi Kernel on github](https://github.com/raspberrypi/linux)
568 * [Official Raspberry Pi Kernel on github](https://github.com/raspberrypi/linux)
548 * [U-BOOT git repository](https://git.denx.de/?p=u-boot.git;a=summary)
569 * [U-BOOT git repository](https://git.denx.de/?p=u-boot.git;a=summary)
549 * [Xorg DDX driver fbturbo](https://github.com/ssvb/xf86-video-fbturbo)
570 * [Xorg DDX driver fbturbo](https://github.com/ssvb/xf86-video-fbturbo)
550 * [RPi3 Wireless interface firmware](https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm)
571 * [RPi3 Wireless interface firmware](https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm)
551 * [Collabora RPi2 Kernel precompiled](https://repositories.collabora.co.uk/debian/)
572 * [Collabora RPi2 Kernel precompiled](https://repositories.collabora.co.uk/debian/)
@@ -1,44 +1,50
1 #
1 #
2 # Setup APT repositories
2 # Setup APT repositories
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Install and setup APT proxy configuration
8 # Install and setup APT proxy configuration
9 if [ -z "$APT_PROXY" ] ; then
9 if [ -z "$APT_PROXY" ] ; then
10 install_readonly files/apt/10proxy "${ETC_DIR}/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"
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" "${ETC_DIR}/apt/apt.conf.d/10proxy"
12 fi
12 fi
13
13
14 # Install APT sources.list
14 # Install APT sources.list
15 install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list"
15 install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list"
16
16
17 # Use specified APT server and release
17 # Use specified APT server and release
18 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "${ETC_DIR}/apt/sources.list"
18 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "${ETC_DIR}/apt/sources.list"
19
20 #Fix for changing path for security updates in testing/bullseye
19 if [ "$RELEASE" = "testing" ] ; then
21 if [ "$RELEASE" = "testing" ] ; then
20 sed -i "s,stretch\\/updates,testing-security," "${ETC_DIR}/apt/sources.list"
22 sed -i "s,stretch\\/updates,testing-security," "${ETC_DIR}/apt/sources.list"
21 else
23 sed -i "s/ stretch/ ${RELEASE}/" "${ETC_DIR}/apt/sources.list"
24 fi
25
26 if [ -z "$RELEASE" ] ; then
27 # Change release in sources list
22 sed -i "s/ stretch/ ${RELEASE}/" "${ETC_DIR}/apt/sources.list"
28 sed -i "s/ stretch/ ${RELEASE}/" "${ETC_DIR}/apt/sources.list"
23 fi
29 fi
24
30
25 # Upgrade package index and update all installed packages and changed dependencies
31 # Upgrade package index and update all installed packages and changed dependencies
26 chroot_exec apt-get -qq -y update
32 chroot_exec apt-get -qq -y update
27 chroot_exec apt-get -qq -y -u dist-upgrade
33 chroot_exec apt-get -qq -y -u dist-upgrade
28
34
29 # Install additional packages
35 # Install additional packages
30 if [ "$APT_INCLUDES_LATE" ] ; then
36 if [ "$APT_INCLUDES_LATE" ] ; then
31 chroot_exec apt-get -qq -y install $(echo "$APT_INCLUDES_LATE" |tr , ' ')
37 chroot_exec apt-get -qq -y install $(echo "$APT_INCLUDES_LATE" |tr , ' ')
32 fi
38 fi
33
39
34 # Install Debian custom packages
40 # Install Debian custom packages
35 if [ -d packages ] ; then
41 if [ -d packages ] ; then
36 for package in packages/*.deb ; do
42 for package in packages/*.deb ; do
37 cp "$package" "${R}"/tmp
43 cp "$package" "${R}"/tmp
38 chroot_exec dpkg --unpack /tmp/"$(basename "$package")"
44 chroot_exec dpkg --unpack /tmp/"$(basename "$package")"
39 done
45 done
40 fi
46 fi
41
47
42 chroot_exec apt-get -qq -y -f install
48 chroot_exec apt-get -qq -y -f install
43
49
44 chroot_exec apt-get -qq -y check
50 chroot_exec apt-get -qq -y check
@@ -1,866 +1,889
1 #
1 #
2 # Build and Setup RPi2/3 Kernel
2 # Build and Setup RPi2/3 Kernel
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Need to use kali kernel src if nexmon is enabled
8 # Need to use kali kernel src if nexmon is enabled
9 if [ "$ENABLE_NEXMON" = true ] ; then
9 if [ "$ENABLE_NEXMON" = true ] ; then
10 KERNEL_URL="${KALI_KERNEL_URL}"
10 KERNEL_URL="${KALI_KERNEL_URL}"
11 # Clear Branch and KernelSRC_DIR if using nexmon. Everyone will forget to clone kali kernel instead of nomrla kernel
11 # Clear Branch and KernelSRC_DIR if using nexmon. Everyone will forget to clone kali kernel instead of nomrla kernel
12 KERNEL_BRANCH=""
12 KERNEL_BRANCH=""
13 KERNELSRC_DIR=""
13 KERNELSRC_DIR=""
14 fi
14 fi
15
15
16 # Fetch and build latest raspberry kernel
16 # Fetch and build latest raspberry kernel
17 if [ "$BUILD_KERNEL" = true ] ; then
17 if [ "$BUILD_KERNEL" = true ] ; then
18 # Setup source directory
18 # Setup source directory
19 mkdir -p "${KERNEL_DIR}"
19 mkdir -p "${KERNEL_DIR}"
20
20
21 # Copy existing kernel sources into chroot directory
21 # Copy existing kernel sources into chroot directory
22 if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then
22 if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then
23 # Copy kernel sources and include hidden files
23 # Copy kernel sources and include hidden files
24 cp -r "${KERNELSRC_DIR}/". "${KERNEL_DIR}"
24 cp -r "${KERNELSRC_DIR}/". "${KERNEL_DIR}"
25
25
26 # Clean the kernel sources
26 # Clean the kernel sources
27 if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then
27 if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then
28 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
28 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
29 fi
29 fi
30 else # KERNELSRC_DIR=""
30 else # KERNELSRC_DIR=""
31 # Create temporary directory for kernel sources
31 # Create temporary directory for kernel sources
32 temp_dir=$(as_nobody mktemp -d)
32 temp_dir=$(as_nobody mktemp -d)
33
33
34 # Fetch current RPi2/3 kernel sources
34 # Fetch current RPi2/3 kernel sources
35 if [ -z "${KERNEL_BRANCH}" ] ; then
35 if [ -z "${KERNEL_BRANCH}" ] ; then
36 as_nobody -H git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" linux
36 as_nobody -H git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" linux
37 else
37 else
38 as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux
38 as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux
39 fi
39 fi
40
40
41 # Copy downloaded kernel sources
41 # Copy downloaded kernel sources
42 cp -r "${temp_dir}/linux/"* "${KERNEL_DIR}"
42 cp -r "${temp_dir}/linux/"* "${KERNEL_DIR}"
43
43
44 # Remove temporary directory for kernel sources
44 # Remove temporary directory for kernel sources
45 rm -fr "${temp_dir}"
45 rm -fr "${temp_dir}"
46
46
47 # Set permissions of the kernel sources
47 # Set permissions of the kernel sources
48 chown -R root:root "${R}/usr/src"
48 chown -R root:root "${R}/usr/src"
49 fi
49 fi
50
50
51 # Calculate optimal number of kernel building threads
51 # Calculate optimal number of kernel building threads
52 if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then
52 if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then
53 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
53 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
54 fi
54 fi
55
55
56 #Copy 32bit config to 64bit
56 #Copy 32bit config to 64bit
57 if [ "$ENABLE_QEMU" = true ] && [ "$KERNEL_ARCH" = arm64 ]; then
57 if [ "$ENABLE_QEMU" = true ] && [ "$KERNEL_ARCH" = arm64 ]; then
58 cp "${KERNEL_DIR}"/arch/arm/configs/vexpress_defconfig "${KERNEL_DIR}"/arch/arm64/configs/
58 cp "${KERNEL_DIR}"/arch/arm/configs/vexpress_defconfig "${KERNEL_DIR}"/arch/arm64/configs/
59 fi
59 fi
60
60
61 # Configure and build kernel
61 # Configure and build kernel
62 if [ "$KERNELSRC_PREBUILT" = false ] ; then
62 if [ "$KERNELSRC_PREBUILT" = false ] ; then
63 # Remove device, network and filesystem drivers from kernel configuration
63 # Remove device, network and filesystem drivers from kernel configuration
64 if [ "$KERNEL_REDUCE" = true ] ; then
64 if [ "$KERNEL_REDUCE" = true ] ; then
65 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
65 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
66 sed -i\
66 sed -i\
67 -e "s/\(^CONFIG_SND.*\=\).*/\1n/"\
67 -e "s/\(^CONFIG_SND.*\=\).*/\1n/"\
68 -e "s/\(^CONFIG_SOUND.*\=\).*/\1n/"\
68 -e "s/\(^CONFIG_SOUND.*\=\).*/\1n/"\
69 -e "s/\(^CONFIG_AC97.*\=\).*/\1n/"\
69 -e "s/\(^CONFIG_AC97.*\=\).*/\1n/"\
70 -e "s/\(^CONFIG_VIDEO_.*\=\).*/\1n/"\
70 -e "s/\(^CONFIG_VIDEO_.*\=\).*/\1n/"\
71 -e "s/\(^CONFIG_MEDIA_TUNER.*\=\).*/\1n/"\
71 -e "s/\(^CONFIG_MEDIA_TUNER.*\=\).*/\1n/"\
72 -e "s/\(^CONFIG_DVB.*\=\)[ym]/\1n/"\
72 -e "s/\(^CONFIG_DVB.*\=\)[ym]/\1n/"\
73 -e "s/\(^CONFIG_REISERFS.*\=\).*/\1n/"\
73 -e "s/\(^CONFIG_REISERFS.*\=\).*/\1n/"\
74 -e "s/\(^CONFIG_JFS.*\=\).*/\1n/"\
74 -e "s/\(^CONFIG_JFS.*\=\).*/\1n/"\
75 -e "s/\(^CONFIG_XFS.*\=\).*/\1n/"\
75 -e "s/\(^CONFIG_XFS.*\=\).*/\1n/"\
76 -e "s/\(^CONFIG_GFS2.*\=\).*/\1n/"\
76 -e "s/\(^CONFIG_GFS2.*\=\).*/\1n/"\
77 -e "s/\(^CONFIG_OCFS2.*\=\).*/\1n/"\
77 -e "s/\(^CONFIG_OCFS2.*\=\).*/\1n/"\
78 -e "s/\(^CONFIG_BTRFS.*\=\).*/\1n/"\
78 -e "s/\(^CONFIG_BTRFS.*\=\).*/\1n/"\
79 -e "s/\(^CONFIG_HFS.*\=\).*/\1n/"\
79 -e "s/\(^CONFIG_HFS.*\=\).*/\1n/"\
80 -e "s/\(^CONFIG_JFFS2.*\=\)[ym]/\1n/"\
80 -e "s/\(^CONFIG_JFFS2.*\=\)[ym]/\1n/"\
81 -e "s/\(^CONFIG_UBIFS.*\=\).*/\1n/"\
81 -e "s/\(^CONFIG_UBIFS.*\=\).*/\1n/"\
82 -e "s/\(^CONFIG_SQUASHFS.*\=\)[ym]/\1n/"\
82 -e "s/\(^CONFIG_SQUASHFS.*\=\)[ym]/\1n/"\
83 -e "s/\(^CONFIG_W1.*\=\)[ym]/\1n/"\
83 -e "s/\(^CONFIG_W1.*\=\)[ym]/\1n/"\
84 -e "s/\(^CONFIG_HAMRADIO.*\=\).*/\1n/"\
84 -e "s/\(^CONFIG_HAMRADIO.*\=\).*/\1n/"\
85 -e "s/\(^CONFIG_CAN.*\=\).*/\1n/"\
85 -e "s/\(^CONFIG_CAN.*\=\).*/\1n/"\
86 -e "s/\(^CONFIG_IRDA.*\=\).*/\1n/"\
86 -e "s/\(^CONFIG_IRDA.*\=\).*/\1n/"\
87 -e "s/\(^CONFIG_BT_.*\=\).*/\1n/"\
87 -e "s/\(^CONFIG_BT_.*\=\).*/\1n/"\
88 -e "s/\(^CONFIG_WIMAX.*\=\)[ym]/\1n/"\
88 -e "s/\(^CONFIG_WIMAX.*\=\)[ym]/\1n/"\
89 -e "s/\(^CONFIG_6LOWPAN.*\=\).*/\1n/"\
89 -e "s/\(^CONFIG_6LOWPAN.*\=\).*/\1n/"\
90 -e "s/\(^CONFIG_IEEE802154.*\=\).*/\1n/"\
90 -e "s/\(^CONFIG_IEEE802154.*\=\).*/\1n/"\
91 -e "s/\(^CONFIG_NFC.*\=\).*/\1n/"\
91 -e "s/\(^CONFIG_NFC.*\=\).*/\1n/"\
92 -e "s/\(^CONFIG_FB_TFT=.*\=\).*/\1n/"\
92 -e "s/\(^CONFIG_FB_TFT=.*\=\).*/\1n/"\
93 -e "s/\(^CONFIG_TOUCHSCREEN.*\=\).*/\1n/"\
93 -e "s/\(^CONFIG_TOUCHSCREEN.*\=\).*/\1n/"\
94 -e "s/\(^CONFIG_USB_GSPCA_.*\=\).*/\1n/"\
94 -e "s/\(^CONFIG_USB_GSPCA_.*\=\).*/\1n/"\
95 -e "s/\(^CONFIG_DRM.*\=\).*/\1n/"\
95 -e "s/\(^CONFIG_DRM.*\=\).*/\1n/"\
96 "${KERNEL_DIR}/.config"
96 "${KERNEL_DIR}/.config"
97 fi
97 fi
98
98
99 if [ "$KERNELSRC_CONFIG" = true ] ; then
99 if [ "$KERNELSRC_CONFIG" = true ] ; then
100 # Load default raspberry kernel configuration
100 # Load default raspberry kernel configuration
101 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
101 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
102
102
103 #Switch to KERNELSRC_DIR so we can use set_kernel_config
103 #Switch to KERNELSRC_DIR so we can use set_kernel_config
104 cd "${KERNEL_DIR}" || exit
104 cd "${KERNEL_DIR}" || exit
105
105
106 if [ "$KERNEL_ARCH" = arm64 ] ; then
106 # Enable RPI POE HAT fan
107 if [ "$KERNEL_POEHAT" = true ]; then
108 set_kernel_config CONFIG_SENSORS_RPI_POE_FAN m
109 fi
110
111 # Enable per-interface network priority control
112 # (for systemd-nspawn)
113 if [ "$KERNEL_NSPAN" = true ]; then
114 set_kernel_config CONFIG_CGROUP_NET_PRIO y
115 fi
116
117 # Compile in BTRFS
118 if [ "$KERNEL_BTRFS" = true ]; then
119 set_kernel_config CONFIG_BTRFS_FS y
120 set_kernel_config CONFIG_BTRFS_FS_POSIX_ACL y
121 set_kernel_config CONFIG_BTRFS_FS_REF_VERIFY y
122 fi
123
124 # Diffie-Hellman operations on retained keys
125 # (required for >keyutils-1.6)
126 if [ "$KERNEL_DHKEY" = true ]; then
127 set_kernel_config CONFIG_KEY_DH_OPERATIONS y
128 fi
129
107 if [ "$KERNEL_ARCH" = arm64 ] && [ "$ENABLE_QEMU" = false ]; then
130 if [ "$KERNEL_ARCH" = arm64 ] && [ "$ENABLE_QEMU" = false ]; then
108 # Mask this temporarily during switch to rpi-4.19.y
131 # Mask this temporarily during switch to rpi-4.19.y
109 #Fix SD_DRIVER upstream and downstream mess in 64bit RPIdeb_config
132 #Fix SD_DRIVER upstream and downstream mess in 64bit RPIdeb_config
110 # use correct driver MMC_BCM2835_MMC instead of MMC_BCM2835_SDHOST - see https://www.raspberrypi.org/forums/viewtopic.php?t=210225
133 # use correct driver MMC_BCM2835_MMC instead of MMC_BCM2835_SDHOST - see https://www.raspberrypi.org/forums/viewtopic.php?t=210225
111 #set_kernel_config CONFIG_MMC_BCM2835 n
134 #set_kernel_config CONFIG_MMC_BCM2835 n
112 #set_kernel_config CONFIG_MMC_SDHCI_IPROC n
135 #set_kernel_config CONFIG_MMC_SDHCI_IPROC n
113 #set_kernel_config CONFIG_USB_DWC2 n
136 #set_kernel_config CONFIG_USB_DWC2 n
114 #sed -i "s|depends on MMC_BCM2835_MMC && MMC_BCM2835_DMA|depends on MMC_BCM2835_MMC|" "${KERNEL_DIR}"/drivers/mmc/host/Kconfig
137 #sed -i "s|depends on MMC_BCM2835_MMC && MMC_BCM2835_DMA|depends on MMC_BCM2835_MMC|" "${KERNEL_DIR}"/drivers/mmc/host/Kconfig
115
138
116 #VLAN got disabled without reason in arm64bit
139 #VLAN got disabled without reason in arm64bit
117 set_kernel_config CONFIG_IPVLAN m
140 set_kernel_config CONFIG_IPVLAN m
118 fi
141 fi
119
142
120 # enable ZSWAP see https://askubuntu.com/a/472227 or https://wiki.archlinux.org/index.php/zswap
143 # enable ZSWAP see https://askubuntu.com/a/472227 or https://wiki.archlinux.org/index.php/zswap
121 if [ "$KERNEL_ZSWAP" = true ] ; then
144 if [ "$KERNEL_ZSWAP" = true ] ; then
122 set_kernel_config CONFIG_ZPOOL y
145 set_kernel_config CONFIG_ZPOOL y
123 set_kernel_config CONFIG_ZSWAP y
146 set_kernel_config CONFIG_ZSWAP y
124 set_kernel_config CONFIG_ZBUD y
147 set_kernel_config CONFIG_ZBUD y
125 set_kernel_config CONFIG_Z3FOLD y
148 set_kernel_config CONFIG_Z3FOLD y
126 set_kernel_config CONFIG_ZSMALLOC y
149 set_kernel_config CONFIG_ZSMALLOC y
127 set_kernel_config CONFIG_PGTABLE_MAPPING y
150 set_kernel_config CONFIG_PGTABLE_MAPPING y
128 set_kernel_config CONFIG_LZO_COMPRESS y
151 set_kernel_config CONFIG_LZO_COMPRESS y
129 fi
152 fi
130
153
131 if [ "$RPI_MODEL" = 4 ] ; then
154 if [ "$RPI_MODEL" = 4 ] ; then
132 # Following are set in current 32-bit LPAE kernel
155 # Following are set in current 32-bit LPAE kernel
133 set_kernel_config CONFIG_CGROUP_PIDS y
156 set_kernel_config CONFIG_CGROUP_PIDS y
134 set_kernel_config CONFIG_NET_IPVTI m
157 set_kernel_config CONFIG_NET_IPVTI m
135 set_kernel_config CONFIG_NF_TABLES_SET m
158 set_kernel_config CONFIG_NF_TABLES_SET m
136 set_kernel_config CONFIG_NF_TABLES_INET y
159 set_kernel_config CONFIG_NF_TABLES_INET y
137 set_kernel_config CONFIG_NF_TABLES_NETDEV y
160 set_kernel_config CONFIG_NF_TABLES_NETDEV y
138 set_kernel_config CONFIG_NF_FLOW_TABLE m
161 set_kernel_config CONFIG_NF_FLOW_TABLE m
139 set_kernel_config CONFIG_NFT_FLOW_OFFLOAD m
162 set_kernel_config CONFIG_NFT_FLOW_OFFLOAD m
140 set_kernel_config CONFIG_NFT_CONNLIMIT m
163 set_kernel_config CONFIG_NFT_CONNLIMIT m
141 set_kernel_config CONFIG_NFT_TUNNEL m
164 set_kernel_config CONFIG_NFT_TUNNEL m
142 set_kernel_config CONFIG_NFT_OBJREF m
165 set_kernel_config CONFIG_NFT_OBJREF m
143 set_kernel_config CONFIG_NFT_FIB_IPV4 m
166 set_kernel_config CONFIG_NFT_FIB_IPV4 m
144 set_kernel_config CONFIG_NFT_FIB_IPV6 m
167 set_kernel_config CONFIG_NFT_FIB_IPV6 m
145 set_kernel_config CONFIG_NFT_FIB_INET m
168 set_kernel_config CONFIG_NFT_FIB_INET m
146 set_kernel_config CONFIG_NFT_SOCKET m
169 set_kernel_config CONFIG_NFT_SOCKET m
147 set_kernel_config CONFIG_NFT_OSF m
170 set_kernel_config CONFIG_NFT_OSF m
148 set_kernel_config CONFIG_NFT_TPROXY m
171 set_kernel_config CONFIG_NFT_TPROXY m
149 set_kernel_config CONFIG_NF_DUP_NETDEV m
172 set_kernel_config CONFIG_NF_DUP_NETDEV m
150 set_kernel_config CONFIG_NFT_DUP_NETDEV m
173 set_kernel_config CONFIG_NFT_DUP_NETDEV m
151 set_kernel_config CONFIG_NFT_FWD_NETDEV m
174 set_kernel_config CONFIG_NFT_FWD_NETDEV m
152 set_kernel_config CONFIG_NFT_FIB_NETDEV m
175 set_kernel_config CONFIG_NFT_FIB_NETDEV m
153 set_kernel_config CONFIG_NF_FLOW_TABLE_INET m
176 set_kernel_config CONFIG_NF_FLOW_TABLE_INET m
154 set_kernel_config CONFIG_NF_FLOW_TABLE m
177 set_kernel_config CONFIG_NF_FLOW_TABLE m
155 set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m
178 set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m
156 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m
179 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m
157 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m
180 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m
158 set_kernel_config CONFIG_NFT_MASQ_IPV6 m
181 set_kernel_config CONFIG_NFT_MASQ_IPV6 m
159 set_kernel_config CONFIG_NFT_REDIR_IPV6 m
182 set_kernel_config CONFIG_NFT_REDIR_IPV6 m
160 set_kernel_config CONFIG_NFT_REJECT_IPV6 m
183 set_kernel_config CONFIG_NFT_REJECT_IPV6 m
161 set_kernel_config CONFIG_NFT_DUP_IPV6 m
184 set_kernel_config CONFIG_NFT_DUP_IPV6 m
162 set_kernel_config CONFIG_NFT_FIB_IPV6 m
185 set_kernel_config CONFIG_NFT_FIB_IPV6 m
163 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV6 m
186 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV6 m
164 set_kernel_config CONFIG_NF_TABLES_BRIDGE m
187 set_kernel_config CONFIG_NF_TABLES_BRIDGE m
165 set_kernel_config CONFIG_NFT_BRIDGE_REJECT m
188 set_kernel_config CONFIG_NFT_BRIDGE_REJECT m
166 set_kernel_config CONFIG_NF_LOG_BRIDGE m
189 set_kernel_config CONFIG_NF_LOG_BRIDGE m
167 set_kernel_config CONFIG_MT76_CORE m
190 set_kernel_config CONFIG_MT76_CORE m
168 set_kernel_config CONFIG_MT76_LEDS m
191 set_kernel_config CONFIG_MT76_LEDS m
169 set_kernel_config CONFIG_MT76_USB m
192 set_kernel_config CONFIG_MT76_USB m
170 set_kernel_config CONFIG_MT76x2_COMMON m
193 set_kernel_config CONFIG_MT76x2_COMMON m
171 set_kernel_config CONFIG_MT76x0U m
194 set_kernel_config CONFIG_MT76x0U m
172 set_kernel_config CONFIG_MT76x2U m
195 set_kernel_config CONFIG_MT76x2U m
173 set_kernel_config CONFIG_TOUCHSCREEN_ILI210X m
196 set_kernel_config CONFIG_TOUCHSCREEN_ILI210X m
174 set_kernel_config CONFIG_BCM_VC_SM m
197 set_kernel_config CONFIG_BCM_VC_SM m
175 set_kernel_config CONFIG_BCM2835_SMI_DEV m
198 set_kernel_config CONFIG_BCM2835_SMI_DEV m
176 set_kernel_config CONFIG_RPIVID_MEM m
199 set_kernel_config CONFIG_RPIVID_MEM m
177 set_kernel_config CONFIG_HW_RANDOM_BCM2835 y
200 set_kernel_config CONFIG_HW_RANDOM_BCM2835 y
178 set_kernel_config CONFIG_TCG_TPM m
201 set_kernel_config CONFIG_TCG_TPM m
179 set_kernel_config CONFIG_HW_RANDOM_TPM y
202 set_kernel_config CONFIG_HW_RANDOM_TPM y
180 set_kernel_config CONFIG_TCG_TIS m
203 set_kernel_config CONFIG_TCG_TIS m
181 set_kernel_config CONFIG_TCG_TIS_SPI m
204 set_kernel_config CONFIG_TCG_TIS_SPI m
182 set_kernel_config CONFIG_I2C_MUX m
205 set_kernel_config CONFIG_I2C_MUX m
183 set_kernel_config CONFIG_I2C_MUX_GPMUX m
206 set_kernel_config CONFIG_I2C_MUX_GPMUX m
184 set_kernel_config CONFIG_I2C_MUX_PCA954x m
207 set_kernel_config CONFIG_I2C_MUX_PCA954x m
185 set_kernel_config CONFIG_SPI_GPIO m
208 set_kernel_config CONFIG_SPI_GPIO m
186 set_kernel_config CONFIG_BATTERY_MAX17040 m
209 set_kernel_config CONFIG_BATTERY_MAX17040 m
187 set_kernel_config CONFIG_SENSORS_GPIO_FAN m
210 set_kernel_config CONFIG_SENSORS_GPIO_FAN m
188 set_kernel_config CONFIG_SENSORS_RASPBERRYPI_HWMON m
211 set_kernel_config CONFIG_SENSORS_RASPBERRYPI_HWMON m
189 set_kernel_config CONFIG_BCM2835_THERMAL y
212 set_kernel_config CONFIG_BCM2835_THERMAL y
190 set_kernel_config CONFIG_RC_CORE y
213 set_kernel_config CONFIG_RC_CORE y
191 set_kernel_config CONFIG_RC_MAP y
214 set_kernel_config CONFIG_RC_MAP y
192 set_kernel_config CONFIG_LIRC y
215 set_kernel_config CONFIG_LIRC y
193 set_kernel_config CONFIG_RC_DECODERS y
216 set_kernel_config CONFIG_RC_DECODERS y
194 set_kernel_config CONFIG_IR_NEC_DECODER m
217 set_kernel_config CONFIG_IR_NEC_DECODER m
195 set_kernel_config CONFIG_IR_RC5_DECODER m
218 set_kernel_config CONFIG_IR_RC5_DECODER m
196 set_kernel_config CONFIG_IR_RC6_DECODER m
219 set_kernel_config CONFIG_IR_RC6_DECODER m
197 set_kernel_config CONFIG_IR_JVC_DECODER m
220 set_kernel_config CONFIG_IR_JVC_DECODER m
198 set_kernel_config CONFIG_IR_SONY_DECODER m
221 set_kernel_config CONFIG_IR_SONY_DECODER m
199 set_kernel_config CONFIG_IR_SANYO_DECODER m
222 set_kernel_config CONFIG_IR_SANYO_DECODER m
200 set_kernel_config CONFIG_IR_SHARP_DECODER m
223 set_kernel_config CONFIG_IR_SHARP_DECODER m
201 set_kernel_config CONFIG_IR_MCE_KBD_DECODER m
224 set_kernel_config CONFIG_IR_MCE_KBD_DECODER m
202 set_kernel_config CONFIG_IR_XMP_DECODER m
225 set_kernel_config CONFIG_IR_XMP_DECODER m
203 set_kernel_config CONFIG_IR_IMON_DECODER m
226 set_kernel_config CONFIG_IR_IMON_DECODER m
204 set_kernel_config CONFIG_RC_DEVICES y
227 set_kernel_config CONFIG_RC_DEVICES y
205 set_kernel_config CONFIG_RC_ATI_REMOTE m
228 set_kernel_config CONFIG_RC_ATI_REMOTE m
206 set_kernel_config CONFIG_IR_IMON m
229 set_kernel_config CONFIG_IR_IMON m
207 set_kernel_config CONFIG_IR_MCEUSB m
230 set_kernel_config CONFIG_IR_MCEUSB m
208 set_kernel_config CONFIG_IR_REDRAT3 m
231 set_kernel_config CONFIG_IR_REDRAT3 m
209 set_kernel_config CONFIG_IR_STREAMZAP m
232 set_kernel_config CONFIG_IR_STREAMZAP m
210 set_kernel_config CONFIG_IR_IGUANA m
233 set_kernel_config CONFIG_IR_IGUANA m
211 set_kernel_config CONFIG_IR_TTUSBIR m
234 set_kernel_config CONFIG_IR_TTUSBIR m
212 set_kernel_config CONFIG_RC_LOOPBACK m
235 set_kernel_config CONFIG_RC_LOOPBACK m
213 set_kernel_config CONFIG_IR_GPIO_CIR m
236 set_kernel_config CONFIG_IR_GPIO_CIR m
214 set_kernel_config CONFIG_IR_GPIO_TX m
237 set_kernel_config CONFIG_IR_GPIO_TX m
215 set_kernel_config CONFIG_IR_PWM_TX m
238 set_kernel_config CONFIG_IR_PWM_TX m
216 set_kernel_config CONFIG_VIDEO_V4L2_SUBDEV_API y
239 set_kernel_config CONFIG_VIDEO_V4L2_SUBDEV_API y
217 set_kernel_config CONFIG_VIDEO_AU0828_RC y
240 set_kernel_config CONFIG_VIDEO_AU0828_RC y
218 set_kernel_config CONFIG_VIDEO_CX231XX m
241 set_kernel_config CONFIG_VIDEO_CX231XX m
219 set_kernel_config CONFIG_VIDEO_CX231XX_RC y
242 set_kernel_config CONFIG_VIDEO_CX231XX_RC y
220 set_kernel_config CONFIG_VIDEO_CX231XX_ALSA m
243 set_kernel_config CONFIG_VIDEO_CX231XX_ALSA m
221 set_kernel_config CONFIG_VIDEO_CX231XX_DVB m
244 set_kernel_config CONFIG_VIDEO_CX231XX_DVB m
222 set_kernel_config CONFIG_VIDEO_TM6000 m
245 set_kernel_config CONFIG_VIDEO_TM6000 m
223 set_kernel_config CONFIG_VIDEO_TM6000_ALSA m
246 set_kernel_config CONFIG_VIDEO_TM6000_ALSA m
224 set_kernel_config CONFIG_VIDEO_TM6000_DVB m
247 set_kernel_config CONFIG_VIDEO_TM6000_DVB m
225 set_kernel_config CONFIG_DVB_USB m
248 set_kernel_config CONFIG_DVB_USB m
226 set_kernel_config CONFIG_DVB_USB_DIB3000MC m
249 set_kernel_config CONFIG_DVB_USB_DIB3000MC m
227 set_kernel_config CONFIG_DVB_USB_A800 m
250 set_kernel_config CONFIG_DVB_USB_A800 m
228 set_kernel_config CONFIG_DVB_USB_DIBUSB_MB m
251 set_kernel_config CONFIG_DVB_USB_DIBUSB_MB m
229 set_kernel_config CONFIG_DVB_USB_DIBUSB_MB_FAULTY y
252 set_kernel_config CONFIG_DVB_USB_DIBUSB_MB_FAULTY y
230 set_kernel_config CONFIG_DVB_USB_DIBUSB_MC m
253 set_kernel_config CONFIG_DVB_USB_DIBUSB_MC m
231 set_kernel_config CONFIG_DVB_USB_DIB0700 m
254 set_kernel_config CONFIG_DVB_USB_DIB0700 m
232 set_kernel_config CONFIG_DVB_USB_UMT_010 m
255 set_kernel_config CONFIG_DVB_USB_UMT_010 m
233 set_kernel_config CONFIG_DVB_USB_CXUSB m
256 set_kernel_config CONFIG_DVB_USB_CXUSB m
234 set_kernel_config CONFIG_DVB_USB_M920X m
257 set_kernel_config CONFIG_DVB_USB_M920X m
235 set_kernel_config CONFIG_DVB_USB_DIGITV m
258 set_kernel_config CONFIG_DVB_USB_DIGITV m
236 set_kernel_config CONFIG_DVB_USB_VP7045 m
259 set_kernel_config CONFIG_DVB_USB_VP7045 m
237 set_kernel_config CONFIG_DVB_USB_VP702X m
260 set_kernel_config CONFIG_DVB_USB_VP702X m
238 set_kernel_config CONFIG_DVB_USB_GP8PSK m
261 set_kernel_config CONFIG_DVB_USB_GP8PSK m
239 set_kernel_config CONFIG_DVB_USB_NOVA_T_USB2 m
262 set_kernel_config CONFIG_DVB_USB_NOVA_T_USB2 m
240 set_kernel_config CONFIG_DVB_USB_TTUSB2 m
263 set_kernel_config CONFIG_DVB_USB_TTUSB2 m
241 set_kernel_config CONFIG_DVB_USB_DTT200U m
264 set_kernel_config CONFIG_DVB_USB_DTT200U m
242 set_kernel_config CONFIG_DVB_USB_OPERA1 m
265 set_kernel_config CONFIG_DVB_USB_OPERA1 m
243 set_kernel_config CONFIG_DVB_USB_AF9005 m
266 set_kernel_config CONFIG_DVB_USB_AF9005 m
244 set_kernel_config CONFIG_DVB_USB_AF9005_REMOTE m
267 set_kernel_config CONFIG_DVB_USB_AF9005_REMOTE m
245 set_kernel_config CONFIG_DVB_USB_PCTV452E m
268 set_kernel_config CONFIG_DVB_USB_PCTV452E m
246 set_kernel_config CONFIG_DVB_USB_DW2102 m
269 set_kernel_config CONFIG_DVB_USB_DW2102 m
247 set_kernel_config CONFIG_DVB_USB_CINERGY_T2 m
270 set_kernel_config CONFIG_DVB_USB_CINERGY_T2 m
248 set_kernel_config CONFIG_DVB_USB_DTV5100 m
271 set_kernel_config CONFIG_DVB_USB_DTV5100 m
249 set_kernel_config CONFIG_DVB_USB_AZ6027 m
272 set_kernel_config CONFIG_DVB_USB_AZ6027 m
250 set_kernel_config CONFIG_DVB_USB_TECHNISAT_USB2 m
273 set_kernel_config CONFIG_DVB_USB_TECHNISAT_USB2 m
251 set_kernel_config CONFIG_DVB_USB_AF9015 m
274 set_kernel_config CONFIG_DVB_USB_AF9015 m
252 set_kernel_config CONFIG_DVB_USB_LME2510 m
275 set_kernel_config CONFIG_DVB_USB_LME2510 m
253 set_kernel_config CONFIG_DVB_USB_RTL28XXU m
276 set_kernel_config CONFIG_DVB_USB_RTL28XXU m
254 set_kernel_config CONFIG_VIDEO_EM28XX_RC m
277 set_kernel_config CONFIG_VIDEO_EM28XX_RC m
255 set_kernel_config CONFIG_SMS_SIANO_RC m
278 set_kernel_config CONFIG_SMS_SIANO_RC m
256 set_kernel_config CONFIG_VIDEO_IR_I2C m
279 set_kernel_config CONFIG_VIDEO_IR_I2C m
257 set_kernel_config CONFIG_VIDEO_ADV7180 m
280 set_kernel_config CONFIG_VIDEO_ADV7180 m
258 set_kernel_config CONFIG_VIDEO_TC358743 m
281 set_kernel_config CONFIG_VIDEO_TC358743 m
259 set_kernel_config CONFIG_VIDEO_OV5647 m
282 set_kernel_config CONFIG_VIDEO_OV5647 m
260 set_kernel_config CONFIG_DVB_M88DS3103 m
283 set_kernel_config CONFIG_DVB_M88DS3103 m
261 set_kernel_config CONFIG_DVB_AF9013 m
284 set_kernel_config CONFIG_DVB_AF9013 m
262 set_kernel_config CONFIG_DVB_RTL2830 m
285 set_kernel_config CONFIG_DVB_RTL2830 m
263 set_kernel_config CONFIG_DVB_RTL2832 m
286 set_kernel_config CONFIG_DVB_RTL2832 m
264 set_kernel_config CONFIG_DVB_SI2168 m
287 set_kernel_config CONFIG_DVB_SI2168 m
265 set_kernel_config CONFIG_DVB_GP8PSK_FE m
288 set_kernel_config CONFIG_DVB_GP8PSK_FE m
266 set_kernel_config CONFIG_DVB_USB m
289 set_kernel_config CONFIG_DVB_USB m
267 set_kernel_config CONFIG_DVB_LGDT3306A m
290 set_kernel_config CONFIG_DVB_LGDT3306A m
268 set_kernel_config CONFIG_FB_SIMPLE y
291 set_kernel_config CONFIG_FB_SIMPLE y
269 set_kernel_config CONFIG_SND_BCM2708_SOC_IQAUDIO_CODEC m
292 set_kernel_config CONFIG_SND_BCM2708_SOC_IQAUDIO_CODEC m
270 set_kernel_config CONFIG_SND_BCM2708_SOC_I_SABRE_Q2M m
293 set_kernel_config CONFIG_SND_BCM2708_SOC_I_SABRE_Q2M m
271 set_kernel_config CONFIG_SND_AUDIOSENSE_PI m
294 set_kernel_config CONFIG_SND_AUDIOSENSE_PI m
272 set_kernel_config CONFIG_SND_SOC_AD193X m
295 set_kernel_config CONFIG_SND_SOC_AD193X m
273 set_kernel_config CONFIG_SND_SOC_AD193X_SPI m
296 set_kernel_config CONFIG_SND_SOC_AD193X_SPI m
274 set_kernel_config CONFIG_SND_SOC_AD193X_I2C m
297 set_kernel_config CONFIG_SND_SOC_AD193X_I2C m
275 set_kernel_config CONFIG_SND_SOC_CS4265 m
298 set_kernel_config CONFIG_SND_SOC_CS4265 m
276 set_kernel_config CONFIG_SND_SOC_DA7213 m
299 set_kernel_config CONFIG_SND_SOC_DA7213 m
277 set_kernel_config CONFIG_SND_SOC_ICS43432 m
300 set_kernel_config CONFIG_SND_SOC_ICS43432 m
278 set_kernel_config CONFIG_SND_SOC_TLV320AIC32X4 m
301 set_kernel_config CONFIG_SND_SOC_TLV320AIC32X4 m
279 set_kernel_config CONFIG_SND_SOC_TLV320AIC32X4_I2C m
302 set_kernel_config CONFIG_SND_SOC_TLV320AIC32X4_I2C m
280 set_kernel_config CONFIG_SND_SOC_I_SABRE_CODEC m
303 set_kernel_config CONFIG_SND_SOC_I_SABRE_CODEC m
281 set_kernel_config CONFIG_HID_BIGBEN_FF m
304 set_kernel_config CONFIG_HID_BIGBEN_FF m
282 #set_kernel_config CONFIG_USB_XHCI_PLATFORM y
305 #set_kernel_config CONFIG_USB_XHCI_PLATFORM y
283 set_kernel_config CONFIG_USB_TMC m
306 set_kernel_config CONFIG_USB_TMC m
284 set_kernel_config CONFIG_USB_UAS y
307 set_kernel_config CONFIG_USB_UAS y
285 set_kernel_config CONFIG_USBIP_VUDC m
308 set_kernel_config CONFIG_USBIP_VUDC m
286 set_kernel_config CONFIG_USB_CONFIGFS m
309 set_kernel_config CONFIG_USB_CONFIGFS m
287 set_kernel_config CONFIG_USB_CONFIGFS_SERIAL y
310 set_kernel_config CONFIG_USB_CONFIGFS_SERIAL y
288 set_kernel_config CONFIG_USB_CONFIGFS_ACM y
311 set_kernel_config CONFIG_USB_CONFIGFS_ACM y
289 set_kernel_config CONFIG_USB_CONFIGFS_OBEX y
312 set_kernel_config CONFIG_USB_CONFIGFS_OBEX y
290 set_kernel_config CONFIG_USB_CONFIGFS_NCM y
313 set_kernel_config CONFIG_USB_CONFIGFS_NCM y
291 set_kernel_config CONFIG_USB_CONFIGFS_ECM y
314 set_kernel_config CONFIG_USB_CONFIGFS_ECM y
292 set_kernel_config CONFIG_USB_CONFIGFS_ECM_SUBSET y
315 set_kernel_config CONFIG_USB_CONFIGFS_ECM_SUBSET y
293 set_kernel_config CONFIG_USB_CONFIGFS_RNDIS y
316 set_kernel_config CONFIG_USB_CONFIGFS_RNDIS y
294 set_kernel_config CONFIG_USB_CONFIGFS_EEM y
317 set_kernel_config CONFIG_USB_CONFIGFS_EEM y
295 set_kernel_config CONFIG_USB_CONFIGFS_MASS_STORAGE y
318 set_kernel_config CONFIG_USB_CONFIGFS_MASS_STORAGE y
296 set_kernel_config CONFIG_USB_CONFIGFS_F_LB_SS y
319 set_kernel_config CONFIG_USB_CONFIGFS_F_LB_SS y
297 set_kernel_config CONFIG_USB_CONFIGFS_F_FS y
320 set_kernel_config CONFIG_USB_CONFIGFS_F_FS y
298 set_kernel_config CONFIG_USB_CONFIGFS_F_UAC1 y
321 set_kernel_config CONFIG_USB_CONFIGFS_F_UAC1 y
299 set_kernel_config CONFIG_USB_CONFIGFS_F_UAC2 y
322 set_kernel_config CONFIG_USB_CONFIGFS_F_UAC2 y
300 set_kernel_config CONFIG_USB_CONFIGFS_F_MIDI y
323 set_kernel_config CONFIG_USB_CONFIGFS_F_MIDI y
301 set_kernel_config CONFIG_USB_CONFIGFS_F_HID y
324 set_kernel_config CONFIG_USB_CONFIGFS_F_HID y
302 set_kernel_config CONFIG_USB_CONFIGFS_F_UVC y
325 set_kernel_config CONFIG_USB_CONFIGFS_F_UVC y
303 set_kernel_config CONFIG_USB_CONFIGFS_F_PRINTER y
326 set_kernel_config CONFIG_USB_CONFIGFS_F_PRINTER y
304 set_kernel_config CONFIG_LEDS_PCA963X m
327 set_kernel_config CONFIG_LEDS_PCA963X m
305 set_kernel_config CONFIG_LEDS_IS31FL32XX m
328 set_kernel_config CONFIG_LEDS_IS31FL32XX m
306 set_kernel_config CONFIG_LEDS_TRIGGER_NETDEV m
329 set_kernel_config CONFIG_LEDS_TRIGGER_NETDEV m
307 set_kernel_config CONFIG_RTC_DRV_RV3028 m
330 set_kernel_config CONFIG_RTC_DRV_RV3028 m
308 set_kernel_config CONFIG_AUXDISPLAY y
331 set_kernel_config CONFIG_AUXDISPLAY y
309 set_kernel_config CONFIG_HD44780 m
332 set_kernel_config CONFIG_HD44780 m
310 set_kernel_config CONFIG_FB_TFT_SH1106 m
333 set_kernel_config CONFIG_FB_TFT_SH1106 m
311 set_kernel_config CONFIG_VIDEO_CODEC_BCM2835 m
334 set_kernel_config CONFIG_VIDEO_CODEC_BCM2835 m
312 set_kernel_config CONFIG_BCM2835_POWER y
335 set_kernel_config CONFIG_BCM2835_POWER y
313 set_kernel_config CONFIG_INV_MPU6050_IIO m
336 set_kernel_config CONFIG_INV_MPU6050_IIO m
314 set_kernel_config CONFIG_INV_MPU6050_I2C m
337 set_kernel_config CONFIG_INV_MPU6050_I2C m
315 set_kernel_config CONFIG_SECURITYFS y
338 set_kernel_config CONFIG_SECURITYFS y
316
339
317 # Safer to build this in
340 # Safer to build this in
318 set_kernel_config CONFIG_BINFMT_MISC y
341 set_kernel_config CONFIG_BINFMT_MISC y
319
342
320 # pulseaudio wants a buffer of at least this size
343 # pulseaudio wants a buffer of at least this size
321 set_kernel_config CONFIG_SND_HDA_PREALLOC_SIZE 2048
344 set_kernel_config CONFIG_SND_HDA_PREALLOC_SIZE 2048
322
345
323 # PR#3063: enable 3D acceleration with 64-bit kernel on RPi4
346 # PR#3063: enable 3D acceleration with 64-bit kernel on RPi4
324 # set the appropriate kernel configs unlocked by this PR
347 # set the appropriate kernel configs unlocked by this PR
325 set_kernel_config CONFIG_ARCH_BCM y
348 set_kernel_config CONFIG_ARCH_BCM y
326 set_kernel_config CONFIG_ARCH_BCM2835 y
349 set_kernel_config CONFIG_ARCH_BCM2835 y
327 set_kernel_config CONFIG_DRM_V3D m
350 set_kernel_config CONFIG_DRM_V3D m
328 set_kernel_config CONFIG_DRM_VC4 m
351 set_kernel_config CONFIG_DRM_VC4 m
329 set_kernel_config CONFIG_DRM_VC4_HDMI_CEC y
352 set_kernel_config CONFIG_DRM_VC4_HDMI_CEC y
330
353
331 # PR#3144: add arm64 pcie bounce buffers; enables 4GiB on RPi4
354 # PR#3144: add arm64 pcie bounce buffers; enables 4GiB on RPi4
332 # required by PR#3144; should already be applied, but just to be safe
355 # required by PR#3144; should already be applied, but just to be safe
333 set_kernel_config CONFIG_PCIE_BRCMSTB y
356 set_kernel_config CONFIG_PCIE_BRCMSTB y
334 set_kernel_config CONFIG_BCM2835_MMC y
357 set_kernel_config CONFIG_BCM2835_MMC y
335
358
336 # Snap needs squashfs. The ubuntu eoan-preinstalled-server image at
359 # Snap needs squashfs. The ubuntu eoan-preinstalled-server image at
337 # http://cdimage.ubuntu.com/ubuntu-server/daily-preinstalled/current/ uses snap
360 # http://cdimage.ubuntu.com/ubuntu-server/daily-preinstalled/current/ uses snap
338 # during cloud-init setup at first boot. Without this the login accounts are not
361 # during cloud-init setup at first boot. Without this the login accounts are not
339 # created and the user can not login.
362 # created and the user can not login.
340 set_kernel_config CONFIG_SQUASHFS y
363 set_kernel_config CONFIG_SQUASHFS y
341
364
342 # Ceph support for Block Device (RBD) and Filesystem (FS)
365 # Ceph support for Block Device (RBD) and Filesystem (FS)
343 # https://docs.ceph.com/docs/master/
366 # https://docs.ceph.com/docs/master/
344 set_kernel_config CONFIG_CEPH_LIB m
367 set_kernel_config CONFIG_CEPH_LIB m
345 set_kernel_config CONFIG_CEPH_LIB_USE_DNS_RESOLVER y
368 set_kernel_config CONFIG_CEPH_LIB_USE_DNS_RESOLVER y
346 set_kernel_config CONFIG_CEPH_FS m
369 set_kernel_config CONFIG_CEPH_FS m
347 set_kernel_config CONFIG_CEPH_FSCACHE y
370 set_kernel_config CONFIG_CEPH_FSCACHE y
348 set_kernel_config CONFIG_CEPH_FS_POSIX_ACL y
371 set_kernel_config CONFIG_CEPH_FS_POSIX_ACL y
349 set_kernel_config CONFIG_BLK_DEV_RBD m
372 set_kernel_config CONFIG_BLK_DEV_RBD m
350 fi
373 fi
351
374
352 # enable basic KVM support; see https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=210546&start=25#p1300453
375 # enable basic KVM support; see https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=210546&start=25#p1300453
353 if [ "$KERNEL_VIRT" = true ] && { [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ]; } ; then
376 if [ "$KERNEL_VIRT" = true ] && { [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ]; } ; then
354 set_kernel_config CONFIG_HAVE_KVM y
377 set_kernel_config CONFIG_HAVE_KVM y
355 set_kernel_config CONFIG_HIGH_RES_TIMERS y
378 set_kernel_config CONFIG_HIGH_RES_TIMERS y
356 set_kernel_config CONFIG_HAVE_KVM_IRQCHIP y
379 set_kernel_config CONFIG_HAVE_KVM_IRQCHIP y
357 set_kernel_config CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL y
380 set_kernel_config CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL y
358 set_kernel_config CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT y
381 set_kernel_config CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT y
359 set_kernel_config CONFIG_HAVE_KVM_EVENTFD y
382 set_kernel_config CONFIG_HAVE_KVM_EVENTFD y
360 set_kernel_config CONFIG_HAVE_KVM_IRQFD y
383 set_kernel_config CONFIG_HAVE_KVM_IRQFD y
361 set_kernel_config CONFIG_HAVE_KVM_IRQ_ROUTING y
384 set_kernel_config CONFIG_HAVE_KVM_IRQ_ROUTING y
362 set_kernel_config CONFIG_HAVE_KVM_MSI y
385 set_kernel_config CONFIG_HAVE_KVM_MSI y
363 set_kernel_config CONFIG_KVM y
386 set_kernel_config CONFIG_KVM y
364 set_kernel_config CONFIG_KVM_ARM_HOST y
387 set_kernel_config CONFIG_KVM_ARM_HOST y
365 set_kernel_config CONFIG_KVM_ARM_PMU y
388 set_kernel_config CONFIG_KVM_ARM_PMU y
366 set_kernel_config CONFIG_KVM_COMPAT y
389 set_kernel_config CONFIG_KVM_COMPAT y
367 set_kernel_config CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT y
390 set_kernel_config CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT y
368 set_kernel_config CONFIG_KVM_MMIO y
391 set_kernel_config CONFIG_KVM_MMIO y
369 set_kernel_config CONFIG_KVM_VFIO y
392 set_kernel_config CONFIG_KVM_VFIO y
370 set_kernel_config CONFIG_KVM_MMU_AUDIT y
393 set_kernel_config CONFIG_KVM_MMU_AUDIT y
371 set_kernel_config CONFIG_VHOST m
394 set_kernel_config CONFIG_VHOST m
372 set_kernel_config CONFIG_VHOST_CROSS_ENDIAN_LEGACY y
395 set_kernel_config CONFIG_VHOST_CROSS_ENDIAN_LEGACY y
373 set_kernel_config CONFIG_VHOST_NET m
396 set_kernel_config CONFIG_VHOST_NET m
374 set_kernel_config CONFIG_VIRTUALIZATION y
397 set_kernel_config CONFIG_VIRTUALIZATION y
375 set_kernel_config CONFIG_SLAB_FREELIST_RANDOM=y
398 set_kernel_config CONFIG_SLAB_FREELIST_RANDOM=y
376 set_kernel_config CONFIG_SLAB_FREELIST_HARDENED=y
399 set_kernel_config CONFIG_SLAB_FREELIST_HARDENED=y
377 set_kernel_config CONFIG_MMU_NOTIFIER y
400 set_kernel_config CONFIG_MMU_NOTIFIER y
378
401
379 # erratum
402 # erratum
380 set_kernel_config ARM64_ERRATUM_834220 y
403 set_kernel_config ARM64_ERRATUM_834220 y
381
404
382 # https://sourceforge.net/p/kvm/mailman/message/18440797/
405 # https://sourceforge.net/p/kvm/mailman/message/18440797/
383 set_kernel_config CONFIG_PREEMPT_NOTIFIERS y
406 set_kernel_config CONFIG_PREEMPT_NOTIFIERS y
384 fi
407 fi
385
408
386 # enable apparmor,integrity audit,
409 # enable apparmor,integrity audit,
387 if [ "$KERNEL_SECURITY" = true ] ; then
410 if [ "$KERNEL_SECURITY" = true ] ; then
388
411
389 # security filesystem, security models and audit
412 # security filesystem, security models and audit
390 set_kernel_config CONFIG_SECURITYFS y
413 set_kernel_config CONFIG_SECURITYFS y
391 set_kernel_config CONFIG_SECURITY y
414 set_kernel_config CONFIG_SECURITY y
392 set_kernel_config CONFIG_AUDIT y
415 set_kernel_config CONFIG_AUDIT y
393
416
394 # harden strcpy and memcpy
417 # harden strcpy and memcpy
395 set_kernel_config CONFIG_HARDENED_USERCOPY y
418 set_kernel_config CONFIG_HARDENED_USERCOPY y
396 set_kernel_config CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR y
419 set_kernel_config CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR y
397 set_kernel_config CONFIG_FORTIFY_SOURCE y
420 set_kernel_config CONFIG_FORTIFY_SOURCE y
398
421
399 # integrity sub-system
422 # integrity sub-system
400 set_kernel_config CONFIG_INTEGRITY y
423 set_kernel_config CONFIG_INTEGRITY y
401 set_kernel_config CONFIG_INTEGRITY_ASYMMETRIC_KEYS y
424 set_kernel_config CONFIG_INTEGRITY_ASYMMETRIC_KEYS y
402 set_kernel_config CONFIG_INTEGRITY_AUDIT y
425 set_kernel_config CONFIG_INTEGRITY_AUDIT y
403 set_kernel_config CONFIG_INTEGRITY_SIGNATURE y
426 set_kernel_config CONFIG_INTEGRITY_SIGNATURE y
404 set_kernel_config CONFIG_INTEGRITY_TRUSTED_KEYRING y
427 set_kernel_config CONFIG_INTEGRITY_TRUSTED_KEYRING y
405
428
406 # This option provides support for retaining authentication tokens and access keys in the kernel.
429 # This option provides support for retaining authentication tokens and access keys in the kernel.
407 set_kernel_config CONFIG_KEYS y
430 set_kernel_config CONFIG_KEYS y
408 set_kernel_config CONFIG_KEYS_COMPAT y
431 set_kernel_config CONFIG_KEYS_COMPAT y
409
432
410 # Apparmor
433 # Apparmor
411 set_kernel_config CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE 0
434 set_kernel_config CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE 0
412 set_kernel_config CONFIG_SECURITY_APPARMOR_HASH_DEFAULT y
435 set_kernel_config CONFIG_SECURITY_APPARMOR_HASH_DEFAULT y
413 set_kernel_config CONFIG_DEFAULT_SECURITY_APPARMOR y
436 set_kernel_config CONFIG_DEFAULT_SECURITY_APPARMOR y
414 set_kernel_config CONFIG_SECURITY_APPARMOR y
437 set_kernel_config CONFIG_SECURITY_APPARMOR y
415 set_kernel_config CONFIG_SECURITY_APPARMOR_HASH y
438 set_kernel_config CONFIG_SECURITY_APPARMOR_HASH y
416 set_kernel_config CONFIG_DEFAULT_SECURITY "apparmor"
439 set_kernel_config CONFIG_DEFAULT_SECURITY "apparmor"
417
440
418 # restrictions on unprivileged users reading the kernel
441 # restrictions on unprivileged users reading the kernel
419 set_kernel_config CONFIG_SECURITY_DMESG_RESTRICT y
442 set_kernel_config CONFIG_SECURITY_DMESG_RESTRICT y
420
443
421 # network security hooks
444 # network security hooks
422 set_kernel_config CONFIG_SECURITY_NETWORK y
445 set_kernel_config CONFIG_SECURITY_NETWORK y
423 set_kernel_config CONFIG_SECURITY_NETWORK_XFRM y
446 set_kernel_config CONFIG_SECURITY_NETWORK_XFRM y
424 set_kernel_config CONFIG_SECURITY_PATH y
447 set_kernel_config CONFIG_SECURITY_PATH y
425 set_kernel_config CONFIG_SECURITY_YAMA n
448 set_kernel_config CONFIG_SECURITY_YAMA n
426
449
427 set_kernel_config CONFIG_SECURITY_SELINUX n
450 set_kernel_config CONFIG_SECURITY_SELINUX n
428 set_kernel_config CONFIG_SECURITY_SMACK n
451 set_kernel_config CONFIG_SECURITY_SMACK n
429 set_kernel_config CONFIG_SECURITY_TOMOYO n
452 set_kernel_config CONFIG_SECURITY_TOMOYO n
430 set_kernel_config CONFIG_SECURITY_APPARMOR_DEBUG n
453 set_kernel_config CONFIG_SECURITY_APPARMOR_DEBUG n
431 set_kernel_config CONFIG_SECURITY_LOADPIN n
454 set_kernel_config CONFIG_SECURITY_LOADPIN n
432 set_kernel_config CONFIG_HARDENED_USERCOPY_PAGESPAN n
455 set_kernel_config CONFIG_HARDENED_USERCOPY_PAGESPAN n
433 set_kernel_config CONFIG_IMA n
456 set_kernel_config CONFIG_IMA n
434 set_kernel_config CONFIG_EVM n
457 set_kernel_config CONFIG_EVM n
435 set_kernel_config CONFIG_FANOTIFY_ACCESS_PERMISSIONS y
458 set_kernel_config CONFIG_FANOTIFY_ACCESS_PERMISSIONS y
436 set_kernel_config CONFIG_NFSD_V4_SECURITY_LABEL y
459 set_kernel_config CONFIG_NFSD_V4_SECURITY_LABEL y
437 set_kernel_config CONFIG_PKCS7_MESSAGE_PARSER y
460 set_kernel_config CONFIG_PKCS7_MESSAGE_PARSER y
438 set_kernel_config CONFIG_SYSTEM_TRUSTED_KEYRING y
461 set_kernel_config CONFIG_SYSTEM_TRUSTED_KEYRING y
439 set_kernel_config CONFIG_SYSTEM_EXTRA_CERTIFICATE y
462 set_kernel_config CONFIG_SYSTEM_EXTRA_CERTIFICATE y
440 set_kernel_config CONFIG_SECONDARY_TRUSTED_KEYRING y
463 set_kernel_config CONFIG_SECONDARY_TRUSTED_KEYRING y
441 set_kernel_config CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY n
464 set_kernel_config CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY n
442 set_kernel_config CONFIG_SYSTEM_TRUSTED_KEYS m
465 set_kernel_config CONFIG_SYSTEM_TRUSTED_KEYS m
443 set_kernel_config CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE 4096
466 set_kernel_config CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE 4096
444
467
445 set_kernel_config CONFIG_ARM64_CRYPTO y
468 set_kernel_config CONFIG_ARM64_CRYPTO y
446 set_kernel_config CONFIG_CRYPTO_SHA256_ARM64 m
469 set_kernel_config CONFIG_CRYPTO_SHA256_ARM64 m
447 set_kernel_config CONFIG_CRYPTO_SHA512_ARM64 m
470 set_kernel_config CONFIG_CRYPTO_SHA512_ARM64 m
448 set_kernel_config CONFIG_CRYPTO_SHA1_ARM64_CE m
471 set_kernel_config CONFIG_CRYPTO_SHA1_ARM64_CE m
449 set_kernel_config CRYPTO_GHASH_ARM64_CE m
472 set_kernel_config CRYPTO_GHASH_ARM64_CE m
450 set_kernel_config CRYPTO_SHA2_ARM64_CE m
473 set_kernel_config CRYPTO_SHA2_ARM64_CE m
451 set_kernel_config CONFIG_CRYPTO_CRCT10DIF_ARM64_CE m
474 set_kernel_config CONFIG_CRYPTO_CRCT10DIF_ARM64_CE m
452 set_kernel_config CONFIG_CRYPTO_CRC32_ARM64_CE m
475 set_kernel_config CONFIG_CRYPTO_CRC32_ARM64_CE m
453 set_kernel_config CONFIG_CRYPTO_AES_ARM64 m
476 set_kernel_config CONFIG_CRYPTO_AES_ARM64 m
454 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE m
477 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE m
455 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE_CCM y
478 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE_CCM y
456 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE_BLK y
479 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE_BLK y
457 set_kernel_config CONFIG_CRYPTO_AES_ARM64_NEON_BLK m
480 set_kernel_config CONFIG_CRYPTO_AES_ARM64_NEON_BLK m
458 set_kernel_config CONFIG_CRYPTO_CHACHA20_NEON m
481 set_kernel_config CONFIG_CRYPTO_CHACHA20_NEON m
459 set_kernel_config CONFIG_CRYPTO_AES_ARM64_BS m
482 set_kernel_config CONFIG_CRYPTO_AES_ARM64_BS m
460 fi
483 fi
461
484
462 # Netfilter kernel support See https://github.com/raspberrypi/linux/issues/2177#issuecomment-354647406
485 # Netfilter kernel support See https://github.com/raspberrypi/linux/issues/2177#issuecomment-354647406
463 if [ "$KERNEL_NF" = true ] ; then
486 if [ "$KERNEL_NF" = true ] ; then
464 set_kernel_config CONFIG_IP_NF_SECURITY m
487 set_kernel_config CONFIG_IP_NF_SECURITY m
465 set_kernel_config CONFIG_NETLABEL y
488 set_kernel_config CONFIG_NETLABEL y
466 set_kernel_config CONFIG_IP6_NF_SECURITY m
489 set_kernel_config CONFIG_IP6_NF_SECURITY m
467 set_kernel_config CONFIG_IP_NF_TARGET_SYNPROXY m
490 set_kernel_config CONFIG_IP_NF_TARGET_SYNPROXY m
468 set_kernel_config CONFIG_NETFILTER_XT_TARGET_AUDIT m
491 set_kernel_config CONFIG_NETFILTER_XT_TARGET_AUDIT m
469 set_kernel_config CONFIG_NETFILTER_XT_MATCH_CGROUP m
492 set_kernel_config CONFIG_NETFILTER_XT_MATCH_CGROUP m
470 set_kernel_config CONFIG_NETFILTER_XT_MATCH_IPCOMP m
493 set_kernel_config CONFIG_NETFILTER_XT_MATCH_IPCOMP m
471 set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m
494 set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m
472 set_kernel_config CONFIG_NFT_FIB_INET m
495 set_kernel_config CONFIG_NFT_FIB_INET m
473 set_kernel_config CONFIG_NFT_FIB_IPV4 m
496 set_kernel_config CONFIG_NFT_FIB_IPV4 m
474 set_kernel_config CONFIG_NFT_FIB_IPV6 m
497 set_kernel_config CONFIG_NFT_FIB_IPV6 m
475 set_kernel_config CONFIG_NFT_FIB_NETDEV m
498 set_kernel_config CONFIG_NFT_FIB_NETDEV m
476 set_kernel_config CONFIG_NFT_OBJREF m
499 set_kernel_config CONFIG_NFT_OBJREF m
477 set_kernel_config CONFIG_NFT_RT m
500 set_kernel_config CONFIG_NFT_RT m
478 set_kernel_config CONFIG_NFT_SET_BITMAP m
501 set_kernel_config CONFIG_NFT_SET_BITMAP m
479 set_kernel_config CONFIG_NF_CONNTRACK_TIMEOUT y
502 set_kernel_config CONFIG_NF_CONNTRACK_TIMEOUT y
480 set_kernel_config CONFIG_NF_LOG_ARP m
503 set_kernel_config CONFIG_NF_LOG_ARP m
481 set_kernel_config CONFIG_NF_SOCKET_IPV4 m
504 set_kernel_config CONFIG_NF_SOCKET_IPV4 m
482 set_kernel_config CONFIG_NF_SOCKET_IPV6 m
505 set_kernel_config CONFIG_NF_SOCKET_IPV6 m
483 set_kernel_config CONFIG_BRIDGE_EBT_BROUTE m
506 set_kernel_config CONFIG_BRIDGE_EBT_BROUTE m
484 set_kernel_config CONFIG_BRIDGE_EBT_T_FILTER m
507 set_kernel_config CONFIG_BRIDGE_EBT_T_FILTER m
485 set_kernel_config CONFIG_BRIDGE_NF_EBTABLES m
508 set_kernel_config CONFIG_BRIDGE_NF_EBTABLES m
486 set_kernel_config CONFIG_IP6_NF_IPTABLES m
509 set_kernel_config CONFIG_IP6_NF_IPTABLES m
487 set_kernel_config CONFIG_IP6_NF_MATCH_AH m
510 set_kernel_config CONFIG_IP6_NF_MATCH_AH m
488 set_kernel_config CONFIG_IP6_NF_MATCH_EUI64 m
511 set_kernel_config CONFIG_IP6_NF_MATCH_EUI64 m
489 set_kernel_config CONFIG_IP6_NF_NAT m
512 set_kernel_config CONFIG_IP6_NF_NAT m
490 set_kernel_config CONFIG_IP6_NF_TARGET_MASQUERADE m
513 set_kernel_config CONFIG_IP6_NF_TARGET_MASQUERADE m
491 set_kernel_config CONFIG_IP6_NF_TARGET_NPT m
514 set_kernel_config CONFIG_IP6_NF_TARGET_NPT m
492 set_kernel_config CONFIG_IP_SET_BITMAP_IPMAC m
515 set_kernel_config CONFIG_IP_SET_BITMAP_IPMAC m
493 set_kernel_config CONFIG_IP_SET_BITMAP_PORT m
516 set_kernel_config CONFIG_IP_SET_BITMAP_PORT m
494 set_kernel_config CONFIG_IP_SET_HASH_IP m
517 set_kernel_config CONFIG_IP_SET_HASH_IP m
495 set_kernel_config CONFIG_IP_SET_HASH_IPMARK m
518 set_kernel_config CONFIG_IP_SET_HASH_IPMARK m
496 set_kernel_config CONFIG_IP_SET_HASH_IPPORT m
519 set_kernel_config CONFIG_IP_SET_HASH_IPPORT m
497 set_kernel_config CONFIG_IP_SET_HASH_IPPORTIP m
520 set_kernel_config CONFIG_IP_SET_HASH_IPPORTIP m
498 set_kernel_config CONFIG_IP_SET_HASH_IPPORTNET m
521 set_kernel_config CONFIG_IP_SET_HASH_IPPORTNET m
499 set_kernel_config CONFIG_IP_SET_HASH_MAC m
522 set_kernel_config CONFIG_IP_SET_HASH_MAC m
500 set_kernel_config CONFIG_IP_SET_HASH_NET m
523 set_kernel_config CONFIG_IP_SET_HASH_NET m
501 set_kernel_config CONFIG_IP_SET_HASH_NETIFACE m
524 set_kernel_config CONFIG_IP_SET_HASH_NETIFACE m
502 set_kernel_config CONFIG_IP_SET_HASH_NETNET m
525 set_kernel_config CONFIG_IP_SET_HASH_NETNET m
503 set_kernel_config CONFIG_IP_SET_HASH_NETPORT m
526 set_kernel_config CONFIG_IP_SET_HASH_NETPORT m
504 set_kernel_config CONFIG_IP_SET_HASH_NETPORTNET m
527 set_kernel_config CONFIG_IP_SET_HASH_NETPORTNET m
505 set_kernel_config CONFIG_IP_SET_LIST_SET m
528 set_kernel_config CONFIG_IP_SET_LIST_SET m
506 set_kernel_config CONFIG_NETFILTER_XTABLES m
529 set_kernel_config CONFIG_NETFILTER_XTABLES m
507 set_kernel_config CONFIG_NETFILTER_XTABLES m
530 set_kernel_config CONFIG_NETFILTER_XTABLES m
508 set_kernel_config CONFIG_NFT_BRIDGE_META m
531 set_kernel_config CONFIG_NFT_BRIDGE_META m
509 set_kernel_config CONFIG_NFT_BRIDGE_REJECT m
532 set_kernel_config CONFIG_NFT_BRIDGE_REJECT m
510 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV4 m
533 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV4 m
511 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m
534 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m
512 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV4 m
535 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV4 m
513 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m
536 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m
514 set_kernel_config CONFIG_NFT_COMPAT m
537 set_kernel_config CONFIG_NFT_COMPAT m
515 set_kernel_config CONFIG_NFT_COUNTER m
538 set_kernel_config CONFIG_NFT_COUNTER m
516 set_kernel_config CONFIG_NFT_CT m
539 set_kernel_config CONFIG_NFT_CT m
517 set_kernel_config CONFIG_NFT_DUP_IPV4 m
540 set_kernel_config CONFIG_NFT_DUP_IPV4 m
518 set_kernel_config CONFIG_NFT_DUP_IPV6 m
541 set_kernel_config CONFIG_NFT_DUP_IPV6 m
519 set_kernel_config CONFIG_NFT_DUP_NETDEV m
542 set_kernel_config CONFIG_NFT_DUP_NETDEV m
520 set_kernel_config CONFIG_NFT_EXTHDR m
543 set_kernel_config CONFIG_NFT_EXTHDR m
521 set_kernel_config CONFIG_NFT_FWD_NETDEV m
544 set_kernel_config CONFIG_NFT_FWD_NETDEV m
522 set_kernel_config CONFIG_NFT_HASH m
545 set_kernel_config CONFIG_NFT_HASH m
523 set_kernel_config CONFIG_NFT_LIMIT m
546 set_kernel_config CONFIG_NFT_LIMIT m
524 set_kernel_config CONFIG_NFT_LOG m
547 set_kernel_config CONFIG_NFT_LOG m
525 set_kernel_config CONFIG_NFT_MASQ m
548 set_kernel_config CONFIG_NFT_MASQ m
526 set_kernel_config CONFIG_NFT_MASQ_IPV4 m
549 set_kernel_config CONFIG_NFT_MASQ_IPV4 m
527 set_kernel_config CONFIG_NFT_MASQ_IPV6 m
550 set_kernel_config CONFIG_NFT_MASQ_IPV6 m
528 set_kernel_config CONFIG_NFT_META m
551 set_kernel_config CONFIG_NFT_META m
529 set_kernel_config CONFIG_NFT_NAT m
552 set_kernel_config CONFIG_NFT_NAT m
530 set_kernel_config CONFIG_NFT_NUMGEN m
553 set_kernel_config CONFIG_NFT_NUMGEN m
531 set_kernel_config CONFIG_NFT_QUEUE m
554 set_kernel_config CONFIG_NFT_QUEUE m
532 set_kernel_config CONFIG_NFT_QUOTA m
555 set_kernel_config CONFIG_NFT_QUOTA m
533 set_kernel_config CONFIG_NFT_REDIR m
556 set_kernel_config CONFIG_NFT_REDIR m
534 set_kernel_config CONFIG_NFT_REDIR_IPV4 m
557 set_kernel_config CONFIG_NFT_REDIR_IPV4 m
535 set_kernel_config CONFIG_NFT_REDIR_IPV6 m
558 set_kernel_config CONFIG_NFT_REDIR_IPV6 m
536 set_kernel_config CONFIG_NFT_REJECT m
559 set_kernel_config CONFIG_NFT_REJECT m
537 set_kernel_config CONFIG_NFT_REJECT_INET m
560 set_kernel_config CONFIG_NFT_REJECT_INET m
538 set_kernel_config CONFIG_NFT_REJECT_IPV4 m
561 set_kernel_config CONFIG_NFT_REJECT_IPV4 m
539 set_kernel_config CONFIG_NFT_REJECT_IPV6 m
562 set_kernel_config CONFIG_NFT_REJECT_IPV6 m
540 set_kernel_config CONFIG_NFT_SET_HASH m
563 set_kernel_config CONFIG_NFT_SET_HASH m
541 set_kernel_config CONFIG_NFT_SET_RBTREE m
564 set_kernel_config CONFIG_NFT_SET_RBTREE m
542 set_kernel_config CONFIG_NF_CONNTRACK_IPV4 m
565 set_kernel_config CONFIG_NF_CONNTRACK_IPV4 m
543 set_kernel_config CONFIG_NF_CONNTRACK_IPV6 m
566 set_kernel_config CONFIG_NF_CONNTRACK_IPV6 m
544 set_kernel_config CONFIG_NF_DEFRAG_IPV4 m
567 set_kernel_config CONFIG_NF_DEFRAG_IPV4 m
545 set_kernel_config CONFIG_NF_DEFRAG_IPV6 m
568 set_kernel_config CONFIG_NF_DEFRAG_IPV6 m
546 set_kernel_config CONFIG_NF_DUP_IPV4 m
569 set_kernel_config CONFIG_NF_DUP_IPV4 m
547 set_kernel_config CONFIG_NF_DUP_IPV6 m
570 set_kernel_config CONFIG_NF_DUP_IPV6 m
548 set_kernel_config CONFIG_NF_DUP_NETDEV m
571 set_kernel_config CONFIG_NF_DUP_NETDEV m
549 set_kernel_config CONFIG_NF_LOG_BRIDGE m
572 set_kernel_config CONFIG_NF_LOG_BRIDGE m
550 set_kernel_config CONFIG_NF_LOG_IPV4 m
573 set_kernel_config CONFIG_NF_LOG_IPV4 m
551 set_kernel_config CONFIG_NF_LOG_IPV6 m
574 set_kernel_config CONFIG_NF_LOG_IPV6 m
552 set_kernel_config CONFIG_NF_NAT_IPV4 m
575 set_kernel_config CONFIG_NF_NAT_IPV4 m
553 set_kernel_config CONFIG_NF_NAT_IPV6 m
576 set_kernel_config CONFIG_NF_NAT_IPV6 m
554 set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV4 y
577 set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV4 y
555 set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV6 y
578 set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV6 y
556 set_kernel_config CONFIG_NF_NAT_PPTP m
579 set_kernel_config CONFIG_NF_NAT_PPTP m
557 set_kernel_config CONFIG_NF_NAT_PROTO_GRE m
580 set_kernel_config CONFIG_NF_NAT_PROTO_GRE m
558 set_kernel_config CONFIG_NF_NAT_REDIRECT y
581 set_kernel_config CONFIG_NF_NAT_REDIRECT y
559 set_kernel_config CONFIG_NF_NAT_SIP m
582 set_kernel_config CONFIG_NF_NAT_SIP m
560 set_kernel_config CONFIG_NF_NAT_SNMP_BASIC m
583 set_kernel_config CONFIG_NF_NAT_SNMP_BASIC m
561 set_kernel_config CONFIG_NF_NAT_TFTP m
584 set_kernel_config CONFIG_NF_NAT_TFTP m
562 set_kernel_config CONFIG_NF_REJECT_IPV4 m
585 set_kernel_config CONFIG_NF_REJECT_IPV4 m
563 set_kernel_config CONFIG_NF_REJECT_IPV6 m
586 set_kernel_config CONFIG_NF_REJECT_IPV6 m
564 set_kernel_config CONFIG_NF_TABLES m
587 set_kernel_config CONFIG_NF_TABLES m
565 set_kernel_config CONFIG_NF_TABLES_ARP m
588 set_kernel_config CONFIG_NF_TABLES_ARP m
566 set_kernel_config CONFIG_NF_TABLES_BRIDGE m
589 set_kernel_config CONFIG_NF_TABLES_BRIDGE m
567 set_kernel_config CONFIG_NF_TABLES_INET m
590 set_kernel_config CONFIG_NF_TABLES_INET m
568 set_kernel_config CONFIG_NF_TABLES_IPV4 y
591 set_kernel_config CONFIG_NF_TABLES_IPV4 y
569 set_kernel_config CONFIG_NF_TABLES_IPV6 y
592 set_kernel_config CONFIG_NF_TABLES_IPV6 y
570 set_kernel_config CONFIG_NF_TABLES_NETDEV m
593 set_kernel_config CONFIG_NF_TABLES_NETDEV m
571 set_kernel_config CONFIG_NF_TABLES_SET m
594 set_kernel_config CONFIG_NF_TABLES_SET m
572 set_kernel_config CONFIG_NF_TABLES_INET y
595 set_kernel_config CONFIG_NF_TABLES_INET y
573 set_kernel_config CONFIG_NF_TABLES_NETDEV y
596 set_kernel_config CONFIG_NF_TABLES_NETDEV y
574 set_kernel_config CONFIG_NFT_CONNLIMIT m
597 set_kernel_config CONFIG_NFT_CONNLIMIT m
575 set_kernel_config CONFIG_NFT_TUNNEL m
598 set_kernel_config CONFIG_NFT_TUNNEL m
576 set_kernel_config CONFIG_NFT_SOCKET m
599 set_kernel_config CONFIG_NFT_SOCKET m
577 set_kernel_config CONFIG_NFT_TPROXY m
600 set_kernel_config CONFIG_NFT_TPROXY m
578 set_kernel_config CONFIG_NF_FLOW_TABLE m
601 set_kernel_config CONFIG_NF_FLOW_TABLE m
579 set_kernel_config CONFIG_NFT_FLOW_OFFLOAD m
602 set_kernel_config CONFIG_NFT_FLOW_OFFLOAD m
580 set_kernel_config CONFIG_NF_FLOW_TABLE_INET m
603 set_kernel_config CONFIG_NF_FLOW_TABLE_INET m
581 set_kernel_config CONFIG_NF_TABLES_ARP y
604 set_kernel_config CONFIG_NF_TABLES_ARP y
582 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV4 y
605 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV4 y
583 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV6 y
606 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV6 y
584 set_kernel_config CONFIG_NF_TABLES_BRIDGE y
607 set_kernel_config CONFIG_NF_TABLES_BRIDGE y
585 set_kernel_config CONFIG_NF_CT_NETLINK_TIMEOUT m
608 set_kernel_config CONFIG_NF_CT_NETLINK_TIMEOUT m
586 set_kernel_config CONFIG_NFT_OSF m
609 set_kernel_config CONFIG_NFT_OSF m
587
610
588 fi
611 fi
589
612
590 # Enables BPF syscall for systemd-journald see https://github.com/torvalds/linux/blob/master/init/Kconfig#L848 or https://groups.google.com/forum/#!topic/linux.gentoo.user/_2aSc_ztGpA
613 # Enables BPF syscall for systemd-journald see https://github.com/torvalds/linux/blob/master/init/Kconfig#L848 or https://groups.google.com/forum/#!topic/linux.gentoo.user/_2aSc_ztGpA
591 if [ "$KERNEL_BPF" = true ] ; then
614 if [ "$KERNEL_BPF" = true ] ; then
592 set_kernel_config CONFIG_BPF_SYSCALL y
615 set_kernel_config CONFIG_BPF_SYSCALL y
593 set_kernel_config CONFIG_BPF_EVENTS y
616 set_kernel_config CONFIG_BPF_EVENTS y
594 set_kernel_config CONFIG_BPF_STREAM_PARSER y
617 set_kernel_config CONFIG_BPF_STREAM_PARSER y
595 set_kernel_config CONFIG_CGROUP_BPF y
618 set_kernel_config CONFIG_CGROUP_BPF y
596 set_kernel_config CONFIG_XDP_SOCKETS y
619 set_kernel_config CONFIG_XDP_SOCKETS y
597 fi
620 fi
598
621
599 # KERNEL_DEFAULT_GOV was set by user
622 # KERNEL_DEFAULT_GOV was set by user
600 if [ "$KERNEL_DEFAULT_GOV" != powersave ] && [ -n "$KERNEL_DEFAULT_GOV" ] ; then
623 if [ "$KERNEL_DEFAULT_GOV" != powersave ] && [ -n "$KERNEL_DEFAULT_GOV" ] ; then
601
624
602 case "$KERNEL_DEFAULT_GOV" in
625 case "$KERNEL_DEFAULT_GOV" in
603 performance)
626 performance)
604 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y
627 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y
605 ;;
628 ;;
606 userspace)
629 userspace)
607 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y
630 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y
608 ;;
631 ;;
609 ondemand)
632 ondemand)
610 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y
633 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y
611 ;;
634 ;;
612 conservative)
635 conservative)
613 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y
636 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y
614 ;;
637 ;;
615 shedutil)
638 shedutil)
616 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y
639 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y
617 ;;
640 ;;
618 *)
641 *)
619 echo "error: unsupported default cpu governor"
642 echo "error: unsupported default cpu governor"
620 exit 1
643 exit 1
621 ;;
644 ;;
622 esac
645 esac
623
646
624 # unset previous default governor
647 # unset previous default governor
625 unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
648 unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
626 fi
649 fi
627
650
628 #Revert to previous directory
651 #Revert to previous directory
629 cd "${WORKDIR}" || exit
652 cd "${WORKDIR}" || exit
630
653
631 # Set kernel configuration parameters to enable qemu emulation
654 # Set kernel configuration parameters to enable qemu emulation
632 if [ "$ENABLE_QEMU" = true ] ; then
655 if [ "$ENABLE_QEMU" = true ] ; then
633 echo "CONFIG_FHANDLE=y" >> "${KERNEL_DIR}"/.config
656 echo "CONFIG_FHANDLE=y" >> "${KERNEL_DIR}"/.config
634 echo "CONFIG_LBDAF=y" >> "${KERNEL_DIR}"/.config
657 echo "CONFIG_LBDAF=y" >> "${KERNEL_DIR}"/.config
635
658
636 if [ "$ENABLE_CRYPTFS" = true ] ; then
659 if [ "$ENABLE_CRYPTFS" = true ] ; then
637 {
660 {
638 echo "CONFIG_EMBEDDED=y"
661 echo "CONFIG_EMBEDDED=y"
639 echo "CONFIG_EXPERT=y"
662 echo "CONFIG_EXPERT=y"
640 echo "CONFIG_DAX=y"
663 echo "CONFIG_DAX=y"
641 echo "CONFIG_MD=y"
664 echo "CONFIG_MD=y"
642 echo "CONFIG_BLK_DEV_MD=y"
665 echo "CONFIG_BLK_DEV_MD=y"
643 echo "CONFIG_MD_AUTODETECT=y"
666 echo "CONFIG_MD_AUTODETECT=y"
644 echo "CONFIG_BLK_DEV_DM=y"
667 echo "CONFIG_BLK_DEV_DM=y"
645 echo "CONFIG_BLK_DEV_DM_BUILTIN=y"
668 echo "CONFIG_BLK_DEV_DM_BUILTIN=y"
646 echo "CONFIG_DM_CRYPT=y"
669 echo "CONFIG_DM_CRYPT=y"
647 echo "CONFIG_CRYPTO_BLKCIPHER=y"
670 echo "CONFIG_CRYPTO_BLKCIPHER=y"
648 echo "CONFIG_CRYPTO_CBC=y"
671 echo "CONFIG_CRYPTO_CBC=y"
649 echo "CONFIG_CRYPTO_XTS=y"
672 echo "CONFIG_CRYPTO_XTS=y"
650 echo "CONFIG_CRYPTO_SHA512=y"
673 echo "CONFIG_CRYPTO_SHA512=y"
651 echo "CONFIG_CRYPTO_MANAGER=y"
674 echo "CONFIG_CRYPTO_MANAGER=y"
652 } >> "${KERNEL_DIR}"/.config
675 } >> "${KERNEL_DIR}"/.config
653 fi
676 fi
654 fi
677 fi
655
678
656 # Copy custom kernel configuration file
679 # Copy custom kernel configuration file
657 if [ -n "$KERNELSRC_USRCONFIG" ] ; then
680 if [ -n "$KERNELSRC_USRCONFIG" ] ; then
658 cp "$KERNELSRC_USRCONFIG" "${KERNEL_DIR}"/.config
681 cp "$KERNELSRC_USRCONFIG" "${KERNEL_DIR}"/.config
659 fi
682 fi
660
683
661 # Set kernel configuration parameters to their default values
684 # Set kernel configuration parameters to their default values
662 if [ "$KERNEL_OLDDEFCONFIG" = true ] ; then
685 if [ "$KERNEL_OLDDEFCONFIG" = true ] ; then
663 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig
686 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig
664 fi
687 fi
665
688
666 # Start menu-driven kernel configuration (interactive)
689 # Start menu-driven kernel configuration (interactive)
667 if [ "$KERNEL_MENUCONFIG" = true ] ; then
690 if [ "$KERNEL_MENUCONFIG" = true ] ; then
668 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
691 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
669 fi
692 fi
670 # end if "$KERNELSRC_CONFIG" = true
693 # end if "$KERNELSRC_CONFIG" = true
671 fi
694 fi
672
695
673 # Use ccache to cross compile the kernel
696 # Use ccache to cross compile the kernel
674 if [ "$KERNEL_CCACHE" = true ] ; then
697 if [ "$KERNEL_CCACHE" = true ] ; then
675 cc="ccache ${CROSS_COMPILE}gcc"
698 cc="ccache ${CROSS_COMPILE}gcc"
676 else
699 else
677 cc="${CROSS_COMPILE}gcc"
700 cc="${CROSS_COMPILE}gcc"
678 fi
701 fi
679
702
680 # Cross compile kernel and dtbs
703 # Cross compile kernel and dtbs
681 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs
704 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs
682
705
683 # Cross compile kernel modules
706 # Cross compile kernel modules
684 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
707 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
685 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules
708 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules
686 fi
709 fi
687 # end if "$KERNELSRC_PREBUILT" = false
710 # end if "$KERNELSRC_PREBUILT" = false
688 fi
711 fi
689
712
690 # Check if kernel compilation was successful
713 # Check if kernel compilation was successful
691 if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then
714 if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then
692 echo "error: kernel compilation failed! (kernel image not found)"
715 echo "error: kernel compilation failed! (kernel image not found)"
693 cleanup
716 cleanup
694 exit 1
717 exit 1
695 fi
718 fi
696
719
697 # Install kernel modules
720 # Install kernel modules
698 if [ "$ENABLE_REDUCE" = true ] ; then
721 if [ "$ENABLE_REDUCE" = true ] ; then
699 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
722 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
700 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
723 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
701 fi
724 fi
702 else
725 else
703 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
726 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
704 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
727 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
705 fi
728 fi
706
729
707 # Install kernel firmware
730 # Install kernel firmware
708 if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then
731 if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then
709 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
732 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
710 fi
733 fi
711 fi
734 fi
712
735
713 # Install kernel headers
736 # Install kernel headers
714 if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then
737 if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then
715 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
738 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
716 fi
739 fi
717
740
718 # Prepare boot (firmware) directory
741 # Prepare boot (firmware) directory
719 mkdir "${BOOT_DIR}"
742 mkdir "${BOOT_DIR}"
720
743
721 # Get kernel release version
744 # Get kernel release version
722 KERNEL_VERSION=$(cat "${KERNEL_DIR}/include/config/kernel.release")
745 KERNEL_VERSION=$(cat "${KERNEL_DIR}/include/config/kernel.release")
723
746
724 # Copy kernel configuration file to the boot directory
747 # Copy kernel configuration file to the boot directory
725 install_readonly "${KERNEL_DIR}/.config" "${R}/boot/config-${KERNEL_VERSION}"
748 install_readonly "${KERNEL_DIR}/.config" "${R}/boot/config-${KERNEL_VERSION}"
726
749
727 # Prepare device tree directory
750 # Prepare device tree directory
728 mkdir "${BOOT_DIR}/overlays"
751 mkdir "${BOOT_DIR}/overlays"
729
752
730 # Ensure the proper .dtb is located
753 # Ensure the proper .dtb is located
731 if [ "$KERNEL_ARCH" = "arm" ] ; then
754 if [ "$KERNEL_ARCH" = "arm" ] ; then
732 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do
755 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do
733 if [ -f "${dtb}" ] ; then
756 if [ -f "${dtb}" ] ; then
734 install_readonly "${dtb}" "${BOOT_DIR}/"
757 install_readonly "${dtb}" "${BOOT_DIR}/"
735 fi
758 fi
736 done
759 done
737 else
760 else
738 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb ; do
761 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb ; do
739 if [ -f "${dtb}" ] ; then
762 if [ -f "${dtb}" ] ; then
740 install_readonly "${dtb}" "${BOOT_DIR}/"
763 install_readonly "${dtb}" "${BOOT_DIR}/"
741 fi
764 fi
742 done
765 done
743 fi
766 fi
744
767
745 # Copy compiled dtb device tree files
768 # Copy compiled dtb device tree files
746 if [ -d "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays" ] ; then
769 if [ -d "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays" ] ; then
747 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtbo ; do
770 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtbo ; do
748 if [ -f "${dtb}" ] ; then
771 if [ -f "${dtb}" ] ; then
749 install_readonly "${dtb}" "${BOOT_DIR}/overlays/"
772 install_readonly "${dtb}" "${BOOT_DIR}/overlays/"
750 fi
773 fi
751 done
774 done
752
775
753 if [ -f "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" ] ; then
776 if [ -f "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" ] ; then
754 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README"
777 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README"
755 fi
778 fi
756 fi
779 fi
757
780
758 if [ "$ENABLE_UBOOT" = false ] ; then
781 if [ "$ENABLE_UBOOT" = false ] ; then
759 # Convert and copy kernel image to the boot directory
782 # Convert and copy kernel image to the boot directory
760 "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
783 "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
761 else
784 else
762 # Copy kernel image to the boot directory
785 # Copy kernel image to the boot directory
763 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
786 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
764 fi
787 fi
765
788
766 # Remove kernel sources
789 # Remove kernel sources
767 if [ "$KERNEL_REMOVESRC" = true ] ; then
790 if [ "$KERNEL_REMOVESRC" = true ] ; then
768 rm -fr "${KERNEL_DIR}"
791 rm -fr "${KERNEL_DIR}"
769 else
792 else
770 # Prepare compiled kernel modules
793 # Prepare compiled kernel modules
771 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
794 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
772 if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then
795 if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then
773 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare
796 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare
774 fi
797 fi
775
798
776 # Create symlinks for kernel modules
799 # Create symlinks for kernel modules
777 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build"
800 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build"
778 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source"
801 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source"
779 fi
802 fi
780 fi
803 fi
781
804
782 else # BUILD_KERNEL=false
805 else # BUILD_KERNEL=false
783 if [ "$SET_ARCH" = 64 ] ; then
806 if [ "$SET_ARCH" = 64 ] ; then
784 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
807 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
785 # Use Sakakis modified kernel if ZSWAP is active
808 # Use Sakakis modified kernel if ZSWAP is active
786 if [ "$KERNEL_ZSWAP" = true ] || [ "$KERNEL_VIRT" = true ] || [ "$KERNEL_NF" = true ] || [ "$KERNEL_BPF" = true ] ; then
809 if [ "$KERNEL_ZSWAP" = true ] || [ "$KERNEL_VIRT" = true ] || [ "$KERNEL_NF" = true ] || [ "$KERNEL_BPF" = true ] ; then
787 RPI3_64_KERNEL_URL="${RPI3_64_BIS_KERNEL_URL}"
810 RPI3_64_KERNEL_URL="${RPI3_64_BIS_KERNEL_URL}"
788 fi
811 fi
789
812
790 # Create temporary directory for dl
813 # Create temporary directory for dl
791 temp_dir=$(as_nobody mktemp -d)
814 temp_dir=$(as_nobody mktemp -d)
792
815
793 # Fetch kernel dl
816 # Fetch kernel dl
794 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL"
817 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL"
795 fi
818 fi
796 if [ "$SET_ARCH" = 64 ] && [ "$RPI_MODEL" = 4 ] ; then
819 if [ "$SET_ARCH" = 64 ] && [ "$RPI_MODEL" = 4 ] ; then
797 # Create temporary directory for dl
820 # Create temporary directory for dl
798 temp_dir=$(as_nobody mktemp -d)
821 temp_dir=$(as_nobody mktemp -d)
799
822
800 # Fetch kernel dl
823 # Fetch kernel dl
801 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI4_64_KERNEL_URL"
824 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI4_64_KERNEL_URL"
802 fi
825 fi
803
826
804 #extract download
827 #extract download
805 tar -xJf "${temp_dir}"/kernel.tar.xz -C "${temp_dir}"
828 tar -xJf "${temp_dir}"/kernel.tar.xz -C "${temp_dir}"
806
829
807 #move extracted kernel to /boot/firmware
830 #move extracted kernel to /boot/firmware
808 mkdir "${R}/boot/firmware"
831 mkdir "${R}/boot/firmware"
809 cp "${temp_dir}"/boot/* "${R}"/boot/firmware/
832 cp "${temp_dir}"/boot/* "${R}"/boot/firmware/
810 cp -r "${temp_dir}"/lib/* "${R}"/lib/
833 cp -r "${temp_dir}"/lib/* "${R}"/lib/
811
834
812 # Remove temporary directory for kernel sources
835 # Remove temporary directory for kernel sources
813 rm -fr "${temp_dir}"
836 rm -fr "${temp_dir}"
814
837
815 # Set permissions of the kernel sources
838 # Set permissions of the kernel sources
816 chown -R root:root "${R}/boot/firmware"
839 chown -R root:root "${R}/boot/firmware"
817 chown -R root:root "${R}/lib/modules"
840 chown -R root:root "${R}/lib/modules"
818 fi
841 fi
819
842
820 # Install Kernel from hypriot comptabile with all Raspberry PI (dunno if its compatible with RPI4 - better compile your own kernel)
843 # Install Kernel from hypriot comptabile with all Raspberry PI (dunno if its compatible with RPI4 - better compile your own kernel)
821 if [ "$SET_ARCH" = 32 ] && [ "$RPI_MODEL" != 4 ] ; then
844 if [ "$SET_ARCH" = 32 ] && [ "$RPI_MODEL" != 4 ] ; then
822 # Create temporary directory for dl
845 # Create temporary directory for dl
823 temp_dir=$(as_nobody mktemp -d)
846 temp_dir=$(as_nobody mktemp -d)
824
847
825 # Fetch kernel
848 # Fetch kernel
826 as_nobody wget -O "${temp_dir}"/kernel.deb -c "$RPI_32_KERNEL_URL"
849 as_nobody wget -O "${temp_dir}"/kernel.deb -c "$RPI_32_KERNEL_URL"
827
850
828 # Copy downloaded kernel package
851 # Copy downloaded kernel package
829 mv "${temp_dir}"/kernel.deb "${R}"/tmp/kernel.deb
852 mv "${temp_dir}"/kernel.deb "${R}"/tmp/kernel.deb
830
853
831 # Set permissions
854 # Set permissions
832 chown -R root:root "${R}"/tmp/kernel.deb
855 chown -R root:root "${R}"/tmp/kernel.deb
833
856
834 # Install kernel
857 # Install kernel
835 chroot_exec dpkg -i /tmp/kernel.deb
858 chroot_exec dpkg -i /tmp/kernel.deb
836
859
837 # move /boot to /boot/firmware to fit script env.
860 # move /boot to /boot/firmware to fit script env.
838 #mkdir "${BOOT_DIR}"
861 #mkdir "${BOOT_DIR}"
839 mkdir "${temp_dir}"/firmware
862 mkdir "${temp_dir}"/firmware
840 mv "${R}"/boot/* "${temp_dir}"/firmware/
863 mv "${R}"/boot/* "${temp_dir}"/firmware/
841 mv "${temp_dir}"/firmware "${R}"/boot/
864 mv "${temp_dir}"/firmware "${R}"/boot/
842
865
843 #same for kernel headers
866 #same for kernel headers
844 if [ "$KERNEL_HEADERS" = true ] ; then
867 if [ "$KERNEL_HEADERS" = true ] ; then
845 # Fetch kernel header
868 # Fetch kernel header
846 as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL"
869 as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL"
847 mv "${temp_dir}"/kernel-header.deb "${R}"/tmp/kernel-header.deb
870 mv "${temp_dir}"/kernel-header.deb "${R}"/tmp/kernel-header.deb
848 chown -R root:root "${R}"/tmp/kernel-header.deb
871 chown -R root:root "${R}"/tmp/kernel-header.deb
849 # Install kernel header
872 # Install kernel header
850 chroot_exec dpkg -i /tmp/kernel-header.deb
873 chroot_exec dpkg -i /tmp/kernel-header.deb
851 rm -f "${R}"/tmp/kernel-header.deb
874 rm -f "${R}"/tmp/kernel-header.deb
852 fi
875 fi
853
876
854 # Remove temporary directory and files
877 # Remove temporary directory and files
855 rm -fr "${temp_dir}"
878 rm -fr "${temp_dir}"
856 rm -f "${R}"/tmp/kernel.deb
879 rm -f "${R}"/tmp/kernel.deb
857 fi
880 fi
858
881
859 # Check if kernel installation was successful
882 # Check if kernel installation was successful
860 KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)"
883 KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)"
861 if [ -z "$KERNEL" ] ; then
884 if [ -z "$KERNEL" ] ; then
862 echo "error: kernel installation failed! (/boot/kernel* not found)"
885 echo "error: kernel installation failed! (/boot/kernel* not found)"
863 cleanup
886 cleanup
864 exit 1
887 exit 1
865 fi
888 fi
866 fi
889 fi
@@ -1,116 +1,120
1 #
1 #
2 # Setup fstab and initramfs
2 # Setup fstab and initramfs
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Install and setup fstab
8 # Install and setup fstab
9 install_readonly files/mount/fstab "${ETC_DIR}/fstab"
9 install_readonly files/mount/fstab "${ETC_DIR}/fstab"
10
10
11 # Add usb/sda disk root partition to fstab
12 if [ "$ENABLE_SPLITFS" = true ] && [ "$ENABLE_CRYPTFS" = false ] ; then
13 sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/fstab"
14 fi
15
16 # Add encrypted root partition to fstab and crypttab
17 if [ "$ENABLE_CRYPTFS" = true ] ; then
18 # Replace fstab root partition with encrypted partition mapping
19 sed -i "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING}/" "${ETC_DIR}/fstab"
20
21 # Add encrypted partition to crypttab and fstab
22 install_readonly files/mount/crypttab "${ETC_DIR}/crypttab"
23 echo "${CRYPTFS_MAPPING} /dev/mmcblk0p2 none luks,initramfs" >> "${ETC_DIR}/crypttab"
24
25 if [ "$ENABLE_SPLITFS" = true ] ; then
26 # Add usb/sda1 disk to crypttab
27 sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/crypttab"
28 fi
29 fi
30
31 if [ "$ENABLE_USBBOOT" = true ] ; then
32 sed -i "s/mmcblk0p1/sda1/" "${ETC_DIR}/fstab"
33 sed -i "s/mmcblk0p2/sda2/" "${ETC_DIR}/fstab"
34
35 # Add usb/sda2 disk to crypttab
36 sed -i "s/mmcblk0p2/sda2/" "${ETC_DIR}/crypttab"
37 fi
38
39 # Generate initramfs file
11 # Generate initramfs file
40 if [ "$ENABLE_INITRAMFS" = true ] ; then
12 if [ "$ENABLE_INITRAMFS" = true ] ; then
41 if [ "$ENABLE_CRYPTFS" = true ] ; then
13 if [ "$ENABLE_CRYPTFS" = true ] ; then
14
42 # Include initramfs scripts to auto expand encrypted root partition
15 # Include initramfs scripts to auto expand encrypted root partition
43 if [ "$EXPANDROOT" = true ] ; then
16 if [ "$EXPANDROOT" = true ] ; then
44 install_exec files/initramfs/expand_encrypted_rootfs "${ETC_DIR}/initramfs-tools/scripts/init-premount/expand_encrypted_rootfs"
17 install_exec files/initramfs/expand_encrypted_rootfs "${ETC_DIR}/initramfs-tools/scripts/init-premount/expand_encrypted_rootfs"
45 install_exec files/initramfs/expand-premount "${ETC_DIR}/initramfs-tools/scripts/local-premount/expand-premount"
18 install_exec files/initramfs/expand-premount "${ETC_DIR}/initramfs-tools/scripts/local-premount/expand-premount"
46 install_exec files/initramfs/expand-tools "${ETC_DIR}/initramfs-tools/hooks/expand-tools"
19 install_exec files/initramfs/expand-tools "${ETC_DIR}/initramfs-tools/hooks/expand-tools"
47 fi
20 fi
48
21
49 if [ "$ENABLE_DHCP" = false ] ; then
22 # Replace fstab root partition with encrypted partition mapping
50 # Get cdir from NET_ADDRESS e.g. 24
23 sed -i "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING}/" "${ETC_DIR}/fstab"
51 cdir=$(${NET_ADDRESS} | cut -d '/' -f2)
52
24
53 # Convert cdir ro netmask e.g. 24 to 255.255.255.0
25 # Add encrypted partition to crypttab and fstab
54 NET_MASK=$(cdr2mask "$cdir")
26 install_readonly files/mount/crypttab "${ETC_DIR}/crypttab"
27 echo "${CRYPTFS_MAPPING} /dev/mmcblk0p2 none luks,initramfs" >> "${ETC_DIR}/crypttab"
55
28
56 # Write static ip settings to "${ETC_DIR}"/initramfs-tools/initramfs.conf
29 if [ "$ENABLE_USBBOOT" = true ] && [ "$ENABLE_SPLITFS" = false ]; then
57 sed -i "\$aIP=${NET_ADDRESS}::${NET_GATEWAY}:${NET_MASK}:${HOSTNAME}:" "${ETC_DIR}"/initramfs-tools/initramfs.conf
30 sed -i "s/mmcblk0p1/sda1/" "${ETC_DIR}/fstab"
58
31 # Add usb/sda2 disk to crypttab
59 # Regenerate initramfs
32 sed -i "s/mmcblk0p2/sda2/" "${ETC_DIR}/crypttab"
60 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
33 fi
34
35 # Add encrypted root partition to fstab and crypttab
36 if [ "$ENABLE_SPLITFS" = true ] && [ "$ENABLE_USBBOOT" = false ]; then
37 # Add usb/sda1 disk to crypttab
38 sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/crypttab"
61 fi
39 fi
62
40
63 if [ "$CRYPTFS_DROPBEAR" = true ]; then
41 if [ "$CRYPTFS_DROPBEAR" = true ]; then
64 if [ -n "$CRYPTFS_DROPBEAR_PUBKEY" ] && [ -f "$CRYPTFS_DROPBEAR_PUBKEY" ] ; then
42 if [ "$ENABLE_DHCP" = false ] ; then
65 install_readonly "${CRYPTFS_DROPBEAR_PUBKEY}" "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub
43 # Get cdir from NET_ADDRESS e.g. 24
66 cat "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub >> "${ETC_DIR}"/dropbear-initramfs/authorized_keys
44 cdir=$(printf "%s" "${NET_ADDRESS}" | cut -d '/' -f2)
67 else
68 # Create key
69 chroot_exec /usr/bin/dropbearkey -t rsa -f /etc/dropbear-initramfs/id_rsa.dropbear
70
71 # Convert dropbear key to openssh key
72 chroot_exec /usr/lib/dropbear/dropbearconvert dropbear openssh /etc/dropbear-initramfs/id_rsa.dropbear /etc/dropbear-initramfs/id_rsa
73
74 # Get Public Key Part
75 chroot_exec /usr/bin/dropbearkey -y -f /etc/dropbear-initramfs/id_rsa.dropbear | chroot_exec tee /etc/dropbear-initramfs/id_rsa.pub
76
77 # Delete unwanted lines
78 sed -i '/Public/d' "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub
79 sed -i '/Fingerprint/d' "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub
80
81 # Trust the new key
82 cat "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub > "${ETC_DIR}"/dropbear-initramfs/authorized_keys
83
84 # Save Keys - convert with putty from rsa/openssh to puttkey
85 cp -f "${ETC_DIR}"/dropbear-initramfs/id_rsa "${BASEDIR}"/dropbear_initramfs_key.rsa
86
87 # Get unlock script
88 install_exec files/initramfs/crypt_unlock.sh "${ETC_DIR}"/initramfs-tools/hooks/crypt_unlock.sh
89
90 # Enable Dropbear inside initramfs
91 printf "#\n# DROPBEAR: [ y | n ]\n#\n\nDROPBEAR=y\n" >> "${ETC_DIR}/initramfs-tools/initramfs.conf"
92
45
93 # Enable Dropbear inside initramfs
46 # Convert cdir ro netmask e.g. 24 to 255.255.255.0
94 sed -i "54 i sleep 5" "${R}"/usr/share/initramfs-tools/scripts/init-premount/dropbear
47 NET_MASK=$(cdr2mask "$cdir")
95 fi
48
96 else
49 # Write static ip settings to "${ETC_DIR}"/initramfs-tools/initramfs.conf
97 # Disable SSHD inside initramfs
50 # ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
98 printf "#\n# DROPBEAR: [ y | n ]\n#\n\nDROPBEAR=n\n" >> "${ETC_DIR}/initramfs-tools/initramfs.conf"
51 sed -i "\$a\nIP=${NET_ADDRESS}::${NET_GATEWAY}:${NET_MASK}:${HOSTNAME}:" "${ETC_DIR}"/initramfs-tools/initramfs.conf
99 fi
52 else
53 sed -i "\$a\nIP=::::${HOSTNAME}::dhcp" "${ETC_DIR}"/initramfs-tools/initramfs.conf
54 fi
55
56 if [ -n "$CRYPTFS_DROPBEAR_PUBKEY" ] && [ -f "$CRYPTFS_DROPBEAR_PUBKEY" ] ; then
57 install_readonly "${CRYPTFS_DROPBEAR_PUBKEY}" "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub
58 cat "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub >> "${ETC_DIR}"/dropbear-initramfs/authorized_keys
59 else
60 # Create key
61 chroot_exec /usr/bin/dropbearkey -t rsa -f /etc/dropbear-initramfs/id_rsa.dropbear
62
63 # Convert dropbear key to openssh key
64 chroot_exec /usr/lib/dropbear/dropbearconvert dropbear openssh /etc/dropbear-initramfs/id_rsa.dropbear /etc/dropbear-initramfs/id_rsa
65
66 # Get Public Key Part
67 chroot_exec /usr/bin/dropbearkey -y -f /etc/dropbear-initramfs/id_rsa.dropbear | chroot_exec tee /etc/dropbear-initramfs/id_rsa.pub
68
69 # Delete unwanted lines
70 sed -i '/Public/d' "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub
71 sed -i '/Fingerprint/d' "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub
72
73 # Trust the new key
74 cat "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub > "${ETC_DIR}"/dropbear-initramfs/authorized_keys
75
76 # Save Keys - convert with putty from rsa/openssh to puttkey
77 cp -f "${ETC_DIR}"/dropbear-initramfs/id_rsa "${BASEDIR}"/dropbear_initramfs_key.rsa
78
79 # Get unlock script
80 install_exec files/initramfs/crypt_unlock.sh "${ETC_DIR}"/initramfs-tools/hooks/crypt_unlock.sh
81
82 # Enable Dropbear inside initramfs
83 printf "#\n# DROPBEAR: [ y | n ]\n#\n\nDROPBEAR=y\n" >> "${ETC_DIR}/initramfs-tools/initramfs.conf"
84
85 # Enable Dropbear inside initramfs
86 sed -i "54 i sleep 5" "${R}"/usr/share/initramfs-tools/scripts/init-premount/dropbear
87 fi
88 # CRYPTFSDROPBEAR=false
89 else
90 # Disable SSHD inside initramfs
91 printf "#\n# DROPBEAR: [ y | n ]\n#\n\nDROPBEAR=n\n" >> "${ETC_DIR}/initramfs-tools/initramfs.conf"
92 fi
100
93
101 # Add cryptsetup modules to initramfs
94 # Add cryptsetup modules to initramfs
102 printf "#\n# CRYPTSETUP: [ y | n ]\n#\n\nCRYPTSETUP=y\n" >> "${ETC_DIR}/initramfs-tools/conf-hook"
95 #printf "#\n# CRYPTSETUP: [ y | n ]\n#\n\nCRYPTSETUP=y\n" >> "${ETC_DIR}/initramfs-tools/conf-hook"
103
96
104 # Dummy mapping required by mkinitramfs
97 # Dummy mapping required by mkinitramfs
105 echo "0 1 crypt $(echo "${CRYPTFS_CIPHER}" | cut -d ':' -f 1) ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0 7:0 4096" | chroot_exec dmsetup create "${CRYPTFS_MAPPING}"
98 echo "0 1 crypt "${CRYPTFS_CIPHER}" ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0 7:0 4096" | chroot_exec dmsetup create "${CRYPTFS_MAPPING}"
106
99
107 # Generate initramfs with encrypted root partition support
100 # Generate initramfs with encrypted root partition support
108 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
101 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
109
102
110 # Remove dummy mapping
103 # Remove dummy mapping
111 chroot_exec cryptsetup close "${CRYPTFS_MAPPING}"
104 chroot_exec cryptsetup close "${CRYPTFS_MAPPING}"
105 # CRYPTFS=false
112 else
106 else
107 #USB BOOT /boot on sda1 / on sda2
108 if [ "$ENABLE_USBBOOT" = true ] ; then
109 sed -i "s/mmcblk0p1/sda1/" "${ETC_DIR}/fstab"
110 sed -i "s/mmcblk0p2/sda2/" "${ETC_DIR}/fstab"
111 fi
112
113 # Add usb/sda disk root partition to fstab
114 if [ "$ENABLE_SPLITFS" = true ] ; then
115 sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/fstab"
116 fi
113 # Generate initramfs without encrypted root partition support
117 # Generate initramfs without encrypted root partition support
114 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
118 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
115 fi
119 fi
116 fi
120 fi
@@ -1,892 +1,897
1 #!/bin/sh
1 #!/bin/sh
2 ########################################################################
2 ########################################################################
3 # rpi23-gen-image.sh 2015-2017
3 # rpi23-gen-image.sh 2015-2017
4 #
4 #
5 # Advanced Debian "stretch" and "buster" bootstrap script for Raspberry Pi
5 # Advanced Debian "stretch" and "buster" bootstrap script for Raspberry Pi
6 #
6 #
7 # This program is free software; you can redistribute it and/or
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
10 # of the License, or (at your option) any later version.
11 #
11 #
12 # Copyright (C) 2015 Jan Wagner <mail@jwagner.eu>
12 # Copyright (C) 2015 Jan Wagner <mail@jwagner.eu>
13 #
13 #
14 # Big thanks for patches and enhancements by 20+ github contributors!
14 # Big thanks for patches and enhancements by 20+ github contributors!
15 ########################################################################
15 ########################################################################
16
16
17 # Are we running as root?
17 # Are we running as root?
18 if [ "$(id -u)" -ne "0" ] ; then
18 if [ "$(id -u)" -ne "0" ] ; then
19 echo "error: this script must be executed with root privileges!"
19 echo "error: this script must be executed with root privileges!"
20 exit 1
20 exit 1
21 fi
21 fi
22
22
23 # Check if ./functions.sh script exists
23 # Check if ./functions.sh script exists
24 if [ ! -r "./functions.sh" ] ; then
24 if [ ! -r "./functions.sh" ] ; then
25 echo "error: './functions.sh' required script not found!"
25 echo "error: './functions.sh' required script not found!"
26 exit 1
26 exit 1
27 fi
27 fi
28
28
29 # Load utility functions
29 # Load utility functions
30 . ./functions.sh
30 . ./functions.sh
31
31
32 # Load parameters from configuration template file
32 # Load parameters from configuration template file
33 if [ -n "$CONFIG_TEMPLATE" ] ; then
33 if [ -n "$CONFIG_TEMPLATE" ] ; then
34 use_template
34 use_template
35 fi
35 fi
36
36
37 # Introduce settings
37 # Introduce settings
38 set -e
38 set -e
39 echo -n -e "\n#\n# RPi 0/1/2/3 Bootstrap Settings\n#\n"
39 echo -n -e "\n#\n# RPi 0/1/2/3 Bootstrap Settings\n#\n"
40 set -x
40 set -x
41
41
42 # Raspberry Pi model configuration
42 # Raspberry Pi model configuration
43 RPI_MODEL=${RPI_MODEL:=2}
43 RPI_MODEL=${RPI_MODEL:=2}
44
44
45 # Debian release
45 # Debian release
46 RELEASE=${RELEASE:=buster}
46 RELEASE=${RELEASE:=buster}
47 if [ $RELEASE = "bullseye" ] ; then
47 if [ $RELEASE = "bullseye" ] ; then
48 RELEASE=testing
48 RELEASE=testing
49 fi
49 fi
50
50
51 # Kernel Branch
51 # Kernel Branch
52 KERNEL_BRANCH=${KERNEL_BRANCH:=""}
52 KERNEL_BRANCH=${KERNEL_BRANCH:=""}
53
53
54 # URLs
54 # URLs
55 KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
55 KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
56 FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot}
56 FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot}
57 WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm}
57 WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm}
58 FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
58 FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
59 UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git}
59 UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git}
60 VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland}
60 VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland}
61 BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git}
61 BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git}
62 NEXMON_URL=${NEXMON_URL:=https://github.com/seemoo-lab/nexmon.git}
62 NEXMON_URL=${NEXMON_URL:=https://github.com/seemoo-lab/nexmon.git}
63 SYSTEMDSWAP_URL=${SYSTEMDSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git}
63 SYSTEMDSWAP_URL=${SYSTEMDSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git}
64
64
65 # Kernel deb packages for 32bit kernel
65 # Kernel deb packages for 32bit kernel
66 RPI_32_KERNEL_URL=${RPI_32_KERNEL_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel_20180422-141901_armhf.deb}
66 RPI_32_KERNEL_URL=${RPI_32_KERNEL_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel_20180422-141901_armhf.deb}
67 RPI_32_KERNELHEADER_URL=${RPI_32_KERNELHEADER_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel-headers_20180422-141901_armhf.deb}
67 RPI_32_KERNELHEADER_URL=${RPI_32_KERNELHEADER_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel-headers_20180422-141901_armhf.deb}
68 # Kernel has KVM and zswap enabled - use if KERNEL_* parameters and precompiled kernel are used
68 # Kernel has KVM and zswap enabled - use if KERNEL_* parameters and precompiled kernel are used
69 RPI3_64_BIS_KERNEL_URL=${RPI3_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel-bis/releases/download/4.19.80.20191022/bcmrpi3-kernel-bis-4.19.80.20191022.tar.xz}
69 RPI3_64_BIS_KERNEL_URL=${RPI3_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel-bis/releases/download/4.19.80.20191022/bcmrpi3-kernel-bis-4.19.80.20191022.tar.xz}
70 # Default precompiled 64bit kernel
70 # Default precompiled 64bit kernel
71 RPI3_64_DEF_KERNEL_URL=${RPI3_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel/releases/download/4.19.80.20191022/bcmrpi3-kernel-4.19.80.20191022.tar.xz}
71 RPI3_64_DEF_KERNEL_URL=${RPI3_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel/releases/download/4.19.80.20191022/bcmrpi3-kernel-4.19.80.20191022.tar.xz}
72 # Sakaki BIS Kernel RPI4 - https://github.com/sakaki-/bcm2711-kernel-bis
72 # Sakaki BIS Kernel RPI4 - https://github.com/sakaki-/bcm2711-kernel-bis
73 RPI4_64_BIS_KERNEL_URL=${RPI4_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcm2711-kernel-bis/releases/download/4.19.59.20190724/bcm2711-kernel-bis-4.19.59.20190724.tar.xz}
73 RPI4_64_BIS_KERNEL_URL=${RPI4_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcm2711-kernel-bis/releases/download/4.19.59.20190724/bcm2711-kernel-bis-4.19.59.20190724.tar.xz}
74 # Default precompiled 64bit kernel - https://github.com/sakaki-/bcm2711-kernel
74 # Default precompiled 64bit kernel - https://github.com/sakaki-/bcm2711-kernel
75 RPI4_64_DEF_KERNEL_URL=${RPI4_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcm2711-kernel-bis/releases/download/4.19.59.20190724/bcm2711-kernel-bis-4.19.59.20190724.tar.xz}
75 RPI4_64_DEF_KERNEL_URL=${RPI4_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcm2711-kernel-bis/releases/download/4.19.59.20190724/bcm2711-kernel-bis-4.19.59.20190724.tar.xz}
76 # Generic
76 # Generic
77 RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_DEF_KERNEL_URL}
77 RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_DEF_KERNEL_URL}
78 RPI4_64_KERNEL_URL=${RPI4_64_KERNEL_URL:=$RPI4_64_DEF_KERNEL_URL}
78 RPI4_64_KERNEL_URL=${RPI4_64_KERNEL_URL:=$RPI4_64_DEF_KERNEL_URL}
79 # Kali kernel src - used if ENABLE_NEXMON=true (they patch the wlan kernel modul)
79 # Kali kernel src - used if ENABLE_NEXMON=true (they patch the wlan kernel modul)
80 KALI_KERNEL_URL=${KALI_KERNEL_URL:=https://github.com/Re4son/re4son-raspberrypi-linux.git}
80 KALI_KERNEL_URL=${KALI_KERNEL_URL:=https://github.com/Re4son/re4son-raspberrypi-linux.git}
81
81
82 # Build directories
82 # Build directories
83 WORKDIR=$(pwd)
83 WORKDIR=$(pwd)
84 BASEDIR=${BASEDIR:=${WORKDIR}/images/${RELEASE}}
84 BASEDIR=${BASEDIR:=${WORKDIR}/images/${RELEASE}}
85 BUILDDIR="${BASEDIR}/build"
85 BUILDDIR="${BASEDIR}/build"
86
86
87 # Chroot directories
87 # Chroot directories
88 R="${BUILDDIR}/chroot"
88 R="${BUILDDIR}/chroot"
89 ETC_DIR="${R}/etc"
89 ETC_DIR="${R}/etc"
90 LIB_DIR="${R}/lib"
90 LIB_DIR="${R}/lib"
91 BOOT_DIR="${R}/boot/firmware"
91 BOOT_DIR="${R}/boot/firmware"
92 KERNEL_DIR="${R}/usr/src/linux"
92 KERNEL_DIR="${R}/usr/src/linux"
93 WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm"
93 WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm"
94 BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt"
94 BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt"
95
95
96 # Firmware directory: Blank if download from github
96 # Firmware directory: Blank if download from github
97 RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
97 RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
98
98
99 # General settings
99 # General settings
100 SET_ARCH=${SET_ARCH:=32}
100 SET_ARCH=${SET_ARCH:=32}
101 HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}}
101 HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}}
102 PASSWORD=${PASSWORD:=raspberry}
102 PASSWORD=${PASSWORD:=raspberry}
103 USER_PASSWORD=${USER_PASSWORD:=raspberry}
103 USER_PASSWORD=${USER_PASSWORD:=raspberry}
104 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
104 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
105 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
105 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
106 EXPANDROOT=${EXPANDROOT:=true}
106 EXPANDROOT=${EXPANDROOT:=true}
107 ENABLE_DPHYSSWAP=${ENABLE_DPHYSSWAP:=true}
107 ENABLE_DPHYSSWAP=${ENABLE_DPHYSSWAP:=true}
108
108
109 # Keyboard settings
109 # Keyboard settings
110 XKB_MODEL=${XKB_MODEL:=""}
110 XKB_MODEL=${XKB_MODEL:=""}
111 XKB_LAYOUT=${XKB_LAYOUT:=""}
111 XKB_LAYOUT=${XKB_LAYOUT:=""}
112 XKB_VARIANT=${XKB_VARIANT:=""}
112 XKB_VARIANT=${XKB_VARIANT:=""}
113 XKB_OPTIONS=${XKB_OPTIONS:=""}
113 XKB_OPTIONS=${XKB_OPTIONS:=""}
114
114
115 # Network settings (DHCP)
115 # Network settings (DHCP)
116 ENABLE_DHCP=${ENABLE_DHCP:=true}
116 ENABLE_DHCP=${ENABLE_DHCP:=true}
117
117
118 # Network settings (static)
118 # Network settings (static)
119 NET_ADDRESS=${NET_ADDRESS:=""}
119 NET_ADDRESS=${NET_ADDRESS:=""}
120 NET_GATEWAY=${NET_GATEWAY:=""}
120 NET_GATEWAY=${NET_GATEWAY:=""}
121 NET_DNS_1=${NET_DNS_1:=""}
121 NET_DNS_1=${NET_DNS_1:=""}
122 NET_DNS_2=${NET_DNS_2:=""}
122 NET_DNS_2=${NET_DNS_2:=""}
123 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
123 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
124 NET_NTP_1=${NET_NTP_1:=""}
124 NET_NTP_1=${NET_NTP_1:=""}
125 NET_NTP_2=${NET_NTP_2:=""}
125 NET_NTP_2=${NET_NTP_2:=""}
126
126
127 # APT settings
127 # APT settings
128 APT_PROXY=${APT_PROXY:=""}
128 APT_PROXY=${APT_PROXY:=""}
129 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
129 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
130 KEEP_APT_PROXY=${KEEP_APT_PROXY:=false}
130 KEEP_APT_PROXY=${KEEP_APT_PROXY:=false}
131
131
132 # Feature settings
132 # Feature settings
133 ENABLE_PRINTK=${ENABLE_PRINTK:=false}
133 ENABLE_PRINTK=${ENABLE_PRINTK:=false}
134 ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false}
134 ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false}
135 ENABLE_MINIUART_OVERLAY=${ENABLE_MINIUART_OVERLAY:=false}
135 ENABLE_MINIUART_OVERLAY=${ENABLE_MINIUART_OVERLAY:=false}
136 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
136 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
137 ENABLE_I2C=${ENABLE_I2C:=false}
137 ENABLE_I2C=${ENABLE_I2C:=false}
138 ENABLE_SPI=${ENABLE_SPI:=false}
138 ENABLE_SPI=${ENABLE_SPI:=false}
139 ENABLE_IPV6=${ENABLE_IPV6:=true}
139 ENABLE_IPV6=${ENABLE_IPV6:=true}
140 ENABLE_SSHD=${ENABLE_SSHD:=true}
140 ENABLE_SSHD=${ENABLE_SSHD:=true}
141 ENABLE_NONFREE=${ENABLE_NONFREE:=false}
141 ENABLE_NONFREE=${ENABLE_NONFREE:=false}
142 ENABLE_WIRELESS=${ENABLE_WIRELESS:=false}
142 ENABLE_WIRELESS=${ENABLE_WIRELESS:=false}
143 ENABLE_SOUND=${ENABLE_SOUND:=true}
143 ENABLE_SOUND=${ENABLE_SOUND:=true}
144 ENABLE_DBUS=${ENABLE_DBUS:=true}
144 ENABLE_DBUS=${ENABLE_DBUS:=true}
145 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
145 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
146 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
146 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
147 ENABLE_XORG=${ENABLE_XORG:=false}
147 ENABLE_XORG=${ENABLE_XORG:=false}
148 ENABLE_WM=${ENABLE_WM:=""}
148 ENABLE_WM=${ENABLE_WM:=""}
149 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
149 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
150 ENABLE_USER=${ENABLE_USER:=true}
150 ENABLE_USER=${ENABLE_USER:=true}
151 USER_NAME=${USER_NAME:="pi"}
151 USER_NAME=${USER_NAME:="pi"}
152 ENABLE_ROOT=${ENABLE_ROOT:=false}
152 ENABLE_ROOT=${ENABLE_ROOT:=false}
153 ENABLE_QEMU=${ENABLE_QEMU:=false}
153 ENABLE_QEMU=${ENABLE_QEMU:=false}
154 ENABLE_SYSVINIT=${ENABLE_SYSVINIT:=false}
154 ENABLE_SYSVINIT=${ENABLE_SYSVINIT:=false}
155
155
156 # SSH settings
156 # SSH settings
157 SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false}
157 SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false}
158 SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false}
158 SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false}
159 SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false}
159 SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false}
160 SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""}
160 SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""}
161 SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""}
161 SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""}
162
162
163 # Advanced settings
163 # Advanced settings
164 ENABLE_SYSTEMDSWAP=${ENABLE_SYSTEMDSWAP:=false}
164 ENABLE_SYSTEMDSWAP=${ENABLE_SYSTEMDSWAP:=false}
165 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
165 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
166 ENABLE_REDUCE=${ENABLE_REDUCE:=false}
166 ENABLE_REDUCE=${ENABLE_REDUCE:=false}
167 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
167 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
168 UBOOTSRC_DIR=${UBOOTSRC_DIR:=""}
168 UBOOTSRC_DIR=${UBOOTSRC_DIR:=""}
169 ENABLE_USBBOOT=${ENABLE_USBBOOT=false}
169 ENABLE_USBBOOT=${ENABLE_USBBOOT=false}
170 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
170 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
171 ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false}
171 ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false}
172 ENABLE_NEXMON=${ENABLE_NEXMON:=false}
172 ENABLE_NEXMON=${ENABLE_NEXMON:=false}
173 VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""}
173 VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""}
174 FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""}
174 FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""}
175 NEXMONSRC_DIR=${NEXMONSRC_DIR:=""}
175 NEXMONSRC_DIR=${NEXMONSRC_DIR:=""}
176 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
176 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
177 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
177 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
178 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
178 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
179 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
179 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
180 ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
180 ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
181 ENABLE_SPLASH=${ENABLE_SPLASH:=true}
181 ENABLE_SPLASH=${ENABLE_SPLASH:=true}
182 ENABLE_LOGO=${ENABLE_LOGO:=true}
182 ENABLE_LOGO=${ENABLE_LOGO:=true}
183 ENABLE_SILENT_BOOT=${ENABLE_SILENT_BOOT=false}
183 ENABLE_SILENT_BOOT=${ENABLE_SILENT_BOOT=false}
184 DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=}
184 DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=}
185
185
186 # Kernel compilation settings
186 # Kernel compilation settings
187 BUILD_KERNEL=${BUILD_KERNEL:=true}
187 BUILD_KERNEL=${BUILD_KERNEL:=true}
188 KERNEL_REDUCE=${KERNEL_REDUCE:=false}
188 KERNEL_REDUCE=${KERNEL_REDUCE:=false}
189 KERNEL_THREADS=${KERNEL_THREADS:=1}
189 KERNEL_THREADS=${KERNEL_THREADS:=1}
190 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
190 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
191 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
191 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
192 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
192 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
193 KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false}
193 KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false}
194 KERNEL_CCACHE=${KERNEL_CCACHE:=false}
194 KERNEL_CCACHE=${KERNEL_CCACHE:=false}
195 KERNEL_ZSWAP=${KERNEL_ZSWAP:=false}
195 KERNEL_ZSWAP=${KERNEL_ZSWAP:=false}
196 KERNEL_VIRT=${KERNEL_VIRT:=false}
196 KERNEL_VIRT=${KERNEL_VIRT:=false}
197 KERNEL_BPF=${KERNEL_BPF:=false}
197 KERNEL_BPF=${KERNEL_BPF:=false}
198 KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=ondemand}
198 KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=ondemand}
199 KERNEL_SECURITY=${KERNEL_SECURITY:=false}
199 KERNEL_SECURITY=${KERNEL_SECURITY:=false}
200 KERNEL_NF=${KERNEL_NF:=false}
200 KERNEL_NF=${KERNEL_NF:=false}
201 KERNEL_DHKEY=${KERNEL_DHKEY:=true}
202 KERNEL_BTRFS=${KERNEL_BTRFS:=false}
203 KERNEL_NSPAN=${KERNEL_NSPAN:=false}
204 KERNEL_POEHAT=${KERNEL_POEHAT:=false}
201
205
202 # Kernel compilation from source directory settings
206 # Kernel compilation from source directory settings
203 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
207 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
204 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
208 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
205 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
209 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
206 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
210 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
207
211
208 # Reduce disk usage settings
212 # Reduce disk usage settings
209 REDUCE_APT=${REDUCE_APT:=true}
213 REDUCE_APT=${REDUCE_APT:=true}
210 REDUCE_DOC=${REDUCE_DOC:=true}
214 REDUCE_DOC=${REDUCE_DOC:=true}
211 REDUCE_MAN=${REDUCE_MAN:=true}
215 REDUCE_MAN=${REDUCE_MAN:=true}
212 REDUCE_VIM=${REDUCE_VIM:=false}
216 REDUCE_VIM=${REDUCE_VIM:=false}
213 REDUCE_BASH=${REDUCE_BASH:=false}
217 REDUCE_BASH=${REDUCE_BASH:=false}
214 REDUCE_HWDB=${REDUCE_HWDB:=true}
218 REDUCE_HWDB=${REDUCE_HWDB:=true}
215 REDUCE_SSHD=${REDUCE_SSHD:=true}
219 REDUCE_SSHD=${REDUCE_SSHD:=true}
216 REDUCE_LOCALE=${REDUCE_LOCALE:=true}
220 REDUCE_LOCALE=${REDUCE_LOCALE:=true}
217
221
218 # Encrypted filesystem settings
222 # Encrypted filesystem settings
219 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
223 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
220 CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""}
224 CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""}
221 CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"}
225 CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"}
222 CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"}
226 CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64"}
227 CRYPTFS_HASH=${CRYPTFS_HASH:="sha512"}
223 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
228 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
224 #Dropbear-initramfs supports unlocking encrypted filesystem via SSH on bootup
229 #Dropbear-initramfs supports unlocking encrypted filesystem via SSH on bootup
225 CRYPTFS_DROPBEAR=${CRYPTFS_DROPBEAR:=false}
230 CRYPTFS_DROPBEAR=${CRYPTFS_DROPBEAR:=false}
226 #Provide your own Dropbear Public RSA-OpenSSH Key otherwise it will be generated
231 #Provide your own Dropbear Public RSA-OpenSSH Key otherwise it will be generated
227 CRYPTFS_DROPBEAR_PUBKEY=${CRYPTFS_DROPBEAR_PUBKEY:=""}
232 CRYPTFS_DROPBEAR_PUBKEY=${CRYPTFS_DROPBEAR_PUBKEY:=""}
228
233
229 # Chroot scripts directory
234 # Chroot scripts directory
230 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
235 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
231
236
232 # Packages required in the chroot build environment
237 # Packages required in the chroot build environment
233 APT_INCLUDES=${APT_INCLUDES:=""}
238 APT_INCLUDES=${APT_INCLUDES:=""}
234 APT_INCLUDES="${APT_INCLUDES},flex,bison,libssl-dev,apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup,libnss-systemd"
239 APT_INCLUDES="${APT_INCLUDES},flex,bison,libssl-dev,apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup,libnss-systemd"
235
240
236 # Packages to exclude from chroot build environment
241 # Packages to exclude from chroot build environment
237 APT_EXCLUDES=${APT_EXCLUDES:=""}
242 APT_EXCLUDES=${APT_EXCLUDES:=""}
238
243
239 # Packages required for bootstrapping
244 # Packages required for bootstrapping
240 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo"
245 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo"
241 MISSING_PACKAGES=""
246 MISSING_PACKAGES=""
242
247
243 # Packages installed for c/c++ build environment in chroot (keep empty)
248 # Packages installed for c/c++ build environment in chroot (keep empty)
244 COMPILER_PACKAGES=""
249 COMPILER_PACKAGES=""
245
250
246 # Check if apt-cacher-ng has port 3142 open and set APT_PROXY
251 # Check if apt-cacher-ng has port 3142 open and set APT_PROXY
247 APT_CACHER_RUNNING=$(lsof -i :3142 | cut -d ' ' -f3 | uniq | sed '/^\s*$/d')
252 APT_CACHER_RUNNING=$(lsof -i :3142 | cut -d ' ' -f3 | uniq | sed '/^\s*$/d')
248 if [ "${APT_CACHER_RUNNING}" = "apt-cacher-ng" ] ; then
253 if [ "${APT_CACHER_RUNNING}" = "apt-cacher-ng" ] ; then
249 APT_PROXY=http://127.0.0.1:3142/
254 APT_PROXY=http://127.0.0.1:3142/
250 fi
255 fi
251
256
252 # Setup architecture specific settings
257 # Setup architecture specific settings
253 if [ -n "$SET_ARCH" ] ; then
258 if [ -n "$SET_ARCH" ] ; then
254 # 64-bit configuration
259 # 64-bit configuration
255 if [ "$SET_ARCH" = 64 ] ; then
260 if [ "$SET_ARCH" = 64 ] ; then
256 # General 64-bit depended settings
261 # General 64-bit depended settings
257 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
262 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
258 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
263 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
259 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
264 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
260
265
261 # Raspberry Pi model specific settings
266 # Raspberry Pi model specific settings
262 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
267 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
263 if [ "$RPI_MODEL" != 4 ] ; then
268 if [ "$RPI_MODEL" != 4 ] ; then
264 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
269 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
265 else
270 else
266 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2711_defconfig}
271 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2711_defconfig}
267 fi
272 fi
268
273
269 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
274 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
270 RELEASE_ARCH=${RELEASE_ARCH:=arm64}
275 RELEASE_ARCH=${RELEASE_ARCH:=arm64}
271 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
276 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
272 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
277 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
273 else
278 else
274 echo "error: Only Raspberry PI 3, 3B+ and 4 support 64-bit"
279 echo "error: Only Raspberry PI 3, 3B+ and 4 support 64-bit"
275 exit 1
280 exit 1
276 fi
281 fi
277 fi
282 fi
278
283
279 # 32-bit configuration
284 # 32-bit configuration
280 if [ "$SET_ARCH" = 32 ] ; then
285 if [ "$SET_ARCH" = 32 ] ; then
281 # General 32-bit dependend settings
286 # General 32-bit dependend settings
282 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
287 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
283 KERNEL_ARCH=${KERNEL_ARCH:=arm}
288 KERNEL_ARCH=${KERNEL_ARCH:=arm}
284 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
289 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
285
290
286 # Raspberry Pi model specific settings
291 # Raspberry Pi model specific settings
287 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
292 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
288 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
293 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
289 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
294 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
290 RELEASE_ARCH=${RELEASE_ARCH:=armel}
295 RELEASE_ARCH=${RELEASE_ARCH:=armel}
291 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img}
296 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img}
292 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
297 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
293 fi
298 fi
294
299
295 # Raspberry Pi model specific settings
300 # Raspberry Pi model specific settings
296 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
301 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
297 if [ "$RPI_MODEL" != 4 ] ; then
302 if [ "$RPI_MODEL" != 4 ] ; then
298 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
303 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
299 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img}
304 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img}
300 else
305 else
301 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2711_defconfig}
306 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2711_defconfig}
302 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7l.img}
307 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7l.img}
303 fi
308 fi
304
309
305 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
310 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
306 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
311 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
307
312
308 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
313 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
309 fi
314 fi
310 fi
315 fi
311 # SET_ARCH not set
316 # SET_ARCH not set
312 else
317 else
313 echo "error: Please set '32' or '64' as value for SET_ARCH"
318 echo "error: Please set '32' or '64' as value for SET_ARCH"
314 exit 1
319 exit 1
315 fi
320 fi
316 # Device specific configuration and U-Boot configuration
321 # Device specific configuration and U-Boot configuration
317 case "$RPI_MODEL" in
322 case "$RPI_MODEL" in
318 0)
323 0)
319 DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb}
324 DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb}
320 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
325 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
321 ;;
326 ;;
322 1)
327 1)
323 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb}
328 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb}
324 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
329 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
325 ;;
330 ;;
326 1P)
331 1P)
327 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb}
332 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb}
328 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
333 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
329 ;;
334 ;;
330 2)
335 2)
331 DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb}
336 DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb}
332 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig}
337 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig}
333 ;;
338 ;;
334 3)
339 3)
335 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
340 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
336 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
341 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
337 ;;
342 ;;
338 3P)
343 3P)
339 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
344 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
340 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
345 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
341 ;;
346 ;;
342 4)
347 4)
343 DTB_FILE=${DTB_FILE:=bcm2711-rpi-4-b.dtb}
348 DTB_FILE=${DTB_FILE:=bcm2711-rpi-4-b.dtb}
344 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_4_defconfig}
349 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_4_defconfig}
345 ;;
350 ;;
346 *)
351 *)
347 echo "error: Raspberry Pi model $RPI_MODEL is not supported!"
352 echo "error: Raspberry Pi model $RPI_MODEL is not supported!"
348 exit 1
353 exit 1
349 ;;
354 ;;
350 esac
355 esac
351
356
352 # Raspberry PI 0,3,3P with Bluetooth and Wifi onboard
357 # Raspberry PI 0,3,3P with Bluetooth and Wifi onboard
353 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
358 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
354 # Include bluetooth packages on supported boards
359 # Include bluetooth packages on supported boards
355 if [ "$ENABLE_BLUETOOTH" = true ] ; then
360 if [ "$ENABLE_BLUETOOTH" = true ] ; then
356 APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
361 APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
357 fi
362 fi
358 if [ "$ENABLE_WIRELESS" = true ] ; then
363 if [ "$ENABLE_WIRELESS" = true ] ; then
359 APT_INCLUDES="${APT_INCLUDES},wireless-tools,crda,wireless-regdb"
364 APT_INCLUDES="${APT_INCLUDES},wireless-tools,crda,wireless-regdb"
360 fi
365 fi
361 else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard
366 else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard
362 # Check if the internal wireless interface is not supported by the RPi model
367 # Check if the internal wireless interface is not supported by the RPi model
363 if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then
368 if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then
364 echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth"
369 echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth"
365 exit 1
370 exit 1
366 fi
371 fi
367 fi
372 fi
368
373
369 if [ "$BUILD_KERNEL" = false ] && [ "$ENABLE_NEXMON" = true ]; then
374 if [ "$BUILD_KERNEL" = false ] && [ "$ENABLE_NEXMON" = true ]; then
370 echo "error: You have to compile kernel sources, if you want to enable nexmon"
375 echo "error: You have to compile kernel sources, if you want to enable nexmon"
371 exit 1
376 exit 1
372 fi
377 fi
373
378
374 # Prepare date string for default image file name
379 # Prepare date string for default image file name
375 DATE="$(date +%Y-%m-%d)"
380 DATE="$(date +%Y-%m-%d)"
376 if [ -z "$KERNEL_BRANCH" ] ; then
381 if [ -z "$KERNEL_BRANCH" ] ; then
377 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
382 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
378 else
383 else
379 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
384 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
380 fi
385 fi
381
386
382 # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported
387 # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported
383 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
388 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
384 if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then
389 if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then
385 echo "error: DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS} is not supported"
390 echo "error: DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS} is not supported"
386 exit 1
391 exit 1
387 fi
392 fi
388 fi
393 fi
389
394
390 # Add cmake to compile videocore sources
395 # Add cmake to compile videocore sources
391 if [ "$ENABLE_VIDEOCORE" = true ] ; then
396 if [ "$ENABLE_VIDEOCORE" = true ] ; then
392 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake"
397 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake"
393 fi
398 fi
394
399
395 # Add deps for nexmon
400 # Add deps for nexmon
396 if [ "$ENABLE_NEXMON" = true ] ; then
401 if [ "$ENABLE_NEXMON" = true ] ; then
397 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libgmp3-dev gawk qpdf make autoconf automake build-essential libtool"
402 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libgmp3-dev gawk qpdf make autoconf automake build-essential libtool"
398 fi
403 fi
399
404
400 # Add libncurses5 to enable kernel menuconfig
405 # Add libncurses5 to enable kernel menuconfig
401 if [ "$KERNEL_MENUCONFIG" = true ] ; then
406 if [ "$KERNEL_MENUCONFIG" = true ] ; then
402 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses-dev"
407 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses-dev"
403 fi
408 fi
404
409
405 # Add ccache compiler cache for (faster) kernel cross (re)compilation
410 # Add ccache compiler cache for (faster) kernel cross (re)compilation
406 if [ "$KERNEL_CCACHE" = true ] ; then
411 if [ "$KERNEL_CCACHE" = true ] ; then
407 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ccache"
412 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ccache"
408 fi
413 fi
409
414
410 # Add cryptsetup package to enable filesystem encryption
415 # Add cryptsetup package to enable filesystem encryption
411 if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
416 if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
412 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup"
417 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup"
413 APT_INCLUDES="${APT_INCLUDES},cryptsetup,busybox,console-setup"
418 APT_INCLUDES="${APT_INCLUDES},cryptsetup,busybox,console-setup,cryptsetup-initramfs"
414
419
415 # If cryptfs,dropbear and initramfs are enabled include dropbear-initramfs package
420 # If cryptfs,dropbear and initramfs are enabled include dropbear-initramfs package
416 if [ "$CRYPTFS_DROPBEAR" = true ] && [ "$ENABLE_INITRAMFS" = true ]; then
421 if [ "$CRYPTFS_DROPBEAR" = true ] && [ "$ENABLE_INITRAMFS" = true ]; then
417 APT_INCLUDES="${APT_INCLUDES},dropbear-initramfs"
422 APT_INCLUDES="${APT_INCLUDES},dropbear-initramfs"
418 fi
423 fi
419
424
420 if [ -z "$CRYPTFS_PASSWORD" ] ; then
425 if [ -z "$CRYPTFS_PASSWORD" ] ; then
421 echo "error: no password defined (CRYPTFS_PASSWORD)!"
426 echo "error: no password defined (CRYPTFS_PASSWORD)!"
422 exit 1
427 exit 1
423 fi
428 fi
424 ENABLE_INITRAMFS=true
429 ENABLE_INITRAMFS=true
425 fi
430 fi
426
431
427 # Add initramfs generation tools
432 # Add initramfs generation tools
428 if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
433 if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
429 APT_INCLUDES="${APT_INCLUDES},initramfs-tools"
434 APT_INCLUDES="${APT_INCLUDES},initramfs-tools"
430 fi
435 fi
431
436
432 # Add device-tree-compiler required for building the U-Boot bootloader
437 # Add device-tree-compiler required for building the U-Boot bootloader
433 if [ "$ENABLE_UBOOT" = true ] ; then
438 if [ "$ENABLE_UBOOT" = true ] ; then
434 APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc"
439 APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc"
435 fi
440 fi
436
441
437 if [ "$ENABLE_USBBOOT" = true ] ; then
442 if [ "$ENABLE_USBBOOT" = true ] ; then
438 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 2 ]; then
443 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 2 ]; then
439 echo "error: Booting from USB alone is only supported by Raspberry Pi 3 and 3P"
444 echo "error: Booting from USB alone is only supported by Raspberry Pi 3 and 3P"
440 exit 1
445 exit 1
441 fi
446 fi
442 fi
447 fi
443
448
444 # Check if root SSH (v2) public key file exists
449 # Check if root SSH (v2) public key file exists
445 if [ -n "$SSH_ROOT_PUB_KEY" ] ; then
450 if [ -n "$SSH_ROOT_PUB_KEY" ] ; then
446 if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then
451 if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then
447 echo "error: '$SSH_ROOT_PUB_KEY' specified SSH public key file not found (SSH_ROOT_PUB_KEY)!"
452 echo "error: '$SSH_ROOT_PUB_KEY' specified SSH public key file not found (SSH_ROOT_PUB_KEY)!"
448 exit 1
453 exit 1
449 fi
454 fi
450 fi
455 fi
451
456
452 # Check if $USER_NAME SSH (v2) public key file exists
457 # Check if $USER_NAME SSH (v2) public key file exists
453 if [ -n "$SSH_USER_PUB_KEY" ] ; then
458 if [ -n "$SSH_USER_PUB_KEY" ] ; then
454 if [ ! -f "$SSH_USER_PUB_KEY" ] ; then
459 if [ ! -f "$SSH_USER_PUB_KEY" ] ; then
455 echo "error: '$SSH_USER_PUB_KEY' specified SSH public key file not found (SSH_USER_PUB_KEY)!"
460 echo "error: '$SSH_USER_PUB_KEY' specified SSH public key file not found (SSH_USER_PUB_KEY)!"
456 exit 1
461 exit 1
457 fi
462 fi
458 fi
463 fi
459
464
460 if [ "$ENABLE_NEXMON" = true ] && [ -n "$KERNEL_BRANCH" ] ; then
465 if [ "$ENABLE_NEXMON" = true ] && [ -n "$KERNEL_BRANCH" ] ; then
461 echo "error: Please unset KERNEL_BRANCH if using ENABLE_NEXMON"
466 echo "error: Please unset KERNEL_BRANCH if using ENABLE_NEXMON"
462 exit 1
467 exit 1
463 fi
468 fi
464
469
465 # Check if all required packages are installed on the build system
470 # Check if all required packages are installed on the build system
466 for package in $REQUIRED_PACKAGES ; do
471 for package in $REQUIRED_PACKAGES ; do
467 if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then
472 if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then
468 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
473 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
469 fi
474 fi
470 done
475 done
471
476
472 # If there are missing packages ask confirmation for install, or exit
477 # If there are missing packages ask confirmation for install, or exit
473 if [ -n "$MISSING_PACKAGES" ] ; then
478 if [ -n "$MISSING_PACKAGES" ] ; then
474 echo "the following packages needed by this script are not installed:"
479 echo "the following packages needed by this script are not installed:"
475 echo "$MISSING_PACKAGES"
480 echo "$MISSING_PACKAGES"
476
481
477 printf "\ndo you want to install the missing packages right now? [y/n] "
482 printf "\ndo you want to install the missing packages right now? [y/n] "
478 read -r confirm
483 read -r confirm
479 [ "$confirm" != "y" ] && exit 1
484 [ "$confirm" != "y" ] && exit 1
480
485
481 # Make sure all missing required packages are installed
486 # Make sure all missing required packages are installed
482 apt-get update && apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"`
487 apt-get update && apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"`
483 fi
488 fi
484
489
485 # Check if ./bootstrap.d directory exists
490 # Check if ./bootstrap.d directory exists
486 if [ ! -d "./bootstrap.d/" ] ; then
491 if [ ! -d "./bootstrap.d/" ] ; then
487 echo "error: './bootstrap.d' required directory not found!"
492 echo "error: './bootstrap.d' required directory not found!"
488 exit 1
493 exit 1
489 fi
494 fi
490
495
491 # Check if ./files directory exists
496 # Check if ./files directory exists
492 if [ ! -d "./files/" ] ; then
497 if [ ! -d "./files/" ] ; then
493 echo "error: './files' required directory not found!"
498 echo "error: './files' required directory not found!"
494 exit 1
499 exit 1
495 fi
500 fi
496
501
497 # Check if specified KERNELSRC_DIR directory exists
502 # Check if specified KERNELSRC_DIR directory exists
498 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
503 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
499 echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!"
504 echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!"
500 exit 1
505 exit 1
501 fi
506 fi
502
507
503 # Check if specified UBOOTSRC_DIR directory exists
508 # Check if specified UBOOTSRC_DIR directory exists
504 if [ -n "$UBOOTSRC_DIR" ] && [ ! -d "$UBOOTSRC_DIR" ] ; then
509 if [ -n "$UBOOTSRC_DIR" ] && [ ! -d "$UBOOTSRC_DIR" ] ; then
505 echo "error: '${UBOOTSRC_DIR}' specified directory not found (UBOOTSRC_DIR)!"
510 echo "error: '${UBOOTSRC_DIR}' specified directory not found (UBOOTSRC_DIR)!"
506 exit 1
511 exit 1
507 fi
512 fi
508
513
509 # Check if specified VIDEOCORESRC_DIR directory exists
514 # Check if specified VIDEOCORESRC_DIR directory exists
510 if [ -n "$VIDEOCORESRC_DIR" ] && [ ! -d "$VIDEOCORESRC_DIR" ] ; then
515 if [ -n "$VIDEOCORESRC_DIR" ] && [ ! -d "$VIDEOCORESRC_DIR" ] ; then
511 echo "error: '${VIDEOCORESRC_DIR}' specified directory not found (VIDEOCORESRC_DIR)!"
516 echo "error: '${VIDEOCORESRC_DIR}' specified directory not found (VIDEOCORESRC_DIR)!"
512 exit 1
517 exit 1
513 fi
518 fi
514
519
515 # Check if specified FBTURBOSRC_DIR directory exists
520 # Check if specified FBTURBOSRC_DIR directory exists
516 if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then
521 if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then
517 echo "error: '${FBTURBOSRC_DIR}' specified directory not found (FBTURBOSRC_DIR)!"
522 echo "error: '${FBTURBOSRC_DIR}' specified directory not found (FBTURBOSRC_DIR)!"
518 exit 1
523 exit 1
519 fi
524 fi
520
525
521 # Check if specified NEXMONSRC_DIR directory exists
526 # Check if specified NEXMONSRC_DIR directory exists
522 if [ -n "$NEXMONSRC_DIR" ] && [ ! -d "$NEXMONSRC_DIR" ] ; then
527 if [ -n "$NEXMONSRC_DIR" ] && [ ! -d "$NEXMONSRC_DIR" ] ; then
523 echo "error: '${NEXMONSRC_DIR}' specified directory not found (NEXMONSRC_DIR)!"
528 echo "error: '${NEXMONSRC_DIR}' specified directory not found (NEXMONSRC_DIR)!"
524 exit 1
529 exit 1
525 fi
530 fi
526
531
527 # Check if specified CHROOT_SCRIPTS directory exists
532 # Check if specified CHROOT_SCRIPTS directory exists
528 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
533 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
529 echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
534 echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
530 exit 1
535 exit 1
531 fi
536 fi
532
537
533 # Check if specified device mapping already exists (will be used by cryptsetup)
538 # Check if specified device mapping already exists (will be used by cryptsetup)
534 if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then
539 if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then
535 echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding"
540 echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding"
536 exit 1
541 exit 1
537 fi
542 fi
538
543
539 # Don't clobber an old build
544 # Don't clobber an old build
540 if [ -e "$BUILDDIR" ] ; then
545 if [ -e "$BUILDDIR" ] ; then
541 echo "error: directory ${BUILDDIR} already exists, not proceeding"
546 echo "error: directory ${BUILDDIR} already exists, not proceeding"
542 exit 1
547 exit 1
543 fi
548 fi
544
549
545 # Setup chroot directory
550 # Setup chroot directory
546 mkdir -p "${R}"
551 mkdir -p "${R}"
547
552
548 # Check if build directory has enough of free disk space >512MB
553 # Check if build directory has enough of free disk space >512MB
549 if [ "$(df --output=avail "${BUILDDIR}" | sed "1d")" -le "524288" ] ; then
554 if [ "$(df --output=avail "${BUILDDIR}" | sed "1d")" -le "524288" ] ; then
550 echo "error: ${BUILDDIR} not enough space left to generate the output image!"
555 echo "error: ${BUILDDIR} not enough space left to generate the output image!"
551 exit 1
556 exit 1
552 fi
557 fi
553
558
554 set -x
559 set -x
555
560
556 # Call "cleanup" function on various signals and errors
561 # Call "cleanup" function on various signals and errors
557 trap cleanup 0 1 2 3 6
562 trap cleanup 0 1 2 3 6
558
563
559 # Add required packages for the minbase installation
564 # Add required packages for the minbase installation
560 if [ "$ENABLE_MINBASE" = true ] ; then
565 if [ "$ENABLE_MINBASE" = true ] ; then
561 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown"
566 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown"
562 fi
567 fi
563
568
564 # Add parted package, required to get partprobe utility
569 # Add parted package, required to get partprobe utility
565 if [ "$EXPANDROOT" = true ] ; then
570 if [ "$EXPANDROOT" = true ] ; then
566 APT_INCLUDES="${APT_INCLUDES},parted"
571 APT_INCLUDES="${APT_INCLUDES},parted"
567 fi
572 fi
568
573
569 # Add dphys-swapfile package, required to enable swap
574 # Add dphys-swapfile package, required to enable swap
570 if [ "$ENABLE_DPHYSSWAP" = true ] ; then
575 if [ "$ENABLE_DPHYSSWAP" = true ] ; then
571 APT_INCLUDES="${APT_INCLUDES},dphys-swapfile"
576 APT_INCLUDES="${APT_INCLUDES},dphys-swapfile"
572 fi
577 fi
573
578
574 # Add dbus package, recommended if using systemd
579 # Add dbus package, recommended if using systemd
575 if [ "$ENABLE_DBUS" = true ] ; then
580 if [ "$ENABLE_DBUS" = true ] ; then
576 APT_INCLUDES="${APT_INCLUDES},dbus"
581 APT_INCLUDES="${APT_INCLUDES},dbus"
577 fi
582 fi
578
583
579 # Add iptables IPv4/IPv6 package
584 # Add iptables IPv4/IPv6 package
580 if [ "$ENABLE_IPTABLES" = true ] ; then
585 if [ "$ENABLE_IPTABLES" = true ] ; then
581 APT_INCLUDES="${APT_INCLUDES},iptables,iptables-persistent"
586 APT_INCLUDES="${APT_INCLUDES},iptables,iptables-persistent"
582 fi
587 fi
583 # Add apparmor for KERNEL_SECURITY
588 # Add apparmor for KERNEL_SECURITY
584 if [ "$KERNEL_SECURITY" = true ] ; then
589 if [ "$KERNEL_SECURITY" = true ] ; then
585 APT_INCLUDES="${APT_INCLUDES},apparmor,apparmor-utils,apparmor-profiles,apparmor-profiles-extra,libapparmor-perl"
590 APT_INCLUDES="${APT_INCLUDES},apparmor,apparmor-utils,apparmor-profiles,apparmor-profiles-extra,libapparmor-perl"
586 fi
591 fi
587
592
588 # Add openssh server package
593 # Add openssh server package
589 if [ "$ENABLE_SSHD" = true ] ; then
594 if [ "$ENABLE_SSHD" = true ] ; then
590 APT_INCLUDES="${APT_INCLUDES},openssh-server"
595 APT_INCLUDES="${APT_INCLUDES},openssh-server"
591 fi
596 fi
592
597
593 # Add alsa-utils package
598 # Add alsa-utils package
594 if [ "$ENABLE_SOUND" = true ] ; then
599 if [ "$ENABLE_SOUND" = true ] ; then
595 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
600 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
596 fi
601 fi
597
602
598 # Add rng-tools package
603 # Add rng-tools package
599 if [ "$ENABLE_HWRANDOM" = true ] ; then
604 if [ "$ENABLE_HWRANDOM" = true ] ; then
600 APT_INCLUDES="${APT_INCLUDES},rng-tools"
605 APT_INCLUDES="${APT_INCLUDES},rng-tools"
601 fi
606 fi
602
607
603 # Add fbturbo video driver
608 # Add fbturbo video driver
604 if [ "$ENABLE_FBTURBO" = true ] ; then
609 if [ "$ENABLE_FBTURBO" = true ] ; then
605 # Enable xorg package dependencies
610 # Enable xorg package dependencies
606 ENABLE_XORG=true
611 ENABLE_XORG=true
607 fi
612 fi
608
613
609 # Add user defined window manager package
614 # Add user defined window manager package
610 if [ -n "$ENABLE_WM" ] ; then
615 if [ -n "$ENABLE_WM" ] ; then
611 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
616 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
612
617
613 # Enable xorg package dependencies
618 # Enable xorg package dependencies
614 ENABLE_XORG=true
619 ENABLE_XORG=true
615 fi
620 fi
616
621
617 # Add xorg package
622 # Add xorg package
618 if [ "$ENABLE_XORG" = true ] ; then
623 if [ "$ENABLE_XORG" = true ] ; then
619 APT_INCLUDES="${APT_INCLUDES},xorg,dbus-x11"
624 APT_INCLUDES="${APT_INCLUDES},xorg,dbus-x11"
620 fi
625 fi
621
626
622 # Replace selected packages with smaller clones
627 # Replace selected packages with smaller clones
623 if [ "$ENABLE_REDUCE" = true ] ; then
628 if [ "$ENABLE_REDUCE" = true ] ; then
624 # Add levee package instead of vim-tiny
629 # Add levee package instead of vim-tiny
625 if [ "$REDUCE_VIM" = true ] ; then
630 if [ "$REDUCE_VIM" = true ] ; then
626 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
631 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
627 fi
632 fi
628
633
629 # Add dropbear package instead of openssh-server
634 # Add dropbear package instead of openssh-server
630 if [ "$REDUCE_SSHD" = true ] ; then
635 if [ "$REDUCE_SSHD" = true ] ; then
631 APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")"
636 APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")"
632 fi
637 fi
633 fi
638 fi
634
639
635 # Configure systemd-sysv exclude to make halt/reboot/shutdown scripts available
640 # Configure systemd-sysv exclude to make halt/reboot/shutdown scripts available
636 if [ "$ENABLE_SYSVINIT" = false ] ; then
641 if [ "$ENABLE_SYSVINIT" = false ] ; then
637 APT_EXCLUDES="--exclude=${APT_EXCLUDES},init,systemd-sysv"
642 APT_EXCLUDES="--exclude=${APT_EXCLUDES},init,systemd-sysv"
638 fi
643 fi
639
644
640 # Configure kernel sources if no KERNELSRC_DIR
645 # Configure kernel sources if no KERNELSRC_DIR
641 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
646 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
642 KERNELSRC_CONFIG=true
647 KERNELSRC_CONFIG=true
643 fi
648 fi
644
649
645 # Configure reduced kernel
650 # Configure reduced kernel
646 if [ "$KERNEL_REDUCE" = true ] ; then
651 if [ "$KERNEL_REDUCE" = true ] ; then
647 KERNELSRC_CONFIG=false
652 KERNELSRC_CONFIG=false
648 fi
653 fi
649
654
650 # Configure qemu compatible kernel
655 # Configure qemu compatible kernel
651 if [ "$ENABLE_QEMU" = true ] ; then
656 if [ "$ENABLE_QEMU" = true ] ; then
652 DTB_FILE=vexpress-v2p-ca15_a7.dtb
657 DTB_FILE=vexpress-v2p-ca15_a7.dtb
653 UBOOT_CONFIG=vexpress_ca15_tc2_defconfig
658 UBOOT_CONFIG=vexpress_ca15_tc2_defconfig
654 KERNEL_DEFCONFIG="vexpress_defconfig"
659 KERNEL_DEFCONFIG="vexpress_defconfig"
655 if [ "$KERNEL_MENUCONFIG" = false ] ; then
660 if [ "$KERNEL_MENUCONFIG" = false ] ; then
656 KERNEL_OLDDEFCONFIG=true
661 KERNEL_OLDDEFCONFIG=true
657 fi
662 fi
658 fi
663 fi
659
664
660 # Execute bootstrap scripts
665 # Execute bootstrap scripts
661 for SCRIPT in bootstrap.d/*.sh; do
666 for SCRIPT in bootstrap.d/*.sh; do
662 head -n 3 "$SCRIPT"
667 head -n 3 "$SCRIPT"
663 . "$SCRIPT"
668 . "$SCRIPT"
664 done
669 done
665
670
666 ## Execute custom bootstrap scripts
671 ## Execute custom bootstrap scripts
667 if [ -d "custom.d" ] ; then
672 if [ -d "custom.d" ] ; then
668 for SCRIPT in custom.d/*.sh; do
673 for SCRIPT in custom.d/*.sh; do
669 . "$SCRIPT"
674 . "$SCRIPT"
670 done
675 done
671 fi
676 fi
672
677
673 # Execute custom scripts inside the chroot
678 # Execute custom scripts inside the chroot
674 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
679 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
675 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
680 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
676 chroot_exec /bin/bash -x <<'EOF'
681 chroot_exec /bin/bash -x <<'EOF'
677 for SCRIPT in /chroot_scripts/* ; do
682 for SCRIPT in /chroot_scripts/* ; do
678 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
683 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
679 $SCRIPT
684 $SCRIPT
680 fi
685 fi
681 done
686 done
682 EOF
687 EOF
683 rm -rf "${R}/chroot_scripts"
688 rm -rf "${R}/chroot_scripts"
684 fi
689 fi
685
690
686 # Remove c/c++ build environment from the chroot
691 # Remove c/c++ build environment from the chroot
687 chroot_remove_cc
692 chroot_remove_cc
688
693
689 # Generate required machine-id
694 # Generate required machine-id
690 MACHINE_ID=$(dbus-uuidgen)
695 MACHINE_ID=$(dbus-uuidgen)
691 echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id"
696 echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id"
692 echo -n "${MACHINE_ID}" > "${ETC_DIR}/machine-id"
697 echo -n "${MACHINE_ID}" > "${ETC_DIR}/machine-id"
693
698
694 # APT Cleanup
699 # APT Cleanup
695 chroot_exec apt-get -y clean
700 chroot_exec apt-get -y clean
696 chroot_exec apt-get -y autoclean
701 chroot_exec apt-get -y autoclean
697 chroot_exec apt-get -y autoremove
702 chroot_exec apt-get -y autoremove
698
703
699 # Unmount mounted filesystems
704 # Unmount mounted filesystems
700 umount -l "${R}/proc"
705 umount -l "${R}/proc"
701 umount -l "${R}/sys"
706 umount -l "${R}/sys"
702
707
703 # Clean up directories
708 # Clean up directories
704 rm -rf "${R}/run/*"
709 rm -rf "${R}/run/*"
705 rm -rf "${R}/tmp/*"
710 rm -rf "${R}/tmp/*"
706
711
707 # Clean up APT proxy settings
712 # Clean up APT proxy settings
708 if [ "$KEEP_APT_PROXY" = false ] ; then
713 if [ "$KEEP_APT_PROXY" = false ] ; then
709 rm -f "${ETC_DIR}/apt/apt.conf.d/10proxy"
714 rm -f "${ETC_DIR}/apt/apt.conf.d/10proxy"
710 fi
715 fi
711
716
712 # Clean up files
717 # Clean up files
713 rm -f "${ETC_DIR}/ssh/ssh_host_*"
718 rm -f "${ETC_DIR}/ssh/ssh_host_*"
714 rm -f "${ETC_DIR}/dropbear/dropbear_*"
719 rm -f "${ETC_DIR}/dropbear/dropbear_*"
715 rm -f "${ETC_DIR}/apt/sources.list.save"
720 rm -f "${ETC_DIR}/apt/sources.list.save"
716 rm -f "${ETC_DIR}/resolvconf/resolv.conf.d/original"
721 rm -f "${ETC_DIR}/resolvconf/resolv.conf.d/original"
717 rm -f "${ETC_DIR}/*-"
722 rm -f "${ETC_DIR}/*-"
718 rm -f "${ETC_DIR}/resolv.conf"
723 rm -f "${ETC_DIR}/resolv.conf"
719 rm -f "${R}/root/.bash_history"
724 rm -f "${R}/root/.bash_history"
720 rm -f "${R}/var/lib/urandom/random-seed"
725 rm -f "${R}/var/lib/urandom/random-seed"
721 rm -f "${R}/initrd.img"
726 rm -f "${R}/initrd.img"
722 rm -f "${R}/vmlinuz"
727 rm -f "${R}/vmlinuz"
723 rm -f "${R}${QEMU_BINARY}"
728 rm -f "${R}${QEMU_BINARY}"
724
729
725 if [ "$ENABLE_QEMU" = true ] ; then
730 if [ "$ENABLE_QEMU" = true ] ; then
726 # Setup QEMU directory
731 # Setup QEMU directory
727 mkdir "${BASEDIR}/qemu"
732 mkdir "${BASEDIR}/qemu"
728
733
729 # Copy kernel image to QEMU directory
734 # Copy kernel image to QEMU directory
730 install_readonly "${BOOT_DIR}/${KERNEL_IMAGE}" "${BASEDIR}/qemu/${KERNEL_IMAGE}"
735 install_readonly "${BOOT_DIR}/${KERNEL_IMAGE}" "${BASEDIR}/qemu/${KERNEL_IMAGE}"
731
736
732 # Copy kernel config to QEMU directory
737 # Copy kernel config to QEMU directory
733 install_readonly "${R}/boot/config-${KERNEL_VERSION}" "${BASEDIR}/qemu/config-${KERNEL_VERSION}"
738 install_readonly "${R}/boot/config-${KERNEL_VERSION}" "${BASEDIR}/qemu/config-${KERNEL_VERSION}"
734
739
735 # Copy kernel dtbs to QEMU directory
740 # Copy kernel dtbs to QEMU directory
736 for dtb in "${BOOT_DIR}/"*.dtb ; do
741 for dtb in "${BOOT_DIR}/"*.dtb ; do
737 if [ -f "${dtb}" ] ; then
742 if [ -f "${dtb}" ] ; then
738 install_readonly "${dtb}" "${BASEDIR}/qemu/"
743 install_readonly "${dtb}" "${BASEDIR}/qemu/"
739 fi
744 fi
740 done
745 done
741
746
742 # Copy kernel overlays to QEMU directory
747 # Copy kernel overlays to QEMU directory
743 if [ -d "${BOOT_DIR}/overlays" ] ; then
748 if [ -d "${BOOT_DIR}/overlays" ] ; then
744 # Setup overlays dtbs directory
749 # Setup overlays dtbs directory
745 mkdir "${BASEDIR}/qemu/overlays"
750 mkdir "${BASEDIR}/qemu/overlays"
746
751
747 for dtb in "${BOOT_DIR}/overlays/"*.dtbo ; do
752 for dtb in "${BOOT_DIR}/overlays/"*.dtbo ; do
748 if [ -f "${dtb}" ] ; then
753 if [ -f "${dtb}" ] ; then
749 install_readonly "${dtb}" "${BASEDIR}/qemu/overlays/"
754 install_readonly "${dtb}" "${BASEDIR}/qemu/overlays/"
750 fi
755 fi
751 done
756 done
752 fi
757 fi
753
758
754 # Copy u-boot files to QEMU directory
759 # Copy u-boot files to QEMU directory
755 if [ "$ENABLE_UBOOT" = true ] ; then
760 if [ "$ENABLE_UBOOT" = true ] ; then
756 if [ -f "${BOOT_DIR}/u-boot.bin" ] ; then
761 if [ -f "${BOOT_DIR}/u-boot.bin" ] ; then
757 install_readonly "${BOOT_DIR}/u-boot.bin" "${BASEDIR}/qemu/u-boot.bin"
762 install_readonly "${BOOT_DIR}/u-boot.bin" "${BASEDIR}/qemu/u-boot.bin"
758 fi
763 fi
759 if [ -f "${BOOT_DIR}/uboot.mkimage" ] ; then
764 if [ -f "${BOOT_DIR}/uboot.mkimage" ] ; then
760 install_readonly "${BOOT_DIR}/uboot.mkimage" "${BASEDIR}/qemu/uboot.mkimage"
765 install_readonly "${BOOT_DIR}/uboot.mkimage" "${BASEDIR}/qemu/uboot.mkimage"
761 fi
766 fi
762 if [ -f "${BOOT_DIR}/boot.scr" ] ; then
767 if [ -f "${BOOT_DIR}/boot.scr" ] ; then
763 install_readonly "${BOOT_DIR}/boot.scr" "${BASEDIR}/qemu/boot.scr"
768 install_readonly "${BOOT_DIR}/boot.scr" "${BASEDIR}/qemu/boot.scr"
764 fi
769 fi
765 fi
770 fi
766
771
767 # Copy initramfs to QEMU directory
772 # Copy initramfs to QEMU directory
768 if [ -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" ] ; then
773 if [ -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" ] ; then
769 install_readonly "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" "${BASEDIR}/qemu/initramfs-${KERNEL_VERSION}"
774 install_readonly "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" "${BASEDIR}/qemu/initramfs-${KERNEL_VERSION}"
770 fi
775 fi
771 fi
776 fi
772
777
773 # Calculate size of the chroot directory in KB
778 # Calculate size of the chroot directory in KB
774 CHROOT_SIZE=$(expr "$(du -s "${R}" | awk '{ print $1 }')")
779 CHROOT_SIZE=$(expr "$(du -s "${R}" | awk '{ print $1 }')")
775
780
776 # Calculate the amount of needed 512 Byte sectors
781 # Calculate the amount of needed 512 Byte sectors
777 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
782 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
778 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
783 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
779 ROOT_OFFSET=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}")
784 ROOT_OFFSET=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}")
780
785
781 # The root partition is EXT4
786 # The root partition is EXT4
782 # This means more space than the actual used space of the chroot is used.
787 # This means more space than the actual used space of the chroot is used.
783 # As overhead for journaling and reserved blocks 35% are added.
788 # As overhead for journaling and reserved blocks 35% are added.
784 ROOT_SECTORS=$(expr "$(expr "${CHROOT_SIZE}" + "${CHROOT_SIZE}" \/ 100 \* 35)" \* 1024 \/ 512)
789 ROOT_SECTORS=$(expr "$(expr "${CHROOT_SIZE}" + "${CHROOT_SIZE}" \/ 100 \* 35)" \* 1024 \/ 512)
785
790
786 # Calculate required image size in 512 Byte sectors
791 # Calculate required image size in 512 Byte sectors
787 IMAGE_SECTORS=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}")
792 IMAGE_SECTORS=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}")
788
793
789 # Prepare image file
794 # Prepare image file
790 if [ "$ENABLE_SPLITFS" = true ] ; then
795 if [ "$ENABLE_SPLITFS" = true ] ; then
791 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count="${TABLE_SECTORS}"
796 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count="${TABLE_SECTORS}"
792 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek="${FRMW_SECTORS}"
797 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek="${FRMW_SECTORS}"
793 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}"
798 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}"
794 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}"
799 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}"
795
800
796 # Write firmware/boot partition tables
801 # Write firmware/boot partition tables
797 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
802 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
798 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
803 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
799 EOM
804 EOM
800
805
801 # Write root partition table
806 # Write root partition table
802 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
807 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
803 ${TABLE_SECTORS},${ROOT_SECTORS},83
808 ${TABLE_SECTORS},${ROOT_SECTORS},83
804 EOM
809 EOM
805
810
806 # Setup temporary loop devices
811 # Setup temporary loop devices
807 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)"
812 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)"
808 ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)"
813 ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)"
809 else # ENABLE_SPLITFS=false
814 else # ENABLE_SPLITFS=false
810 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}"
815 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}"
811 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}"
816 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}"
812
817
813 # Write partition table
818 # Write partition table
814 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
819 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
815 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
820 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
816 ${ROOT_OFFSET},${ROOT_SECTORS},83
821 ${ROOT_OFFSET},${ROOT_SECTORS},83
817 EOM
822 EOM
818
823
819 # Setup temporary loop devices
824 # Setup temporary loop devices
820 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME".img)"
825 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME".img)"
821 ROOT_LOOP="$(losetup -o 65M -f --show "$IMAGE_NAME".img)"
826 ROOT_LOOP="$(losetup -o 65M -f --show "$IMAGE_NAME".img)"
822 fi
827 fi
823
828
824 if [ "$ENABLE_CRYPTFS" = true ] ; then
829 if [ "$ENABLE_CRYPTFS" = true ] ; then
825 # Create dummy ext4 fs
830 # Create dummy ext4 fs
826 mkfs.ext4 "$ROOT_LOOP"
831 mkfs.ext4 "$ROOT_LOOP"
827
832
828 # Setup password keyfile
833 # Setup password keyfile
829 touch .password
834 touch .password
830 chmod 600 .password
835 chmod 600 .password
831 echo -n ${CRYPTFS_PASSWORD} > .password
836 echo -n ${CRYPTFS_PASSWORD} > .password
832
837
833 # Initialize encrypted partition
838 # Initialize encrypted partition
834 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
839 cryptsetup --verbose --debug -q luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -h "${CRYPTFS_HASH}" -s "${CRYPTFS_XTSKEYSIZE}" .password
835
840
836 # Open encrypted partition and setup mapping
841 # Open encrypted partition and setup mapping
837 cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}"
842 cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}"
838
843
839 # Secure delete password keyfile
844 # Secure delete password keyfile
840 shred -zu .password
845 shred -zu .password
841
846
842 # Update temporary loop device
847 # Update temporary loop device
843 ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}"
848 ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}"
844
849
845 # Wipe encrypted partition (encryption cipher is used for randomness)
850 # Wipe encrypted partition (encryption cipher is used for randomness)
846 dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count="$(blockdev --getsz "${ROOT_LOOP}")"
851 dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count="$(blockdev --getsz "${ROOT_LOOP}")"
847 fi
852 fi
848
853
849 # Build filesystems
854 # Build filesystems
850 mkfs.vfat "$FRMW_LOOP"
855 mkfs.vfat "$FRMW_LOOP"
851 mkfs.ext4 "$ROOT_LOOP"
856 mkfs.ext4 "$ROOT_LOOP"
852
857
853 # Mount the temporary loop devices
858 # Mount the temporary loop devices
854 mkdir -p "$BUILDDIR/mount"
859 mkdir -p "$BUILDDIR/mount"
855 mount "$ROOT_LOOP" "$BUILDDIR/mount"
860 mount "$ROOT_LOOP" "$BUILDDIR/mount"
856
861
857 mkdir -p "$BUILDDIR/mount/boot/firmware"
862 mkdir -p "$BUILDDIR/mount/boot/firmware"
858 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
863 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
859
864
860 # Copy all files from the chroot to the loop device mount point directory
865 # Copy all files from the chroot to the loop device mount point directory
861 rsync -a "${R}/" "$BUILDDIR/mount/"
866 rsync -a "${R}/" "$BUILDDIR/mount/"
862
867
863 # Unmount all temporary loop devices and mount points
868 # Unmount all temporary loop devices and mount points
864 cleanup
869 cleanup
865
870
866 # Create block map file(s) of image(s)
871 # Create block map file(s) of image(s)
867 if [ "$ENABLE_SPLITFS" = true ] ; then
872 if [ "$ENABLE_SPLITFS" = true ] ; then
868 # Create block map files for "bmaptool"
873 # Create block map files for "bmaptool"
869 bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img"
874 bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img"
870 bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img"
875 bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img"
871
876
872 # Image was successfully created
877 # Image was successfully created
873 echo "$IMAGE_NAME-frmw.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
878 echo "$IMAGE_NAME-frmw.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
874 echo "$IMAGE_NAME-root.img ($(expr \( "${TABLE_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
879 echo "$IMAGE_NAME-root.img ($(expr \( "${TABLE_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
875 else
880 else
876 # Create block map file for "bmaptool"
881 # Create block map file for "bmaptool"
877 bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img"
882 bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img"
878
883
879 # Image was successfully created
884 # Image was successfully created
880 echo "$IMAGE_NAME.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
885 echo "$IMAGE_NAME.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
881
886
882 # Create qemu qcow2 image
887 # Create qemu qcow2 image
883 if [ "$ENABLE_QEMU" = true ] ; then
888 if [ "$ENABLE_QEMU" = true ] ; then
884 QEMU_IMAGE=${QEMU_IMAGE:=${BASEDIR}/qemu/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
889 QEMU_IMAGE=${QEMU_IMAGE:=${BASEDIR}/qemu/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
885 QEMU_SIZE=16G
890 QEMU_SIZE=16G
886
891
887 qemu-img convert -f raw -O qcow2 "$IMAGE_NAME".img "$QEMU_IMAGE".qcow2
892 qemu-img convert -f raw -O qcow2 "$IMAGE_NAME".img "$QEMU_IMAGE".qcow2
888 qemu-img resize "$QEMU_IMAGE".qcow2 $QEMU_SIZE
893 qemu-img resize "$QEMU_IMAGE".qcow2 $QEMU_SIZE
889
894
890 echo "$QEMU_IMAGE.qcow2 ($QEMU_SIZE)" ": successfully created"
895 echo "$QEMU_IMAGE.qcow2 ($QEMU_SIZE)" ": successfully created"
891 fi
896 fi
892 fi
897 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant