##// END OF EJS Templates
bullseye fix...
Unknown -
r666:6556ca62c9b5
parent child
Show More
@@ -1,44 +1,44
1 #
1 #
2 # Setup APT repositories
2 # Setup APT repositories
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Install and setup APT proxy configuration
8 # Install and setup APT proxy configuration
9 if [ -z "$APT_PROXY" ] ; then
9 if [ -z "$APT_PROXY" ] ; then
10 install_readonly files/apt/10proxy "${ETC_DIR}/apt/apt.conf.d/10proxy"
10 install_readonly files/apt/10proxy "${ETC_DIR}/apt/apt.conf.d/10proxy"
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" "${ETC_DIR}/apt/apt.conf.d/10proxy"
11 sed -i "s/\"\"/\"${APT_PROXY}\"/" "${ETC_DIR}/apt/apt.conf.d/10proxy"
12 fi
12 fi
13
13
14 # Install APT sources.list
14 # Install APT sources.list
15 install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list"
15 install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list"
16
16
17 # Use specified APT server and release
17 # Use specified APT server and release
18 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "${ETC_DIR}/apt/sources.list"
18 sed -i "s/\/ftp.debian.org\//\/${APT_SERVER}\//" "${ETC_DIR}/apt/sources.list"
19 if [ "$RELEASE" = "bullseye" ] || [ "$RELEASE" = "testing" ] ; then
19 if [ "$RELEASE" = "testing" ] ; then
20 sed -i "s,stretch\\/updates,testing-security," "${ETC_DIR}/apt/sources.list"
20 sed -i "s,stretch\\/updates,testing-security," "${ETC_DIR}/apt/sources.list"
21 else
21 else
22 sed -i "s/ stretch/ ${RELEASE}/" "${ETC_DIR}/apt/sources.list"
22 sed -i "s/ stretch/ ${RELEASE}/" "${ETC_DIR}/apt/sources.list"
23 fi
23 fi
24
24
25 # Upgrade package index and update all installed packages and changed dependencies
25 # Upgrade package index and update all installed packages and changed dependencies
26 chroot_exec apt-get -qq -y update
26 chroot_exec apt-get -qq -y update
27 chroot_exec apt-get -qq -y -u dist-upgrade
27 chroot_exec apt-get -qq -y -u dist-upgrade
28
28
29 # Install additional packages
29 # Install additional packages
30 if [ "$APT_INCLUDES_LATE" ] ; then
30 if [ "$APT_INCLUDES_LATE" ] ; then
31 chroot_exec apt-get -qq -y install "$(echo "$APT_INCLUDES_LATE" |tr , ' ')"
31 chroot_exec apt-get -qq -y install "$(echo "$APT_INCLUDES_LATE" |tr , ' ')"
32 fi
32 fi
33
33
34 # Install Debian custom packages
34 # Install Debian custom packages
35 if [ -d packages ] ; then
35 if [ -d packages ] ; then
36 for package in packages/*.deb ; do
36 for package in packages/*.deb ; do
37 cp "$package" "${R}"/tmp
37 cp "$package" "${R}"/tmp
38 chroot_exec dpkg --unpack /tmp/"$(basename "$package")"
38 chroot_exec dpkg --unpack /tmp/"$(basename "$package")"
39 done
39 done
40 fi
40 fi
41
41
42 chroot_exec apt-get -qq -y -f install
42 chroot_exec apt-get -qq -y -f install
43
43
44 chroot_exec apt-get -qq -y check
44 chroot_exec apt-get -qq -y check
@@ -1,893 +1,895
1 #!/bin/sh
1 #!/bin/sh
2 ########################################################################
2 ########################################################################
3 # rpi23-gen-image.sh 2015-2017
3 # rpi23-gen-image.sh 2015-2017
4 #
4 #
5 # Advanced Debian "stretch" and "buster" bootstrap script for Raspberry Pi
5 # Advanced Debian "stretch" and "buster" bootstrap script for Raspberry Pi
6 #
6 #
7 # This program is free software; you can redistribute it and/or
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
10 # of the License, or (at your option) any later version.
11 #
11 #
12 # Copyright (C) 2015 Jan Wagner <mail@jwagner.eu>
12 # Copyright (C) 2015 Jan Wagner <mail@jwagner.eu>
13 #
13 #
14 # Big thanks for patches and enhancements by 20+ github contributors!
14 # Big thanks for patches and enhancements by 20+ github contributors!
15 ########################################################################
15 ########################################################################
16
16
17 # Are we running as root?
17 # Are we running as root?
18 if [ "$(id -u)" -ne "0" ] ; then
18 if [ "$(id -u)" -ne "0" ] ; then
19 echo "error: this script must be executed with root privileges!"
19 echo "error: this script must be executed with root privileges!"
20 exit 1
20 exit 1
21 fi
21 fi
22
22
23 # Check if ./functions.sh script exists
23 # Check if ./functions.sh script exists
24 if [ ! -r "./functions.sh" ] ; then
24 if [ ! -r "./functions.sh" ] ; then
25 echo "error: './functions.sh' required script not found!"
25 echo "error: './functions.sh' required script not found!"
26 exit 1
26 exit 1
27 fi
27 fi
28
28
29 # Load utility functions
29 # Load utility functions
30 . ./functions.sh
30 . ./functions.sh
31
31
32 # Load parameters from configuration template file
32 # Load parameters from configuration template file
33 if [ -n "$CONFIG_TEMPLATE" ] ; then
33 if [ -n "$CONFIG_TEMPLATE" ] ; then
34 use_template
34 use_template
35 fi
35 fi
36
36
37 # Introduce settings
37 # Introduce settings
38 set -e
38 set -e
39 echo -n -e "\n#\n# RPi 0/1/2/3 Bootstrap Settings\n#\n"
39 echo -n -e "\n#\n# RPi 0/1/2/3 Bootstrap Settings\n#\n"
40 set -x
40 set -x
41
41
42 # Raspberry Pi model configuration
42 # Raspberry Pi model configuration
43 RPI_MODEL=${RPI_MODEL:=2}
43 RPI_MODEL=${RPI_MODEL:=2}
44
44
45 # Debian release
45 # Debian release
46 RELEASE=${RELEASE:=buster}
46 RELEASE=${RELEASE:=buster}
47 if [ $RELEASE = bullseye] ; then
48 RELEASE=testing
49 fi
47
50
48 # Kernel Branch
51 # Kernel Branch
49 KERNEL_BRANCH=${KERNEL_BRANCH:=""}
52 KERNEL_BRANCH=${KERNEL_BRANCH:=""}
50
53
51 # URLs
54 # URLs
52 KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
55 KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
53 FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot}
56 FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot}
54 WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm}
57 WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm}
55 COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian}
56 FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
58 FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
57 UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git}
59 UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git}
58 VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland}
60 VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland}
59 BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git}
61 BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git}
60 NEXMON_URL=${NEXMON_URL:=https://github.com/seemoo-lab/nexmon.git}
62 NEXMON_URL=${NEXMON_URL:=https://github.com/seemoo-lab/nexmon.git}
61 SYSTEMDSWAP_URL=${SYSTEMDSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git}
63 SYSTEMDSWAP_URL=${SYSTEMDSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git}
62
64
63 # Kernel deb packages for 32bit kernel
65 # Kernel deb packages for 32bit kernel
64 RPI_32_KERNEL_URL=${RPI_32_KERNEL_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel_20180422-141901_armhf.deb}
66 RPI_32_KERNEL_URL=${RPI_32_KERNEL_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel_20180422-141901_armhf.deb}
65 RPI_32_KERNELHEADER_URL=${RPI_32_KERNELHEADER_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel-headers_20180422-141901_armhf.deb}
67 RPI_32_KERNELHEADER_URL=${RPI_32_KERNELHEADER_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel-headers_20180422-141901_armhf.deb}
66 # Kernel has KVM and zswap enabled - use if KERNEL_* parameters and precompiled kernel are used
68 # Kernel has KVM and zswap enabled - use if KERNEL_* parameters and precompiled kernel are used
67 RPI3_64_BIS_KERNEL_URL=${RPI3_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel-bis/releases/download/4.14.80.20181113/bcmrpi3-kernel-bis-4.14.80.20181113.tar.xz}
69 RPI3_64_BIS_KERNEL_URL=${RPI3_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel-bis/releases/download/4.14.80.20181113/bcmrpi3-kernel-bis-4.14.80.20181113.tar.xz}
68 # Default precompiled 64bit kernel
70 # Default precompiled 64bit kernel
69 RPI3_64_DEF_KERNEL_URL=${RPI3_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel/releases/download/4.14.80.20181113/bcmrpi3-kernel-4.14.80.20181113.tar.xz}
71 RPI3_64_DEF_KERNEL_URL=${RPI3_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel/releases/download/4.14.80.20181113/bcmrpi3-kernel-4.14.80.20181113.tar.xz}
70 # Sakaki BIS Kernel RPI4
72 # Sakaki BIS Kernel RPI4
71 RPI4_64_DEF_KERNEL_URL=https://github.com/sakaki-/bcm2711-kernel-bis/releases/download/4.19.59.20190724/bcm2711-kernel-bis-4.19.59.20190724.tar.xz
73 RPI4_64_DEF_KERNEL_URL=https://github.com/sakaki-/bcm2711-kernel-bis/releases/download/4.19.59.20190724/bcm2711-kernel-bis-4.19.59.20190724.tar.xz
72 # Generic
74 # Generic
73 RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_DEF_KERNEL_URL}
75 RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_DEF_KERNEL_URL}
74 RPI4_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI4_64_DEF_KERNEL_URL}
76 RPI4_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI4_64_DEF_KERNEL_URL}
75 # Kali kernel src - used if ENABLE_NEXMON=true (they patch the wlan kernel modul)
77 # Kali kernel src - used if ENABLE_NEXMON=true (they patch the wlan kernel modul)
76 KALI_KERNEL_URL=${KALI_KERNEL_URL:=https://github.com/Re4son/re4son-raspberrypi-linux.git}
78 KALI_KERNEL_URL=${KALI_KERNEL_URL:=https://github.com/Re4son/re4son-raspberrypi-linux.git}
77
79
78 # Build directories
80 # Build directories
79 WORKDIR=$(pwd)
81 WORKDIR=$(pwd)
80 BASEDIR=${BASEDIR:=${WORKDIR}/images/${RELEASE}}
82 BASEDIR=${BASEDIR:=${WORKDIR}/images/${RELEASE}}
81 BUILDDIR="${BASEDIR}/build"
83 BUILDDIR="${BASEDIR}/build"
82
84
83 # Chroot directories
85 # Chroot directories
84 R="${BUILDDIR}/chroot"
86 R="${BUILDDIR}/chroot"
85 ETC_DIR="${R}/etc"
87 ETC_DIR="${R}/etc"
86 LIB_DIR="${R}/lib"
88 LIB_DIR="${R}/lib"
87 BOOT_DIR="${R}/boot/firmware"
89 BOOT_DIR="${R}/boot/firmware"
88 KERNEL_DIR="${R}/usr/src/linux"
90 KERNEL_DIR="${R}/usr/src/linux"
89 WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm"
91 WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm"
90 BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt"
92 BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt"
91
93
92 # Firmware directory: Blank if download from github
94 # Firmware directory: Blank if download from github
93 RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
95 RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
94
96
95 # General settings
97 # General settings
96 SET_ARCH=${SET_ARCH:=32}
98 SET_ARCH=${SET_ARCH:=32}
97 HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}}
99 HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}}
98 PASSWORD=${PASSWORD:=raspberry}
100 PASSWORD=${PASSWORD:=raspberry}
99 USER_PASSWORD=${USER_PASSWORD:=raspberry}
101 USER_PASSWORD=${USER_PASSWORD:=raspberry}
100 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
102 DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
101 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
103 TIMEZONE=${TIMEZONE:="Europe/Berlin"}
102 EXPANDROOT=${EXPANDROOT:=true}
104 EXPANDROOT=${EXPANDROOT:=true}
103 ENABLE_DPHYSSWAP=${ENABLE_DPHYSSWAP:=true}
105 ENABLE_DPHYSSWAP=${ENABLE_DPHYSSWAP:=true}
104
106
105 # Keyboard settings
107 # Keyboard settings
106 XKB_MODEL=${XKB_MODEL:=""}
108 XKB_MODEL=${XKB_MODEL:=""}
107 XKB_LAYOUT=${XKB_LAYOUT:=""}
109 XKB_LAYOUT=${XKB_LAYOUT:=""}
108 XKB_VARIANT=${XKB_VARIANT:=""}
110 XKB_VARIANT=${XKB_VARIANT:=""}
109 XKB_OPTIONS=${XKB_OPTIONS:=""}
111 XKB_OPTIONS=${XKB_OPTIONS:=""}
110
112
111 # Network settings (DHCP)
113 # Network settings (DHCP)
112 ENABLE_DHCP=${ENABLE_DHCP:=true}
114 ENABLE_DHCP=${ENABLE_DHCP:=true}
113
115
114 # Network settings (static)
116 # Network settings (static)
115 NET_ADDRESS=${NET_ADDRESS:=""}
117 NET_ADDRESS=${NET_ADDRESS:=""}
116 NET_GATEWAY=${NET_GATEWAY:=""}
118 NET_GATEWAY=${NET_GATEWAY:=""}
117 NET_DNS_1=${NET_DNS_1:=""}
119 NET_DNS_1=${NET_DNS_1:=""}
118 NET_DNS_2=${NET_DNS_2:=""}
120 NET_DNS_2=${NET_DNS_2:=""}
119 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
121 NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
120 NET_NTP_1=${NET_NTP_1:=""}
122 NET_NTP_1=${NET_NTP_1:=""}
121 NET_NTP_2=${NET_NTP_2:=""}
123 NET_NTP_2=${NET_NTP_2:=""}
122
124
123 # APT settings
125 # APT settings
124 APT_PROXY=${APT_PROXY:=""}
126 APT_PROXY=${APT_PROXY:=""}
125 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
127 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
126 KEEP_APT_PROXY=${KEEP_APT_PROXY:=false}
128 KEEP_APT_PROXY=${KEEP_APT_PROXY:=false}
127
129
128 # Feature settings
130 # Feature settings
129 ENABLE_PRINTK=${ENABLE_PRINTK:=false}
131 ENABLE_PRINTK=${ENABLE_PRINTK:=false}
130 ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false}
132 ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false}
131 ENABLE_MINIUART_OVERLAY=${ENABLE_MINIUART_OVERLAY:=false}
133 ENABLE_MINIUART_OVERLAY=${ENABLE_MINIUART_OVERLAY:=false}
132 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
134 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
133 ENABLE_I2C=${ENABLE_I2C:=false}
135 ENABLE_I2C=${ENABLE_I2C:=false}
134 ENABLE_SPI=${ENABLE_SPI:=false}
136 ENABLE_SPI=${ENABLE_SPI:=false}
135 ENABLE_IPV6=${ENABLE_IPV6:=true}
137 ENABLE_IPV6=${ENABLE_IPV6:=true}
136 ENABLE_SSHD=${ENABLE_SSHD:=true}
138 ENABLE_SSHD=${ENABLE_SSHD:=true}
137 ENABLE_NONFREE=${ENABLE_NONFREE:=false}
139 ENABLE_NONFREE=${ENABLE_NONFREE:=false}
138 ENABLE_WIRELESS=${ENABLE_WIRELESS:=false}
140 ENABLE_WIRELESS=${ENABLE_WIRELESS:=false}
139 ENABLE_SOUND=${ENABLE_SOUND:=true}
141 ENABLE_SOUND=${ENABLE_SOUND:=true}
140 ENABLE_DBUS=${ENABLE_DBUS:=true}
142 ENABLE_DBUS=${ENABLE_DBUS:=true}
141 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
143 ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
142 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
144 ENABLE_MINGPU=${ENABLE_MINGPU:=false}
143 ENABLE_XORG=${ENABLE_XORG:=false}
145 ENABLE_XORG=${ENABLE_XORG:=false}
144 ENABLE_WM=${ENABLE_WM:=""}
146 ENABLE_WM=${ENABLE_WM:=""}
145 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
147 ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
146 ENABLE_USER=${ENABLE_USER:=true}
148 ENABLE_USER=${ENABLE_USER:=true}
147 USER_NAME=${USER_NAME:="pi"}
149 USER_NAME=${USER_NAME:="pi"}
148 ENABLE_ROOT=${ENABLE_ROOT:=false}
150 ENABLE_ROOT=${ENABLE_ROOT:=false}
149 ENABLE_QEMU=${ENABLE_QEMU:=false}
151 ENABLE_QEMU=${ENABLE_QEMU:=false}
150 ENABLE_SYSVINIT=${ENABLE_SYSVINIT:=false}
152 ENABLE_SYSVINIT=${ENABLE_SYSVINIT:=false}
151
153
152 # SSH settings
154 # SSH settings
153 SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false}
155 SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false}
154 SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false}
156 SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false}
155 SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false}
157 SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false}
156 SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""}
158 SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""}
157 SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""}
159 SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""}
158
160
159 # Advanced settings
161 # Advanced settings
160 ENABLE_SYSTEMDSWAP=${ENABLE_SYSTEMDSWAP:=false}
162 ENABLE_SYSTEMDSWAP=${ENABLE_SYSTEMDSWAP:=false}
161 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
163 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
162 ENABLE_REDUCE=${ENABLE_REDUCE:=false}
164 ENABLE_REDUCE=${ENABLE_REDUCE:=false}
163 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
165 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
164 UBOOTSRC_DIR=${UBOOTSRC_DIR:=""}
166 UBOOTSRC_DIR=${UBOOTSRC_DIR:=""}
165 ENABLE_USBBOOT=${ENABLE_USBBOOT=false}
167 ENABLE_USBBOOT=${ENABLE_USBBOOT=false}
166 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
168 ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
167 ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false}
169 ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false}
168 ENABLE_NEXMON=${ENABLE_NEXMON:=false}
170 ENABLE_NEXMON=${ENABLE_NEXMON:=false}
169 VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""}
171 VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""}
170 FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""}
172 FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""}
171 NEXMONSRC_DIR=${NEXMONSRC_DIR:=""}
173 NEXMONSRC_DIR=${NEXMONSRC_DIR:=""}
172 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
174 ENABLE_HARDNET=${ENABLE_HARDNET:=false}
173 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
175 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
174 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
176 ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
175 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
177 ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
176 ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
178 ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
177 ENABLE_SPLASH=${ENABLE_SPLASH:=true}
179 ENABLE_SPLASH=${ENABLE_SPLASH:=true}
178 ENABLE_LOGO=${ENABLE_LOGO:=true}
180 ENABLE_LOGO=${ENABLE_LOGO:=true}
179 ENABLE_SILENT_BOOT=${ENABLE_SILENT_BOOT=false}
181 ENABLE_SILENT_BOOT=${ENABLE_SILENT_BOOT=false}
180 DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=}
182 DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=}
181
183
182 # Kernel compilation settings
184 # Kernel compilation settings
183 BUILD_KERNEL=${BUILD_KERNEL:=true}
185 BUILD_KERNEL=${BUILD_KERNEL:=true}
184 KERNEL_REDUCE=${KERNEL_REDUCE:=false}
186 KERNEL_REDUCE=${KERNEL_REDUCE:=false}
185 KERNEL_THREADS=${KERNEL_THREADS:=1}
187 KERNEL_THREADS=${KERNEL_THREADS:=1}
186 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
188 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
187 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
189 KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
188 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
190 KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
189 KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false}
191 KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false}
190 KERNEL_CCACHE=${KERNEL_CCACHE:=false}
192 KERNEL_CCACHE=${KERNEL_CCACHE:=false}
191 KERNEL_ZSWAP=${KERNEL_ZSWAP:=false}
193 KERNEL_ZSWAP=${KERNEL_ZSWAP:=false}
192 KERNEL_VIRT=${KERNEL_VIRT:=false}
194 KERNEL_VIRT=${KERNEL_VIRT:=false}
193 KERNEL_BPF=${KERNEL_BPF:=false}
195 KERNEL_BPF=${KERNEL_BPF:=false}
194 KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=ondemand}
196 KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=ondemand}
195 KERNEL_SECURITY=${KERNEL_SECURITY:=false}
197 KERNEL_SECURITY=${KERNEL_SECURITY:=false}
196 KERNEL_NF=${KERNEL_NF:=false}
198 KERNEL_NF=${KERNEL_NF:=false}
197 KERNEL_DHKEY=${KERNEL_DHKEY:=true}
199 KERNEL_DHKEY=${KERNEL_DHKEY:=true}
198 KERNEL_BTRFS=${KERNEL_BTRFS:=false}
200 KERNEL_BTRFS=${KERNEL_BTRFS:=false}
199 KERNEL_NSPAN=${KERNEL_NSPAN:=false}
201 KERNEL_NSPAN=${KERNEL_NSPAN:=false}
200 KERNEL_POEHAT=${KERNEL_POEHAT:=false}
202 KERNEL_POEHAT=${KERNEL_POEHAT:=false}
201
203
202 # Kernel compilation from source directory settings
204 # Kernel compilation from source directory settings
203 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
205 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
204 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
206 KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
205 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
207 KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
206 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
208 KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
207
209
208 # Reduce disk usage settings
210 # Reduce disk usage settings
209 REDUCE_APT=${REDUCE_APT:=true}
211 REDUCE_APT=${REDUCE_APT:=true}
210 REDUCE_DOC=${REDUCE_DOC:=true}
212 REDUCE_DOC=${REDUCE_DOC:=true}
211 REDUCE_MAN=${REDUCE_MAN:=true}
213 REDUCE_MAN=${REDUCE_MAN:=true}
212 REDUCE_VIM=${REDUCE_VIM:=false}
214 REDUCE_VIM=${REDUCE_VIM:=false}
213 REDUCE_BASH=${REDUCE_BASH:=false}
215 REDUCE_BASH=${REDUCE_BASH:=false}
214 REDUCE_HWDB=${REDUCE_HWDB:=true}
216 REDUCE_HWDB=${REDUCE_HWDB:=true}
215 REDUCE_SSHD=${REDUCE_SSHD:=true}
217 REDUCE_SSHD=${REDUCE_SSHD:=true}
216 REDUCE_LOCALE=${REDUCE_LOCALE:=true}
218 REDUCE_LOCALE=${REDUCE_LOCALE:=true}
217
219
218 # Encrypted filesystem settings
220 # Encrypted filesystem settings
219 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
221 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
220 CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""}
222 CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""}
221 CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"}
223 CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"}
222 CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"}
224 CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"}
223 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
225 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
224 #Dropbear-initramfs supports unlocking encrypted filesystem via SSH on bootup
226 #Dropbear-initramfs supports unlocking encrypted filesystem via SSH on bootup
225 CRYPTFS_DROPBEAR=${CRYPTFS_DROPBEAR:=false}
227 CRYPTFS_DROPBEAR=${CRYPTFS_DROPBEAR:=false}
226 #Provide your own Dropbear Public RSA-OpenSSH Key otherwise it will be generated
228 #Provide your own Dropbear Public RSA-OpenSSH Key otherwise it will be generated
227 CRYPTFS_DROPBEAR_PUBKEY=${CRYPTFS_DROPBEAR_PUBKEY:=""}
229 CRYPTFS_DROPBEAR_PUBKEY=${CRYPTFS_DROPBEAR_PUBKEY:=""}
228
230
229 # Chroot scripts directory
231 # Chroot scripts directory
230 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
232 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
231
233
232 # Packages required in the chroot build environment
234 # Packages required in the chroot build environment
233 APT_INCLUDES=${APT_INCLUDES:=""}
235 APT_INCLUDES=${APT_INCLUDES:=""}
234 APT_INCLUDES="${APT_INCLUDES},flex,bison,libssl-dev,apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup,libnss-systemd"
236 APT_INCLUDES="${APT_INCLUDES},flex,bison,libssl-dev,apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup,libnss-systemd"
235
237
236 # Packages to exclude from chroot build environment
238 # Packages to exclude from chroot build environment
237 APT_EXCLUDES=${APT_EXCLUDES:=""}
239 APT_EXCLUDES=${APT_EXCLUDES:=""}
238
240
239 # Packages required for bootstrapping
241 # Packages required for bootstrapping
240 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo"
242 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo"
241 MISSING_PACKAGES=""
243 MISSING_PACKAGES=""
242
244
243 # Packages installed for c/c++ build environment in chroot (keep empty)
245 # Packages installed for c/c++ build environment in chroot (keep empty)
244 COMPILER_PACKAGES=""
246 COMPILER_PACKAGES=""
245
247
246 # Check if apt-cacher-ng has port 3142 open and set APT_PROXY
248 # Check if apt-cacher-ng has port 3142 open and set APT_PROXY
247 APT_CACHER_RUNNING=$(lsof -i :3142 | cut -d ' ' -f3 | uniq | sed '/^\s*$/d')
249 APT_CACHER_RUNNING=$(lsof -i :3142 | cut -d ' ' -f3 | uniq | sed '/^\s*$/d')
248 if [ "${APT_CACHER_RUNNING}" = "apt-cacher-ng" ] ; then
250 if [ "${APT_CACHER_RUNNING}" = "apt-cacher-ng" ] ; then
249 APT_PROXY=http://127.0.0.1:3142/
251 APT_PROXY=http://127.0.0.1:3142/
250 fi
252 fi
251
253
252 # Setup architecture specific settings
254 # Setup architecture specific settings
253 if [ -n "$SET_ARCH" ] ; then
255 if [ -n "$SET_ARCH" ] ; then
254 # 64-bit configuration
256 # 64-bit configuration
255 if [ "$SET_ARCH" = 64 ] ; then
257 if [ "$SET_ARCH" = 64 ] ; then
256 # General 64-bit depended settings
258 # General 64-bit depended settings
257 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
259 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
258 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
260 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
259 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
261 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
260
262
261 # Raspberry Pi model specific settings
263 # Raspberry Pi model specific settings
262 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
264 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
263 if [ "$RPI_MODEL" != 4 ] ; then
265 if [ "$RPI_MODEL" != 4 ] ; then
264 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
266 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
265 else
267 else
266 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2711_defconfig}
268 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2711_defconfig}
267 fi
269 fi
268
270
269 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
271 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
270 RELEASE_ARCH=${RELEASE_ARCH:=arm64}
272 RELEASE_ARCH=${RELEASE_ARCH:=arm64}
271 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
273 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
272 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
274 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
273 else
275 else
274 echo "error: Only Raspberry PI 3, 3B+ and 4 support 64-bit"
276 echo "error: Only Raspberry PI 3, 3B+ and 4 support 64-bit"
275 exit 1
277 exit 1
276 fi
278 fi
277 fi
279 fi
278
280
279 # 32-bit configuration
281 # 32-bit configuration
280 if [ "$SET_ARCH" = 32 ] ; then
282 if [ "$SET_ARCH" = 32 ] ; then
281 # General 32-bit dependend settings
283 # General 32-bit dependend settings
282 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
284 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
283 KERNEL_ARCH=${KERNEL_ARCH:=arm}
285 KERNEL_ARCH=${KERNEL_ARCH:=arm}
284 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
286 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
285
287
286 # Raspberry Pi model specific settings
288 # Raspberry Pi model specific settings
287 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
289 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
288 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
290 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
289 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
291 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
290 RELEASE_ARCH=${RELEASE_ARCH:=armel}
292 RELEASE_ARCH=${RELEASE_ARCH:=armel}
291 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img}
293 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img}
292 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
294 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
293 fi
295 fi
294
296
295 # Raspberry Pi model specific settings
297 # Raspberry Pi model specific settings
296 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
298 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
297 if [ "$RPI_MODEL" != 4 ] ; then
299 if [ "$RPI_MODEL" != 4 ] ; then
298 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
300 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
299 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img}
301 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img}
300 else
302 else
301 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2711_defconfig}
303 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2711_defconfig}
302 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7l.img}
304 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7l.img}
303 fi
305 fi
304
306
305 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
307 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
306 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
308 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
307
309
308 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
310 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
309 fi
311 fi
310 fi
312 fi
311 # SET_ARCH not set
313 # SET_ARCH not set
312 else
314 else
313 echo "error: Please set '32' or '64' as value for SET_ARCH"
315 echo "error: Please set '32' or '64' as value for SET_ARCH"
314 exit 1
316 exit 1
315 fi
317 fi
316 # Device specific configuration and U-Boot configuration
318 # Device specific configuration and U-Boot configuration
317 case "$RPI_MODEL" in
319 case "$RPI_MODEL" in
318 0)
320 0)
319 DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb}
321 DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb}
320 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
322 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
321 ;;
323 ;;
322 1)
324 1)
323 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb}
325 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb}
324 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
326 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
325 ;;
327 ;;
326 1P)
328 1P)
327 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb}
329 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb}
328 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
330 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
329 ;;
331 ;;
330 2)
332 2)
331 DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb}
333 DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb}
332 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig}
334 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig}
333 ;;
335 ;;
334 3)
336 3)
335 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
337 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
336 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
338 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
337 ;;
339 ;;
338 3P)
340 3P)
339 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
341 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
340 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
342 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
341 ;;
343 ;;
342 4)
344 4)
343 DTB_FILE=${DTB_FILE:=bcm2711-rpi-4-b.dtb}
345 DTB_FILE=${DTB_FILE:=bcm2711-rpi-4-b.dtb}
344 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_4_defconfig}
346 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_4_defconfig}
345 ;;
347 ;;
346 *)
348 *)
347 echo "error: Raspberry Pi model $RPI_MODEL is not supported!"
349 echo "error: Raspberry Pi model $RPI_MODEL is not supported!"
348 exit 1
350 exit 1
349 ;;
351 ;;
350 esac
352 esac
351
353
352 # Raspberry PI 0,3,3P with Bluetooth and Wifi onboard
354 # Raspberry PI 0,3,3P with Bluetooth and Wifi onboard
353 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
355 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
354 # Include bluetooth packages on supported boards
356 # Include bluetooth packages on supported boards
355 if [ "$ENABLE_BLUETOOTH" = true ] ; then
357 if [ "$ENABLE_BLUETOOTH" = true ] ; then
356 APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
358 APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
357 fi
359 fi
358 if [ "$ENABLE_WIRELESS" = true ] ; then
360 if [ "$ENABLE_WIRELESS" = true ] ; then
359 APT_INCLUDES="${APT_INCLUDES},wireless-tools,crda,wireless-regdb"
361 APT_INCLUDES="${APT_INCLUDES},wireless-tools,crda,wireless-regdb"
360 fi
362 fi
361 else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard
363 else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard
362 # Check if the internal wireless interface is not supported by the RPi model
364 # Check if the internal wireless interface is not supported by the RPi model
363 if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then
365 if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then
364 echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth"
366 echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth"
365 exit 1
367 exit 1
366 fi
368 fi
367 fi
369 fi
368
370
369 if [ "$BUILD_KERNEL" = false ] && [ "$ENABLE_NEXMON" = true ]; then
371 if [ "$BUILD_KERNEL" = false ] && [ "$ENABLE_NEXMON" = true ]; then
370 echo "error: You have to compile kernel sources, if you want to enable nexmon"
372 echo "error: You have to compile kernel sources, if you want to enable nexmon"
371 exit 1
373 exit 1
372 fi
374 fi
373
375
374 # Prepare date string for default image file name
376 # Prepare date string for default image file name
375 DATE="$(date +%Y-%m-%d)"
377 DATE="$(date +%Y-%m-%d)"
376 if [ -z "$KERNEL_BRANCH" ] ; then
378 if [ -z "$KERNEL_BRANCH" ] ; then
377 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
379 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
378 else
380 else
379 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
381 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
380 fi
382 fi
381
383
382 # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported
384 # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported
383 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
385 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
384 if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then
386 if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then
385 echo "error: DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS} is not supported"
387 echo "error: DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS} is not supported"
386 exit 1
388 exit 1
387 fi
389 fi
388 fi
390 fi
389
391
390 # Add cmake to compile videocore sources
392 # Add cmake to compile videocore sources
391 if [ "$ENABLE_VIDEOCORE" = true ] ; then
393 if [ "$ENABLE_VIDEOCORE" = true ] ; then
392 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake"
394 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake"
393 fi
395 fi
394
396
395 # Add deps for nexmon
397 # Add deps for nexmon
396 if [ "$ENABLE_NEXMON" = true ] ; then
398 if [ "$ENABLE_NEXMON" = true ] ; then
397 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libgmp3-dev gawk qpdf bison flex make autoconf automake build-essential libtool"
399 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libgmp3-dev gawk qpdf bison flex make autoconf automake build-essential libtool"
398 fi
400 fi
399
401
400 # Add libncurses5 to enable kernel menuconfig
402 # Add libncurses5 to enable kernel menuconfig
401 if [ "$KERNEL_MENUCONFIG" = true ] ; then
403 if [ "$KERNEL_MENUCONFIG" = true ] ; then
402 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses-dev"
404 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses-dev"
403 fi
405 fi
404
406
405 # Add ccache compiler cache for (faster) kernel cross (re)compilation
407 # Add ccache compiler cache for (faster) kernel cross (re)compilation
406 if [ "$KERNEL_CCACHE" = true ] ; then
408 if [ "$KERNEL_CCACHE" = true ] ; then
407 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ccache"
409 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ccache"
408 fi
410 fi
409
411
410 # Add cryptsetup package to enable filesystem encryption
412 # Add cryptsetup package to enable filesystem encryption
411 if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
413 if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
412 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup"
414 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup"
413 APT_INCLUDES="${APT_INCLUDES},cryptsetup,busybox,console-setup"
415 APT_INCLUDES="${APT_INCLUDES},cryptsetup,busybox,console-setup"
414
416
415 # If cryptfs,dropbear and initramfs are enabled include dropbear-initramfs package
417 # If cryptfs,dropbear and initramfs are enabled include dropbear-initramfs package
416 if [ "$CRYPTFS_DROPBEAR" = true ] && [ "$ENABLE_INITRAMFS" = true ]; then
418 if [ "$CRYPTFS_DROPBEAR" = true ] && [ "$ENABLE_INITRAMFS" = true ]; then
417 APT_INCLUDES="${APT_INCLUDES},dropbear-initramfs"
419 APT_INCLUDES="${APT_INCLUDES},dropbear-initramfs"
418 fi
420 fi
419
421
420 if [ -z "$CRYPTFS_PASSWORD" ] ; then
422 if [ -z "$CRYPTFS_PASSWORD" ] ; then
421 echo "error: no password defined (CRYPTFS_PASSWORD)!"
423 echo "error: no password defined (CRYPTFS_PASSWORD)!"
422 exit 1
424 exit 1
423 fi
425 fi
424 ENABLE_INITRAMFS=true
426 ENABLE_INITRAMFS=true
425 fi
427 fi
426
428
427 # Add initramfs generation tools
429 # Add initramfs generation tools
428 if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
430 if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
429 APT_INCLUDES="${APT_INCLUDES},initramfs-tools"
431 APT_INCLUDES="${APT_INCLUDES},initramfs-tools"
430 fi
432 fi
431
433
432 # Add device-tree-compiler required for building the U-Boot bootloader
434 # Add device-tree-compiler required for building the U-Boot bootloader
433 if [ "$ENABLE_UBOOT" = true ] ; then
435 if [ "$ENABLE_UBOOT" = true ] ; then
434 APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc"
436 APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc"
435 fi
437 fi
436
438
437 if [ "$ENABLE_USBBOOT" = true ] ; then
439 if [ "$ENABLE_USBBOOT" = true ] ; then
438 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 2 ]; then
440 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 2 ]; then
439 echo "error: Booting from USB alone is only supported by Raspberry Pi 3 and 3P"
441 echo "error: Booting from USB alone is only supported by Raspberry Pi 3 and 3P"
440 exit 1
442 exit 1
441 fi
443 fi
442 fi
444 fi
443
445
444 # Check if root SSH (v2) public key file exists
446 # Check if root SSH (v2) public key file exists
445 if [ -n "$SSH_ROOT_PUB_KEY" ] ; then
447 if [ -n "$SSH_ROOT_PUB_KEY" ] ; then
446 if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then
448 if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then
447 echo "error: '$SSH_ROOT_PUB_KEY' specified SSH public key file not found (SSH_ROOT_PUB_KEY)!"
449 echo "error: '$SSH_ROOT_PUB_KEY' specified SSH public key file not found (SSH_ROOT_PUB_KEY)!"
448 exit 1
450 exit 1
449 fi
451 fi
450 fi
452 fi
451
453
452 # Check if $USER_NAME SSH (v2) public key file exists
454 # Check if $USER_NAME SSH (v2) public key file exists
453 if [ -n "$SSH_USER_PUB_KEY" ] ; then
455 if [ -n "$SSH_USER_PUB_KEY" ] ; then
454 if [ ! -f "$SSH_USER_PUB_KEY" ] ; then
456 if [ ! -f "$SSH_USER_PUB_KEY" ] ; then
455 echo "error: '$SSH_USER_PUB_KEY' specified SSH public key file not found (SSH_USER_PUB_KEY)!"
457 echo "error: '$SSH_USER_PUB_KEY' specified SSH public key file not found (SSH_USER_PUB_KEY)!"
456 exit 1
458 exit 1
457 fi
459 fi
458 fi
460 fi
459
461
460 if [ "$ENABLE_NEXMON" = true ] && [ -n "$KERNEL_BRANCH" ] ; then
462 if [ "$ENABLE_NEXMON" = true ] && [ -n "$KERNEL_BRANCH" ] ; then
461 echo "error: Please unset KERNEL_BRANCH if using ENABLE_NEXMON"
463 echo "error: Please unset KERNEL_BRANCH if using ENABLE_NEXMON"
462 exit 1
464 exit 1
463 fi
465 fi
464
466
465 # Check if all required packages are installed on the build system
467 # Check if all required packages are installed on the build system
466 for package in $REQUIRED_PACKAGES ; do
468 for package in $REQUIRED_PACKAGES ; do
467 if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then
469 if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then
468 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
470 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
469 fi
471 fi
470 done
472 done
471
473
472 # If there are missing packages ask confirmation for install, or exit
474 # If there are missing packages ask confirmation for install, or exit
473 if [ -n "$MISSING_PACKAGES" ] ; then
475 if [ -n "$MISSING_PACKAGES" ] ; then
474 echo "the following packages needed by this script are not installed:"
476 echo "the following packages needed by this script are not installed:"
475 echo "$MISSING_PACKAGES"
477 echo "$MISSING_PACKAGES"
476
478
477 printf "\ndo you want to install the missing packages right now? [y/n] "
479 printf "\ndo you want to install the missing packages right now? [y/n] "
478 read -r confirm
480 read -r confirm
479 [ "$confirm" != "y" ] && exit 1
481 [ "$confirm" != "y" ] && exit 1
480
482
481 # Make sure all missing required packages are installed
483 # Make sure all missing required packages are installed
482 apt-get update
484 apt-get update
483 apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"`
485 apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"`
484 fi
486 fi
485
487
486 # Check if ./bootstrap.d directory exists
488 # Check if ./bootstrap.d directory exists
487 if [ ! -d "./bootstrap.d/" ] ; then
489 if [ ! -d "./bootstrap.d/" ] ; then
488 echo "error: './bootstrap.d' required directory not found!"
490 echo "error: './bootstrap.d' required directory not found!"
489 exit 1
491 exit 1
490 fi
492 fi
491
493
492 # Check if ./files directory exists
494 # Check if ./files directory exists
493 if [ ! -d "./files/" ] ; then
495 if [ ! -d "./files/" ] ; then
494 echo "error: './files' required directory not found!"
496 echo "error: './files' required directory not found!"
495 exit 1
497 exit 1
496 fi
498 fi
497
499
498 # Check if specified KERNELSRC_DIR directory exists
500 # Check if specified KERNELSRC_DIR directory exists
499 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
501 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
500 echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!"
502 echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!"
501 exit 1
503 exit 1
502 fi
504 fi
503
505
504 # Check if specified UBOOTSRC_DIR directory exists
506 # Check if specified UBOOTSRC_DIR directory exists
505 if [ -n "$UBOOTSRC_DIR" ] && [ ! -d "$UBOOTSRC_DIR" ] ; then
507 if [ -n "$UBOOTSRC_DIR" ] && [ ! -d "$UBOOTSRC_DIR" ] ; then
506 echo "error: '${UBOOTSRC_DIR}' specified directory not found (UBOOTSRC_DIR)!"
508 echo "error: '${UBOOTSRC_DIR}' specified directory not found (UBOOTSRC_DIR)!"
507 exit 1
509 exit 1
508 fi
510 fi
509
511
510 # Check if specified VIDEOCORESRC_DIR directory exists
512 # Check if specified VIDEOCORESRC_DIR directory exists
511 if [ -n "$VIDEOCORESRC_DIR" ] && [ ! -d "$VIDEOCORESRC_DIR" ] ; then
513 if [ -n "$VIDEOCORESRC_DIR" ] && [ ! -d "$VIDEOCORESRC_DIR" ] ; then
512 echo "error: '${VIDEOCORESRC_DIR}' specified directory not found (VIDEOCORESRC_DIR)!"
514 echo "error: '${VIDEOCORESRC_DIR}' specified directory not found (VIDEOCORESRC_DIR)!"
513 exit 1
515 exit 1
514 fi
516 fi
515
517
516 # Check if specified FBTURBOSRC_DIR directory exists
518 # Check if specified FBTURBOSRC_DIR directory exists
517 if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then
519 if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then
518 echo "error: '${FBTURBOSRC_DIR}' specified directory not found (FBTURBOSRC_DIR)!"
520 echo "error: '${FBTURBOSRC_DIR}' specified directory not found (FBTURBOSRC_DIR)!"
519 exit 1
521 exit 1
520 fi
522 fi
521
523
522 # Check if specified NEXMONSRC_DIR directory exists
524 # Check if specified NEXMONSRC_DIR directory exists
523 if [ -n "$NEXMONSRC_DIR" ] && [ ! -d "$NEXMONSRC_DIR" ] ; then
525 if [ -n "$NEXMONSRC_DIR" ] && [ ! -d "$NEXMONSRC_DIR" ] ; then
524 echo "error: '${NEXMONSRC_DIR}' specified directory not found (NEXMONSRC_DIR)!"
526 echo "error: '${NEXMONSRC_DIR}' specified directory not found (NEXMONSRC_DIR)!"
525 exit 1
527 exit 1
526 fi
528 fi
527
529
528 # Check if specified CHROOT_SCRIPTS directory exists
530 # Check if specified CHROOT_SCRIPTS directory exists
529 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
531 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
530 echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
532 echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
531 exit 1
533 exit 1
532 fi
534 fi
533
535
534 # Check if specified device mapping already exists (will be used by cryptsetup)
536 # Check if specified device mapping already exists (will be used by cryptsetup)
535 if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then
537 if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then
536 echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding"
538 echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding"
537 exit 1
539 exit 1
538 fi
540 fi
539
541
540 # Don't clobber an old build
542 # Don't clobber an old build
541 if [ -e "$BUILDDIR" ] ; then
543 if [ -e "$BUILDDIR" ] ; then
542 echo "error: directory ${BUILDDIR} already exists, not proceeding"
544 echo "error: directory ${BUILDDIR} already exists, not proceeding"
543 exit 1
545 exit 1
544 fi
546 fi
545
547
546 # Setup chroot directory
548 # Setup chroot directory
547 mkdir -p "${R}"
549 mkdir -p "${R}"
548
550
549 # Check if build directory has enough of free disk space >512MB
551 # Check if build directory has enough of free disk space >512MB
550 if [ "$(df --output=avail "${BUILDDIR}" | sed "1d")" -le "524288" ] ; then
552 if [ "$(df --output=avail "${BUILDDIR}" | sed "1d")" -le "524288" ] ; then
551 echo "error: ${BUILDDIR} not enough space left to generate the output image!"
553 echo "error: ${BUILDDIR} not enough space left to generate the output image!"
552 exit 1
554 exit 1
553 fi
555 fi
554
556
555 set -x
557 set -x
556
558
557 # Call "cleanup" function on various signals and errors
559 # Call "cleanup" function on various signals and errors
558 trap cleanup 0 1 2 3 6
560 trap cleanup 0 1 2 3 6
559
561
560 # Add required packages for the minbase installation
562 # Add required packages for the minbase installation
561 if [ "$ENABLE_MINBASE" = true ] ; then
563 if [ "$ENABLE_MINBASE" = true ] ; then
562 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown"
564 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown"
563 fi
565 fi
564
566
565 # Add parted package, required to get partprobe utility
567 # Add parted package, required to get partprobe utility
566 if [ "$EXPANDROOT" = true ] ; then
568 if [ "$EXPANDROOT" = true ] ; then
567 APT_INCLUDES="${APT_INCLUDES},parted"
569 APT_INCLUDES="${APT_INCLUDES},parted"
568 fi
570 fi
569
571
570 # Add dphys-swapfile package, required to enable swap
572 # Add dphys-swapfile package, required to enable swap
571 if [ "$ENABLE_DPHYSSWAP" = true ] ; then
573 if [ "$ENABLE_DPHYSSWAP" = true ] ; then
572 APT_INCLUDES="${APT_INCLUDES},dphys-swapfile"
574 APT_INCLUDES="${APT_INCLUDES},dphys-swapfile"
573 fi
575 fi
574
576
575 # Add dbus package, recommended if using systemd
577 # Add dbus package, recommended if using systemd
576 if [ "$ENABLE_DBUS" = true ] ; then
578 if [ "$ENABLE_DBUS" = true ] ; then
577 APT_INCLUDES="${APT_INCLUDES},dbus"
579 APT_INCLUDES="${APT_INCLUDES},dbus"
578 fi
580 fi
579
581
580 # Add iptables IPv4/IPv6 package
582 # Add iptables IPv4/IPv6 package
581 if [ "$ENABLE_IPTABLES" = true ] ; then
583 if [ "$ENABLE_IPTABLES" = true ] ; then
582 APT_INCLUDES="${APT_INCLUDES},iptables,iptables-persistent"
584 APT_INCLUDES="${APT_INCLUDES},iptables,iptables-persistent"
583 fi
585 fi
584 # Add apparmor for KERNEL_SECURITY
586 # Add apparmor for KERNEL_SECURITY
585 if [ "$KERNEL_SECURITY" = true ] ; then
587 if [ "$KERNEL_SECURITY" = true ] ; then
586 APT_INCLUDES="${APT_INCLUDES},apparmor,apparmor-utils,apparmor-profiles,apparmor-profiles-extra,libapparmor-perl"
588 APT_INCLUDES="${APT_INCLUDES},apparmor,apparmor-utils,apparmor-profiles,apparmor-profiles-extra,libapparmor-perl"
587 fi
589 fi
588
590
589 # Add openssh server package
591 # Add openssh server package
590 if [ "$ENABLE_SSHD" = true ] ; then
592 if [ "$ENABLE_SSHD" = true ] ; then
591 APT_INCLUDES="${APT_INCLUDES},openssh-server"
593 APT_INCLUDES="${APT_INCLUDES},openssh-server"
592 fi
594 fi
593
595
594 # Add alsa-utils package
596 # Add alsa-utils package
595 if [ "$ENABLE_SOUND" = true ] ; then
597 if [ "$ENABLE_SOUND" = true ] ; then
596 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
598 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
597 fi
599 fi
598
600
599 # Add rng-tools package
601 # Add rng-tools package
600 if [ "$ENABLE_HWRANDOM" = true ] ; then
602 if [ "$ENABLE_HWRANDOM" = true ] ; then
601 APT_INCLUDES="${APT_INCLUDES},rng-tools"
603 APT_INCLUDES="${APT_INCLUDES},rng-tools"
602 fi
604 fi
603
605
604 # Add fbturbo video driver
606 # Add fbturbo video driver
605 if [ "$ENABLE_FBTURBO" = true ] ; then
607 if [ "$ENABLE_FBTURBO" = true ] ; then
606 # Enable xorg package dependencies
608 # Enable xorg package dependencies
607 ENABLE_XORG=true
609 ENABLE_XORG=true
608 fi
610 fi
609
611
610 # Add user defined window manager package
612 # Add user defined window manager package
611 if [ -n "$ENABLE_WM" ] ; then
613 if [ -n "$ENABLE_WM" ] ; then
612 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
614 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
613
615
614 # Enable xorg package dependencies
616 # Enable xorg package dependencies
615 ENABLE_XORG=true
617 ENABLE_XORG=true
616 fi
618 fi
617
619
618 # Add xorg package
620 # Add xorg package
619 if [ "$ENABLE_XORG" = true ] ; then
621 if [ "$ENABLE_XORG" = true ] ; then
620 APT_INCLUDES="${APT_INCLUDES},xorg,dbus-x11"
622 APT_INCLUDES="${APT_INCLUDES},xorg,dbus-x11"
621 fi
623 fi
622
624
623 # Replace selected packages with smaller clones
625 # Replace selected packages with smaller clones
624 if [ "$ENABLE_REDUCE" = true ] ; then
626 if [ "$ENABLE_REDUCE" = true ] ; then
625 # Add levee package instead of vim-tiny
627 # Add levee package instead of vim-tiny
626 if [ "$REDUCE_VIM" = true ] ; then
628 if [ "$REDUCE_VIM" = true ] ; then
627 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
629 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
628 fi
630 fi
629
631
630 # Add dropbear package instead of openssh-server
632 # Add dropbear package instead of openssh-server
631 if [ "$REDUCE_SSHD" = true ] ; then
633 if [ "$REDUCE_SSHD" = true ] ; then
632 APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")"
634 APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")"
633 fi
635 fi
634 fi
636 fi
635
637
636 # Configure systemd-sysv exclude to make halt/reboot/shutdown scripts available
638 # Configure systemd-sysv exclude to make halt/reboot/shutdown scripts available
637 if [ "$ENABLE_SYSVINIT" = false ] ; then
639 if [ "$ENABLE_SYSVINIT" = false ] ; then
638 APT_EXCLUDES="--exclude=${APT_EXCLUDES},init,systemd-sysv"
640 APT_EXCLUDES="--exclude=${APT_EXCLUDES},init,systemd-sysv"
639 fi
641 fi
640
642
641 # Configure kernel sources if no KERNELSRC_DIR
643 # Configure kernel sources if no KERNELSRC_DIR
642 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
644 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
643 KERNELSRC_CONFIG=true
645 KERNELSRC_CONFIG=true
644 fi
646 fi
645
647
646 # Configure reduced kernel
648 # Configure reduced kernel
647 if [ "$KERNEL_REDUCE" = true ] ; then
649 if [ "$KERNEL_REDUCE" = true ] ; then
648 KERNELSRC_CONFIG=false
650 KERNELSRC_CONFIG=false
649 fi
651 fi
650
652
651 # Configure qemu compatible kernel
653 # Configure qemu compatible kernel
652 if [ "$ENABLE_QEMU" = true ] ; then
654 if [ "$ENABLE_QEMU" = true ] ; then
653 DTB_FILE=vexpress-v2p-ca15_a7.dtb
655 DTB_FILE=vexpress-v2p-ca15_a7.dtb
654 UBOOT_CONFIG=vexpress_ca15_tc2_defconfig
656 UBOOT_CONFIG=vexpress_ca15_tc2_defconfig
655 KERNEL_DEFCONFIG="vexpress_defconfig"
657 KERNEL_DEFCONFIG="vexpress_defconfig"
656 if [ "$KERNEL_MENUCONFIG" = false ] ; then
658 if [ "$KERNEL_MENUCONFIG" = false ] ; then
657 KERNEL_OLDDEFCONFIG=true
659 KERNEL_OLDDEFCONFIG=true
658 fi
660 fi
659 fi
661 fi
660
662
661 # Execute bootstrap scripts
663 # Execute bootstrap scripts
662 for SCRIPT in bootstrap.d/*.sh; do
664 for SCRIPT in bootstrap.d/*.sh; do
663 head -n 3 "$SCRIPT"
665 head -n 3 "$SCRIPT"
664 . "$SCRIPT"
666 . "$SCRIPT"
665 done
667 done
666
668
667 ## Execute custom bootstrap scripts
669 ## Execute custom bootstrap scripts
668 if [ -d "custom.d" ] ; then
670 if [ -d "custom.d" ] ; then
669 for SCRIPT in custom.d/*.sh; do
671 for SCRIPT in custom.d/*.sh; do
670 . "$SCRIPT"
672 . "$SCRIPT"
671 done
673 done
672 fi
674 fi
673
675
674 # Execute custom scripts inside the chroot
676 # Execute custom scripts inside the chroot
675 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
677 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
676 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
678 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
677 chroot_exec /bin/bash -x <<'EOF'
679 chroot_exec /bin/bash -x <<'EOF'
678 for SCRIPT in /chroot_scripts/* ; do
680 for SCRIPT in /chroot_scripts/* ; do
679 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
681 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
680 $SCRIPT
682 $SCRIPT
681 fi
683 fi
682 done
684 done
683 EOF
685 EOF
684 rm -rf "${R}/chroot_scripts"
686 rm -rf "${R}/chroot_scripts"
685 fi
687 fi
686
688
687 # Remove c/c++ build environment from the chroot
689 # Remove c/c++ build environment from the chroot
688 chroot_remove_cc
690 chroot_remove_cc
689
691
690 # Generate required machine-id
692 # Generate required machine-id
691 MACHINE_ID=$(dbus-uuidgen)
693 MACHINE_ID=$(dbus-uuidgen)
692 echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id"
694 echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id"
693 echo -n "${MACHINE_ID}" > "${ETC_DIR}/machine-id"
695 echo -n "${MACHINE_ID}" > "${ETC_DIR}/machine-id"
694
696
695 # APT Cleanup
697 # APT Cleanup
696 chroot_exec apt-get -y clean
698 chroot_exec apt-get -y clean
697 chroot_exec apt-get -y autoclean
699 chroot_exec apt-get -y autoclean
698 chroot_exec apt-get -y autoremove
700 chroot_exec apt-get -y autoremove
699
701
700 # Unmount mounted filesystems
702 # Unmount mounted filesystems
701 umount -l "${R}/proc"
703 umount -l "${R}/proc"
702 umount -l "${R}/sys"
704 umount -l "${R}/sys"
703
705
704 # Clean up directories
706 # Clean up directories
705 rm -rf "${R}/run/*"
707 rm -rf "${R}/run/*"
706 rm -rf "${R}/tmp/*"
708 rm -rf "${R}/tmp/*"
707
709
708 # Clean up APT proxy settings
710 # Clean up APT proxy settings
709 if [ "$KEEP_APT_PROXY" = false ] ; then
711 if [ "$KEEP_APT_PROXY" = false ] ; then
710 rm -f "${ETC_DIR}/apt/apt.conf.d/10proxy"
712 rm -f "${ETC_DIR}/apt/apt.conf.d/10proxy"
711 fi
713 fi
712
714
713 # Clean up files
715 # Clean up files
714 rm -f "${ETC_DIR}/ssh/ssh_host_*"
716 rm -f "${ETC_DIR}/ssh/ssh_host_*"
715 rm -f "${ETC_DIR}/dropbear/dropbear_*"
717 rm -f "${ETC_DIR}/dropbear/dropbear_*"
716 rm -f "${ETC_DIR}/apt/sources.list.save"
718 rm -f "${ETC_DIR}/apt/sources.list.save"
717 rm -f "${ETC_DIR}/resolvconf/resolv.conf.d/original"
719 rm -f "${ETC_DIR}/resolvconf/resolv.conf.d/original"
718 rm -f "${ETC_DIR}/*-"
720 rm -f "${ETC_DIR}/*-"
719 rm -f "${ETC_DIR}/resolv.conf"
721 rm -f "${ETC_DIR}/resolv.conf"
720 rm -f "${R}/root/.bash_history"
722 rm -f "${R}/root/.bash_history"
721 rm -f "${R}/var/lib/urandom/random-seed"
723 rm -f "${R}/var/lib/urandom/random-seed"
722 rm -f "${R}/initrd.img"
724 rm -f "${R}/initrd.img"
723 rm -f "${R}/vmlinuz"
725 rm -f "${R}/vmlinuz"
724 rm -f "${R}${QEMU_BINARY}"
726 rm -f "${R}${QEMU_BINARY}"
725
727
726 if [ "$ENABLE_QEMU" = true ] ; then
728 if [ "$ENABLE_QEMU" = true ] ; then
727 # Setup QEMU directory
729 # Setup QEMU directory
728 mkdir "${BASEDIR}/qemu"
730 mkdir "${BASEDIR}/qemu"
729
731
730 # Copy kernel image to QEMU directory
732 # Copy kernel image to QEMU directory
731 install_readonly "${BOOT_DIR}/${KERNEL_IMAGE}" "${BASEDIR}/qemu/${KERNEL_IMAGE}"
733 install_readonly "${BOOT_DIR}/${KERNEL_IMAGE}" "${BASEDIR}/qemu/${KERNEL_IMAGE}"
732
734
733 # Copy kernel config to QEMU directory
735 # Copy kernel config to QEMU directory
734 install_readonly "${R}/boot/config-${KERNEL_VERSION}" "${BASEDIR}/qemu/config-${KERNEL_VERSION}"
736 install_readonly "${R}/boot/config-${KERNEL_VERSION}" "${BASEDIR}/qemu/config-${KERNEL_VERSION}"
735
737
736 # Copy kernel dtbs to QEMU directory
738 # Copy kernel dtbs to QEMU directory
737 for dtb in "${BOOT_DIR}/"*.dtb ; do
739 for dtb in "${BOOT_DIR}/"*.dtb ; do
738 if [ -f "${dtb}" ] ; then
740 if [ -f "${dtb}" ] ; then
739 install_readonly "${dtb}" "${BASEDIR}/qemu/"
741 install_readonly "${dtb}" "${BASEDIR}/qemu/"
740 fi
742 fi
741 done
743 done
742
744
743 # Copy kernel overlays to QEMU directory
745 # Copy kernel overlays to QEMU directory
744 if [ -d "${BOOT_DIR}/overlays" ] ; then
746 if [ -d "${BOOT_DIR}/overlays" ] ; then
745 # Setup overlays dtbs directory
747 # Setup overlays dtbs directory
746 mkdir "${BASEDIR}/qemu/overlays"
748 mkdir "${BASEDIR}/qemu/overlays"
747
749
748 for dtb in "${BOOT_DIR}/overlays/"*.dtbo ; do
750 for dtb in "${BOOT_DIR}/overlays/"*.dtbo ; do
749 if [ -f "${dtb}" ] ; then
751 if [ -f "${dtb}" ] ; then
750 install_readonly "${dtb}" "${BASEDIR}/qemu/overlays/"
752 install_readonly "${dtb}" "${BASEDIR}/qemu/overlays/"
751 fi
753 fi
752 done
754 done
753 fi
755 fi
754
756
755 # Copy u-boot files to QEMU directory
757 # Copy u-boot files to QEMU directory
756 if [ "$ENABLE_UBOOT" = true ] ; then
758 if [ "$ENABLE_UBOOT" = true ] ; then
757 if [ -f "${BOOT_DIR}/u-boot.bin" ] ; then
759 if [ -f "${BOOT_DIR}/u-boot.bin" ] ; then
758 install_readonly "${BOOT_DIR}/u-boot.bin" "${BASEDIR}/qemu/u-boot.bin"
760 install_readonly "${BOOT_DIR}/u-boot.bin" "${BASEDIR}/qemu/u-boot.bin"
759 fi
761 fi
760 if [ -f "${BOOT_DIR}/uboot.mkimage" ] ; then
762 if [ -f "${BOOT_DIR}/uboot.mkimage" ] ; then
761 install_readonly "${BOOT_DIR}/uboot.mkimage" "${BASEDIR}/qemu/uboot.mkimage"
763 install_readonly "${BOOT_DIR}/uboot.mkimage" "${BASEDIR}/qemu/uboot.mkimage"
762 fi
764 fi
763 if [ -f "${BOOT_DIR}/boot.scr" ] ; then
765 if [ -f "${BOOT_DIR}/boot.scr" ] ; then
764 install_readonly "${BOOT_DIR}/boot.scr" "${BASEDIR}/qemu/boot.scr"
766 install_readonly "${BOOT_DIR}/boot.scr" "${BASEDIR}/qemu/boot.scr"
765 fi
767 fi
766 fi
768 fi
767
769
768 # Copy initramfs to QEMU directory
770 # Copy initramfs to QEMU directory
769 if [ -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" ] ; then
771 if [ -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" ] ; then
770 install_readonly "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" "${BASEDIR}/qemu/initramfs-${KERNEL_VERSION}"
772 install_readonly "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" "${BASEDIR}/qemu/initramfs-${KERNEL_VERSION}"
771 fi
773 fi
772 fi
774 fi
773
775
774 # Calculate size of the chroot directory in KB
776 # Calculate size of the chroot directory in KB
775 CHROOT_SIZE=$(expr "$(du -s "${R}" | awk '{ print $1 }')")
777 CHROOT_SIZE=$(expr "$(du -s "${R}" | awk '{ print $1 }')")
776
778
777 # Calculate the amount of needed 512 Byte sectors
779 # Calculate the amount of needed 512 Byte sectors
778 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
780 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
779 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
781 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
780 ROOT_OFFSET=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}")
782 ROOT_OFFSET=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}")
781
783
782 # The root partition is EXT4
784 # The root partition is EXT4
783 # This means more space than the actual used space of the chroot is used.
785 # This means more space than the actual used space of the chroot is used.
784 # As overhead for journaling and reserved blocks 35% are added.
786 # As overhead for journaling and reserved blocks 35% are added.
785 ROOT_SECTORS=$(expr "$(expr "${CHROOT_SIZE}" + "${CHROOT_SIZE}" \/ 100 \* 35)" \* 1024 \/ 512)
787 ROOT_SECTORS=$(expr "$(expr "${CHROOT_SIZE}" + "${CHROOT_SIZE}" \/ 100 \* 35)" \* 1024 \/ 512)
786
788
787 # Calculate required image size in 512 Byte sectors
789 # Calculate required image size in 512 Byte sectors
788 IMAGE_SECTORS=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}")
790 IMAGE_SECTORS=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}")
789
791
790 # Prepare image file
792 # Prepare image file
791 if [ "$ENABLE_SPLITFS" = true ] ; then
793 if [ "$ENABLE_SPLITFS" = true ] ; then
792 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count="${TABLE_SECTORS}"
794 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count="${TABLE_SECTORS}"
793 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek="${FRMW_SECTORS}"
795 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek="${FRMW_SECTORS}"
794 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}"
796 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}"
795 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}"
797 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}"
796
798
797 # Write firmware/boot partition tables
799 # Write firmware/boot partition tables
798 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
800 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
799 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
801 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
800 EOM
802 EOM
801
803
802 # Write root partition table
804 # Write root partition table
803 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
805 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
804 ${TABLE_SECTORS},${ROOT_SECTORS},83
806 ${TABLE_SECTORS},${ROOT_SECTORS},83
805 EOM
807 EOM
806
808
807 # Setup temporary loop devices
809 # Setup temporary loop devices
808 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)"
810 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)"
809 ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)"
811 ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)"
810 else # ENABLE_SPLITFS=false
812 else # ENABLE_SPLITFS=false
811 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}"
813 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}"
812 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}"
814 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}"
813
815
814 # Write partition table
816 # Write partition table
815 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
817 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
816 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
818 ${TABLE_SECTORS},${FRMW_SECTORS},c,*
817 ${ROOT_OFFSET},${ROOT_SECTORS},83
819 ${ROOT_OFFSET},${ROOT_SECTORS},83
818 EOM
820 EOM
819
821
820 # Setup temporary loop devices
822 # Setup temporary loop devices
821 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME".img)"
823 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME".img)"
822 ROOT_LOOP="$(losetup -o 65M -f --show "$IMAGE_NAME".img)"
824 ROOT_LOOP="$(losetup -o 65M -f --show "$IMAGE_NAME".img)"
823 fi
825 fi
824
826
825 if [ "$ENABLE_CRYPTFS" = true ] ; then
827 if [ "$ENABLE_CRYPTFS" = true ] ; then
826 # Create dummy ext4 fs
828 # Create dummy ext4 fs
827 mkfs.ext4 "$ROOT_LOOP"
829 mkfs.ext4 "$ROOT_LOOP"
828
830
829 # Setup password keyfile
831 # Setup password keyfile
830 touch .password
832 touch .password
831 chmod 600 .password
833 chmod 600 .password
832 echo -n ${CRYPTFS_PASSWORD} > .password
834 echo -n ${CRYPTFS_PASSWORD} > .password
833
835
834 # Initialize encrypted partition
836 # Initialize encrypted partition
835 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
837 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
836
838
837 # Open encrypted partition and setup mapping
839 # Open encrypted partition and setup mapping
838 cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}"
840 cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}"
839
841
840 # Secure delete password keyfile
842 # Secure delete password keyfile
841 shred -zu .password
843 shred -zu .password
842
844
843 # Update temporary loop device
845 # Update temporary loop device
844 ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}"
846 ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}"
845
847
846 # Wipe encrypted partition (encryption cipher is used for randomness)
848 # Wipe encrypted partition (encryption cipher is used for randomness)
847 dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count="$(blockdev --getsz "${ROOT_LOOP}")"
849 dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count="$(blockdev --getsz "${ROOT_LOOP}")"
848 fi
850 fi
849
851
850 # Build filesystems
852 # Build filesystems
851 mkfs.vfat "$FRMW_LOOP"
853 mkfs.vfat "$FRMW_LOOP"
852 mkfs.ext4 "$ROOT_LOOP"
854 mkfs.ext4 "$ROOT_LOOP"
853
855
854 # Mount the temporary loop devices
856 # Mount the temporary loop devices
855 mkdir -p "$BUILDDIR/mount"
857 mkdir -p "$BUILDDIR/mount"
856 mount "$ROOT_LOOP" "$BUILDDIR/mount"
858 mount "$ROOT_LOOP" "$BUILDDIR/mount"
857
859
858 mkdir -p "$BUILDDIR/mount/boot/firmware"
860 mkdir -p "$BUILDDIR/mount/boot/firmware"
859 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
861 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
860
862
861 # Copy all files from the chroot to the loop device mount point directory
863 # Copy all files from the chroot to the loop device mount point directory
862 rsync -a "${R}/" "$BUILDDIR/mount/"
864 rsync -a "${R}/" "$BUILDDIR/mount/"
863
865
864 # Unmount all temporary loop devices and mount points
866 # Unmount all temporary loop devices and mount points
865 cleanup
867 cleanup
866
868
867 # Create block map file(s) of image(s)
869 # Create block map file(s) of image(s)
868 if [ "$ENABLE_SPLITFS" = true ] ; then
870 if [ "$ENABLE_SPLITFS" = true ] ; then
869 # Create block map files for "bmaptool"
871 # Create block map files for "bmaptool"
870 bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img"
872 bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img"
871 bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img"
873 bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img"
872
874
873 # Image was successfully created
875 # Image was successfully created
874 echo "$IMAGE_NAME-frmw.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
876 echo "$IMAGE_NAME-frmw.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
875 echo "$IMAGE_NAME-root.img ($(expr \( "${TABLE_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
877 echo "$IMAGE_NAME-root.img ($(expr \( "${TABLE_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
876 else
878 else
877 # Create block map file for "bmaptool"
879 # Create block map file for "bmaptool"
878 bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img"
880 bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img"
879
881
880 # Image was successfully created
882 # Image was successfully created
881 echo "$IMAGE_NAME.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
883 echo "$IMAGE_NAME.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
882
884
883 # Create qemu qcow2 image
885 # Create qemu qcow2 image
884 if [ "$ENABLE_QEMU" = true ] ; then
886 if [ "$ENABLE_QEMU" = true ] ; then
885 QEMU_IMAGE=${QEMU_IMAGE:=${BASEDIR}/qemu/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
887 QEMU_IMAGE=${QEMU_IMAGE:=${BASEDIR}/qemu/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
886 QEMU_SIZE=16G
888 QEMU_SIZE=16G
887
889
888 qemu-img convert -f raw -O qcow2 "$IMAGE_NAME".img "$QEMU_IMAGE".qcow2
890 qemu-img convert -f raw -O qcow2 "$IMAGE_NAME".img "$QEMU_IMAGE".qcow2
889 qemu-img resize "$QEMU_IMAGE".qcow2 $QEMU_SIZE
891 qemu-img resize "$QEMU_IMAGE".qcow2 $QEMU_SIZE
890
892
891 echo "$QEMU_IMAGE.qcow2 ($QEMU_SIZE)" ": successfully created"
893 echo "$QEMU_IMAGE.qcow2 ($QEMU_SIZE)" ": successfully created"
892 fi
894 fi
893 fi
895 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant