@@ -15,6 +15,7 | |||
|
15 | 15 | # Copyright (C) 2015 Luca Falavigna <dktrkranz@debian.org> |
|
16 | 16 | ######################################################################## |
|
17 | 17 | |
|
18 | # Clean up all temporary mount points | |
|
18 | 19 | cleanup (){ |
|
19 | 20 | set +x |
|
20 | 21 | set +e |
@@ -32,6 +33,7 cleanup (){ | |||
|
32 | 33 | set -e |
|
33 | 34 | set -x |
|
34 | 35 | |
|
36 | # Debian release | |
|
35 | 37 | RELEASE=${RELEASE:=jessie} |
|
36 | 38 | |
|
37 | 39 | # Build settings |
@@ -144,6 +146,11 if [ "$ENABLE_SSHD" = true ] ; then | |||
|
144 | 146 | APT_INCLUDES="${APT_INCLUDES},openssh-server" |
|
145 | 147 | fi |
|
146 | 148 | |
|
149 | # Add alsa-utils package | |
|
150 | if [ "$ENABLE_SOUND" = true ] ; then | |
|
151 | APT_INCLUDES="${APT_INCLUDES},alsa-utils" | |
|
152 | fi | |
|
153 | ||
|
147 | 154 | # Add rng-tools package |
|
148 | 155 | if [ "$ENABLE_HWRANDOM" = true ] ; then |
|
149 | 156 | APT_INCLUDES="${APT_INCLUDES},rng-tools" |
@@ -259,13 +266,14 wget -q -O $R/boot/firmware/start.elf https://github.com/raspberrypi/firmware/ra | |||
|
259 | 266 | wget -q -O $R/boot/firmware/start_x.elf https://github.com/raspberrypi/firmware/raw/cd355a9dd4f1f4de2e79b0c8e102840885cdf1de/boot/start_x.elf |
|
260 | 267 | cp $VMLINUZ $R/boot/firmware/kernel7.img |
|
261 | 268 | |
|
262 | # Set up hosts | |
|
269 | # Set up IPv4 hosts | |
|
263 | 270 | echo ${HOSTNAME} >$R/etc/hostname |
|
264 | 271 | cat <<EOM >$R/etc/hosts |
|
265 | 272 | 127.0.0.1 localhost |
|
266 | 273 | 127.0.1.1 ${HOSTNAME} |
|
267 | 274 | EOM |
|
268 | 275 | |
|
276 | # Set up IPv6 hosts | |
|
269 | 277 | if [ "$ENABLE_IPV6" = true ] ; then |
|
270 | 278 | cat <<EOM >>$R/etc/hosts |
|
271 | 279 | |
@@ -275,6 +283,29 ff02::2 ip6-allrouters | |||
|
275 | 283 | EOM |
|
276 | 284 | fi |
|
277 | 285 | |
|
286 | # Place hint about network configuration | |
|
287 | cat <<EOM >$R/etc/network/interfaces | |
|
288 | # Debian switched to systemd-networkd configuration files. | |
|
289 | # please configure your networks in '/etc/systemd/network/' | |
|
290 | EOM | |
|
291 | ||
|
292 | # Enable systemd-networkd DHCP configuration for interface eth0 | |
|
293 | cat <<EOM >$R/etc/systemd/network/eth.network | |
|
294 | [Match] | |
|
295 | Name=eth0 | |
|
296 | ||
|
297 | [Network] | |
|
298 | DHCP=yes | |
|
299 | EOM | |
|
300 | ||
|
301 | # Set DHCP configuration to IPv4 only | |
|
302 | if [ "$ENABLE_IPV6" = false ] ; then | |
|
303 | sed -i "s/=yes/=v4/" $R/etc/systemd/network/eth.network | |
|
304 | fi | |
|
305 | ||
|
306 | # Enable systemd-networkd service | |
|
307 | LANG=C chroot $R systemctl enable systemd-networkd | |
|
308 | ||
|
278 | 309 | # Generate crypt(3) password string |
|
279 | 310 | ENCRYPTED_PASSWORD=`mkpasswd -m sha-512 ${PASSWORD}` |
|
280 | 311 | |
@@ -285,21 +316,6 LANG=C chroot $R usermod -a -G sudo -p "${ENCRYPTED_PASSWORD}" pi | |||
|
285 | 316 | # Set up root password |
|
286 | 317 | LANG=C chroot $R usermod -p "${ENCRYPTED_PASSWORD}" root |
|
287 | 318 | |
|
288 | # Set up interfaces | |
|
289 | cat <<EOM >$R/etc/network/interfaces | |
|
290 | # interfaces(5) file used by ifup(8) and ifdown(8) | |
|
291 | # Include files from /etc/network/interfaces.d: | |
|
292 | source-directory /etc/network/interfaces.d | |
|
293 | ||
|
294 | # The loopback network interface | |
|
295 | auto lo | |
|
296 | iface lo inet loopback | |
|
297 | ||
|
298 | # The primary network interface | |
|
299 | allow-hotplug eth0 | |
|
300 | iface eth0 inet dhcp | |
|
301 | EOM | |
|
302 | ||
|
303 | 319 | # Set up firmware boot cmdline |
|
304 | 320 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait net.ifnames=1 console=tty1" |
|
305 | 321 | |
@@ -362,6 +378,11 cat <<EOM >$R/boot/firmware/config.txt | |||
|
362 | 378 | #arm_freq=800 |
|
363 | 379 | EOM |
|
364 | 380 | |
|
381 | # Load snd_bcm2835 kernel module at boot time | |
|
382 | if [ "$ENABLE_SOUND" = true ] ; then | |
|
383 | echo "snd_bcm2835" >>$R/etc/modules | |
|
384 | fi | |
|
385 | ||
|
365 | 386 | # Set smallest possible GPU memory allocation size: 16MB (no X) |
|
366 | 387 | if [ "$ENABLE_MINGPU" = true ] ; then |
|
367 | 388 | echo "gpu_mem=16" >>$R/boot/firmware/config.txt |
@@ -684,7 +705,6 fi | |||
|
684 | 705 | |
|
685 | 706 | # Install gcc/c++ build environment inside the chroot |
|
686 | 707 | if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ]; then |
|
687 | # Install minimal gcc/g++ build environment | |
|
688 | 708 |
|
|
689 | 709 | fi |
|
690 | 710 | |
@@ -722,7 +742,6 EOM | |||
|
722 | 742 | LANG=C chroot $R mkimage -A arm -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "RPi2 Boot Script" -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr |
|
723 | 743 | fi |
|
724 | 744 | |
|
725 | ||
|
726 | 745 | # Fetch and build fbturbo Xorg driver |
|
727 | 746 | if [ "$ENABLE_FBTURBO" = true ] ; then |
|
728 | 747 | # Fetch fbturbo driver sources |
@@ -750,27 +769,9 fi | |||
|
750 | 769 | |
|
751 | 770 | # Remove gcc/c++ build environment from the chroot |
|
752 | 771 | if [ "$ENABLE_UBOOT" = true ] || [ "$ENABLE_FBTURBO" = true ]; then |
|
753 | # Remove minimal gcc/c++ build environment | |
|
754 | 772 |
|
|
755 | 773 | fi |
|
756 | 774 | |
|
757 | # Enable systemd-networkd DHCP configuration for the eth0 interface | |
|
758 | printf "[Match]\nName=eth0\n\n[Network]\nDHCP=yes\n" > $R/etc/systemd/network/eth.network | |
|
759 | ||
|
760 | # Set DHCP configuration to IPv4 only | |
|
761 | if [ "$ENABLE_IPV6" = false ] ; then | |
|
762 | sed -i "s/=yes/=v4/" $R/etc/systemd/network/eth.network | |
|
763 | fi | |
|
764 | ||
|
765 | # Enable systemd-networkd service | |
|
766 | LANG=C chroot $R systemctl enable systemd-networkd | |
|
767 | ||
|
768 | # Place hint about netowrk configuration | |
|
769 | cat <<EOM >$R/etc/network/interfaces | |
|
770 | # Debian switched to systemd-networkd configuration files. | |
|
771 | # please configure your networks in '/etc/systemd/network/' | |
|
772 | EOM | |
|
773 | ||
|
774 | 775 | # Clean cached downloads |
|
775 | 776 | LANG=C chroot $R apt-get -y clean |
|
776 | 777 | LANG=C chroot $R apt-get -y autoclean |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant