##// END OF EJS Templates
Added Debian stretch release support
drtyhlpr -
r92:09d30ea4bc55
parent child
Show More
@@ -0,0 +1,14
1 #!/bin/sh -e
2 #
3 # rc.local
4 #
5 # This script is executed at the end of each multiuser runlevel.
6 # Make sure that the script will "exit 0" on success or any other
7 # value on error.
8 #
9 # In order to enable or disable this script just change the execution
10 # bits.
11 #
12 # By default this script does nothing.
13
14 exit 0
@@ -0,0 +1,13
1 logger -t "rc.firstboot" "Configuring network interface name"
2
3 INTERFACE_NAME=$(dmesg | grep "renamed from eth0" | awk -F ":| " '{ print $9 }')
4
5 if [ ! -z INTERFACE_NAME ] ; then
6 if [ -r "/etc/systemd/network/eth.network" ] ; then
7 sed -i "s/eth0/${INTERFACE_NAME}/" /etc/systemd/network/eth.network
8 fi
9
10 if [ -r "/lib/systemd/network/10-eth.network" ] ; then
11 sed -i "s/eth0/${INTERFACE_NAME}/" /lib/systemd/network/10-eth.network
12 fi
13 fi
@@ -1,6 +1,6
1 1 # rpi2-gen-image
2 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 supports the bootstrapping of the Debian releases "jessie" and "stretch".
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.
@@ -22,6 +22,7 BUILD_KERNEL=true ENABLE_MINBASE=true ENABLE_IPV6=false ./rpi2-gen-image.sh
22 22 BUILD_KERNEL=true KERNELSRC_DIR=/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 ENABLE_CRYPTFS=true CRYPTFS_PASSWORD=changeme EXPANDROOT=false ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ./rpi2-gen-image.sh
25 RELEASE=stretch BUILD_KERNEL=true ./rpi2-gen-image.sh
25 26 ```
26 27
27 28 #### APT settings:
@@ -35,6 +36,9 Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will sp
35 36 A comma separated list of additional packages to be installed during bootstrapping.
36 37
37 38 #### General system settings:
39 ##### `RELEASE`="jessie"
40 Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases "jessie" and "stretch". `BUILD_KERNEL`=true will automatically be set if the Debian release `stretch` is used.
41
38 42 ##### `HOSTNAME`="rpi2-jessie"
39 43 Set system host name. It's recommended that the host name is unique in the corresponding subnet.
40 44
@@ -171,6 +175,9 Path to a directory with scripts that should be run in the chroot before the ima
171 175 ##### `ENABLE_INITRAMFS`=false
172 176 Create an initramfs that that will be loaded during the Linux startup process. `ENABLE_INITRAMFS` will automatically get enabled if `ENABLE_CRYPTFS`=true. This parameter will be ignored if `BUILD_KERNEL`=false.
173 177
178 ##### `ENABLE_IFNAMES`=true
179 Enable automatic assignment of predictable, stable network interface names for all local Ethernet, WLAN interfaces. This might create complex and long interface names. This parameter is only supported if the Debian release `stretch` is used.
180
174 181 #### Kernel compilation:
175 182 ##### `BUILD_KERNEL`=false
176 183 Build and install the latest RPi2 Linux kernel. Currently only the default RPi2 kernel configuration is used.
@@ -7,6 +7,7
7 7
8 8 VARIANT=""
9 9 COMPONENTS="main"
10 EXCLUDES=""
10 11
11 12 # Use non-free Debian packages if needed
12 13 if [ "$ENABLE_NONFREE" = true ] ; then
@@ -18,8 +19,13 if [ "$ENABLE_MINBASE" = true ] ; then
18 19 VARIANT="--variant=minbase"
19 20 fi
20 21
22 # Exclude packages if required by Debian release
23 if [ "$RELEASE" = "stretch" ] ; then
24 EXCLUDES="--exclude=init,systemd-sysv"
25 fi
26
21 27 # Base debootstrap (unpack only)
22 http_proxy=${APT_PROXY} debootstrap --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian"
28 http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian"
23 29
24 30 # Copy qemu emulator binary to chroot
25 31 install_exec "${QEMU_BINARY}" "${R}${QEMU_BINARY}"
@@ -34,4 +40,8 chroot_exec /debootstrap/debootstrap --second-stage
34 40 # Mount required filesystems
35 41 mount -t proc none "${R}/proc"
36 42 mount -t sysfs none "${R}/sys"
37 mount --bind /dev/pts "${R}/dev/pts"
43
44 # Mount pseudo terminal slave if supported by Debian release
45 if [ -d "${R}/dev/pts" ] ; then
46 mount --bind /dev/pts "${R}/dev/pts"
47 fi
@@ -171,9 +171,9 fi
171 171
172 172 # Setup firmware boot cmdline
173 173 if [ "$ENABLE_SPLITFS" = true ] ; then
174 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}"
174 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
175 175 else
176 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}"
176 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1"
177 177 fi
178 178
179 179 # Add encrypted root partition to cmdline.txt
@@ -195,6 +195,18 if [ "$ENABLE_IPV6" = false ] ; then
195 195 CMDLINE="${CMDLINE} ipv6.disable=1"
196 196 fi
197 197
198 # Automatically assign predictable network interface names
199 if [ "$ENABLE_IFNAMES" = false ] ; then
200 CMDLINE="${CMDLINE} net.ifnames=0"
201 else
202 CMDLINE="${CMDLINE} net.ifnames=1"
203 fi
204
205 # Set init to systemd if required by Debian release
206 if [ "$RELEASE" = "stretch" ] ; then
207 CMDLINE="${CMDLINE} init=/bin/systemd"
208 fi
209
198 210 # Install firmware boot cmdline
199 211 echo "${CMDLINE}" > "${BOOTDIR}/cmdline.txt"
200 212
@@ -56,6 +56,12 fi
56 56 # Remove empty settings from network configuration
57 57 sed -i "/.*=\$/d" "${ETCDIR}/systemd/network/eth.network"
58 58
59 # Move systemd network configuration if required by Debian release
60 if [ "$RELEASE" = "stretch" ] ; then
61 mv -v "${ETCDIR}/systemd/network/eth.network" "${LIBDIR}/systemd/network/10-eth.network"
62 rm -fr "${ETCDIR}/systemd/network"
63 fi
64
59 65 # Enable systemd-networkd service
60 66 chroot_exec systemctl enable systemd-networkd
61 67
@@ -29,10 +29,20 cat files/firstboot/24-generate-machineid.sh >> "${ETCDIR}/rc.firstboot"
29 29 # Create /etc/resolv.conf symlink
30 30 cat files/firstboot/25-create-resolv-symlink.sh >> "${ETCDIR}/rc.firstboot"
31 31
32 # Configure automatic network interface names
33 if [ "$ENABLE_IFNAMES" = true ] ; then
34 cat files/firstboot/26-config-ifnames.sh >> "${ETCDIR}/rc.firstboot"
35 fi
36
32 37 # Finalize rc.firstboot script
33 38 cat files/firstboot/99-finish.sh >> "${ETCDIR}/rc.firstboot"
34 39 chmod +x "${ETCDIR}/rc.firstboot"
35 40
41 # Install default rc.local if it does not exist
42 if [ ! -f "${ETCDIR}/rc.local" ] ; then
43 install_exec files/etc/rc.local "${ETCDIR}/rc.local"
44 fi
45
36 46 # Add rc.firstboot script to rc.local
37 47 sed -i '/exit 0/d' "${ETCDIR}/rc.local"
38 48 echo /etc/rc.firstboot >> "${ETCDIR}/rc.local"
@@ -1,3 +1,7
1 logger -t "rc.firstboot" "Reload systemd manager configuration"
2 systemctl daemon-reload
3 systemctl restart networking.service
4 systemctl restart systemd-networkd.service
1 5 logger -t "rc.firstboot" "First boot actions finished"
2 6 rm -f /etc/rc.firstboot
3 7 sed -i '/.*rc.firstboot/d' /etc/rc.local
@@ -3,7 +3,7
3 3 ########################################################################
4 4 # rpi2-gen-image.sh 2015-2016
5 5 #
6 # Advanced debian "jessie" bootstrap script for RPi2
6 # Advanced Debian "jessie" and "stretch" bootstrap script for RPi2
7 7 #
8 8 # This program is free software; you can redistribute it and/or
9 9 # modify it under the terms of the GNU General Public License
@@ -61,6 +61,7 BUILDDIR="${BASEDIR}/build"
61 61 # Chroot directories
62 62 R="${BUILDDIR}/chroot"
63 63 ETCDIR="${R}/etc"
64 LIBDIR="${R}/lib"
64 65 BOOTDIR="${R}/boot/firmware"
65 66 KERNELDIR="${R}/usr/src/linux"
66 67
@@ -122,6 +123,7 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
122 123 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
123 124 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
124 125 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
126 ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
125 127
126 128 # Kernel compilation settings
127 129 BUILD_KERNEL=${BUILD_KERNEL:=false}
@@ -162,7 +164,7 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
162 164
163 165 # Packages required in the chroot build environment
164 166 APT_INCLUDES=${APT_INCLUDES:=""}
165 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo"
167 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils"
166 168
167 169 # Packages required for bootstrapping
168 170 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git"
@@ -170,6 +172,11 MISSING_PACKAGES=""
170 172
171 173 set +x
172 174
175 # Build latest RPi2 Linux kernel if required by Debian release
176 if [ "$RELEASE" = "stretch" ] ; then
177 BUILD_KERNEL=true
178 fi
179
173 180 # Add packages required for kernel cross compilation
174 181 if [ "$BUILD_KERNEL" = true ] ; then
175 182 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant