##// END OF EJS Templates
README.md fix, rm-lost-file
Jan Wagner -
r74:d4ab3cfce58c
parent child
Show More
@@ -1,240 +1,240
1 1 # rpi2-gen-image
2 2 ## Introduction
3 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 5 ## Build dependencies
6 6 The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user.
7 7
8 8 ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git-core```
9 9
10 10 ## Command-line parameters
11 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 13 #####Command-line examples:
14 14 ```shell
15 15 ENABLE_UBOOT=true ./rpi2-gen-image.sh
16 16 ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi2-gen-image.sh
17 17 ENABLE_WM=xfce4 ENABLE_FBTURBO=true ENABLE_MINBASE=true ./rpi2-gen-image.sh
18 18 ENABLE_HARDNET=true ENABLE_IPTABLES=true /rpi2-gen-image.sh
19 19 APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image.sh
20 20 ENABLE_MINBASE=true ./rpi2-gen-image.sh
21 21 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi2-gen-image.sh
22 22 BUILD_KERNEL=true KERNEL_SRCDIR=/tmp/linux ./rpi2-gen-image.sh
23 23 ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi2-gen-image.sh
24 24 ```
25 25
26 26 #### APT settings:
27 27 ##### `APT_SERVER`="ftp.debian.org"
28 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 30 ##### `APT_PROXY`=""
31 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 33 ##### `APT_INCLUDES`=""
34 34 A comma seperated list of additional packages to be installed during bootstrapping.
35 35
36 36 #### General system settings:
37 37 ##### `HOSTNAME`="rpi2-jessie"
38 38 Set system host name. It's recommended that the host name is unique in the corresponding subnet.
39 39
40 40 ##### `PASSWORD`="raspberry"
41 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 43 ##### `DEFLOCAL`="en_US.UTF-8"
44 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 46 ##### `TIMEZONE`="Europe/Berlin"
47 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 49 ##### `EXPANDROOT`=true
50 50 Expand the root partition and filesystem automatically on first boot.
51 51
52 52 #### Keyboard settings:
53 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 55 ##### `XKB_MODEL`=""
56 56 Set the name of the model of your keyboard type.
57 57
58 58 ##### `XKB_LAYOUT`=""
59 59 Set the supported keyboard layout(s).
60 60
61 61 ##### `XKB_VARIANT`=""
62 62 Set the supported variant(s) of the keyboard layout(s).
63 63
64 64 ##### `XKB_OPTIONS`=""
65 65 Set extra xkb configuration options.
66 66
67 67 #### Networking settings (DHCP):
68 68 This setting is used to set up networking auto configuration in `/etc/systemd/network/eth.network`.
69 69
70 70 #####`ENABLE_DHCP`=true
71 71 Set the system to use DHCP. This requires an DHCP server.
72 72
73 73 #### Networking settings (static):
74 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 76 #####`NET_ADDRESS`=""
77 77 Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24".
78 78
79 79 #####`NET_GATEWAY`=""
80 80 Set the IP address for the default gateway.
81 81
82 82 #####`NET_DNS_1`=""
83 83 Set the IP address for the first DNS server.
84 84
85 85 #####`NET_DNS_2`=""
86 86 Set the IP address for the second DNS server.
87 87
88 88 #####`NET_DNS_DOMAINS`=""
89 89 Set the default DNS search domains to use for non fully qualified host names.
90 90
91 91 #####`NET_NTP_1`=""
92 92 Set the IP address for the first NTP server.
93 93
94 94 #####`NET_NTP_2`=""
95 95 Set the IP address for the second NTP server.
96 96
97 97 #### Basic system features:
98 98 ##### `ENABLE_CONSOLE`=true
99 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 101 ##### `ENABLE_IPV6`=true
102 102 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
103 103
104 104 ##### `ENABLE_SSHD`=true
105 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 107 ##### `ENABLE_RSYSLOG`=true
108 108 If set to false, disable and uninstall rsyslog (so logs will be available only
109 109 in journal files)
110 110
111 111 ##### `ENABLE_SOUND`=true
112 112 Enable sound hardware and install Advanced Linux Sound Architecture.
113 113
114 114 ##### `ENABLE_HWRANDOM`=true
115 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 117 ##### `ENABLE_MINGPU`=false
118 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 120 ##### `ENABLE_DBUS`=true
121 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 123 ##### `ENABLE_XORG`=false
124 124 Install Xorg open-source X Window System.
125 125
126 126 ##### `ENABLE_WM`=""
127 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 129 #### Advanced system features:
130 130 ##### `ENABLE_MINBASE`=false
131 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 133 ##### `ENABLE_REDUCE`=false
134 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 136 ##### `ENABLE_UBOOT`=false
137 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 139 ##### `ENABLE_FBTURBO`=false
140 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 142 ##### `ENABLE_IPTABLES`=false
143 143 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
144 144
145 145 ##### `ENABLE_USER`=true
146 146 Create pi user with password raspberry
147 147
148 148 ##### `ENABLE_ROOT`=true
149 149 Set root user password so root login will be enabled
150 150
151 151 ##### `ENABLE_ROOT_SSH`=true
152 152 Enable password root login via SSH. May be a security risk with default
153 153 password, use only in trusted environments.
154 154
155 155 ##### `ENABLE_HARDNET`=false
156 156 Enable IPv4/IPv6 network stack hardening settings.
157 157
158 158 ##### `ENABLE_SPLITFS`=false
159 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 161 ##### `CHROOT_SCRIPTS`=""
162 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 164 #### Kernel compilation:
165 165 ##### `BUILD_KERNEL`=false
166 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 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.
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 170
171 171 ##### `KERNEL_THREADS`=1
172 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.
173 173
174 174 ##### `KERNEL_HEADERS`=true
175 175 Install kernel headers with built kernel.
176 176
177 177 ##### `KERNEL_MENUCONFIG`=false
178 178 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
179 179
180 180 ##### `KERNEL_CONFIGSRC`=true
181 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`.
182 182
183 183 ##### `KERNEL_CLEANSRC`=false
184 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.
185 185
186 186 ##### `KERNEL_RMSRC`=true
187 187 Remove all kernel sources from the generated OS image after it was built and installed.
188 188
189 189 ## Understanding the script
190 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:
191 191
192 192 | Script | Description |
193 193 | --- | --- |
194 194 | `10-bootstrap.sh` | Debootstrap basic system |
195 195 | `11-apt.sh` | Setup APT repositories |
196 196 | `12-locale.sh` | Setup Locales and keyboard settings |
197 197 | `13-kernel.sh` | Build and install RPi2 Kernel |
198 198 | `20-networking.sh` | Setup Networking |
199 199 | `21-firewall.sh` | Setup Firewall |
200 200 | `30-security.sh` | Setup Users and Security settings |
201 201 | `31-logging.sh` | Setup Logging |
202 202 | `41-uboot.sh` | Build and Setup U-Boot |
203 203 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
204 204 | `50-firstboot.sh` | First boot actions |
205 205
206 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.
207 207
208 208 | Directory | Description |
209 209 | --- | --- |
210 210 | `boot` | Boot and RPi2 configuration files |
211 211 | `dpkg` | Package Manager configuration |
212 212 | `firstboot` | Scripts that get executed on first boot |
213 213 | `iptables` | Firewall configuration files |
214 214 | `locales` | Locales configuration |
215 215 | `modules` | Kernel Modules configuration |
216 216 | `mount` | Fstab configuration |
217 217 | `network` | Networking configuration files |
218 218 | `sysctl.d` | Swapping and Network Hardening configuration |
219 219 | `xorg` | fbturbo Xorg driver configuration |
220 220
221 221 ## Logging of the bootstrapping process
222 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:
223 223
224 224 ```shell
225 225 script -c 'APT_SERVER=ftp.de.debian.org ./rpi2-gen-image.sh' ./build.log
226 226 ```
227 227
228 228 ## Flashing the image file
229 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`.
230 230
231 231 #####Flashing examples:
232 232 ```shell
233 233 bmaptool copy ./images/jessie/2015-12-13-debian-jessie.img /dev/mmcblk0
234 234 dd bs=4M if=./images/jessie/2015-12-13-debian-jessie.img of=/dev/mmcblk0
235 235 ```
236 236 If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, then the `-root` one on the USB drive:
237 237 ```shell
238 238 bmaptool copy ./images/jessie/2015-12-13-debian-jessie-frmw.img /dev/mmcblk0
239 239 bmaptool copy ./images/jessie/2015-12-13-debian-jessie-root.img /dev/sdc
240 240 ```
1 NO CONTENT: file was removed
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant