@@ -1,155 +1,166 | |||||
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 dosfstools rsync bmap-tools whois git-core``` |
|
8 | ```debootstrap debian-archive-keyring qemu-user-static 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 | ``` |
|
21 | ``` | |
22 |
|
22 | |||
23 | #### APT settings: |
|
23 | #### APT settings: | |
24 | ##### `APT_SERVER`="ftp.debian.org" |
|
24 | ##### `APT_SERVER`="ftp.debian.org" | |
25 | 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. |
|
25 | 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. | |
26 |
|
26 | |||
27 | ##### `APT_PROXY`="" |
|
27 | ##### `APT_PROXY`="" | |
28 | 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. |
|
28 | 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. | |
29 |
|
29 | |||
30 | ##### `APT_INCLUDES`="" |
|
30 | ##### `APT_INCLUDES`="" | |
31 | A comma seperated list of additional packages to be installed during bootstrapping. |
|
31 | A comma seperated list of additional packages to be installed during bootstrapping. | |
32 |
|
32 | |||
33 | #### General system settings: |
|
33 | #### General system settings: | |
34 | ##### `HOSTNAME`="rpi2-jessie" |
|
34 | ##### `HOSTNAME`="rpi2-jessie" | |
35 | Set system host name. It's recommended that the host name is unique in the corresponding subnet. |
|
35 | Set system host name. It's recommended that the host name is unique in the corresponding subnet. | |
36 |
|
36 | |||
37 | ##### `PASSWORD`="raspberry" |
|
37 | ##### `PASSWORD`="raspberry" | |
38 | Set system `root` password. The same password is used for the created user `pi`. It's **STRONGLY** recommended that you choose a custom password. |
|
38 | Set system `root` password. The same password is used for the created user `pi`. It's **STRONGLY** recommended that you choose a custom password. | |
39 |
|
39 | |||
40 | ##### `DEFLOCAL`="en_US.UTF-8" |
|
40 | ##### `DEFLOCAL`="en_US.UTF-8" | |
41 | 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`. |
|
41 | 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`. | |
42 |
|
42 | |||
43 | ##### `TIMEZONE`="Europe/Berlin" |
|
43 | ##### `TIMEZONE`="Europe/Berlin" | |
44 | 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. |
|
44 | 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. | |
45 |
|
45 | |||
46 | ##### `EXPANDROOT`=true |
|
46 | ##### `EXPANDROOT`=true | |
47 | Expand the root partition and filesystem automatically on first boot. |
|
47 | Expand the root partition and filesystem automatically on first boot. | |
48 |
|
48 | |||
49 | #### Keyboard settings: |
|
49 | #### Keyboard settings: | |
50 | 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. |
|
50 | 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. | |
|
51 | ||||
51 | ##### `XKBMODEL`="" |
|
52 | ##### `XKBMODEL`="" | |
|
53 | Set the name of the model of your keyboard type. | |||
|
54 | ||||
52 | ##### `XKBLAYOUT`="" |
|
55 | ##### `XKBLAYOUT`="" | |
|
56 | Set the supported keyboard layout(s). | |||
|
57 | ||||
53 | ##### `XKBVARIANT`="" |
|
58 | ##### `XKBVARIANT`="" | |
|
59 | Set the supported variant(s) of the keyboard layout(s). | |||
|
60 | ||||
54 | ##### `XKBOPTIONS`="" |
|
61 | ##### `XKBOPTIONS`="" | |
|
62 | Set extra xkb configuration options. | |||
55 |
|
63 | |||
56 | #### Networking settings |
|
64 | #### Networking settings (DHCP) | |
57 |
Th |
|
65 | This setting is used to set up networking auto configuration in `/etc/systemd/network/eth.network`. | |
58 |
|
66 | |||
59 | #####`ENABLE_DHCP`=true |
|
67 | #####`ENABLE_DHCP`=true | |
60 | Set the system to use DHCP. When set to "true", the following `NET_*` settings (used for static configuration) are ignored. |
|
68 | Set the system to use DHCP. This requires an DHCP server. | |
|
69 | ||||
|
70 | #### Networking settings (static) | |||
|
71 | 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`. | |||
61 |
|
72 | |||
62 | #####`NET_ADDRESS`="" |
|
73 | #####`NET_ADDRESS`="" | |
63 | Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24". |
|
74 | Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24". | |
64 |
|
75 | |||
65 | #####`NET_GATEWAY`="" |
|
76 | #####`NET_GATEWAY`="" | |
66 | Set the IP address for the default gateway. |
|
77 | Set the IP address for the default gateway. | |
67 |
|
78 | |||
68 | #####`NET_DNS_1`="" |
|
79 | #####`NET_DNS_1`="" | |
69 | Set the IP address for the first DNS server. |
|
80 | Set the IP address for the first DNS server. | |
70 |
|
81 | |||
71 | #####`NET_DNS_2`="" |
|
82 | #####`NET_DNS_2`="" | |
72 | Set the IP address for the second DNS server. |
|
83 | Set the IP address for the second DNS server. | |
73 |
|
84 | |||
74 | #####`NET_DNS_DOMAINS`="" |
|
85 | #####`NET_DNS_DOMAINS`="" | |
75 | Set the default DNS search domains to use for non fully qualified host names. |
|
86 | Set the default DNS search domains to use for non fully qualified host names. | |
76 |
|
87 | |||
77 | #####`NET_NTP_1`="" |
|
88 | #####`NET_NTP_1`="" | |
78 | Set the IP address for the first NTP server. |
|
89 | Set the IP address for the first NTP server. | |
79 |
|
90 | |||
80 | #####`NET_NTP_2`="" |
|
91 | #####`NET_NTP_2`="" | |
81 | Set the IP address for the second NTP server. |
|
92 | Set the IP address for the second NTP server. | |
82 |
|
93 | |||
83 | #### Basic system features: |
|
94 | #### Basic system features: | |
84 | ##### `ENABLE_CONSOLE`=true |
|
95 | ##### `ENABLE_CONSOLE`=true | |
85 | 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. |
|
96 | 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. | |
86 |
|
97 | |||
87 | ##### `ENABLE_IPV6`=true |
|
98 | ##### `ENABLE_IPV6`=true | |
88 | Enable IPv6 support. The network interface configuration is managed via systemd-networkd. |
|
99 | Enable IPv6 support. The network interface configuration is managed via systemd-networkd. | |
89 |
|
100 | |||
90 | ##### `ENABLE_SSHD`=true |
|
101 | ##### `ENABLE_SSHD`=true | |
91 | 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. |
|
102 | 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. | |
92 |
|
103 | |||
93 | ##### `ENABLE_RSYSLOG`=true |
|
104 | ##### `ENABLE_RSYSLOG`=true | |
94 | If set to false, disable and uninstall rsyslog (so logs will be available only |
|
105 | If set to false, disable and uninstall rsyslog (so logs will be available only | |
95 | in journal files) |
|
106 | in journal files) | |
96 |
|
107 | |||
97 | ##### `ENABLE_SOUND`=true |
|
108 | ##### `ENABLE_SOUND`=true | |
98 | Enable sound hardware and install Advanced Linux Sound Architecture. |
|
109 | Enable sound hardware and install Advanced Linux Sound Architecture. | |
99 |
|
110 | |||
100 | ##### `ENABLE_HWRANDOM`=true |
|
111 | ##### `ENABLE_HWRANDOM`=true | |
101 | Enable Hardware Random Number Generator. Strong random numbers are important for most network based communications that use encryption. It's recommended to be enabled. |
|
112 | Enable Hardware Random Number Generator. Strong random numbers are important for most network based communications that use encryption. It's recommended to be enabled. | |
102 |
|
113 | |||
103 | ##### `ENABLE_MINGPU`=false |
|
114 | ##### `ENABLE_MINGPU`=false | |
104 | Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU. |
|
115 | Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU. | |
105 |
|
116 | |||
106 | ##### `ENABLE_DBUS`=true |
|
117 | ##### `ENABLE_DBUS`=true | |
107 | Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled. |
|
118 | Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled. | |
108 |
|
119 | |||
109 | ##### `ENABLE_XORG`=false |
|
120 | ##### `ENABLE_XORG`=false | |
110 | Install Xorg open-source X Window System. |
|
121 | Install Xorg open-source X Window System. | |
111 |
|
122 | |||
112 | ##### `ENABLE_WM`="" |
|
123 | ##### `ENABLE_WM`="" | |
113 | 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`. |
|
124 | 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`. | |
114 |
|
125 | |||
115 | #### Advanced sytem features: |
|
126 | #### Advanced sytem features: | |
116 | ##### `ENABLE_MINBASE`=false |
|
127 | ##### `ENABLE_MINBASE`=false | |
117 | Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB. |
|
128 | Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB. | |
118 |
|
129 | |||
119 | ##### `ENABLE_UBOOT`=false |
|
130 | ##### `ENABLE_UBOOT`=false | |
120 | 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. |
|
131 | 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. | |
121 |
|
132 | |||
122 | ##### `ENABLE_FBTURBO`=false |
|
133 | ##### `ENABLE_FBTURBO`=false | |
123 | 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. |
|
134 | 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. | |
124 |
|
135 | |||
125 | ##### `ENABLE_IPTABLES`=false |
|
136 | ##### `ENABLE_IPTABLES`=false | |
126 | Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service. |
|
137 | Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service. | |
127 |
|
138 | |||
128 | ##### `ENABLE_USER`=true |
|
139 | ##### `ENABLE_USER`=true | |
129 | Create pi user with password raspberry |
|
140 | Create pi user with password raspberry | |
130 |
|
141 | |||
131 | ##### `ENABLE_ROOT`=true |
|
142 | ##### `ENABLE_ROOT`=true | |
132 | Set root user password so root login will be enabled |
|
143 | Set root user password so root login will be enabled | |
133 |
|
144 | |||
134 | ##### `ENABLE_ROOT_SSH`=true |
|
145 | ##### `ENABLE_ROOT_SSH`=true | |
135 | Enable password root login via SSH. May be a security risk with default |
|
146 | Enable password root login via SSH. May be a security risk with default | |
136 | password, use only in trusted environments. |
|
147 | password, use only in trusted environments. | |
137 |
|
148 | |||
138 | ##### `ENABLE_HARDNET`=false |
|
149 | ##### `ENABLE_HARDNET`=false | |
139 | Enable IPv4/IPv6 network stack hardening settings. |
|
150 | Enable IPv4/IPv6 network stack hardening settings. | |
140 |
|
151 | |||
141 | ## Logging of the bootstrapping process |
|
152 | ## Logging of the bootstrapping process | |
142 | 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: |
|
153 | 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: | |
143 |
|
154 | |||
144 | ```shell |
|
155 | ```shell | |
145 | script -c 'APT_SERVER=ftp.de.debian.org ./rpi2-gen-image.sh' ./build.log |
|
156 | script -c 'APT_SERVER=ftp.de.debian.org ./rpi2-gen-image.sh' ./build.log | |
146 | ``` |
|
157 | ``` | |
147 |
|
158 | |||
148 | ## Flashing the image file |
|
159 | ## Flashing the image file | |
149 | 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`. |
|
160 | 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`. | |
150 |
|
161 | |||
151 | #####Flashing examples: |
|
162 | #####Flashing examples: | |
152 | ```shell |
|
163 | ```shell | |
153 | bmaptool copy ./images/jessie/2015-12-13-debian-jessie.img /dev/mmcblk0 |
|
164 | bmaptool copy ./images/jessie/2015-12-13-debian-jessie.img /dev/mmcblk0 | |
154 | dd bs=4M if=./images/jessie/2015-12-13-debian-jessie.img of=/dev/mmcblk0 |
|
165 | dd bs=4M if=./images/jessie/2015-12-13-debian-jessie.img of=/dev/mmcblk0 | |
155 | ``` |
|
166 | ``` |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant