##// END OF EJS Templates
Added: KERNELSRC_PREBUILT, KERNELSRC_ rename, fix-quotes
Jan Wagner -
r75:24bd7e97cf9d
parent child
Show More
@@ -1,3 +1,4
1 images
1 images
2 custom.d
2 custom.d
3 *.swp
3 *.swp
4 *.log
@@ -1,240 +1,243
1 # rpi2-gen-image
1 # rpi2-gen-image
2 ## Introduction
2 ## Introduction
3 `rpi2-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for the Raspberry 2 (RPi2) computer. The script at this time only supports the bootstrapping of the current stable Debian 8 "jessie" release.
3 `rpi2-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for the Raspberry 2 (RPi2) computer. The script at this time only supports the bootstrapping of the current stable Debian 8 "jessie" release.
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-core```
8 ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core```
9
9
10 ## Command-line parameters
10 ## Command-line parameters
11 The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi2-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi2-gen-image.sh` script.
11 The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi2-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi2-gen-image.sh` script.
12
12
13 #####Command-line examples:
13 #####Command-line examples:
14 ```shell
14 ```shell
15 ENABLE_UBOOT=true ./rpi2-gen-image.sh
15 ENABLE_UBOOT=true ./rpi2-gen-image.sh
16 ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi2-gen-image.sh
16 ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi2-gen-image.sh
17 ENABLE_WM=xfce4 ENABLE_FBTURBO=true ENABLE_MINBASE=true ./rpi2-gen-image.sh
17 ENABLE_WM=xfce4 ENABLE_FBTURBO=true ENABLE_MINBASE=true ./rpi2-gen-image.sh
18 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi2-gen-image.sh
18 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi2-gen-image.sh
19 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image.sh
19 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image.sh
20 ENABLE_MINBASE=true ./rpi2-gen-image.sh
20 ENABLE_MINBASE=true ./rpi2-gen-image.sh
21 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi2-gen-image.sh
21 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi2-gen-image.sh
22 BUILD_KERNEL=true KERNEL_SRCDIR=/tmp/linux ./rpi2-gen-image.sh
22 BUILD_KERNEL=true KERNELSRC_DIR=/tmp/linux ./rpi2-gen-image.sh
23 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi2-gen-image.sh
23 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi2-gen-image.sh
24 ```
24 ```
25
25
26 #### APT settings:
26 #### APT settings:
27 ##### `APT_SERVER`="ftp.debian.org"
27 ##### `APT_SERVER`="ftp.debian.org"
28 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.
28 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.
29
29
30 ##### `APT_PROXY`=""
30 ##### `APT_PROXY`=""
31 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.
31 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.
32
32
33 ##### `APT_INCLUDES`=""
33 ##### `APT_INCLUDES`=""
34 A comma seperated list of additional packages to be installed during bootstrapping.
34 A comma seperated list of additional packages to be installed during bootstrapping.
35
35
36 #### General system settings:
36 #### General system settings:
37 ##### `HOSTNAME`="rpi2-jessie"
37 ##### `HOSTNAME`="rpi2-jessie"
38 Set system host name. It's recommended that the host name is unique in the corresponding subnet.
38 Set system host name. It's recommended that the host name is unique in the corresponding subnet.
39
39
40 ##### `PASSWORD`="raspberry"
40 ##### `PASSWORD`="raspberry"
41 Set system `root` password. The same password is used for the created user `pi`. It's **STRONGLY** recommended that you choose a custom password.
41 Set system `root` password. The same password is used for the created user `pi`. It's **STRONGLY** recommended that you choose a custom password.
42
42
43 ##### `DEFLOCAL`="en_US.UTF-8"
43 ##### `DEFLOCAL`="en_US.UTF-8"
44 Set default system locale. This setting can also be changed inside the running OS using the `dpkg-reconfigure locales` command. The script variant `minbase` (ENABLE_MINBASE=true) doesn't install `locales`.
44 Set default system locale. This setting can also be changed inside the running OS using the `dpkg-reconfigure locales` command. The script variant `minbase` (ENABLE_MINBASE=true) doesn't install `locales`.
45
45
46 ##### `TIMEZONE`="Europe/Berlin"
46 ##### `TIMEZONE`="Europe/Berlin"
47 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.
47 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.
48
48
49 ##### `EXPANDROOT`=true
49 ##### `EXPANDROOT`=true
50 Expand the root partition and filesystem automatically on first boot.
50 Expand the root partition and filesystem automatically on first boot.
51
51
52 #### Keyboard settings:
52 #### Keyboard settings:
53 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.
53 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.
54
54
55 ##### `XKB_MODEL`=""
55 ##### `XKB_MODEL`=""
56 Set the name of the model of your keyboard type.
56 Set the name of the model of your keyboard type.
57
57
58 ##### `XKB_LAYOUT`=""
58 ##### `XKB_LAYOUT`=""
59 Set the supported keyboard layout(s).
59 Set the supported keyboard layout(s).
60
60
61 ##### `XKB_VARIANT`=""
61 ##### `XKB_VARIANT`=""
62 Set the supported variant(s) of the keyboard layout(s).
62 Set the supported variant(s) of the keyboard layout(s).
63
63
64 ##### `XKB_OPTIONS`=""
64 ##### `XKB_OPTIONS`=""
65 Set extra xkb configuration options.
65 Set extra xkb configuration options.
66
66
67 #### Networking settings (DHCP):
67 #### Networking settings (DHCP):
68 This setting is used to set up networking auto configuration in `/etc/systemd/network/eth.network`.
68 This setting is used to set up networking auto configuration in `/etc/systemd/network/eth.network`.
69
69
70 #####`ENABLE_DHCP`=true
70 #####`ENABLE_DHCP`=true
71 Set the system to use DHCP. This requires an DHCP server.
71 Set the system to use DHCP. This requires an DHCP server.
72
72
73 #### Networking settings (static):
73 #### Networking settings (static):
74 These settings are used to set up a static networking configuration in /etc/systemd/network/eth.network. The following static networking settings are only supported if `ENABLE_DHCP` was set to `false`.
74 These settings are used to set up a static networking configuration in /etc/systemd/network/eth.network. The following static networking settings are only supported if `ENABLE_DHCP` was set to `false`.
75
75
76 #####`NET_ADDRESS`=""
76 #####`NET_ADDRESS`=""
77 Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24".
77 Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24".
78
78
79 #####`NET_GATEWAY`=""
79 #####`NET_GATEWAY`=""
80 Set the IP address for the default gateway.
80 Set the IP address for the default gateway.
81
81
82 #####`NET_DNS_1`=""
82 #####`NET_DNS_1`=""
83 Set the IP address for the first DNS server.
83 Set the IP address for the first DNS server.
84
84
85 #####`NET_DNS_2`=""
85 #####`NET_DNS_2`=""
86 Set the IP address for the second DNS server.
86 Set the IP address for the second DNS server.
87
87
88 #####`NET_DNS_DOMAINS`=""
88 #####`NET_DNS_DOMAINS`=""
89 Set the default DNS search domains to use for non fully qualified host names.
89 Set the default DNS search domains to use for non fully qualified host names.
90
90
91 #####`NET_NTP_1`=""
91 #####`NET_NTP_1`=""
92 Set the IP address for the first NTP server.
92 Set the IP address for the first NTP server.
93
93
94 #####`NET_NTP_2`=""
94 #####`NET_NTP_2`=""
95 Set the IP address for the second NTP server.
95 Set the IP address for the second NTP server.
96
96
97 #### Basic system features:
97 #### Basic system features:
98 ##### `ENABLE_CONSOLE`=true
98 ##### `ENABLE_CONSOLE`=true
99 Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system.
99 Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system.
100
100
101 ##### `ENABLE_IPV6`=true
101 ##### `ENABLE_IPV6`=true
102 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
102 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
103
103
104 ##### `ENABLE_SSHD`=true
104 ##### `ENABLE_SSHD`=true
105 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.
105 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.
106
106
107 ##### `ENABLE_RSYSLOG`=true
107 ##### `ENABLE_RSYSLOG`=true
108 If set to false, disable and uninstall rsyslog (so logs will be available only
108 If set to false, disable and uninstall rsyslog (so logs will be available only
109 in journal files)
109 in journal files)
110
110
111 ##### `ENABLE_SOUND`=true
111 ##### `ENABLE_SOUND`=true
112 Enable sound hardware and install Advanced Linux Sound Architecture.
112 Enable sound hardware and install Advanced Linux Sound Architecture.
113
113
114 ##### `ENABLE_HWRANDOM`=true
114 ##### `ENABLE_HWRANDOM`=true
115 Enable Hardware Random Number Generator. Strong random numbers are important for most network based communications that use encryption. It's recommended to be enabled.
115 Enable Hardware Random Number Generator. Strong random numbers are important for most network based communications that use encryption. It's recommended to be enabled.
116
116
117 ##### `ENABLE_MINGPU`=false
117 ##### `ENABLE_MINGPU`=false
118 Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU.
118 Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU.
119
119
120 ##### `ENABLE_DBUS`=true
120 ##### `ENABLE_DBUS`=true
121 Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled.
121 Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled.
122
122
123 ##### `ENABLE_XORG`=false
123 ##### `ENABLE_XORG`=false
124 Install Xorg open-source X Window System.
124 Install Xorg open-source X Window System.
125
125
126 ##### `ENABLE_WM`=""
126 ##### `ENABLE_WM`=""
127 Install a user defined window manager for the X Window System. To make sure all X related package dependencies are getting installed `ENABLE_XORG` will automatically get enabled if `ENABLE_WM` is used. The `rpi2-gen-image.sh` script has been tested with the following list of window managers: `blackbox`, `openbox`, `fluxbox`, `jwm`, `dwm`, `xfce4`, `awesome`.
127 Install a user defined window manager for the X Window System. To make sure all X related package dependencies are getting installed `ENABLE_XORG` will automatically get enabled if `ENABLE_WM` is used. The `rpi2-gen-image.sh` script has been tested with the following list of window managers: `blackbox`, `openbox`, `fluxbox`, `jwm`, `dwm`, `xfce4`, `awesome`.
128
128
129 #### Advanced system features:
129 #### Advanced system features:
130 ##### `ENABLE_MINBASE`=false
130 ##### `ENABLE_MINBASE`=false
131 Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB.
131 Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB.
132
132
133 ##### `ENABLE_REDUCE`=false
133 ##### `ENABLE_REDUCE`=false
134 Reduce the disk usage by deleting all man pages and doc files (harsh). APT will be configured to use compressed package repository lists and no package caching files. If `ENABLE_MINGPU`=true unnecessary start.elf and fixup.dat files will also be removed from the boot partition. This will make it possible to generate output OS images with about 160MB of used disk space. It's recommended to use this parameter in combination with `ENABLE_MINBASE`=true.
134 Reduce the disk usage by deleting all man pages and doc files (harsh). APT will be configured to use compressed package repository lists and no package caching files. If `ENABLE_MINGPU`=true unnecessary start.elf and fixup.dat files will also be removed from the boot partition. This will make it possible to generate output OS images with about 160MB of used disk space. It's recommended to use this parameter in combination with `ENABLE_MINBASE`=true.
135
135
136 ##### `ENABLE_UBOOT`=false
136 ##### `ENABLE_UBOOT`=false
137 Replace default RPi2 second stage bootloader (bootcode.bin) with U-Boot bootloader. U-Boot can boot images via the network using the BOOTP/TFTP protocol.
137 Replace default RPi2 second stage bootloader (bootcode.bin) with U-Boot bootloader. U-Boot can boot images via the network using the BOOTP/TFTP protocol.
138
138
139 ##### `ENABLE_FBTURBO`=false
139 ##### `ENABLE_FBTURBO`=false
140 Install and enable the hardware accelerated Xorg video driver `fbturbo`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling.
140 Install and enable the hardware accelerated Xorg video driver `fbturbo`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling.
141
141
142 ##### `ENABLE_IPTABLES`=false
142 ##### `ENABLE_IPTABLES`=false
143 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
143 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
144
144
145 ##### `ENABLE_USER`=true
145 ##### `ENABLE_USER`=true
146 Create pi user with password raspberry
146 Create pi user with password raspberry
147
147
148 ##### `ENABLE_ROOT`=true
148 ##### `ENABLE_ROOT`=true
149 Set root user password so root login will be enabled
149 Set root user password so root login will be enabled
150
150
151 ##### `ENABLE_ROOT_SSH`=true
151 ##### `ENABLE_ROOT_SSH`=true
152 Enable password root login via SSH. May be a security risk with default
152 Enable password root login via SSH. May be a security risk with default
153 password, use only in trusted environments.
153 password, use only in trusted environments.
154
154
155 ##### `ENABLE_HARDNET`=false
155 ##### `ENABLE_HARDNET`=false
156 Enable IPv4/IPv6 network stack hardening settings.
156 Enable IPv4/IPv6 network stack hardening settings.
157
157
158 ##### `ENABLE_SPLITFS`=false
158 ##### `ENABLE_SPLITFS`=false
159 Enable having root partition on an USB drive by creating two image files: one for the `/boot/firmware` mount point, and another for `/`.
159 Enable having root partition on an USB drive by creating two image files: one for the `/boot/firmware` mount point, and another for `/`.
160
160
161 ##### `CHROOT_SCRIPTS`=""
161 ##### `CHROOT_SCRIPTS`=""
162 Path to a directory with scripts that should be run in the chroot before the image is finally built. Every executable file in this direcory is run in lexicographical order.
162 Path to a directory with scripts that should be run in the chroot before the image is finally built. Every executable file in this direcory is run in lexicographical order.
163
163
164 #### Kernel compilation:
164 #### Kernel compilation:
165 ##### `BUILD_KERNEL`=false
165 ##### `BUILD_KERNEL`=false
166 Build and install the latest RPi2 Linux kernel. Currently only the default RPi2 kernel configuration is used. Detailed configuration parameters for customizing the kernel and minor bug fixes still need to get implemented. feel free to help.
166 Build and install the latest RPi2 Linux kernel. Currently only the default RPi2 kernel configuration is used. Detailed configuration parameters for customizing the kernel and minor bug fixes still need to get implemented. feel free to help.
167
167
168 ##### `KERNEL_SRCDIR`=""
169 Path to a directory of [RaspberryPi Linux kernel sources](https://github.com/raspberrypi/linux) that will be copied, configured, build and installed inside the chroot.
170
171 ##### `KERNEL_THREADS`=1
168 ##### `KERNEL_THREADS`=1
172 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.
169 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.
173
170
174 ##### `KERNEL_HEADERS`=true
171 ##### `KERNEL_HEADERS`=true
175 Install kernel headers with built kernel.
172 Install kernel headers with built kernel.
176
173
177 ##### `KERNEL_MENUCONFIG`=false
174 ##### `KERNEL_MENUCONFIG`=false
178 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
175 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
179
176
180 ##### `KERNEL_CONFIGSRC`=true
177 ##### `KERNEL_REMOVESRC`=true
181 Run `make bcm2709_defconfig` (and optional `make menuconfig`) to configure the kernel sources before building. This setting is automatically set to `true` if no existing kernel sources directory was specified using `KERNEL_SRCDIR`.
178 Remove all kernel sources from the generated OS image after it was built and installed.
182
179
183 ##### `KERNEL_CLEANSRC`=false
180 ##### `KERNELSRC_DIR`=""
184 Clean the existing kernel sources directory `KERNEL_SRCDIR` (using `make mrproper`) after it was copied to the chroot and before the compilation of the kernel has started. This setting will be ignored if no `KERNEL_SRCDIR` was specified.
181 Path to a directory of [RaspberryPi Linux kernel sources](https://github.com/raspberrypi/linux) that will be copied, configured, build and installed inside the chroot.
185
182
186 ##### `KERNEL_RMSRC`=true
183 ##### `KERNELSRC_CLEAN`=false
187 Remove all kernel sources from the generated OS image after it was built and installed.
184 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 setting will be ignored if no `KERNELSRC_DIR` was specified or if `KERNELSRC_PREBUILT`=true.
185
186 ##### `KERNELSRC_CONFIG`=true
187 Run `make bcm2709_defconfig` (and optional `make menuconfig`) to configure the kernel sources before building. This setting is automatically set to `true` if no existing kernel sources directory was specified using `KERNELSRC_DIR`. This settings is ignored if `KERNELSRC_PREBUILT`=true.
188
189 ##### `KERNELSRC_PREBUILT`=false
190 With this parameter set to true the script expects the existing kernel sources directory to be already successfully cross-compiled. The parameters `KERNELSRC_CLEAN`, `KERNELSRC_CONFIG` and `KERNEL_MENUCONFIG` are ignored and no kernel compilation tasks are performed.
188
191
189 ## Understanding the script
192 ## Understanding the script
190 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:
193 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:
191
194
192 | Script | Description |
195 | Script | Description |
193 | --- | --- |
196 | --- | --- |
194 | `10-bootstrap.sh` | Debootstrap basic system |
197 | `10-bootstrap.sh` | Debootstrap basic system |
195 | `11-apt.sh` | Setup APT repositories |
198 | `11-apt.sh` | Setup APT repositories |
196 | `12-locale.sh` | Setup Locales and keyboard settings |
199 | `12-locale.sh` | Setup Locales and keyboard settings |
197 | `13-kernel.sh` | Build and install RPi2 Kernel |
200 | `13-kernel.sh` | Build and install RPi2 Kernel |
198 | `20-networking.sh` | Setup Networking |
201 | `20-networking.sh` | Setup Networking |
199 | `21-firewall.sh` | Setup Firewall |
202 | `21-firewall.sh` | Setup Firewall |
200 | `30-security.sh` | Setup Users and Security settings |
203 | `30-security.sh` | Setup Users and Security settings |
201 | `31-logging.sh` | Setup Logging |
204 | `31-logging.sh` | Setup Logging |
202 | `41-uboot.sh` | Build and Setup U-Boot |
205 | `41-uboot.sh` | Build and Setup U-Boot |
203 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
206 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
204 | `50-firstboot.sh` | First boot actions |
207 | `50-firstboot.sh` | First boot actions |
205
208
206 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.
209 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.
207
210
208 | Directory | Description |
211 | Directory | Description |
209 | --- | --- |
212 | --- | --- |
210 | `boot` | Boot and RPi2 configuration files |
213 | `boot` | Boot and RPi2 configuration files |
211 | `dpkg` | Package Manager configuration |
214 | `dpkg` | Package Manager configuration |
212 | `firstboot` | Scripts that get executed on first boot |
215 | `firstboot` | Scripts that get executed on first boot |
213 | `iptables` | Firewall configuration files |
216 | `iptables` | Firewall configuration files |
214 | `locales` | Locales configuration |
217 | `locales` | Locales configuration |
215 | `modules` | Kernel Modules configuration |
218 | `modules` | Kernel Modules configuration |
216 | `mount` | Fstab configuration |
219 | `mount` | Fstab configuration |
217 | `network` | Networking configuration files |
220 | `network` | Networking configuration files |
218 | `sysctl.d` | Swapping and Network Hardening configuration |
221 | `sysctl.d` | Swapping and Network Hardening configuration |
219 | `xorg` | fbturbo Xorg driver configuration |
222 | `xorg` | fbturbo Xorg driver configuration |
220
223
221 ## Logging of the bootstrapping process
224 ## Logging of the bootstrapping process
222 All information related to the bootstrapping process and the commands executed by the `rpi2-gen-image.sh` script can easily be saved into a logfile. The common shell command `script` can be used for this purpose:
225 All information related to the bootstrapping process and the commands executed by the `rpi2-gen-image.sh` script can easily be saved into a logfile. The common shell command `script` can be used for this purpose:
223
226
224 ```shell
227 ```shell
225 script -c 'APT_SERVER=ftp.de.debian.org ./rpi2-gen-image.sh' ./build.log
228 script -c 'APT_SERVER=ftp.de.debian.org ./rpi2-gen-image.sh' ./build.log
226 ```
229 ```
227
230
228 ## Flashing the image file
231 ## Flashing the image file
229 After the image file was successfully created by the `rpi2-gen-image.sh` script it can be copied to the microSD card that will be used by the RPi2 computer. This can be performed by using the tools `bmaptool` or `dd`. Using `bmaptool` will probably speed-up the copy process because `bmaptool` copies more wisely than `dd`.
232 After the image file was successfully created by the `rpi2-gen-image.sh` script it can be copied to the microSD card that will be used by the RPi2 computer. This can be performed by using the tools `bmaptool` or `dd`. Using `bmaptool` will probably speed-up the copy process because `bmaptool` copies more wisely than `dd`.
230
233
231 #####Flashing examples:
234 #####Flashing examples:
232 ```shell
235 ```shell
233 bmaptool copy ./images/jessie/2015-12-13-debian-jessie.img /dev/mmcblk0
236 bmaptool copy ./images/jessie/2015-12-13-debian-jessie.img /dev/mmcblk0
234 dd bs=4M if=./images/jessie/2015-12-13-debian-jessie.img of=/dev/mmcblk0
237 dd bs=4M if=./images/jessie/2015-12-13-debian-jessie.img of=/dev/mmcblk0
235 ```
238 ```
236 If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, then the `-root` one on the USB drive:
239 If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, then the `-root` one on the USB drive:
237 ```shell
240 ```shell
238 bmaptool copy ./images/jessie/2015-12-13-debian-jessie-frmw.img /dev/mmcblk0
241 bmaptool copy ./images/jessie/2015-12-13-debian-jessie-frmw.img /dev/mmcblk0
239 bmaptool copy ./images/jessie/2015-12-13-debian-jessie-root.img /dev/sdc
242 bmaptool copy ./images/jessie/2015-12-13-debian-jessie-root.img /dev/sdc
240 ```
243 ```
@@ -1,28 +1,28
1 #
1 #
2 # Debootstrap basic system
2 # Debootstrap basic system
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Base debootstrap (unpack only)
8 # Base debootstrap (unpack only)
9 if [ "$ENABLE_MINBASE" = true ] ; then
9 if [ "$ENABLE_MINBASE" = true ] ; then
10 http_proxy=${APT_PROXY} debootstrap --arch=${RELEASE_ARCH} --variant=minbase --foreign --include=${APT_INCLUDES} ${RELEASE} $R http://${APT_SERVER}/debian
10 http_proxy=${APT_PROXY} debootstrap --arch="${RELEASE_ARCH}" --variant=minbase --foreign --include="${APT_INCLUDES}" "${RELEASE}" "$R" "http://${APT_SERVER}/debian"
11 else
11 else
12 http_proxy=${APT_PROXY} debootstrap --arch=${RELEASE_ARCH} --foreign --include=${APT_INCLUDES} ${RELEASE} $R http://${APT_SERVER}/debian
12 http_proxy=${APT_PROXY} debootstrap --arch="${RELEASE_ARCH}" --foreign --include="${APT_INCLUDES}" "${RELEASE}" "$R" "http://${APT_SERVER}/debian"
13 fi
13 fi
14
14
15 # Copy qemu emulator binary to chroot
15 # Copy qemu emulator binary to chroot
16 cp ${QEMU_BINARY} $R/usr/bin
16 cp "${QEMU_BINARY}" "$R/usr/bin"
17
17
18 # Copy debian-archive-keyring.pgp
18 # Copy debian-archive-keyring.pgp
19 mkdir -p $R/usr/share/keyrings
19 mkdir -p "$R/usr/share/keyrings"
20 cp /usr/share/keyrings/debian-archive-keyring.gpg $R/usr/share/keyrings/debian-archive-keyring.gpg
20 cp /usr/share/keyrings/debian-archive-keyring.gpg "$R/usr/share/keyrings/debian-archive-keyring.gpg"
21
21
22 # Complete the bootstrapping process
22 # Complete the bootstrapping process
23 chroot_exec /debootstrap/debootstrap --second-stage
23 chroot_exec /debootstrap/debootstrap --second-stage
24
24
25 # Mount required filesystems
25 # Mount required filesystems
26 mount -t proc none $R/proc
26 mount -t proc none "$R/proc"
27 mount -t sysfs none $R/sys
27 mount -t sysfs none "$R/sys"
28 mount --bind /dev/pts $R/dev/pts
28 mount --bind /dev/pts "$R/dev/pts"
@@ -1,30 +1,30
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 $R/etc/apt/apt.conf.d/10proxy
10 install_readonly files/apt/10proxy "$R/etc/apt/apt.conf.d/10proxy"
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" $R/etc/apt/apt.conf.d/10proxy
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" "$R/etc/apt/apt.conf.d/10proxy"
12 fi
12 fi
13
13
14 # Install APT pinning configuration for flash-kernel package
14 # Install APT pinning configuration for flash-kernel package
15 install_readonly files/apt/flash-kernel $R/etc/apt/preferences.d/flash-kernel
15 install_readonly files/apt/flash-kernel "$R/etc/apt/preferences.d/flash-kernel"
16
16
17 # Upgrade collabora package index and install collabora keyring
17 # Upgrade collabora package index and install collabora keyring
18 echo "deb https://repositories.collabora.co.uk/debian ${RELEASE} rpi2" >$R/etc/apt/sources.list
18 echo "deb https://repositories.collabora.co.uk/debian ${RELEASE} rpi2" > "$R/etc/apt/sources.list"
19 chroot_exec apt-get -qq -y update
19 chroot_exec apt-get -qq -y update
20 chroot_exec apt-get -qq -y --force-yes install collabora-obs-archive-keyring
20 chroot_exec apt-get -qq -y --force-yes install collabora-obs-archive-keyring
21
21
22 # Install APT sources.list
22 # Install APT sources.list
23 install_readonly files/apt/sources.list $R/etc/apt/sources.list
23 install_readonly files/apt/sources.list "$R/etc/apt/sources.list"
24 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" $R/etc/apt/sources.list
24 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "$R/etc/apt/sources.list"
25 sed -i "s/ jessie/ ${RELEASE}/" $R/etc/apt/sources.list
25 sed -i "s/ jessie/ ${RELEASE}/" "$R/etc/apt/sources.list"
26
26
27 # Upgrade package index and update all installed packages and changed dependencies
27 # Upgrade package index and update all installed packages and changed dependencies
28 chroot_exec apt-get -qq -y update
28 chroot_exec apt-get -qq -y update
29 chroot_exec apt-get -qq -y -u dist-upgrade
29 chroot_exec apt-get -qq -y -u dist-upgrade
30 chroot_exec apt-get -qq -y check
30 chroot_exec apt-get -qq -y check
@@ -1,58 +1,58
1 #
1 #
2 # Setup Locales and keyboard settings
2 # Setup Locales and keyboard settings
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Install and setup timezone
8 # Install and setup timezone
9 echo ${TIMEZONE} >$R/etc/timezone
9 echo ${TIMEZONE} > "$R/etc/timezone"
10 chroot_exec dpkg-reconfigure -f noninteractive tzdata
10 chroot_exec dpkg-reconfigure -f noninteractive tzdata
11
11
12 # Install and setup default locale and keyboard configuration
12 # Install and setup default locale and keyboard configuration
13 if [ "$ENABLE_MINBASE" = false ] ; then
13 if [ "$ENABLE_MINBASE" = false ] ; then
14 # Set locale choice in debconf db, even though dpkg-reconfigure ignores and overwrites them due to some bug
14 # Set locale choice in debconf db, even though dpkg-reconfigure ignores and overwrites them due to some bug
15 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685957
15 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684134 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=685957
16 # ... so we have to set locales manually
16 # ... so we have to set locales manually
17 if [ "$DEFLOCAL" = "en_US.UTF-8" ] ; then
17 if [ "$DEFLOCAL" = "en_US.UTF-8" ] ; then
18 chroot_exec echo "locales locales/locales_to_be_generated multiselect ${DEFLOCAL} UTF-8" | debconf-set-selections
18 chroot_exec echo "locales locales/locales_to_be_generated multiselect ${DEFLOCAL} UTF-8" | debconf-set-selections
19 else
19 else
20 # en_US.UTF-8 should be available anyway : https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_reconfiguration_of_the_locale
20 # en_US.UTF-8 should be available anyway : https://www.debian.org/doc/manuals/debian-reference/ch08.en.html#_the_reconfiguration_of_the_locale
21 chroot_exec echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, ${DEFLOCAL} UTF-8" | debconf-set-selections
21 chroot_exec echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, ${DEFLOCAL} UTF-8" | debconf-set-selections
22 sed -i "/en_US.UTF-8/s/^#//" $R/etc/locale.gen
22 sed -i "/en_US.UTF-8/s/^#//" "$R/etc/locale.gen"
23 fi
23 fi
24
24
25 sed -i "/${DEFLOCAL}/s/^#//" $R/etc/locale.gen
25 sed -i "/${DEFLOCAL}/s/^#//" "$R/etc/locale.gen"
26 chroot_exec echo "locales locales/default_environment_locale select ${DEFLOCAL}" | debconf-set-selections
26 chroot_exec echo "locales locales/default_environment_locale select ${DEFLOCAL}" | debconf-set-selections
27 chroot_exec locale-gen
27 chroot_exec locale-gen
28 chroot_exec update-locale LANG=${DEFLOCAL}
28 chroot_exec update-locale LANG="${DEFLOCAL}"
29
29
30 # Install and setup default keyboard configuration
30 # Install and setup default keyboard configuration
31 if [ "$XKB_MODEL" != "" ] ; then
31 if [ "$XKB_MODEL" != "" ] ; then
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" $R/etc/default/keyboard
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "$R/etc/default/keyboard"
33 fi
33 fi
34 if [ "$XKB_LAYOUT" != "" ] ; then
34 if [ "$XKB_LAYOUT" != "" ] ; then
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" $R/etc/default/keyboard
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "$R/etc/default/keyboard"
36 fi
36 fi
37 if [ "$XKB_VARIANT" != "" ] ; then
37 if [ "$XKB_VARIANT" != "" ] ; then
38 sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKB_VARIANT}\"/" $R/etc/default/keyboard
38 sed -i "s/^XKBVARIANT.*/XKBVARIANT=\"${XKB_VARIANT}\"/" "$R/etc/default/keyboard"
39 fi
39 fi
40 if [ "$XKB_OPTIONS" != "" ] ; then
40 if [ "$XKB_OPTIONS" != "" ] ; then
41 sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKB_OPTIONS}\"/" $R/etc/default/keyboard
41 sed -i "s/^XKBOPTIONS.*/XKBOPTIONS=\"${XKB_OPTIONS}\"/" "$R/etc/default/keyboard"
42 fi
42 fi
43 chroot_exec dpkg-reconfigure -f noninteractive keyboard-configuration
43 chroot_exec dpkg-reconfigure -f noninteractive keyboard-configuration
44
44
45 # Install and setup font console
45 # Install and setup font console
46 case "${DEFLOCAL}" in
46 case "${DEFLOCAL}" in
47 *UTF-8)
47 *UTF-8)
48 sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' $R/etc/default/console-setup
48 sed -i 's/^CHARMAP.*/CHARMAP="UTF-8"/' "$R/etc/default/console-setup"
49 ;;
49 ;;
50 *)
50 *)
51 sed -i 's/^CHARMAP.*/CHARMAP="guess"/' $R/etc/default/console-setup
51 sed -i 's/^CHARMAP.*/CHARMAP="guess"/' "$R/etc/default/console-setup"
52 ;;
52 ;;
53 esac
53 esac
54 chroot_exec dpkg-reconfigure -f noninteractive console-setup
54 chroot_exec dpkg-reconfigure -f noninteractive console-setup
55 else # ENABLE_MINBASE=true
55 else # ENABLE_MINBASE=true
56 # Install POSIX default locale
56 # Install POSIX default locale
57 install_readonly files/locales/locale $R/etc/default/locale
57 install_readonly files/locales/locale "$R/etc/default/locale"
58 fi
58 fi
@@ -1,152 +1,163
1 #
1 #
2 # Build and Setup RPi2 Kernel
2 # Build and Setup RPi2 Kernel
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Fetch and build latest raspberry kernel
8 # Fetch and build latest raspberry kernel
9 if [ "$BUILD_KERNEL" = true ] ; then
9 if [ "$BUILD_KERNEL" = true ] ; then
10 # Setup source directory
10 # Setup source directory
11 mkdir -p $R/usr/src
11 mkdir -p "$R/usr/src"
12
12
13 # Copy existing kernel sources into chroot directory
13 # Copy existing kernel sources into chroot directory
14 if [ -n "$KERNEL_SRCDIR" ] && [ -d "$KERNEL_SRCDIR" ] ; then
14 if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then
15 # Copy kernel sources
15 # Copy kernel sources
16 cp -r "${KERNEL_SRCDIR}" "${R}/usr/src"
16 cp -r "${KERNELSRC_DIR}" "${R}/usr/src"
17
17
18 # Clean the kernel sources
18 # Clean the kernel sources
19 if [ "$KERNEL_CLEANSRC" = true ] ; then
19 if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then
20 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} mrproper
20 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
21 fi
21 fi
22 else # KERNEL_SRCDIR=""
22 else # KERNELSRC_DIR=""
23 # Fetch current raspberrypi kernel sources
23 # Fetch current raspberrypi kernel sources
24 git -C $R/usr/src clone --depth=1 https://github.com/raspberrypi/linux
24 git -C "$R/usr/src" clone --depth=1 https://github.com/raspberrypi/linux
25 fi
25 fi
26
26
27 # Calculate optimal number of kernel building threads
27 # Calculate optimal number of kernel building threads
28 if [ "$KERNEL_THREADS" = "1" ] ; then
28 if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then
29 if [ -r /proc/cpuinfo ] ; then
29 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
30 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
31 fi
32 fi
30 fi
33
31
34 if [ "$KERNEL_CONFIGSRC" = true ] ; then
32 if [ "$KERNELSRC_PREBUILT" = false ] ; then
35 # Load default raspberry kernel configuration
33 if [ "$KERNELSRC_CONFIG" = true ] ; then
36 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${KERNEL_DEFCONFIG}
34 # Load default raspberry kernel configuration
35 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
37
36
38 # Start menu-driven kernel configuration (interactive)
37 # Start menu-driven kernel configuration (interactive)
39 if [ "$KERNEL_MENUCONFIG" = true ] ; then
38 if [ "$KERNEL_MENUCONFIG" = true ] ; then
40 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} menuconfig
39 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
40 fi
41 fi
41 fi
42 fi
43
42
44 # Cross compile kernel and modules
43 # Cross compile kernel and modules
45 make -C $R/usr/src/linux -j${KERNEL_THREADS} ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} zImage modules dtbs
44 make -C "$R/usr/src/linux" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" zImage modules dtbs
45 fi
46
46
47 # Check if kernel compilation was successful
47 # Check if kernel compilation was successful
48 if [ ! -r $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage ] ; then
48 if [ ! -r "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage" ] ; then
49 echo "error: kernel compilation failed!"
49 echo "error: kernel compilation failed! (zImage not found)"
50 cleanup
50 cleanup
51 exit 1
51 exit 1
52 fi
52 fi
53
53
54 # Install kernel modules
54 # Install kernel modules
55 if [ "$ENABLE_REDUCE" = true ] ; then
55 if [ "$ENABLE_REDUCE" = true ] ; then
56 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
56 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
57 else
57 else
58 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_PATH=../../.. modules_install
58 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
59
60 # Install kernel firmware
61 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
59 fi
62 fi
60
63
61 # Install kernel headers
64 # Install kernel headers
62 if [ "$KERNEL_HEADERS" = true ] ; then
65 if [ "$KERNEL_HEADERS" = true ] ; then
63 make -C $R/usr/src/linux ARCH=${KERNEL_ARCH} CROSS_COMPILE=${CROSS_COMPILE} INSTALL_HDR_PATH=../.. headers_install
66 make -C "$R/usr/src/linux" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
64 fi
67 fi
65
68
66 # Copy and rename compiled kernel to boot directory
69 # Prepare boot (firmware) directory
67 mkdir $R/boot/firmware/
70 mkdir "$R/boot/firmware/"
68 $R/usr/src/linux/scripts/mkknlimg $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage $R/boot/firmware/kernel7.img
71
72 # Get kernel release version
73 KERNEL_VERSION=`cat "$R/usr/src/linux/include/config/kernel.release"`
74
75 # Copy kernel configuration file to the boot directory
76 cp "$R/usr/src/linux/.config" "$R/boot/config-${KERNEL_VERSION}"
77
78 # Copy dts and dtb device tree sources and binaries
79 mkdir "$R/boot/firmware/overlays/"
80 cp "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "$R/boot/firmware/"
81 cp "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "$R/boot/firmware/overlays/"
82 cp "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "$R/boot/firmware/overlays/"
69
83
70 # Copy dts and dtb device definitions
84 # Convert kernel zImage and copy it to the boot directory
71 mkdir $R/boot/firmware/overlays/
85 "$R/usr/src/linux/scripts/mkknlimg" "$R/usr/src/linux/arch/${KERNEL_ARCH}/boot/zImage" "$R/boot/firmware/kernel7.img"
72 cp $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/*.dtb $R/boot/firmware/
73 cp $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/overlays/*.dtb* $R/boot/firmware/overlays/
74 cp $R/usr/src/linux/arch/${KERNEL_ARCH}/boot/dts/overlays/README $R/boot/firmware/overlays/
75
86
76 # Remove kernel sources
87 # Remove kernel sources
77 if [ "$KERNEL_RMSRC" = true ] ; then
88 if [ "$KERNEL_REMOVESRC" = true ] ; then
78 rm -fr $R/usr/src/linux
89 rm -fr "$R/usr/src/linux"
79 fi
90 fi
80
91
81 # Install raspberry bootloader and flash-kernel packages
92 # Install raspberry bootloader and flash-kernel packages
82 chroot_exec apt-get -qq -y --no-install-recommends install raspberrypi-bootloader-nokernel
93 chroot_exec apt-get -qq -y --no-install-recommends install raspberrypi-bootloader-nokernel
83 else # BUILD_KERNEL=false
94 else # BUILD_KERNEL=false
84 # Kernel installation
95 # Kernel installation
85 chroot_exec apt-get -qq -y --no-install-recommends install linux-image-${COLLABORA_KERNEL} raspberrypi-bootloader-nokernel
96 chroot_exec apt-get -qq -y --no-install-recommends install linux-image-"${COLLABORA_KERNEL}" raspberrypi-bootloader-nokernel
86
97
87 # Install flash-kernel last so it doesn't try (and fail) to detect the platform in the chroot
98 # Install flash-kernel last so it doesn't try (and fail) to detect the platform in the chroot
88 chroot_exec apt-get -qq -y install flash-kernel
99 chroot_exec apt-get -qq -y install flash-kernel
89
100
90 VMLINUZ="$(ls -1 $R/boot/vmlinuz-* | sort | tail -n 1)"
101 VMLINUZ="$(ls -1 $R/boot/vmlinuz-* | sort | tail -n 1)"
91 [ -z "$VMLINUZ" ] && exit 1
102 [ -z "$VMLINUZ" ] && exit 1
92 cp $VMLINUZ $R/boot/firmware/kernel7.img
103 cp "$VMLINUZ" "$R/boot/firmware/kernel7.img"
93 fi
104 fi
94
105
95 # Setup firmware boot cmdline
106 # Setup firmware boot cmdline
96 if [ "$ENABLE_SPLITFS" = true ] ; then
107 if [ "$ENABLE_SPLITFS" = true ] ; then
97 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait net.ifnames=1 console=tty1 ${CMDLINE}"
108 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait net.ifnames=1 console=tty1 ${CMDLINE}"
98 else
109 else
99 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait net.ifnames=1 console=tty1 ${CMDLINE}"
110 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait net.ifnames=1 console=tty1 ${CMDLINE}"
100 fi
111 fi
101
112
102 # Add serial console support
113 # Add serial console support
103 if [ "$ENABLE_CONSOLE" = true ] ; then
114 if [ "$ENABLE_CONSOLE" = true ] ; then
104 CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"
115 CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"
105 fi
116 fi
106
117
107 # Remove IPv6 networking support
118 # Remove IPv6 networking support
108 if [ "$ENABLE_IPV6" = false ] ; then
119 if [ "$ENABLE_IPV6" = false ] ; then
109 CMDLINE="${CMDLINE} ipv6.disable=1"
120 CMDLINE="${CMDLINE} ipv6.disable=1"
110 fi
121 fi
111
122
112 # Install firmware boot cmdline
123 # Install firmware boot cmdline
113 echo "${CMDLINE}" >$R/boot/firmware/cmdline.txt
124 echo "${CMDLINE}" > "$R/boot/firmware/cmdline.txt"
114
125
115 # Install firmware config
126 # Install firmware config
116 install_readonly files/boot/config.txt $R/boot/firmware/config.txt
127 install_readonly files/boot/config.txt "$R/boot/firmware/config.txt"
117
128
118 # Setup minimal GPU memory allocation size: 16MB (no X)
129 # Setup minimal GPU memory allocation size: 16MB (no X)
119 if [ "$ENABLE_MINGPU" = true ] ; then
130 if [ "$ENABLE_MINGPU" = true ] ; then
120 echo "gpu_mem=16" >>$R/boot/firmware/config.txt
131 echo "gpu_mem=16" >> "$R/boot/firmware/config.txt"
121 fi
132 fi
122
133
123 # Create firmware configuration and cmdline symlinks
134 # Create firmware configuration and cmdline symlinks
124 ln -sf firmware/config.txt $R/boot/config.txt
135 ln -sf firmware/config.txt "$R/boot/config.txt"
125 ln -sf firmware/cmdline.txt $R/boot/cmdline.txt
136 ln -sf firmware/cmdline.txt "$R/boot/cmdline.txt"
126
137
127 # Install and setup kernel modules to load at boot
138 # Install and setup kernel modules to load at boot
128 mkdir -p $R/lib/modules-load.d/
139 mkdir -p "$R/lib/modules-load.d/"
129 install_readonly files/modules/rpi2.conf $R/lib/modules-load.d/rpi2.conf
140 install_readonly files/modules/rpi2.conf "$R/lib/modules-load.d/rpi2.conf"
130
141
131 # Load hardware random module at boot
142 # Load hardware random module at boot
132 if [ "$ENABLE_HWRANDOM" = true ] ; then
143 if [ "$ENABLE_HWRANDOM" = true ] ; then
133 sed -i "s/^# bcm2708_rng/bcm2708_rng/" $R/lib/modules-load.d/rpi2.conf
144 sed -i "s/^# bcm2708_rng/bcm2708_rng/" "$R/lib/modules-load.d/rpi2.conf"
134 fi
145 fi
135
146
136 # Load sound module at boot
147 # Load sound module at boot
137 if [ "$ENABLE_SOUND" = true ] ; then
148 if [ "$ENABLE_SOUND" = true ] ; then
138 sed -i "s/^# snd_bcm2835/snd_bcm2835/" $R/lib/modules-load.d/rpi2.conf
149 sed -i "s/^# snd_bcm2835/snd_bcm2835/" "$R/lib/modules-load.d/rpi2.conf"
139 fi
150 fi
140
151
141 # Install kernel modules blacklist
152 # Install kernel modules blacklist
142 mkdir -p $R/etc/modprobe.d/
153 mkdir -p "$R/etc/modprobe.d/"
143 install_readonly files/modules/raspi-blacklist.conf $R/etc/modprobe.d/raspi-blacklist.conf
154 install_readonly files/modules/raspi-blacklist.conf "$R/etc/modprobe.d/raspi-blacklist.conf"
144
155
145 # Install and setup fstab
156 # Install and setup fstab
146 install_readonly files/mount/fstab $R/etc/fstab
157 install_readonly files/mount/fstab "$R/etc/fstab"
147 if [ "$ENABLE_SPLITFS" = true ] ; then
158 if [ "$ENABLE_SPLITFS" = true ] ; then
148 sed -i 's/mmcblk0p2/sda1/' $R/etc/fstab
159 sed -i 's/mmcblk0p2/sda1/' "$R/etc/fstab"
149 fi
160 fi
150
161
151 # Install sysctl.d configuration files
162 # Install sysctl.d configuration files
152 install_readonly files/sysctl.d/81-rpi-vm.conf $R/etc/sysctl.d/81-rpi-vm.conf
163 install_readonly files/sysctl.d/81-rpi-vm.conf "$R/etc/sysctl.d/81-rpi-vm.conf"
@@ -1,72 +1,72
1 #
1 #
2 # Setup Networking
2 # Setup Networking
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Install and setup hostname
8 # Install and setup hostname
9 install_readonly files/network/hostname $R/etc/hostname
9 install_readonly files/network/hostname "$R/etc/hostname"
10 sed -i "s/^rpi2-jessie/${HOSTNAME}/" $R/etc/hostname
10 sed -i "s/^rpi2-jessie/${HOSTNAME}/" "$R/etc/hostname"
11
11
12 # Install and setup hosts
12 # Install and setup hosts
13 install_readonly files/network/hosts $R/etc/hosts
13 install_readonly files/network/hosts "$R/etc/hosts"
14 sed -i "s/rpi2-jessie/${HOSTNAME}/" $R/etc/hosts
14 sed -i "s/rpi2-jessie/${HOSTNAME}/" "$R/etc/hosts"
15
15
16 # Setup hostname entry with static IP
16 # Setup hostname entry with static IP
17 if [ "$NET_ADDRESS" != "" ] ; then
17 if [ "$NET_ADDRESS" != "" ] ; then
18 NET_IP=$(echo ${NET_ADDRESS} | cut -f 1 -d'/')
18 NET_IP=$(echo "${NET_ADDRESS}" | cut -f 1 -d'/')
19 sed -i "s/^127.0.1.1/${NET_IP}/" $R/etc/hosts
19 sed -i "s/^127.0.1.1/${NET_IP}/" "$R/etc/hosts"
20 fi
20 fi
21
21
22 # Remove IPv6 hosts
22 # Remove IPv6 hosts
23 if [ "$ENABLE_IPV6" = false ] ; then
23 if [ "$ENABLE_IPV6" = false ] ; then
24 sed -i -e "/::[1-9]/d" -e "/^$/d" $R/etc/hosts
24 sed -i -e "/::[1-9]/d" -e "/^$/d" "$R/etc/hosts"
25 fi
25 fi
26
26
27 # Install hint about network configuration
27 # Install hint about network configuration
28 install_readonly files/network/interfaces $R/etc/network/interfaces
28 install_readonly files/network/interfaces "$R/etc/network/interfaces"
29
29
30 # Install configuration for interface eth0
30 # Install configuration for interface eth0
31 install_readonly files/network/eth.network $R/etc/systemd/network/eth.network
31 install_readonly files/network/eth.network "$R/etc/systemd/network/eth.network"
32
32
33 if [ "$ENABLE_DHCP" = true ] ; then
33 if [ "$ENABLE_DHCP" = true ] ; then
34 # Enable DHCP configuration for interface eth0
34 # Enable DHCP configuration for interface eth0
35 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" $R/etc/systemd/network/eth.network
35 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "$R/etc/systemd/network/eth.network"
36
36
37 # Set DHCP configuration to IPv4 only
37 # Set DHCP configuration to IPv4 only
38 if [ "$ENABLE_IPV6" = false ] ; then
38 if [ "$ENABLE_IPV6" = false ] ; then
39 sed -i "s/DHCP=.*/DHCP=v4/" $R/etc/systemd/network/eth.network
39 sed -i "s/DHCP=.*/DHCP=v4/" "$R/etc/systemd/network/eth.network"
40 fi
40 fi
41
41
42 else # ENABLE_DHCP=false
42 else # ENABLE_DHCP=false
43 # Set static network configuration for interface eth0
43 # Set static network configuration for interface eth0
44 sed -i\
44 sed -i\
45 -e "s|DHCP=.*|DHCP=no|"\
45 -e "s|DHCP=.*|DHCP=no|"\
46 -e "s|Address=\$|Address=${NET_ADDRESS}|"\
46 -e "s|Address=\$|Address=${NET_ADDRESS}|"\
47 -e "s|Gateway=\$|Gateway=${NET_GATEWAY}|"\
47 -e "s|Gateway=\$|Gateway=${NET_GATEWAY}|"\
48 -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_1}|"\
48 -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_1}|"\
49 -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_2}|"\
49 -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_2}|"\
50 -e "s|Domains=\$|Domains=${NET_DNS_DOMAINS}|"\
50 -e "s|Domains=\$|Domains=${NET_DNS_DOMAINS}|"\
51 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\
51 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\
52 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\
52 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\
53 $R/etc/systemd/network/eth.network
53 "$R/etc/systemd/network/eth.network"
54 fi
54 fi
55
55
56 # Remove empty settings from network configuration
56 # Remove empty settings from network configuration
57 sed -i "/.*=\$/d" $R/etc/systemd/network/eth.network
57 sed -i "/.*=\$/d" "$R/etc/systemd/network/eth.network"
58
58
59 # Enable systemd-networkd service
59 # Enable systemd-networkd service
60 chroot_exec systemctl enable systemd-networkd
60 chroot_exec systemctl enable systemd-networkd
61
61
62 # Install host.conf resolver configuration
62 # Install host.conf resolver configuration
63 install_readonly files/network/host.conf $R/etc/host.conf
63 install_readonly files/network/host.conf "$R/etc/host.conf"
64
64
65 # Enable network stack hardening
65 # Enable network stack hardening
66 if [ "$ENABLE_HARDNET" = true ] ; then
66 if [ "$ENABLE_HARDNET" = true ] ; then
67 # Install sysctl.d configuration files
67 # Install sysctl.d configuration files
68 install_readonly files/sysctl.d/82-rpi-net-hardening.conf $R/etc/sysctl.d/82-rpi-net-hardening.conf
68 install_readonly files/sysctl.d/82-rpi-net-hardening.conf "$R/etc/sysctl.d/82-rpi-net-hardening.conf"
69
69
70 # Setup resolver warnings about spoofed addresses
70 # Setup resolver warnings about spoofed addresses
71 sed -i "s/^# spoof warn/spoof warn/" $R/etc/host.conf
71 sed -i "s/^# spoof warn/spoof warn/" "$R/etc/host.conf"
72 fi
72 fi
@@ -1,44 +1,44
1 #
1 #
2 # Setup Firewall
2 # Setup Firewall
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 if [ "$ENABLE_IPTABLES" = true ] ; then
8 if [ "$ENABLE_IPTABLES" = true ] ; then
9 # Create iptables configuration directory
9 # Create iptables configuration directory
10 mkdir -p "$R/etc/iptables"
10 mkdir -p "$R/etc/iptables"
11
11
12 # Install iptables systemd service
12 # Install iptables systemd service
13 install_readonly files/iptables/iptables.service $R/etc/systemd/system/iptables.service
13 install_readonly files/iptables/iptables.service "$R/etc/systemd/system/iptables.service"
14
14
15 # Install flush-table script called by iptables service
15 # Install flush-table script called by iptables service
16 install_exec files/iptables/flush-iptables.sh $R/etc/iptables/flush-iptables.sh
16 install_exec files/iptables/flush-iptables.sh "$R/etc/iptables/flush-iptables.sh"
17
17
18 # Install iptables rule file
18 # Install iptables rule file
19 install_readonly files/iptables/iptables.rules $R/etc/iptables/iptables.rules
19 install_readonly files/iptables/iptables.rules "$R/etc/iptables/iptables.rules"
20
20
21 # Reload systemd configuration and enable iptables service
21 # Reload systemd configuration and enable iptables service
22 chroot_exec systemctl daemon-reload
22 chroot_exec systemctl daemon-reload
23 chroot_exec systemctl enable iptables.service
23 chroot_exec systemctl enable iptables.service
24
24
25 if [ "$ENABLE_IPV6" = true ] ; then
25 if [ "$ENABLE_IPV6" = true ] ; then
26 # Install ip6tables systemd service
26 # Install ip6tables systemd service
27 install_readonly files/iptables/ip6tables.service $R/etc/systemd/system/ip6tables.service
27 install_readonly files/iptables/ip6tables.service "$R/etc/systemd/system/ip6tables.service"
28
28
29 # Install ip6tables file
29 # Install ip6tables file
30 install_exec files/iptables/flush-ip6tables.sh $R/etc/iptables/flush-ip6tables.sh
30 install_exec files/iptables/flush-ip6tables.sh "$R/etc/iptables/flush-ip6tables.sh"
31
31
32 install_readonly files/iptables/ip6tables.rules $R/etc/iptables/ip6tables.rules
32 install_readonly files/iptables/ip6tables.rules "$R/etc/iptables/ip6tables.rules"
33
33
34 # Reload systemd configuration and enable iptables service
34 # Reload systemd configuration and enable iptables service
35 chroot_exec systemctl daemon-reload
35 chroot_exec systemctl daemon-reload
36 chroot_exec systemctl enable ip6tables.service
36 chroot_exec systemctl enable ip6tables.service
37 fi
37 fi
38 fi
38 fi
39
39
40 if [ "$ENABLE_SSHD" = false ] ; then
40 if [ "$ENABLE_SSHD" = false ] ; then
41 # Remove SSHD related iptables rules
41 # Remove SSHD related iptables rules
42 sed -i "/^#/! {/SSH/ s/^/# /}" $R/etc/iptables/iptables.rules 2> /dev/null
42 sed -i "/^#/! {/SSH/ s/^/# /}" "$R/etc/iptables/iptables.rules" 2> /dev/null
43 sed -i "/^#/! {/SSH/ s/^/# /}" $R/etc/iptables/ip6tables.rules 2> /dev/null
43 sed -i "/^#/! {/SSH/ s/^/# /}" "$R/etc/iptables/ip6tables.rules" 2> /dev/null
44 fi
44 fi
@@ -1,32 +1,32
1 #
1 #
2 # Setup users and security settings
2 # Setup users and security settings
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Generate crypt(3) password string
8 # Generate crypt(3) password string
9 ENCRYPTED_PASSWORD=`mkpasswd -m sha-512 ${PASSWORD}`
9 ENCRYPTED_PASSWORD=`mkpasswd -m sha-512 "${PASSWORD}"`
10
10
11 # Setup default user
11 # Setup default user
12 if [ "$ENABLE_USER" = true ] ; then
12 if [ "$ENABLE_USER" = true ] ; then
13 chroot_exec adduser --gecos pi --add_extra_groups --disabled-password pi
13 chroot_exec adduser --gecos pi --add_extra_groups --disabled-password pi
14 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_PASSWORD}" pi
14 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_PASSWORD}" pi
15 fi
15 fi
16
16
17 # Setup root password or not
17 # Setup root password or not
18 if [ "$ENABLE_ROOT" = true ] ; then
18 if [ "$ENABLE_ROOT" = true ] ; then
19 chroot_exec usermod -p "${ENCRYPTED_PASSWORD}" root
19 chroot_exec usermod -p "${ENCRYPTED_PASSWORD}" root
20
20
21 if [ "$ENABLE_ROOT_SSH" = true ] ; then
21 if [ "$ENABLE_ROOT_SSH" = true ] ; then
22 sed -i "s|[#]*PermitRootLogin.*|PermitRootLogin yes|g" $R/etc/ssh/sshd_config
22 sed -i "s|[#]*PermitRootLogin.*|PermitRootLogin yes|g" "$R/etc/ssh/sshd_config"
23 fi
23 fi
24 else
24 else
25 # Set no root password to disable root login
25 # Set no root password to disable root login
26 chroot_exec usermod -p \'!\' root
26 chroot_exec usermod -p \'!\' root
27 fi
27 fi
28
28
29 # Enable serial console systemd style
29 # Enable serial console systemd style
30 if [ "$ENABLE_CONSOLE" = true ] ; then
30 if [ "$ENABLE_CONSOLE" = true ] ; then
31 chroot_exec systemctl enable serial-getty\@ttyAMA0.service
31 chroot_exec systemctl enable serial-getty\@ttyAMA0.service
32 fi
32 fi
@@ -1,13 +1,13
1 #
1 #
2 # Setup Logging
2 # Setup Logging
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Disable rsyslog
8 # Disable rsyslog
9 if [ "$ENABLE_RSYSLOG" = false ] ; then
9 if [ "$ENABLE_RSYSLOG" = false ] ; then
10 sed -i "s|[#]*ForwardToSyslog=yes|ForwardToSyslog=no|g" $R/etc/systemd/journald.conf
10 sed -i "s|[#]*ForwardToSyslog=yes|ForwardToSyslog=no|g" "$R/etc/systemd/journald.conf"
11 chroot_exec systemctl disable rsyslog
11 chroot_exec systemctl disable rsyslog
12 chroot_exec apt-get -qq -y --force-yes purge rsyslog
12 chroot_exec apt-get -qq -y --force-yes purge rsyslog
13 fi
13 fi
@@ -1,31 +1,31
1 #
1 #
2 # Build and Setup U-Boot
2 # Build and Setup U-Boot
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Install gcc/c++ build environment inside the chroot
8 # Install gcc/c++ build environment inside the chroot
9 if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then
9 if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then
10 chroot_exec apt-get -q -y --force-yes --no-install-recommends install linux-compiler-gcc-4.9-arm g++ make bc
10 chroot_exec apt-get -q -y --force-yes --no-install-recommends install linux-compiler-gcc-4.9-arm g++ make bc
11 fi
11 fi
12
12
13 # Fetch and build U-Boot bootloader
13 # Fetch and build U-Boot bootloader
14 if [ "$ENABLE_UBOOT" = true ] ; then
14 if [ "$ENABLE_UBOOT" = true ] ; then
15 # Fetch U-Boot bootloader sources
15 # Fetch U-Boot bootloader sources
16 git -C $R/tmp clone git://git.denx.de/u-boot.git
16 git -C "$R/tmp" clone git://git.denx.de/u-boot.git
17
17
18 # Build and install U-Boot inside chroot
18 # Build and install U-Boot inside chroot
19 chroot_exec make -C /tmp/u-boot/ rpi_2_defconfig all
19 chroot_exec make -C /tmp/u-boot/ rpi_2_defconfig all
20
20
21 # Copy compiled bootloader binary and set config.txt to load it
21 # Copy compiled bootloader binary and set config.txt to load it
22 cp $R/tmp/u-boot/u-boot.bin $R/boot/firmware/
22 cp "$R/tmp/u-boot/u-boot.bin" "$R/boot/firmware/"
23 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> $R/boot/firmware/config.txt
23 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "$R/boot/firmware/config.txt"
24
24
25 # Install and setup U-Boot command file
25 # Install and setup U-Boot command file
26 install_readonly files/boot/uboot.mkimage $R/boot/firmware/uboot.mkimage
26 install_readonly files/boot/uboot.mkimage "$R/boot/firmware/uboot.mkimage"
27 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat $R/boot/firmware/uboot.mkimage)" > $R/boot/firmware/uboot.mkimage
27 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat $R/boot/firmware/uboot.mkimage)" > "$R/boot/firmware/uboot.mkimage"
28
28
29 # Generate U-Boot bootloader image
29 # Generate U-Boot bootloader image
30 chroot_exec /tmp/u-boot/tools/mkimage -A ${KERNEL_ARCH} -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n RPi2 -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
30 chroot_exec /tmp/u-boot/tools/mkimage -A "${KERNEL_ARCH}" -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n RPi2 -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
31 fi
31 fi
@@ -1,34 +1,34
1 #
1 #
2 # Build and Setup fbturbo Xorg driver
2 # Build and Setup fbturbo Xorg driver
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 if [ "$ENABLE_FBTURBO" = true ] ; then
8 if [ "$ENABLE_FBTURBO" = true ] ; then
9 # Fetch fbturbo driver sources
9 # Fetch fbturbo driver sources
10 git -C $R/tmp clone https://github.com/ssvb/xf86-video-fbturbo.git
10 git -C "$R/tmp" clone https://github.com/ssvb/xf86-video-fbturbo.git
11
11
12 # Install Xorg build dependencies
12 # Install Xorg build dependencies
13 chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev
13 chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev
14
14
15 # Build and install fbturbo driver inside chroot
15 # Build and install fbturbo driver inside chroot
16 chroot_exec /bin/bash -x <<'EOF'
16 chroot_exec /bin/bash -x <<'EOF'
17 cd /tmp/xf86-video-fbturbo
17 cd /tmp/xf86-video-fbturbo
18 autoreconf -vi
18 autoreconf -vi
19 ./configure --prefix=/usr
19 ./configure --prefix=/usr
20 make
20 make
21 make install
21 make install
22 EOF
22 EOF
23
23
24 # Install fbturbo driver Xorg configuration
24 # Install fbturbo driver Xorg configuration
25 install_readonly files/xorg/99-fbturbo.conf $R/usr/share/X11/xorg.conf.d/99-fbturbo.conf
25 install_readonly files/xorg/99-fbturbo.conf "$R/usr/share/X11/xorg.conf.d/99-fbturbo.conf"
26
26
27 # Remove Xorg build dependencies
27 # Remove Xorg build dependencies
28 chroot_exec apt-get -qq -y --auto-remove purge xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev
28 chroot_exec apt-get -qq -y --auto-remove purge xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev
29 fi
29 fi
30
30
31 # Remove gcc/c++ build environment from the chroot
31 # Remove gcc/c++ build environment from the chroot
32 if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then
32 if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ] ; then
33 chroot_exec apt-get -qq -y --auto-remove purge bc binutils cpp cpp-4.9 g++ g++-4.9 gcc gcc-4.9 libasan1 libatomic1 libc-dev-bin libc6-dev libcloog-isl4 libgcc-4.9-dev libgomp1 libisl10 libmpc3 libmpfr4 libstdc++-4.9-dev libubsan0 linux-compiler-gcc-4.9-arm linux-libc-dev make
33 chroot_exec apt-get -qq -y --auto-remove purge bc binutils cpp cpp-4.9 g++ g++-4.9 gcc gcc-4.9 libasan1 libatomic1 libc-dev-bin libc6-dev libcloog-isl4 libgcc-4.9-dev libgomp1 libisl10 libmpc3 libmpfr4 libstdc++-4.9-dev libubsan0 linux-compiler-gcc-4.9-arm linux-libc-dev make
34 fi
34 fi
@@ -1,35 +1,35
1 #
1 #
2 # First boot actions
2 # First boot actions
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Prepare rc.firstboot script
8 # Prepare rc.firstboot script
9 cat files/firstboot/10-begin.sh > $R/etc/rc.firstboot
9 cat files/firstboot/10-begin.sh > "$R/etc/rc.firstboot"
10
10
11 # Ensure openssh server host keys are regenerated on first boot
11 # Ensure openssh server host keys are regenerated on first boot
12 if [ "$ENABLE_SSHD" = true ] ; then
12 if [ "$ENABLE_SSHD" = true ] ; then
13 cat files/firstboot/21-generate-ssh-keys.sh >> $R/etc/rc.firstboot
13 cat files/firstboot/21-generate-ssh-keys.sh >> "$R/etc/rc.firstboot"
14 rm -f $R/etc/ssh/ssh_host_*
14 rm -f "$R/etc/ssh/ssh_host_*"
15 fi
15 fi
16
16
17 # Prepare filesystem auto expand
17 # Prepare filesystem auto expand
18 if [ "$EXPANDROOT" = true ] ; then
18 if [ "$EXPANDROOT" = true ] ; then
19 cat files/firstboot/22-expandroot.sh >> $R/etc/rc.firstboot
19 cat files/firstboot/22-expandroot.sh >> "$R/etc/rc.firstboot"
20 fi
20 fi
21
21
22 # Ensure that dbus machine-id exists
22 # Ensure that dbus machine-id exists
23 cat files/firstboot/23-generate-machineid.sh >> $R/etc/rc.firstboot
23 cat files/firstboot/23-generate-machineid.sh >> "$R/etc/rc.firstboot"
24
24
25 # Create /etc/resolv.conf symlink
25 # Create /etc/resolv.conf symlink
26 cat files/firstboot/24-create-resolv-symlink.sh >> $R/etc/rc.firstboot
26 cat files/firstboot/24-create-resolv-symlink.sh >> "$R/etc/rc.firstboot"
27
27
28 # Finalize rc.firstboot script
28 # Finalize rc.firstboot script
29 cat files/firstboot/99-finish.sh >> $R/etc/rc.firstboot
29 cat files/firstboot/99-finish.sh >> "$R/etc/rc.firstboot"
30 chmod +x $R/etc/rc.firstboot
30 chmod +x "$R/etc/rc.firstboot"
31
31
32 # Add rc.firstboot script to rc.local
32 # Add rc.firstboot script to rc.local
33 sed -i '/exit 0/d' $R/etc/rc.local
33 sed -i '/exit 0/d' "$R/etc/rc.local"
34 echo /etc/rc.firstboot >> $R/etc/rc.local
34 echo /etc/rc.firstboot >> "$R/etc/rc.local"
35 echo exit 0 >> $R/etc/rc.local
35 echo exit 0 >> "$R/etc/rc.local"
@@ -1,456 +1,461
1 #!/bin/sh
1 #!/bin/sh
2
2
3 ########################################################################
3 ########################################################################
4 # rpi2-gen-image.sh ver2a 12/2015
4 # rpi2-gen-image.sh ver2a 12/2015
5 #
5 #
6 # Advanced debian "jessie" bootstrap script for RPi2
6 # Advanced debian "jessie" bootstrap script for RPi2
7 #
7 #
8 # This program is free software; you can redistribute it and/or
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License
9 # modify it under the terms of the GNU General Public License
10 # as published by the Free Software Foundation; either version 2
10 # as published by the Free Software Foundation; either version 2
11 # of the License, or (at your option) any later version.
11 # of the License, or (at your option) any later version.
12 #
12 #
13 # some parts based on rpi2-build-image:
13 # some parts based on rpi2-build-image:
14 # Copyright (C) 2015 Ryan Finnie <ryan@finnie.org>
14 # Copyright (C) 2015 Ryan Finnie <ryan@finnie.org>
15 # Copyright (C) 2015 Luca Falavigna <dktrkranz@debian.org>
15 # Copyright (C) 2015 Luca Falavigna <dktrkranz@debian.org>
16 ########################################################################
16 ########################################################################
17
17
18 # Check if ./functions.sh script exists
18 # Check if ./functions.sh script exists
19 if [ ! -r "./functions.sh" ] ; then
19 if [ ! -r "./functions.sh" ] ; then
20 echo "error: './functions.sh' required script not found. please reinstall the latest script version!"
20 echo "error: './functions.sh' required script not found. please reinstall the latest script version!"
21 exit 1
21 exit 1
22 fi
22 fi
23
23
24 # Load utility functions
24 # Load utility functions
25 . ./functions.sh
25 . ./functions.sh
26
26
27 # Introduce settings
27 # Introduce settings
28 set -e
28 set -e
29 echo -n -e "\n#\n# RPi2 Bootstrap Settings\n#\n"
29 echo -n -e "\n#\n# RPi2 Bootstrap Settings\n#\n"
30 set -x
30 set -x
31
31
32 # Debian release
32 # Debian release
33 RELEASE=${RELEASE:=jessie}
33 RELEASE=${RELEASE:=jessie}
34 KERNEL_ARCH=${KERNEL_ARCH:=arm}
34 KERNEL_ARCH=${KERNEL_ARCH:=arm}
35 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
35 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
36 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
36 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
37 COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2}
37 COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2}
38 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
38 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
39 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
39 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
40
40
41 # Build settings
41 # Build settings
42 BASEDIR=$(pwd)/images/${RELEASE}
42 BASEDIR=$(pwd)/images/${RELEASE}
43 BUILDDIR=${BASEDIR}/build
43 BUILDDIR=${BASEDIR}/build
44
44
45 # General settings
45 # General settings
46 HOSTNAME=${HOSTNAME:=rpi2-${RELEASE}}
46 HOSTNAME=${HOSTNAME:=rpi2-${RELEASE}}
47 PASSWORD=${PASSWORD:=raspberry}
47 PASSWORD=${PASSWORD:=raspberry}
48 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
48 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
49 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
49 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
50 EXPANDROOT=${EXPANDROOT:=true}
50 EXPANDROOT=${EXPANDROOT:=true}
51
51
52 # Keyboard settings
52 # Keyboard settings
53 XKB_MODEL=${XKB_MODEL:=""}
53 XKB_MODEL=${XKB_MODEL:=""}
54 XKB_LAYOUT=${XKB_LAYOUT:=""}
54 XKB_LAYOUT=${XKB_LAYOUT:=""}
55 XKB_VARIANT=${XKB_VARIANT:=""}
55 XKB_VARIANT=${XKB_VARIANT:=""}
56 XKB_OPTIONS=${XKB_OPTIONS:=""}
56 XKB_OPTIONS=${XKB_OPTIONS:=""}
57
57
58 # Network settings (DHCP)
58 # Network settings (DHCP)
59 ENABLE_DHCP=${ENABLE_DHCP:=true}
59 ENABLE_DHCP=${ENABLE_DHCP:=true}
60
60
61 # Network settings (static)
61 # Network settings (static)
62 # only used on ENABLE_DHCP=false
62 # only used on ENABLE_DHCP=false
63 NET_ADDRESS=${NET_ADDRESS:=""}
63 NET_ADDRESS=${NET_ADDRESS:=""}
64 NET_GATEWAY=${NET_GATEWAY:=""}
64 NET_GATEWAY=${NET_GATEWAY:=""}
65 NET_DNS_1=${NET_DNS_1:=""}
65 NET_DNS_1=${NET_DNS_1:=""}
66 NET_DNS_2=${NET_DNS_2:=""}
66 NET_DNS_2=${NET_DNS_2:=""}
67 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
67 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
68 NET_NTP_1=${NET_NTP_1:=""}
68 NET_NTP_1=${NET_NTP_1:=""}
69 NET_NTP_2=${NET_NTP_2:=""}
69 NET_NTP_2=${NET_NTP_2:=""}
70
70
71 # APT settings
71 # APT settings
72 APT_PROXY=${APT_PROXY:=""}
72 APT_PROXY=${APT_PROXY:=""}
73 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
73 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
74
74
75 # Feature settings
75 # Feature settings
76 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
76 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
77 ENABLE_IPV6=${ENABLE_IPV6:=true}
77 ENABLE_IPV6=${ENABLE_IPV6:=true}
78 ENABLE_SSHD=${ENABLE_SSHD:=true}
78 ENABLE_SSHD=${ENABLE_SSHD:=true}
79 ENABLE_SOUND=${ENABLE_SOUND:=true}
79 ENABLE_SOUND=${ENABLE_SOUND:=true}
80 ENABLE_DBUS=${ENABLE_DBUS:=true}
80 ENABLE_DBUS=${ENABLE_DBUS:=true}
81 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
81 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
82 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
82 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
83 ENABLE_XORG=${ENABLE_XORG:=false}
83 ENABLE_XORG=${ENABLE_XORG:=false}
84 ENABLE_WM=${ENABLE_WM:=""}
84 ENABLE_WM=${ENABLE_WM:=""}
85 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
85 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
86 ENABLE_USER=${ENABLE_USER:=true}
86 ENABLE_USER=${ENABLE_USER:=true}
87 ENABLE_ROOT=${ENABLE_ROOT:=false}
87 ENABLE_ROOT=${ENABLE_ROOT:=false}
88 ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
88 ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
89
89
90 # Advanced settings
90 # Advanced settings
91 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
91 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
92 ENABLE_REDUCE=${ENABLE_REDUCE:=flase}
92 ENABLE_REDUCE=${ENABLE_REDUCE:=flase}
93 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
93 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
94 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
94 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
95 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
95 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
96 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
96 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
97 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
97 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
98
98
99 # Kernel compilation settings
99 # Kernel compilation settings
100 BUILD_KERNEL=${BUILD_KERNEL:=false}
100 BUILD_KERNEL=${BUILD_KERNEL:=false}
101 KERNEL_SRCDIR=${KERNEL_SRCDIR:=""}
102 KERNEL_THREADS=${KERNEL_THREADS:=1}
101 KERNEL_THREADS=${KERNEL_THREADS:=1}
103 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
102 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
104 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
103 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
105 KERNEL_CLEANSRC=${KERNEL_CLEANSRC:=false}
104 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
106 KERNEL_CONFIGSRC=${KERNEL_CONFIGSRC:=true}
105
107 KERNEL_RMSRC=${KERNEL_RMSRC:=true}
106 # Kernel compilation from source directory settings
107 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
108 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
109 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
110 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
108
111
109 # Image chroot path
112 # Image chroot path
110 R=${BUILDDIR}/chroot
113 R=${BUILDDIR}/chroot
111 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
114 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
112
115
113 # Packages required for bootstrapping
116 # Packages required for bootstrapping
114 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core"
117 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core"
115
118
116 # Missing packages that need to be installed
119 # Missing packages that need to be installed
117 MISSING_PACKAGES=""
120 MISSING_PACKAGES=""
118
121
119 # Packages required in the chroot build environment
122 # Packages required in the chroot build environment
120 APT_INCLUDES=${APT_INCLUDES:=""}
123 APT_INCLUDES=${APT_INCLUDES:=""}
121 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo"
124 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo"
122
125
123 set +x
126 set +x
124
127
125 # Are we running as root?
128 # Are we running as root?
126 if [ "$(id -u)" -ne "0" ] ; then
129 if [ "$(id -u)" -ne "0" ] ; then
127 echo "error: this script must be executed with root privileges!"
130 echo "error: this script must be executed with root privileges!"
128 exit 1
131 exit 1
129 fi
132 fi
130
133
131 # Check if ./bootstrap.d directory exists
134 # Check if ./bootstrap.d directory exists
132 if [ ! -d "./bootstrap.d/" ] ; then
135 if [ ! -d "./bootstrap.d/" ] ; then
133 echo "error: './bootstrap.d' required directory not found. please reinstall the latest script version!"
136 echo "error: './bootstrap.d' required directory not found. please reinstall the latest script version!"
134 exit 1
137 exit 1
135 fi
138 fi
136
139
137 # Check if ./files directory exists
140 # Check if ./files directory exists
138 if [ ! -d "./files/" ] ; then
141 if [ ! -d "./files/" ] ; then
139 echo "error: './files' required directory not found. please reinstall the latest script version!"
142 echo "error: './files' required directory not found. please reinstall the latest script version!"
140 exit 1
143 exit 1
141 fi
144 fi
142
145
143 # Check if specified KERNEL_SRCDIR directory exists
146 # Check if specified KERNELSRC_DIR directory exists
144 if [ -n "$KERNEL_SRCDIR" ] && [ ! -d "$KERNEL_SRCDIR" ] ; then
147 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
145 echo "error: ${KERNEL_SRCDIR} (KERNEL_SRCDIR) specified directory not found!"
148 echo "error: ${KERNELSRC_DIR} (KERNELSRC_DIR) specified directory not found!"
146 exit 1
149 exit 1
147 fi
150 fi
148
151
149 # Check if specified CHROOT_SCRIPTS directory exists
152 # Check if specified CHROOT_SCRIPTS directory exists
150 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
153 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
151 echo "error: ${CHROOT_SCRIPTS} (CHROOT_SCRIPTS) specified directory not found!"
154 echo "error: ${CHROOT_SCRIPTS} (CHROOT_SCRIPTS) specified directory not found!"
152 exit 1
155 exit 1
153 fi
156 fi
154
157
155 # Add packages required for kernel cross compilation
158 # Add packages required for kernel cross compilation
156 if [ "$BUILD_KERNEL" = true ] ; then
159 if [ "$BUILD_KERNEL" = true ] ; then
157 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
160 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
161
158 if [ "$KERNEL_MENUCONFIG" = true ] ; then
162 if [ "$KERNEL_MENUCONFIG" = true ] ; then
159 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ncurses-dev"
163 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ncurses-dev"
160 fi
164 fi
161 fi
165 fi
162
166
163 # Check if all required packages are installed
167 # Check if all required packages are installed
164 for package in $REQUIRED_PACKAGES ; do
168 for package in $REQUIRED_PACKAGES ; do
165 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
169 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
166 MISSING_PACKAGES="$MISSING_PACKAGES $package"
170 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
167 fi
171 fi
168 done
172 done
169
173
170 # Ask if missing packages should get installed right now
174 # Ask if missing packages should get installed right now
171 if [ -n "$MISSING_PACKAGES" ] ; then
175 if [ -n "$MISSING_PACKAGES" ] ; then
172 echo "the following packages needed by this script are not installed:"
176 echo "the following packages needed by this script are not installed:"
173 echo "$MISSING_PACKAGES"
177 echo "$MISSING_PACKAGES"
174
178
175 echo -n "\ndo you want to install the missing packages right now? [y/n] "
179 echo -n "\ndo you want to install the missing packages right now? [y/n] "
176 read confirm
180 read confirm
177 if [ "$confirm" != "y" ] ; then
181 if [ "$confirm" != "y" ] ; then
178 exit 1
182 exit 1
179 fi
183 fi
180 fi
184 fi
181
185
182 # Make sure all required packages are installed
186 # Make sure all required packages are installed
183 apt-get -qq -y install ${REQUIRED_PACKAGES}
187 apt-get -qq -y install ${REQUIRED_PACKAGES}
184
188
185 # Don't clobber an old build
189 # Don't clobber an old build
186 if [ -e "$BUILDDIR" ] ; then
190 if [ -e "$BUILDDIR" ] ; then
187 echo "error: directory ${BUILDDIR} already exists, not proceeding"
191 echo "error: directory ${BUILDDIR} already exists, not proceeding"
188 exit 1
192 exit 1
189 fi
193 fi
190
194
195 # Setup chroot directory
196 mkdir -p "$R"
197
191 # Check if build directory has enough of free disk space >512MB
198 # Check if build directory has enough of free disk space >512MB
192 if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "524288" ] ; then
199 if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "524288" ] ; then
193 echo "error: ${BUILDDIR} not enough space left on this partition to generate the output image!"
200 echo "error: ${BUILDDIR} not enough space left on this partition to generate the output image!"
194 exit 1
201 exit 1
195 fi
202 fi
196
203
197 # Warn if build directory has low free disk space <1024MB
204 # Warn if build directory has low free disk space <1024MB
198 if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "1048576" ] ; then
205 if [ "$(df --output=avail ${BUILDDIR} | sed "1d")" -le "1048576" ] ; then
199 echo `df -h --output=avail ${BUILDDIR} | sed "1 s|.*Avail|warning: $partition is low on free space:|"`
206 echo `df -h --output=avail ${BUILDDIR} | sed "1 s|.*Avail|warning: $partition is low on free space:|"`
200 fi
207 fi
201
208
202 set -x
209 set -x
203
210
204 # Call "cleanup" function on various signals and errors
211 # Call "cleanup" function on various signals and errors
205 trap cleanup 0 1 2 3 6
212 trap cleanup 0 1 2 3 6
206
213
207 # Setup chroot directory
208 mkdir -p $R
209
210 # Add required packages for the minbase installation
214 # Add required packages for the minbase installation
211 if [ "$ENABLE_MINBASE" = true ] ; then
215 if [ "$ENABLE_MINBASE" = true ] ; then
212 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools"
216 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools"
213 else
217 else
214 APT_INCLUDES="${APT_INCLUDES},locales,keyboard-configuration,console-setup"
218 APT_INCLUDES="${APT_INCLUDES},locales,keyboard-configuration,console-setup"
215 fi
219 fi
216
220
217 # Add parted package, required to get partprobe utility
221 # Add parted package, required to get partprobe utility
218 if [ "$EXPANDROOT" = true ] ; then
222 if [ "$EXPANDROOT" = true ] ; then
219 APT_INCLUDES="${APT_INCLUDES},parted"
223 APT_INCLUDES="${APT_INCLUDES},parted"
220 fi
224 fi
221
225
222 # Add dbus package, recommended if using systemd
226 # Add dbus package, recommended if using systemd
223 if [ "$ENABLE_DBUS" = true ] ; then
227 if [ "$ENABLE_DBUS" = true ] ; then
224 APT_INCLUDES="${APT_INCLUDES},dbus"
228 APT_INCLUDES="${APT_INCLUDES},dbus"
225 fi
229 fi
226
230
227 # Add iptables IPv4/IPv6 package
231 # Add iptables IPv4/IPv6 package
228 if [ "$ENABLE_IPTABLES" = true ] ; then
232 if [ "$ENABLE_IPTABLES" = true ] ; then
229 APT_INCLUDES="${APT_INCLUDES},iptables"
233 APT_INCLUDES="${APT_INCLUDES},iptables"
230 fi
234 fi
231
235
232 # Add openssh server package
236 # Add openssh server package
233 if [ "$ENABLE_SSHD" = true ] ; then
237 if [ "$ENABLE_SSHD" = true ] ; then
234 APT_INCLUDES="${APT_INCLUDES},openssh-server"
238 APT_INCLUDES="${APT_INCLUDES},openssh-server"
235 fi
239 fi
236
240
237 # Add alsa-utils package
241 # Add alsa-utils package
238 if [ "$ENABLE_SOUND" = true ] ; then
242 if [ "$ENABLE_SOUND" = true ] ; then
239 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
243 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
240 fi
244 fi
241
245
242 # Add rng-tools package
246 # Add rng-tools package
243 if [ "$ENABLE_HWRANDOM" = true ] ; then
247 if [ "$ENABLE_HWRANDOM" = true ] ; then
244 APT_INCLUDES="${APT_INCLUDES},rng-tools"
248 APT_INCLUDES="${APT_INCLUDES},rng-tools"
245 fi
249 fi
246
250
247 # Add fbturbo video driver
251 # Add fbturbo video driver
248 if [ "$ENABLE_FBTURBO" = true ] ; then
252 if [ "$ENABLE_FBTURBO" = true ] ; then
249 # Enable xorg package dependencies
253 # Enable xorg package dependencies
250 ENABLE_XORG=true
254 ENABLE_XORG=true
251 fi
255 fi
252
256
253 # Add user defined window manager package
257 # Add user defined window manager package
254 if [ -n "$ENABLE_WM" ] ; then
258 if [ -n "$ENABLE_WM" ] ; then
255 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
259 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
256
260
257 # Enable xorg package dependencies
261 # Enable xorg package dependencies
258 ENABLE_XORG=true
262 ENABLE_XORG=true
259 fi
263 fi
260
264
261 # Add xorg package
265 # Add xorg package
262 if [ "$ENABLE_XORG" = true ] ; then
266 if [ "$ENABLE_XORG" = true ] ; then
263 APT_INCLUDES="${APT_INCLUDES},xorg"
267 APT_INCLUDES="${APT_INCLUDES},xorg"
264 fi
268 fi
265
269
266 # Set KERNEL_CONFIGSRC=true
270 # Set KERNELSRC_CONFIG=true
267 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNEL_SRCDIR" ] ; then
271 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
268 KERNEL_CONFIGSRC=true
272 KERNELSRC_CONFIG=true
269 fi
273 fi
270
274
271 ## MAIN bootstrap
275 ## MAIN bootstrap
272 for SCRIPT in bootstrap.d/*.sh; do
276 for SCRIPT in bootstrap.d/*.sh; do
273 # Execute bootstrap scripts (lexicographical order)
277 # Execute bootstrap scripts (lexicographical order)
274 head -n 3 $SCRIPT
278 head -n 3 "$SCRIPT"
275 . $SCRIPT
279 . "$SCRIPT"
276 done
280 done
277
281
278 ## Custom bootstrap scripts
282 ## Custom bootstrap scripts
279 if [ -d "custom.d" ] ; then
283 if [ -d "custom.d" ] ; then
280 # Execute custom bootstrap scripts (lexicographical order)
284 # Execute custom bootstrap scripts (lexicographical order)
281 for SCRIPT in custom.d/*.sh; do
285 for SCRIPT in custom.d/*.sh; do
282 . $SCRIPT
286 . "$SCRIPT"
283 done
287 done
284 fi
288 fi
285
289
286 # Invoke custom scripts
290 # Invoke custom scripts
287 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
291 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
288 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
292 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
289 # Execute scripts inside the chroot (lexicographical order)
293 # Execute scripts inside the chroot (lexicographical order)
290 chroot_exec /bin/bash -x <<'EOF'
294 chroot_exec /bin/bash -x <<'EOF'
291 for SCRIPT in /chroot_scripts/* ; do
295 for SCRIPT in /chroot_scripts/* ; do
292 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
296 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
293 $SCRIPT
297 $SCRIPT
294 fi
298 fi
295 done
299 done
296 EOF
300 EOF
297 rm -rf "${R}/chroot_scripts"
301 rm -rf "$R/chroot_scripts"
298 fi
302 fi
299
303
300 # Remove apt-utils
304 # Remove apt-utils
301 chroot_exec apt-get purge -qq -y --force-yes apt-utils
305 chroot_exec apt-get purge -qq -y --force-yes apt-utils
302
306
303 # Reduce the image size by removing and compressing
307 # Reduce the image size by removing and compressing
304 if [ "$ENABLE_REDUCE" = true ] ; then
308 if [ "$ENABLE_REDUCE" = true ] ; then
305 # Install dpkg configuration fragment file
309 # Install dpkg configuration fragment file
306 install_readonly files/dpkg/01nodoc $R/etc/dpkg/dpkg.cfg.d/01nodoc
310 install_readonly files/dpkg/01nodoc "$R/etc/dpkg/dpkg.cfg.d/01nodoc"
307
311
308 # Install APT configuration fragment files
312 # Install APT configuration fragment files
309 install_readonly files/apt/02nocache $R/etc/apt/apt.conf.d/02nocache
313 install_readonly files/apt/02nocache "$R/etc/apt/apt.conf.d/02nocache"
310 install_readonly files/apt/03compress $R/etc/apt/apt.conf.d/03compress
314 install_readonly files/apt/03compress "$R/etc/apt/apt.conf.d/03compress"
311 install_readonly files/apt/04norecommends $R/etc/apt/apt.conf.d/04norecommends
315 install_readonly files/apt/04norecommends "$R/etc/apt/apt.conf.d/04norecommends"
312
316
313 # Remove APT cache files
317 # Remove APT cache files
314 rm -fr $R/var/cache/apt/pkgcache.bin
318 rm -fr "$R/var/cache/apt/pkgcache.bin"
315 rm -fr $R/var/cache/apt/srcpkgcache.bin
319 rm -fr "$R/var/cache/apt/srcpkgcache.bin"
316
320
317 # Remove all doc and man files
321 # Remove all doc and man files
318 find $R/usr/share/doc -depth -type f ! -name copyright | xargs rm || true
322 find "$R/usr/share/doc" -depth -type f ! -name copyright | xargs rm || true
319 find $R/usr/share/doc -empty | xargs rmdir || true
323 find "$R/usr/share/doc" -empty | xargs rmdir || true
320 rm -rf $R/usr/share/man $R/usr/share/groff $R/usr/share/info $R/usr/share/lintian $R/usr/share/linda $R/var/cache/man
324 rm -rf "$R/usr/share/man" "$R/usr/share/groff" "$R/usr/share/info" "$R/usr/share/lintian" "$R/usr/share/linda" "$R/var/cache/man"
321
325
322 # Remove all translation files
326 # Remove all translation files
323 find $R/usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en' | xargs rm -r
327 find "$R/usr/share/locale" -mindepth 1 -maxdepth 1 ! -name 'en' | xargs rm -r
324
328
325 # Clean APT list of repositories
329 # Clean APT list of repositories
326 rm -fr $R/var/lib/apt/lists/*
330 rm -fr "$R/var/lib/apt/lists/*"
327 chroot_exec apt-get -qq -y update
331 chroot_exec apt-get -qq -y update
328
332
333 # Remove GPU kernels
329 if [ "$ENABLE_MINGPU" = true ] ; then
334 if [ "$ENABLE_MINGPU" = true ] ; then
330 rm -f $R/boot/firmware/start.elf
335 rm -f "$R/boot/firmware/start.elf"
331 rm -f $R/boot/firmware/fixup.dat
336 rm -f "$R/boot/firmware/fixup.dat"
332 rm -f $R/boot/firmware/start_x.elf
337 rm -f "$R/boot/firmware/start_x.elf"
333 rm -f $R/boot/firmware/fixup_x.dat
338 rm -f "$R/boot/firmware/fixup_x.dat"
334 fi
339 fi
335 fi
340 fi
336
341
337 # APT Cleanup
342 # APT Cleanup
338 chroot_exec apt-get -y clean
343 chroot_exec apt-get -y clean
339 chroot_exec apt-get -y autoclean
344 chroot_exec apt-get -y autoclean
340 chroot_exec apt-get -y autoremove
345 chroot_exec apt-get -y autoremove
341
346
342 # Unmount mounted filesystems
347 # Unmount mounted filesystems
343 umount -l $R/proc
348 umount -l "$R/proc"
344 umount -l $R/sys
349 umount -l "$R/sys"
345
350
346 # Clean up directories
351 # Clean up directories
347 rm -rf $R/run
352 rm -rf "$R/run"
348 rm -rf $R/tmp/*
353 rm -rf "$R/tmp/*"
349
354
350 # Clean up files
355 # Clean up files
351 rm -f $R/etc/apt/sources.list.save
356 rm -f "$R/etc/apt/sources.list.save"
352 rm -f $R/etc/resolvconf/resolv.conf.d/original
357 rm -f "$R/etc/resolvconf/resolv.conf.d/original"
353 rm -f $R/etc/*-
358 rm -f "$R/etc/*-"
354 rm -f $R/root/.bash_history
359 rm -f "$R/root/.bash_history"
355 rm -f $R/var/lib/urandom/random-seed
360 rm -f "$R/var/lib/urandom/random-seed"
356 rm -f $R/var/lib/dbus/machine-id
361 rm -f "$R/var/lib/dbus/machine-id"
357 rm -f $R/etc/machine-id
362 rm -f "$R/etc/machine-id"
358 rm -f $R/etc/apt/apt.conf.d/10proxy
363 rm -f "$R/etc/apt/apt.conf.d/10proxy"
359 rm -f $R/etc/resolv.conf
364 rm -f "$R/etc/resolv.conf"
360 rm -f "${R}${QEMU_BINARY}"
365 rm -f "${R}${QEMU_BINARY}"
361
366
362 # Calculate size of the chroot directory in KB
367 # Calculate size of the chroot directory in KB
363 CHROOT_SIZE=$(expr `du -s $R | awk '{ print $1 }'`)
368 CHROOT_SIZE=$(expr `du -s "$R" | awk '{ print $1 }'`)
364
369
365 # Calculate the amount of needed 512 Byte sectors
370 # Calculate the amount of needed 512 Byte sectors
366 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
371 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
367 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
372 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
368 ROOT_OFFSET=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS})
373 ROOT_OFFSET=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS})
369
374
370 # The root partition is EXT4
375 # The root partition is EXT4
371 # This means more space than the actual used space of the chroot is used.
376 # This means more space than the actual used space of the chroot is used.
372 # As overhead for journaling and reserved blocks 20% are added.
377 # As overhead for journaling and reserved blocks 20% are added.
373 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 20) \* 1024 \/ 512)
378 ROOT_SECTORS=$(expr $(expr ${CHROOT_SIZE} + ${CHROOT_SIZE} \/ 100 \* 20) \* 1024 \/ 512)
374
379
375 # Calculate required image size in 512 Byte sectors
380 # Calculate required image size in 512 Byte sectors
376 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
381 IMAGE_SECTORS=$(expr ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS})
377
382
378 # Prepare date string for image file name
383 # Prepare date string for image file name
379 DATE="$(date +%Y-%m-%d)"
384 DATE="$(date +%Y-%m-%d)"
380
385
381 # Prepare image file
386 # Prepare image file
382 if [ "$ENABLE_SPLITFS" = true ] ; then
387 if [ "$ENABLE_SPLITFS" = true ] ; then
383 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=${TABLE_SECTORS}
388 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=${TABLE_SECTORS}
384 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
389 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" bs=512 count=0 seek=${FRMW_SECTORS}
385 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=${TABLE_SECTORS}
390 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=${TABLE_SECTORS}
386 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
391 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}-root.img" bs=512 count=0 seek=${ROOT_SECTORS}
387 # Write partition tables
392 # Write partition tables
388 sfdisk -q -L -f "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" <<EOM
393 sfdisk -q -L -f "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img" <<EOM
389 unit: sectors
394 unit: sectors
390
395
391 1 : start= ${TABLE_SECTORS}, size= ${FRMW_SECTORS}, Id= c, bootable
396 1 : start= ${TABLE_SECTORS}, size= ${FRMW_SECTORS}, Id= c, bootable
392 2 : start= 0, size= 0, Id= 0
397 2 : start= 0, size= 0, Id= 0
393 3 : start= 0, size= 0, Id= 0
398 3 : start= 0, size= 0, Id= 0
394 4 : start= 0, size= 0, Id= 0
399 4 : start= 0, size= 0, Id= 0
395 EOM
400 EOM
396 sfdisk -q -L -f "$BASEDIR/${DATE}-debian-${RELEASE}-root.img" <<EOM
401 sfdisk -q -L -f "$BASEDIR/${DATE}-debian-${RELEASE}-root.img" <<EOM
397 unit: sectors
402 unit: sectors
398
403
399 1 : start= ${TABLE_SECTORS}, size= ${ROOT_SECTORS}, Id=83
404 1 : start= ${TABLE_SECTORS}, size= ${ROOT_SECTORS}, Id=83
400 2 : start= 0, size= 0, Id= 0
405 2 : start= 0, size= 0, Id= 0
401 3 : start= 0, size= 0, Id= 0
406 3 : start= 0, size= 0, Id= 0
402 4 : start= 0, size= 0, Id= 0
407 4 : start= 0, size= 0, Id= 0
403 EOM
408 EOM
404 # Setup temporary loop devices
409 # Setup temporary loop devices
405 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-frmw.img)"
410 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-frmw.img)"
406 ROOT_LOOP="$(losetup -o 1M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-root.img)"
411 ROOT_LOOP="$(losetup -o 1M -f --show $BASEDIR/${DATE}-debian-${RELEASE}-root.img)"
407 else
412 else
408 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
413 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=${TABLE_SECTORS}
409 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
414 dd if=/dev/zero of="$BASEDIR/${DATE}-debian-${RELEASE}.img" bs=512 count=0 seek=${IMAGE_SECTORS}
410 # Write partition table
415 # Write partition table
411 sfdisk -q -f "$BASEDIR/${DATE}-debian-${RELEASE}.img" <<EOM
416 sfdisk -q -f "$BASEDIR/${DATE}-debian-${RELEASE}.img" <<EOM
412 unit: sectors
417 unit: sectors
413
418
414 1 : start= ${TABLE_SECTORS}, size= ${FRMW_SECTORS}, Id= c, bootable
419 1 : start= ${TABLE_SECTORS}, size= ${FRMW_SECTORS}, Id= c, bootable
415 2 : start= ${ROOT_OFFSET}, size= ${ROOT_SECTORS}, Id=83
420 2 : start= ${ROOT_OFFSET}, size= ${ROOT_SECTORS}, Id=83
416 3 : start= 0, size= 0, Id= 0
421 3 : start= 0, size= 0, Id= 0
417 4 : start= 0, size= 0, Id= 0
422 4 : start= 0, size= 0, Id= 0
418 EOM
423 EOM
419 # Setup temporary loop devices
424 # Setup temporary loop devices
420 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
425 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
421 ROOT_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
426 ROOT_LOOP="$(losetup -o 65M -f --show $BASEDIR/${DATE}-debian-${RELEASE}.img)"
422 fi
427 fi
423
428
424 # Build filesystems
429 # Build filesystems
425 mkfs.vfat "$FRMW_LOOP"
430 mkfs.vfat "$FRMW_LOOP"
426 mkfs.ext4 "$ROOT_LOOP"
431 mkfs.ext4 "$ROOT_LOOP"
427
432
428 # Mount the temporary loop devices
433 # Mount the temporary loop devices
429 mkdir -p "$BUILDDIR/mount"
434 mkdir -p "$BUILDDIR/mount"
430 mount "$ROOT_LOOP" "$BUILDDIR/mount"
435 mount "$ROOT_LOOP" "$BUILDDIR/mount"
431
436
432 mkdir -p "$BUILDDIR/mount/boot/firmware"
437 mkdir -p "$BUILDDIR/mount/boot/firmware"
433 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
438 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
434
439
435 # Copy all files from the chroot to the loop device mount point directory
440 # Copy all files from the chroot to the loop device mount point directory
436 rsync -a "$R/" "$BUILDDIR/mount/"
441 rsync -a "$R/" "$BUILDDIR/mount/"
437
442
438 # Unmount all temporary loop devices and mount points
443 # Unmount all temporary loop devices and mount points
439 cleanup
444 cleanup
440
445
441 # Create block map file(s) of image(s)
446 # Create block map file(s) of image(s)
442 if [ "$ENABLE_SPLITFS" = true ] ; then
447 if [ "$ENABLE_SPLITFS" = true ] ; then
443 # Create block map files for "bmaptool"
448 # Create block map files for "bmaptool"
444 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img"
449 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img"
445 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-root.img"
450 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}-root.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}-root.img"
446
451
447 # Image was successfully created
452 # Image was successfully created
448 echo "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
453 echo "$BASEDIR/${DATE}-debian-${RELEASE}-frmw.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
449 echo "$BASEDIR/${DATE}-debian-${RELEASE}-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
454 echo "$BASEDIR/${DATE}-debian-${RELEASE}-root.img ($(expr \( ${TABLE_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
450 else
455 else
451 # Create block map file for "bmaptool"
456 # Create block map file for "bmaptool"
452 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}.img"
457 bmaptool create -o "$BASEDIR/${DATE}-debian-${RELEASE}.bmap" "$BASEDIR/${DATE}-debian-${RELEASE}.img"
453
458
454 # Image was successfully created
459 # Image was successfully created
455 echo "$BASEDIR/${DATE}-debian-${RELEASE}.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
460 echo "$BASEDIR/${DATE}-debian-${RELEASE}.img ($(expr \( ${TABLE_SECTORS} + ${FRMW_SECTORS} + ${ROOT_SECTORS} \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
456 fi
461 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant