@@ -1,97 +1,97 | |||
|
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 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 enviroment 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_HARDNET=true ENABLE_IPTABLES=true /rpi2-gen-image.sh |
|
18 | 18 | APT_SERVER=ftp.de.debian.org APT_PROXY="http://127.0.0.1:3142/" ./rpi2-gen-image.sh |
|
19 | 19 | ENABLE_MINBASE=true ./rpi2-gen-image.sh |
|
20 | 20 | ``` |
|
21 | 21 | |
|
22 | 22 | #### APT settings: |
|
23 | 23 | ##### `APT_SERVER`="ftp.debian.org" |
|
24 | 24 | Set Debian packages server address. Choose a server from the list of Debian wordwide [mirror sites](https://www.debian.org/mirror/list). Using a nearby server will probably speed-up all required downloads within the bootstrapping process. |
|
25 | 25 | |
|
26 | 26 | ##### `APT_PROXY`="" |
|
27 | 27 | 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 | 28 | |
|
29 | 29 | #### General system settings: |
|
30 | 30 | ##### `HOSTNAME`="rpi2-jessie" |
|
31 | 31 | Set system host name. It's recommended that the host name is unique in the corresponding subnet. |
|
32 | 32 | |
|
33 | 33 | ##### `PASSWORD`="raspberry" |
|
34 | 34 | Set system `root` password. The same password is used for the created user `pi`. It's **STRONGLY** recommended that you choose a custom password. |
|
35 | 35 | |
|
36 | 36 | ##### `DEFLOCAL`="en_US.UTF-8" |
|
37 | 37 | Set default system locale and keyboard layout. 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`. |
|
38 | 38 | |
|
39 | 39 | ##### `TIMEZONE`="Europe/Berlin" |
|
40 | 40 | 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. |
|
41 | 41 | |
|
42 | 42 | #### Basic system features: |
|
43 | 43 | ##### `ENABLE_CONSOLE`=true |
|
44 | 44 | 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. |
|
45 | 45 | |
|
46 | 46 | ##### `ENABLE_IPV6`=true |
|
47 | 47 | Enable IPv6 support. The network interface configuration is managed via systemd-networkd. |
|
48 | 48 | |
|
49 | 49 | ##### `ENABLE_SSHD`=true |
|
50 | 50 | 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. |
|
51 | 51 | |
|
52 | 52 | ##### `ENABLE_SOUND`=true |
|
53 | 53 | Enable sound hardware and install Advanced Linux Sound Architecture. |
|
54 | 54 | |
|
55 | 55 | ##### `ENABLE_HWRANDOM`=true |
|
56 | 56 | Enable Hardware Random Number Generator. Strong random numbers are important for most network based communications that use encryption. It's recommended to be enabled. |
|
57 | 57 | |
|
58 | 58 | ##### `ENABLE_MINGPU`=false |
|
59 | 59 | Minimize the amount of shared memory reserverd for the GPU. It doesn't seem to be possible to fully disable the GPU. |
|
60 | 60 | |
|
61 | 61 | ##### `ENABLE_DBUS`=true |
|
62 | 62 | Install and enable D-Bus message bus. Please note that systemd should work without D-bus but it's recommended to be enabled. |
|
63 | 63 | |
|
64 | 64 | ##### `ENABLE_XORG`=false |
|
65 | 65 | Install Xorg open-source X Window System. |
|
66 | 66 | |
|
67 | 67 | ##### `ENABLE_FLUXBOX`=false |
|
68 | Install Fluxbox window manager for the X Window System. | |
|
68 | Install Fluxbox window manager for the X Window System. To make sure all X releated package dependencies are getting installed `ENABLE_XORG` will automatically get enabled if `ENABLE_FLUXBOX` is used. | |
|
69 | 69 | |
|
70 | 70 | #### Advanced sytem features: |
|
71 | 71 | ##### `ENABLE_MINBASE`=false |
|
72 | 72 | Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB. |
|
73 | 73 | |
|
74 | 74 | ##### `ENABLE_UBOOT`=false |
|
75 | Replace default RPi bootloader with U-Boot bootloader. U-Boot can boot images via the network using the BOOTP/TFTP protocol. | |
|
75 | 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. | |
|
76 | 76 | |
|
77 | 77 | ##### `ENABLE_IPTABLES`=false |
|
78 | 78 | Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service. |
|
79 | 79 | |
|
80 | 80 | ##### `ENABLE_HARDNET`=false |
|
81 | 81 | Enable IPv4/IPv6 network stack hardening settings. |
|
82 | 82 | |
|
83 | 83 | ## Logging of the bootstrapping process |
|
84 | 84 | 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: |
|
85 | 85 | |
|
86 | 86 | ```shell |
|
87 | 87 | script -c 'APT_SERVER=ftp.de.debian.org ./rpi2-gen-image.sh' ./build.log |
|
88 | 88 | ``` |
|
89 | 89 | |
|
90 | 90 | ## Flashing the image file |
|
91 | 91 | After the image file was succesfully 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`. |
|
92 | 92 | |
|
93 | 93 | #####Flashing examples: |
|
94 | 94 | ```shell |
|
95 | 95 | bmaptool copy ./images/jessie/2015-12-13-debian-jessie.img /dev/mmcblk0 |
|
96 | 96 | dd bs=4M if=./images/jessie/2015-12-13-debian-jessie.img of=/dev/mmcblk0 |
|
97 | 97 | ``` |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant