@@ -0,0 +1,90 | |||
|
1 | # Configuration file raspi3 Stretch IFÉ 2017/04/15 | |
|
2 | # | |
|
3 | APT_SERVER=ftp.fr.debian.org | |
|
4 | APT_INCLUDES="gnupg,gnupg2,firmware-linux-nonfree,firmware-linux,dh-autoreconf,\ | |
|
5 | gettext,build-essential,git,cmake,libjson-c-dev,unzip,usbutils,\ | |
|
6 | bison,libboost-all-dev,automake,autoconf,autogen,libtool,libtool-bin,\ | |
|
7 | pkg-config,checkinstall,menulibre,libnotify-bin,python3,python3-dev,\ | |
|
8 | python,python-dev,python-configobj,python-cheetah,python-imaging,python-serial,python-usb,\ | |
|
9 | python-tk,python3-tk,python3-scipy,pandoc,python-pypandoc,python3-pypandoc,\ | |
|
10 | python-pandocfilters,python3-pandocfilters,\ | |
|
11 | python-geopy,python3-geopy,python-pip,python3-pip,\ | |
|
12 | pcre2-utils,libpcre++-dev,libpcre2-dev,libjpeg-dev,jed,i2c-tools,python-smbus,policykit-1,\ | |
|
13 | pmount,ntpdate,\ | |
|
14 | texlive,texlive-xetex,nginx-extras,ffmpeg,wicd,wicd-gtk,console-data,keyboard-configuration,\ | |
|
15 | icedtea-8-plugin,openjdk-8-jdk,openjdk-8-jre,openjdk-8-jre-headless,libqtwebkit-dev,libqt5webkit5-dev,\ | |
|
16 | libudev-dev,libzzip-dev,zlib1g-dev,libcanberra-gtk-module,libnss-myhostname,libfreetype6-dev,libpng16-16,\ | |
|
17 | nmap,libltdl-dev,dbus-user-session,debian-archive-keyring,\ | |
|
18 | xutils-dev,lxsession,openbox-lxde-session,lxde,x11proto-randr-dev,lxrandr,\ | |
|
19 | tightvncserver,geany,geany-plugin-py,geany-plugin-markdown,firefox-esr,firefox-esr-l10n-fr" | |
|
20 | #---------------------- | |
|
21 | RPI_MODEL=3 | |
|
22 | RELEASE="buster" | |
|
23 | HOSTNAME="raspife3" | |
|
24 | PASSWORD="***********" | |
|
25 | USER_PASSWORD="***********" | |
|
26 | DEFLOCAL="fr_FR.UTF-8" | |
|
27 | TIMEZONE="Europe/Paris" | |
|
28 | EXPANDROOT=false | |
|
29 | #----------------------- | |
|
30 | XKB_MODEL="pc105" | |
|
31 | XKB_LAYOUT="fr" | |
|
32 | XKB_VARIANT="latin9" | |
|
33 | XKB_OPTIONS="" | |
|
34 | #------------------------ | |
|
35 | ENABLE_DHCP=true | |
|
36 | #------------------------ | |
|
37 | ENABLE_CONSOLE=false | |
|
38 | ENABLE_I2C=true | |
|
39 | ENABLE_SPI=true | |
|
40 | ENABLE_IPV6=true | |
|
41 | ENABLE_SSHD=true | |
|
42 | ENABLE_NONFREE=true | |
|
43 | ENABLE_WIRELESS=true | |
|
44 | ENABLE_RSYSLOG=true | |
|
45 | ENABLE_SOUND=true | |
|
46 | ENABLE_HWRANDOM=true | |
|
47 | ENABLE_MINGPU=true | |
|
48 | ENABLE_DBUS=true | |
|
49 | ENABLE_XORG=true | |
|
50 | ENABLE_WM="lxdm" | |
|
51 | #------------------------ | |
|
52 | ENABLE_MINBASE=false | |
|
53 | ENABLE_REDUCE=false | |
|
54 | ENABLE_UBOOT=false | |
|
55 | ENABLE_FBTURBO=true | |
|
56 | ENABLE_IPTABLES=false | |
|
57 | ENABLE_USER=true | |
|
58 | USER_NAME=ens-ife | |
|
59 | ENABLE_ROOT=true | |
|
60 | ENABLE_HARDNET=true | |
|
61 | ENABLE_INITRAMFS=true | |
|
62 | ENABLE_IFNAMES=true | |
|
63 | #------------------------ | |
|
64 | ENABLE_ROOT_SSH=false | |
|
65 | SSH_LIMIT_USERS=false | |
|
66 | SSH_ROOT_PUB_KEY="/home/*******/.ssh/authorized_keys" | |
|
67 | SSH_USER_PUB_KEY="/home/*******/.ssh/authorized_keys" | |
|
68 | #------------------------ | |
|
69 | BUILD_KERNEL=true | |
|
70 | KERNEL_REDUCE=false | |
|
71 | KERNEL_HEADERS=true | |
|
72 | KERNEL_REMOVESRC=true | |
|
73 | KERNELSRC_CLEAN=true | |
|
74 | KERNELSRC_CONFIG=true | |
|
75 | #------------------------ | |
|
76 | REDUCE_APT=false | |
|
77 | REDUCE_DOC=true | |
|
78 | REDUCE_MAN=false | |
|
79 | REDUCE_HWDB=true | |
|
80 | REDUCE_BASH=false | |
|
81 | REDUCE_SSHD=false | |
|
82 | REDUCE_LOCALE=false | |
|
83 | #------------------------- | |
|
84 | ENABLE_CRYPTFS=false | |
|
85 | #------------------------- | |
|
86 | BASEDIR=/data/RpiGenImage/Images/${RELEASE} | |
|
87 | DATE=`date +%Y-%m-%d` | |
|
88 | IMAGE_NAME=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE} | |
|
89 | ||
|
90 |
@@ -1,47 +1,53 | |||
|
1 | 1 | # |
|
2 | 2 | # Debootstrap basic system |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | VARIANT="" |
|
9 | 9 | COMPONENTS="main" |
|
10 | 10 | EXCLUDES="" |
|
11 | 11 | |
|
12 | 12 | # Use non-free Debian packages if needed |
|
13 | 13 | if [ "$ENABLE_NONFREE" = true ] ; then |
|
14 | 14 | COMPONENTS="main,non-free" |
|
15 | 15 | fi |
|
16 | 16 | |
|
17 | 17 | # Use minbase bootstrap variant which only includes essential packages |
|
18 | 18 | if [ "$ENABLE_MINBASE" = true ] ; then |
|
19 | 19 | VARIANT="--variant=minbase" |
|
20 | 20 | fi |
|
21 | 21 | |
|
22 | 22 | # Exclude packages if required by Debian release |
|
23 | 23 | if [ "$RELEASE" = "stretch" ] ; then |
|
24 | 24 | EXCLUDES="--exclude=init,systemd-sysv" |
|
25 | 25 | fi |
|
26 | 26 | |
|
27 | # Exclude packages if required by Debian buster release | |
|
28 | if [ "$RELEASE" = "buster" ] ; then | |
|
29 | EXCLUDES="--exclude=init,systemd-sysv" | |
|
30 | fi | |
|
31 | ||
|
27 | 32 | # Base debootstrap (unpack only) |
|
28 | 33 | http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" |
|
29 | 34 | |
|
30 | # Copy qemu emulator binary to chroot | |
|
31 | install_exec "${QEMU_BINARY}" "${R}${QEMU_BINARY}" | |
|
35 | # Copy qemu emulator binary to chroot modified for changes in _apt management in buster | |
|
36 | #install_exec "${QEMU_BINARY}" "${R}${QEMU_BINARY}" | |
|
37 | install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" | |
|
32 | 38 | |
|
33 | 39 | # Copy debian-archive-keyring.pgp |
|
34 | 40 | mkdir -p "${R}/usr/share/keyrings" |
|
35 | 41 | install_readonly /usr/share/keyrings/debian-archive-keyring.gpg "${R}/usr/share/keyrings/debian-archive-keyring.gpg" |
|
36 | 42 | |
|
37 | 43 | # Complete the bootstrapping process |
|
38 | 44 | chroot_exec /debootstrap/debootstrap --second-stage |
|
39 | 45 | |
|
40 | 46 | # Mount required filesystems |
|
41 | 47 | mount -t proc none "${R}/proc" |
|
42 | 48 | mount -t sysfs none "${R}/sys" |
|
43 | 49 | |
|
44 | 50 | # Mount pseudo terminal slave if supported by Debian release |
|
45 | 51 | if [ -d "${R}/dev/pts" ] ; then |
|
46 | 52 | mount --bind /dev/pts "${R}/dev/pts" |
|
47 | 53 | fi |
@@ -1,51 +1,52 | |||
|
1 | 1 | # |
|
2 | 2 | # Setup APT repositories |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | # Install and setup APT proxy configuration |
|
9 | 9 | if [ -z "$APT_PROXY" ] ; then |
|
10 | 10 | install_readonly files/apt/10proxy "${ETC_DIR}/apt/apt.conf.d/10proxy" |
|
11 | 11 | sed -i "s/\"\"/\"${APT_PROXY}\"/" "${ETC_DIR}/apt/apt.conf.d/10proxy" |
|
12 | 12 | fi |
|
13 | 13 | |
|
14 | 14 | if [ "$BUILD_KERNEL" = false ] ; then |
|
15 | 15 | # Install APT pinning configuration for flash-kernel package |
|
16 | 16 | install_readonly files/apt/flash-kernel "${ETC_DIR}/apt/preferences.d/flash-kernel" |
|
17 | 17 | |
|
18 | 18 | # Install APT sources.list |
|
19 | 19 | install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list" |
|
20 | 20 | echo "deb ${COLLABORA_URL} ${RELEASE} rpi2" >> "${ETC_DIR}/apt/sources.list" |
|
21 | 21 | |
|
22 | 22 | # Upgrade collabora package index and install collabora keyring |
|
23 | 23 | chroot_exec apt-get -qq -y update |
|
24 | chroot_exec apt-get -qq -y --allow-unauthenticated install collabora-obs-archive-keyring | |
|
24 | # Removed --allow-unauthenticated as suggested after modification on _apt privileges | |
|
25 | chroot_exec apt-get -qq -y install collabora-obs-archive-keyring | |
|
25 | 26 | else # BUILD_KERNEL=true |
|
26 | 27 | # Install APT sources.list |
|
27 | 28 | install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list" |
|
28 | 29 | |
|
29 | 30 | # Use specified APT server and release |
|
30 | 31 | sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "${ETC_DIR}/apt/sources.list" |
|
31 | 32 | sed -i "s/ jessie/ ${RELEASE}/" "${ETC_DIR}/apt/sources.list" |
|
32 | 33 | fi |
|
33 | 34 | |
|
34 | 35 | # Allow the installation of non-free Debian packages |
|
35 | 36 | if [ "$ENABLE_NONFREE" = true ] ; then |
|
36 | 37 | sed -i "s/ contrib/ contrib non-free/" "${ETC_DIR}/apt/sources.list" |
|
37 | 38 | fi |
|
38 | 39 | |
|
39 | 40 | # Upgrade package index and update all installed packages and changed dependencies |
|
40 | 41 | chroot_exec apt-get -qq -y update |
|
41 | 42 | chroot_exec apt-get -qq -y -u dist-upgrade |
|
42 | 43 | |
|
43 | 44 | if [ -d packages ] ; then |
|
44 | 45 | for package in packages/*.deb ; do |
|
45 | 46 | cp $package ${R}/tmp |
|
46 | 47 | chroot_exec dpkg --unpack /tmp/$(basename $package) |
|
47 | 48 | done |
|
48 | 49 | fi |
|
49 | 50 | chroot_exec apt-get -qq -y -f install |
|
50 | 51 | |
|
51 | 52 | chroot_exec apt-get -qq -y check |
@@ -1,151 +1,151 | |||
|
1 | 1 | # |
|
2 | 2 | # Setup RPi2/3 config and cmdline |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | if [ "$BUILD_KERNEL" = true ] ; then |
|
9 | 9 | if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then |
|
10 | 10 | # Install boot binaries from local directory |
|
11 | 11 | cp ${RPI_FIRMWARE_DIR}/boot/bootcode.bin ${BOOT_DIR}/bootcode.bin |
|
12 | 12 | cp ${RPI_FIRMWARE_DIR}/boot/fixup.dat ${BOOT_DIR}/fixup.dat |
|
13 | 13 | cp ${RPI_FIRMWARE_DIR}/boot/fixup_cd.dat ${BOOT_DIR}/fixup_cd.dat |
|
14 | 14 | cp ${RPI_FIRMWARE_DIR}/boot/fixup_x.dat ${BOOT_DIR}/fixup_x.dat |
|
15 | 15 | cp ${RPI_FIRMWARE_DIR}/boot/start.elf ${BOOT_DIR}/start.elf |
|
16 | 16 | cp ${RPI_FIRMWARE_DIR}/boot/start_cd.elf ${BOOT_DIR}/start_cd.elf |
|
17 | 17 | cp ${RPI_FIRMWARE_DIR}/boot/start_x.elf ${BOOT_DIR}/start_x.elf |
|
18 | 18 | else |
|
19 | 19 | # Create temporary directory for boot binaries |
|
20 | 20 | temp_dir=$(sudo -u nobody mktemp -d) |
|
21 | 21 | |
|
22 | 22 | # Install latest boot binaries from raspberry/firmware github |
|
23 | 23 | sudo -u nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin" |
|
24 | 24 | sudo -u nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat" |
|
25 | 25 | sudo -u nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat" |
|
26 | 26 | sudo -u nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat" |
|
27 | 27 | sudo -u nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf" |
|
28 | 28 | sudo -u nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf" |
|
29 | 29 | sudo -u nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf" |
|
30 | 30 | |
|
31 | 31 | # Move downloaded boot binaries |
|
32 | 32 | mv "${temp_dir}/"* "${BOOT_DIR}/" |
|
33 | 33 | |
|
34 | 34 | # Remove temporary directory for boot binaries |
|
35 | 35 | rm -fr "${temp_dir}" |
|
36 | 36 | |
|
37 | 37 | # Set permissions of the boot binaries |
|
38 | 38 | chown -R root:root "${BOOT_DIR}" |
|
39 | 39 | chmod -R 600 "${BOOT_DIR}" |
|
40 | 40 | fi |
|
41 | 41 | fi |
|
42 | 42 | |
|
43 | 43 | # Setup firmware boot cmdline |
|
44 | 44 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
45 | 45 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" |
|
46 | 46 | else |
|
47 | 47 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" |
|
48 | 48 | fi |
|
49 | 49 | |
|
50 | 50 | # Add encrypted root partition to cmdline.txt |
|
51 | 51 | if [ "$ENABLE_CRYPTFS" = true ] ; then |
|
52 | 52 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
53 | 53 | CMDLINE=$(echo ${CMDLINE} | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/") |
|
54 | 54 | else |
|
55 | 55 | CMDLINE=$(echo ${CMDLINE} | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/") |
|
56 | 56 | fi |
|
57 | 57 | fi |
|
58 | 58 | |
|
59 | 59 | # Add serial console support |
|
60 | 60 | if [ "$ENABLE_CONSOLE" = true ] ; then |
|
61 | 61 | CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200" |
|
62 | 62 | fi |
|
63 | 63 | |
|
64 | 64 | # Remove IPv6 networking support |
|
65 | 65 | if [ "$ENABLE_IPV6" = false ] ; then |
|
66 | 66 | CMDLINE="${CMDLINE} ipv6.disable=1" |
|
67 | 67 | fi |
|
68 | 68 | |
|
69 | 69 | # Automatically assign predictable network interface names |
|
70 | 70 | if [ "$ENABLE_IFNAMES" = false ] ; then |
|
71 | 71 | CMDLINE="${CMDLINE} net.ifnames=0" |
|
72 | 72 | else |
|
73 | 73 | CMDLINE="${CMDLINE} net.ifnames=1" |
|
74 | 74 | fi |
|
75 | 75 | |
|
76 | # Set init to systemd if required by Debian release | |
|
77 | if [ "$RELEASE" = "stretch" ] ; then | |
|
76 | # Set init to systemd if required by Debian release stretch or buster | |
|
77 | if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then | |
|
78 | 78 | CMDLINE="${CMDLINE} init=/bin/systemd" |
|
79 | 79 | fi |
|
80 | 80 | |
|
81 | 81 | # Install firmware boot cmdline |
|
82 | 82 | echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt" |
|
83 | 83 | |
|
84 | 84 | # Install firmware config |
|
85 | 85 | install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" |
|
86 | 86 | |
|
87 | 87 | # Setup minimal GPU memory allocation size: 16MB (no X) |
|
88 | 88 | if [ "$ENABLE_MINGPU" = true ] ; then |
|
89 | 89 | echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt" |
|
90 | 90 | fi |
|
91 | 91 | |
|
92 | 92 | # Setup boot with initramfs |
|
93 | 93 | if [ "$ENABLE_INITRAMFS" = true ] ; then |
|
94 | 94 | echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt" |
|
95 | 95 | fi |
|
96 | 96 | |
|
97 | 97 | # Disable RPi3 Bluetooth and restore ttyAMA0 serial device |
|
98 | 98 | if [ "$RPI_MODEL" = 3 ] ; then |
|
99 | 99 | if [ "$ENABLE_CONSOLE" = true ] && [ "$ENABLE_UBOOT" = false ] ; then |
|
100 | 100 | echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt" |
|
101 | 101 | echo "enable_uart=1" >> "${BOOT_DIR}/config.txt" |
|
102 | 102 | fi |
|
103 | 103 | fi |
|
104 | 104 | |
|
105 | 105 | # Create firmware configuration and cmdline symlinks |
|
106 | 106 | ln -sf firmware/config.txt "${R}/boot/config.txt" |
|
107 | 107 | ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt" |
|
108 | 108 | |
|
109 | 109 | # Install and setup kernel modules to load at boot |
|
110 | 110 | mkdir -p "${R}/lib/modules-load.d/" |
|
111 | 111 | install_readonly files/modules/rpi2.conf "${R}/lib/modules-load.d/rpi2.conf" |
|
112 | 112 | |
|
113 | 113 | # Load hardware random module at boot |
|
114 | 114 | if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then |
|
115 | 115 | sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${R}/lib/modules-load.d/rpi2.conf" |
|
116 | 116 | fi |
|
117 | 117 | |
|
118 | 118 | # Load sound module at boot |
|
119 | 119 | if [ "$ENABLE_SOUND" = true ] ; then |
|
120 | 120 | sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${R}/lib/modules-load.d/rpi2.conf" |
|
121 | 121 | else |
|
122 | 122 | echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt" |
|
123 | 123 | fi |
|
124 | 124 | |
|
125 | 125 | # Enable I2C interface |
|
126 | 126 | if [ "$ENABLE_I2C" = true ] ; then |
|
127 | 127 | echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt" |
|
128 | 128 | sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${R}/lib/modules-load.d/rpi2.conf" |
|
129 | 129 | sed -i "s/^# i2c-dev/i2c-dev/" "${R}/lib/modules-load.d/rpi2.conf" |
|
130 | 130 | fi |
|
131 | 131 | |
|
132 | 132 | # Enable SPI interface |
|
133 | 133 | if [ "$ENABLE_SPI" = true ] ; then |
|
134 | 134 | echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt" |
|
135 | 135 | echo "spi-bcm2708" >> "${R}/lib/modules-load.d/rpi2.conf" |
|
136 | 136 | if [ "$RPI_MODEL" = 3 ] ; then |
|
137 | 137 | sed -i "s/spi-bcm2708/spi-bcm2835/" "${R}/lib/modules-load.d/rpi2.conf" |
|
138 | 138 | fi |
|
139 | 139 | fi |
|
140 | 140 | |
|
141 | 141 | # Disable RPi2/3 under-voltage warnings |
|
142 | 142 | if [ ! -z "$DISABLE_UNDERVOLT_WARNINGS" ] ; then |
|
143 | 143 | echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt" |
|
144 | 144 | fi |
|
145 | 145 | |
|
146 | 146 | # Install kernel modules blacklist |
|
147 | 147 | mkdir -p "${ETC_DIR}/modprobe.d/" |
|
148 | 148 | install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf" |
|
149 | 149 | |
|
150 | 150 | # Install sysctl.d configuration files |
|
151 | 151 | install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf" |
@@ -1,107 +1,107 | |||
|
1 | 1 | # |
|
2 | 2 | # Setup Networking |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | # Install and setup hostname |
|
9 | 9 | install_readonly files/network/hostname "${ETC_DIR}/hostname" |
|
10 | 10 | sed -i "s/^rpi2-jessie/${HOSTNAME}/" "${ETC_DIR}/hostname" |
|
11 | 11 | |
|
12 | 12 | # Install and setup hosts |
|
13 | 13 | install_readonly files/network/hosts "${ETC_DIR}/hosts" |
|
14 | 14 | sed -i "s/rpi2-jessie/${HOSTNAME}/" "${ETC_DIR}/hosts" |
|
15 | 15 | |
|
16 | 16 | # Setup hostname entry with static IP |
|
17 | 17 | if [ "$NET_ADDRESS" != "" ] ; then |
|
18 | 18 | NET_IP=$(echo "${NET_ADDRESS}" | cut -f 1 -d'/') |
|
19 | 19 | sed -i "s/^127.0.1.1/${NET_IP}/" "${ETC_DIR}/hosts" |
|
20 | 20 | fi |
|
21 | 21 | |
|
22 | 22 | # Remove IPv6 hosts |
|
23 | 23 | if [ "$ENABLE_IPV6" = false ] ; then |
|
24 | 24 | sed -i -e "/::[1-9]/d" -e "/^$/d" "${ETC_DIR}/hosts" |
|
25 | 25 | fi |
|
26 | 26 | |
|
27 | 27 | # Install hint about network configuration |
|
28 | 28 | install_readonly files/network/interfaces "${ETC_DIR}/network/interfaces" |
|
29 | 29 | |
|
30 | 30 | # Install configuration for interface eth0 |
|
31 | 31 | install_readonly files/network/eth.network "${ETC_DIR}/systemd/network/eth.network" |
|
32 | 32 | |
|
33 | 33 | if [ "$ENABLE_DHCP" = true ] ; then |
|
34 | 34 | # Enable DHCP configuration for interface eth0 |
|
35 | 35 | sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETC_DIR}/systemd/network/eth.network" |
|
36 | 36 | |
|
37 | 37 | # Set DHCP configuration to IPv4 only |
|
38 | 38 | if [ "$ENABLE_IPV6" = false ] ; then |
|
39 | 39 | sed -i "s/DHCP=.*/DHCP=v4/" "${ETC_DIR}/systemd/network/eth.network" |
|
40 | 40 | fi |
|
41 | 41 | |
|
42 | 42 | else # ENABLE_DHCP=false |
|
43 | 43 | # Set static network configuration for interface eth0 |
|
44 | 44 | sed -i\ |
|
45 | 45 | -e "s|DHCP=.*|DHCP=no|"\ |
|
46 | 46 | -e "s|Address=\$|Address=${NET_ADDRESS}|"\ |
|
47 | 47 | -e "s|Gateway=\$|Gateway=${NET_GATEWAY}|"\ |
|
48 | 48 | -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_1}|"\ |
|
49 | 49 | -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_2}|"\ |
|
50 | 50 | -e "s|Domains=\$|Domains=${NET_DNS_DOMAINS}|"\ |
|
51 | 51 | -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\ |
|
52 | 52 | -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\ |
|
53 | 53 | "${ETC_DIR}/systemd/network/eth.network" |
|
54 | 54 | fi |
|
55 | 55 | |
|
56 | 56 | # Remove empty settings from network configuration |
|
57 | 57 | sed -i "/.*=\$/d" "${ETC_DIR}/systemd/network/eth.network" |
|
58 | 58 | |
|
59 | # Move systemd network configuration if required by Debian release | |
|
60 | if [ "$RELEASE" = "stretch" ] ; then | |
|
59 | # Move systemd network configuration if required by Debian release stretch or buster | |
|
60 | if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then | |
|
61 | 61 | mv -v "${ETC_DIR}/systemd/network/eth.network" "${LIB_DIR}/systemd/network/10-eth.network" |
|
62 | 62 | rm -fr "${ETC_DIR}/systemd/network" |
|
63 | 63 | fi |
|
64 | 64 | |
|
65 | 65 | # Enable systemd-networkd service |
|
66 | 66 | chroot_exec systemctl enable systemd-networkd |
|
67 | 67 | |
|
68 | 68 | # Install host.conf resolver configuration |
|
69 | 69 | install_readonly files/network/host.conf "${ETC_DIR}/host.conf" |
|
70 | 70 | |
|
71 | 71 | # Enable network stack hardening |
|
72 | 72 | if [ "$ENABLE_HARDNET" = true ] ; then |
|
73 | 73 | # Install sysctl.d configuration files |
|
74 | 74 | install_readonly files/sysctl.d/82-rpi-net-hardening.conf "${ETC_DIR}/sysctl.d/82-rpi-net-hardening.conf" |
|
75 | 75 | |
|
76 | 76 | # Setup resolver warnings about spoofed addresses |
|
77 | 77 | sed -i "s/^# spoof warn/spoof warn/" "${ETC_DIR}/host.conf" |
|
78 | 78 | fi |
|
79 | 79 | |
|
80 | 80 | # Enable time sync |
|
81 | 81 | if [ "NET_NTP_1" != "" ] ; then |
|
82 | 82 | chroot_exec systemctl enable systemd-timesyncd.service |
|
83 | 83 | fi |
|
84 | 84 | |
|
85 | 85 | # Download the firmware binary blob required to use the RPi3 wireless interface |
|
86 | 86 | if [ "$ENABLE_WIRELESS" = true ] ; then |
|
87 | 87 | if [ ! -d ${WLAN_FIRMWARE_DIR} ] ; then |
|
88 | 88 | mkdir -p ${WLAN_FIRMWARE_DIR} |
|
89 | 89 | fi |
|
90 | 90 | |
|
91 | 91 | # Create temporary directory for firmware binary blob |
|
92 | 92 | temp_dir=$(sudo -u nobody mktemp -d) |
|
93 | 93 | |
|
94 | 94 | # Fetch firmware binary blob |
|
95 | 95 | sudo -u nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" |
|
96 | 96 | sudo -u nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" |
|
97 | 97 | |
|
98 | 98 | # Move downloaded firmware binary blob |
|
99 | 99 | mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" |
|
100 | 100 | |
|
101 | 101 | # Remove temporary directory for firmware binary blob |
|
102 | 102 | rm -fr "${temp_dir}" |
|
103 | 103 | |
|
104 | 104 | # Set permissions of the firmware binary blob |
|
105 | 105 | chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* |
|
106 | 106 | chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* |
|
107 | 107 | fi |
@@ -1,51 +1,54 | |||
|
1 | 1 | # |
|
2 | 2 | # Build and Setup fbturbo Xorg driver |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | if [ "$ENABLE_FBTURBO" = true ] ; then |
|
9 | 9 | # Install c/c++ build environment inside the chroot |
|
10 | 10 | chroot_install_cc |
|
11 | 11 | |
|
12 | 12 | # Copy existing fbturbo sources into chroot directory |
|
13 | 13 | if [ -n "$FBTURBOSRC_DIR" ] && [ -d "$FBTURBOSRC_DIR" ] ; then |
|
14 | 14 | # Copy local fbturbo sources |
|
15 | 15 | cp -r "${FBTURBOSRC_DIR}" "${R}/tmp" |
|
16 | 16 | else |
|
17 | 17 | # Create temporary directory for fbturbo sources |
|
18 | 18 | temp_dir=$(sudo -u nobody mktemp -d) |
|
19 | 19 | |
|
20 | 20 | # Fetch fbturbo sources |
|
21 | 21 | sudo -u nobody git -C "${temp_dir}" clone "${FBTURBO_URL}" |
|
22 | 22 | |
|
23 | 23 | # Move downloaded fbturbo sources |
|
24 | 24 | mv "${temp_dir}/xf86-video-fbturbo" "${R}/tmp/" |
|
25 | 25 | |
|
26 | 26 | # Remove temporary directory for fbturbo sources |
|
27 | 27 | rm -fr "${temp_dir}" |
|
28 | 28 | fi |
|
29 | 29 | |
|
30 | 30 | # Install Xorg build dependencies |
|
31 | 31 | if [ "$RELEASE" = "jessie" ] ; then |
|
32 | 32 | chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev |
|
33 | 33 | elif [ "$RELEASE" = "stretch" ] ; then |
|
34 | 34 | chroot_exec apt-get -q -y --no-install-recommends --allow-unauthenticated install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev |
|
35 | # removed --allow-unauthenticated as recommended after amendment on _apt privileges | |
|
36 | elif [ "$RELEASE" = "buster" ] ; then | |
|
37 | chroot_exec apt-get -q -y --no-install-recommends install xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev | |
|
35 | 38 | fi |
|
36 | 39 | |
|
37 | 40 | # Build and install fbturbo driver inside chroot |
|
38 | 41 | chroot_exec /bin/bash -x <<'EOF' |
|
39 | 42 | cd /tmp/xf86-video-fbturbo |
|
40 | 43 | autoreconf -vi |
|
41 | 44 | ./configure --prefix=/usr |
|
42 | 45 | make |
|
43 | 46 | make install |
|
44 | 47 | EOF |
|
45 | 48 | |
|
46 | 49 | # Install fbturbo driver Xorg configuration |
|
47 | 50 | install_readonly files/xorg/99-fbturbo.conf "${R}/usr/share/X11/xorg.conf.d/99-fbturbo.conf" |
|
48 | 51 | |
|
49 | 52 | # Remove Xorg build dependencies |
|
50 | 53 | chroot_exec apt-get -qq -y --auto-remove purge xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev |
|
51 | 54 | fi |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant