##// END OF EJS Templates
fixes
burnbabyburn -
r334:2cc58610fbf0
parent child
Show More
@@ -1,101 +1,102
1 1 #!/bin/bash
2 2 #
3 3 # Build and Setup U-Boot
4 4 #
5 5
6 6 # Load utility functions
7 7 . ./functions.sh
8 8
9 9 # Fetch and build U-Boot bootloader
10 10 if [ "$ENABLE_UBOOT" = true ] ; then
11 11 # Install c/c++ build environment inside the chroot
12 12 chroot_install_cc
13 13
14 14 # Copy existing U-Boot sources into chroot directory
15 15 if [ -n "$UBOOTSRC_DIR" ] && [ -d "$UBOOTSRC_DIR" ] ; then
16 16 # Copy local U-Boot sources
17 17 cp -r "${UBOOTSRC_DIR}" "${R}/tmp"
18 18 else
19 19 # Create temporary directory for U-Boot sources
20 20 temp_dir=$(as_nobody mktemp -d)
21 21
22 22 # Fetch U-Boot sources
23 23 as_nobody git -C "${temp_dir}" clone "${UBOOT_URL}"
24 24
25 25 # Copy downloaded U-Boot sources
26 26 mv "${temp_dir}/u-boot" "${R}/tmp/"
27 27
28 28 # Set permissions of the U-Boot sources
29 29 chown -R root:root "${R}/tmp/u-boot"
30 30
31 31 # Remove temporary directory for U-Boot sources
32 32 rm -fr "${temp_dir}"
33 33 fi
34 34
35 35 # Build and install U-Boot inside chroot
36 36 chroot_exec make -j"${KERNEL_THREADS}" -C /tmp/u-boot/ "${UBOOT_CONFIG}" all
37 37
38 38 # Copy compiled bootloader binary and set config.txt to load it
39 39 install_exec "${R}/tmp/u-boot/tools/mkimage" "${R}/usr/sbin/mkimage"
40 40 install_readonly "${R}/tmp/u-boot/u-boot.bin" "${BOOT_DIR}/u-boot.bin"
41 41 printf "\n# boot u-boot kernel\nkernel=u-boot.bin\n" >> "${BOOT_DIR}/config.txt"
42 42
43 43 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
44 44 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
45 45
46 46 if [ "$ENABLE_INITRAMFS" = true ] ; then
47 47 # Convert generated initramfs for U-Boot using mkimage
48 48 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -T ramdisk -C none -n "initramfs-${KERNEL_VERSION}" -d "/boot/firmware/initramfs-${KERNEL_VERSION}" "/boot/firmware/initramfs-${KERNEL_VERSION}.uboot"
49 49
50 50 # Remove original initramfs file
51 51 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
52 52
53 53 # Configure U-Boot to load generated initramfs
54 54 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
55 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
55 56 else # ENABLE_INITRAMFS=false
56 57 # Remove initramfs from U-Boot mkfile
57 58 sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage"
58 59
59 60 if [ "$BUILD_KERNEL" = false ] ; then
60 61 # Remove dtbfile from U-Boot mkfile
61 62 sed -i '/.*dtbfile.*/d' "${BOOT_DIR}/uboot.mkimage"
62 63 printf "\nbootz \${kernel_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
63 64 else
64 65 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
65 66 fi
66 67 fi
67 68
68 69 if [ "$SET_ARCH" = 64 ] ; then
69 70 echo "Setting up config.txt to boot 64bit uboot"
70 71
71 72 printf "\n# 64bit-mode" >> "${BOOT_DIR}/config.txt"
72 73 printf "\n# arm_control=0x200 is deprecated https://www.raspberrypi.org/documentation/configuration/config-txt/misc.md" >> "${BOOT_DIR}/config.txt"
73 74 printf "\narm_64bit=1" >> "${BOOT_DIR}/config.txt"
74 75 sed -i "s|bootz|booti|g" "${BOOT_DIR}/uboot.mkimage"
75 76 fi
76 77
77 78 # instead of sd, boot from usb device
78 79 if [ "$ENABLE_UBOOTUSB" = true ] ; then
79 80 sed -i "s|mmc|usb|g" "${BOOT_DIR}/uboot.mkimage"
80 81 fi
81 82
82 83 # Set mkfile to use the correct mach id
83 84 if [ "$ENABLE_QEMU" = true ] ; then
84 85 sed -i "s/^\(setenv machid \).*/\10x000008e0/" "${BOOT_DIR}/uboot.mkimage"
85 86 fi
86 87
87 88 # Set mkfile to use the correct dtb file
88 89 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
89 90
90 91 # Set mkfile to use kernel image
91 92 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage"
92 93
93 94 # Remove all leading blank lines
94 95 sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage"
95 96
96 97 # Generate U-Boot bootloader image
97 98 chroot_exec /usr/sbin/mkimage -A "${KERNEL_ARCH}" -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "RPi${RPI_MODEL}" -d /boot/firmware/uboot.mkimage /boot/firmware/boot.scr
98 99
99 100 # Remove U-Boot sources
100 101 rm -fr "${R}/tmp/u-boot"
101 102 fi
@@ -1,784 +1,784
1 1 #!/bin/bash
2 2 ########################################################################
3 3 # rpi23-gen-image.sh 2015-2017
4 4 #
5 5 # Advanced Debian "stretch" and "buster" bootstrap script for RPi2/3
6 6 #
7 7 # This program is free software; you can redistribute it and/or
8 8 # modify it under the terms of the GNU General Public License
9 9 # as published by the Free Software Foundation; either version 2
10 10 # of the License, or (at your option) any later version.
11 11 #
12 12 # Copyright (C) 2015 Jan Wagner <mail@jwagner.eu>
13 13 #
14 14 # Big thanks for patches and enhancements by 20+ github contributors!
15 15 ########################################################################
16 16
17 17 # Are we running as root?
18 18 if [ "$(id -u)" -ne "0" ] ; then
19 19 echo "error: this script must be executed with root privileges!"
20 20 exit 1
21 21 fi
22 22
23 23 # Check if ./functions.sh script exists
24 24 if [ ! -r "./functions.sh" ] ; then
25 25 echo "error: './functions.sh' required script not found!"
26 26 exit 1
27 27 fi
28 28
29 29 # Load utility functions
30 30 . ./functions.sh
31 31
32 32 # Load parameters from configuration template file
33 33 if [ -n "$CONFIG_TEMPLATE" ] ; then
34 34 use_template
35 35 fi
36 36
37 37 # Introduce settings
38 38 set -e
39 39 echo -n -e "\n#\n# RPi2/3 Bootstrap Settings\n#\n"
40 40 set -x
41 41
42 42 # Raspberry Pi model configuration
43 43 export RPI_MODEL=${RPI_MODEL:=2}
44 44
45 45 # Debian release
46 46 export RELEASE=${RELEASE:=buster}
47 47
48 48 #Kernel Branch
49 49 export KERNEL_BRANCH=${KERNEL_BRANCH:=""}
50 50
51 51 # URLs
52 52 export KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux}
53 53 export FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/master/boot}
54 54 export WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm}
55 55 export FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git}
56 56 export UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git}
57 57
58 58 # Firmware directory: Blank if download from github
59 59 export RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
60 60
61 61 # Build directories
62 62 export BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}
63 63 export BUILDDIR="${BASEDIR}/build"
64 64
65 65 # Prepare date string for default image file name
66 66 DATE="$(date +%Y-%m-%d)"
67 67 if [ -z "$KERNEL_BRANCH" ] ; then
68 68 export IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
69 69 else
70 70 export IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
71 71 fi
72 72
73 73 # Chroot directories
74 74 export R="${BUILDDIR}/chroot"
75 75 export ETC_DIR="${R}/etc"
76 76 export LIB_DIR="${R}/lib"
77 77 export BOOT_DIR="${R}/boot/firmware"
78 78 export KERNEL_DIR="${R}/usr/src/linux"
79 79 export WLAN_FIRMWARE_DIR="${R}/lib/firmware/brcm"
80 80
81 81 # General settings
82 82 export SET_ARCH=${SET_ARCH:=32}
83 83 export HOSTNAME=${HOSTNAME:=rpi${RPI_MODEL}-${RELEASE}}
84 84 export PASSWORD=${PASSWORD:=raspberry}
85 85 export USER_PASSWORD=${USER_PASSWORD:=raspberry}
86 86 export DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"}
87 87 export TIMEZONE=${TIMEZONE:="Europe/Berlin"}
88 88 export EXPANDROOT=${EXPANDROOT:=true}
89 89
90 90 # Keyboard settings
91 91 export XKB_MODEL=${XKB_MODEL:=""}
92 92 export XKB_LAYOUT=${XKB_LAYOUT:=""}
93 93 export XKB_VARIANT=${XKB_VARIANT:=""}
94 94 export XKB_OPTIONS=${XKB_OPTIONS:=""}
95 95
96 96 # Network settings (DHCP)
97 97 export ENABLE_DHCP=${ENABLE_DHCP:=true}
98 98
99 99 # Network settings (static)
100 100 export NET_ADDRESS=${NET_ADDRESS:=""}
101 101 export NET_GATEWAY=${NET_GATEWAY:=""}
102 102 export NET_DNS_1=${NET_DNS_1:=""}
103 103 export NET_DNS_2=${NET_DNS_2:=""}
104 104 export NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""}
105 105 export NET_NTP_1=${NET_NTP_1:=""}
106 106 export NET_NTP_2=${NET_NTP_2:=""}
107 107
108 108 # APT settings
109 109 export APT_PROXY=${APT_PROXY:=""}
110 110 export APT_SERVER=${APT_SERVER:="ftp.debian.org"}
111 111
112 112 # Feature settings
113 113 export ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
114 114 export ENABLE_I2C=${ENABLE_I2C:=false}
115 115 export ENABLE_SPI=${ENABLE_SPI:=false}
116 116 export ENABLE_IPV6=${ENABLE_IPV6:=true}
117 117 export ENABLE_SSHD=${ENABLE_SSHD:=true}
118 118 export ENABLE_NONFREE=${ENABLE_NONFREE:=false}
119 119 export ENABLE_WIRELESS=${ENABLE_WIRELESS:=false}
120 120 export ENABLE_SOUND=${ENABLE_SOUND:=true}
121 121 export ENABLE_DBUS=${ENABLE_DBUS:=true}
122 122 export ENABLE_HWRANDOM=${ENABLE_HWRANDOM:=true}
123 123 export ENABLE_MINGPU=${ENABLE_MINGPU:=false}
124 124 export ENABLE_XORG=${ENABLE_XORG:=false}
125 125 export ENABLE_WM=${ENABLE_WM:=""}
126 126 export ENABLE_RSYSLOG=${ENABLE_RSYSLOG:=true}
127 127 export ENABLE_USER=${ENABLE_USER:=true}
128 128 export USER_NAME=${USER_NAME:="pi"}
129 129 export ENABLE_ROOT=${ENABLE_ROOT:=false}
130 130 export ENABLE_QEMU=${ENABLE_QEMU:=false}
131 131
132 132 # SSH settings
133 133 export SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false}
134 134 export SSH_DISABLE_PASSWORD_AUTH=${SSH_DISABLE_PASSWORD_AUTH:=false}
135 135 export SSH_LIMIT_USERS=${SSH_LIMIT_USERS:=false}
136 136 export SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""}
137 137 export SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""}
138 138
139 139 # Advanced settings
140 140 export ENABLE_MINBASE=${ENABLE_MINBASE:=false}
141 141 export ENABLE_REDUCE=${ENABLE_REDUCE:=false}
142 142 export ENABLE_UBOOT=${ENABLE_UBOOT:=false}
143 143 export UBOOTSRC_DIR=${UBOOTSRC_DIR:=""}
144 144 export ENABLE_UBOOTUSB=${ENABLE_UBOOTUSB=false}
145 145 export ENABLE_FBTURBO=${ENABLE_FBTURBO:=false}
146 146 export FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""}
147 147 export ENABLE_HARDNET=${ENABLE_HARDNET:=false}
148 148 export ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
149 149 export ENABLE_SPLITFS=${ENABLE_SPLITFS:=false}
150 150 export ENABLE_INITRAMFS=${ENABLE_INITRAMFS:=false}
151 151 export ENABLE_IFNAMES=${ENABLE_IFNAMES:=true}
152 152 export DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS:=}
153 153
154 154 # Kernel compilation settings
155 155 export BUILD_KERNEL=${BUILD_KERNEL:=true}
156 156 export KERNEL_REDUCE=${KERNEL_REDUCE:=false}
157 157 export KERNEL_THREADS=${KERNEL_THREADS:=1}
158 158 export KERNEL_HEADERS=${KERNEL_HEADERS:=true}
159 159 export KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false}
160 160 export KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true}
161 161 export KERNEL_OLDDEFCONFIG=${KERNEL_OLDDEFCONFIG:=false}
162 162 export KERNEL_CCACHE=${KERNEL_CCACHE:=false}
163 163
164 164 # Kernel compilation from source directory settings
165 165 export KERNELSRC_DIR=${KERNELSRC_DIR:=""}
166 166 export KERNELSRC_CLEAN=${KERNELSRC_CLEAN:=false}
167 167 export KERNELSRC_CONFIG=${KERNELSRC_CONFIG:=true}
168 168 export KERNELSRC_PREBUILT=${KERNELSRC_PREBUILT:=false}
169 169
170 170 # Reduce disk usage settings
171 171 export REDUCE_APT=${REDUCE_APT:=true}
172 172 export REDUCE_DOC=${REDUCE_DOC:=true}
173 173 export REDUCE_MAN=${REDUCE_MAN:=true}
174 174 export REDUCE_VIM=${REDUCE_VIM:=false}
175 175 export REDUCE_BASH=${REDUCE_BASH:=false}
176 176 export REDUCE_HWDB=${REDUCE_HWDB:=true}
177 177 export REDUCE_SSHD=${REDUCE_SSHD:=true}
178 178 export REDUCE_LOCALE=${REDUCE_LOCALE:=true}
179 179
180 180 # Encrypted filesystem settings
181 181 ENABLE_CRYPTFS=${ENABLE_CRYPTFS:=false}
182 182 CRYPTFS_PASSWORD=${CRYPTFS_PASSWORD:=""}
183 183 CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"}
184 184 CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"}
185 185 CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512}
186 186
187 187 # Chroot scripts directory
188 188 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
189 189
190 190 # Packages required in the chroot build environment
191 191 export APT_INCLUDES=${APT_INCLUDES:=""}
192 192 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup"
193 193
194 194 # Packages required for bootstrapping
195 195 export REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo netselect-apt"
196 196 export MISSING_PACKAGES=""
197 197
198 198 # Packages installed for c/c++ build environment in chroot (keep empty)
199 199 export COMPILER_PACKAGES=""
200 200
201 201 #autconfigure best apt server to not spam ftp.debian.org
202 202 #rm files/apt/sources.list
203 203 #netselect-apt does not know buster yet
204 204 if [ "$RELEASE" = "buster" ] ; then
205 205 RLS=testing
206 206 else
207 207 RLS="$RELEASE"
208 208 fi
209 209
210 210 if [ -f "$(pwd)/files/apt/sources.list" ] ; then
211 211 rm "$(pwd)/files/apt/sources.list"
212 212 fi
213 213
214 214 if [ "$ENABLE_NONFREE" = true ] ; then
215 215 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "$(pwd)/files/apt/sources.list" -d "$RLS"
216 216 else
217 217 netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS"
218 218 fi
219 219 APT_SERVER=$(grep -m 1 http files/apt/sources.list | sed "s|http://| |g" | cut -d ' ' -f 3)
220 220 APT_SERVER=${APT_SERVER::-1}
221 221
222 222 #make script easier and more stable to use with convenient setup switch. Just setup SET_ARCH and RPI_MODEL and your good to go!
223 223 if [ -n "$SET_ARCH" ] ; then
224 224 echo "Setting Architecture specific settings"
225 225 ##################################
226 226 # 64 bit config
227 227 ##################################
228 228 if [ "$SET_ARCH" = 64 ] ; then
229 229 echo "64 bit mode selected - Setting up enviroment"
230 230 # 64 bit depended settings
231 231 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
232 232 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
233 233 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
234 234
235 235 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
236 236 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
237 237 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
238 238 RELEASE_ARCH=${RELEASE_ARCH:=arm64}
239 239 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
240 240 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
241 241 else
242 242 echo "error: At the moment Raspberry PI 3 and 3B+ are the only Models which support 64bit"
243 243 exit 1
244 244 fi
245 245 fi
246 246
247 247 ##################################
248 248 # 32 bit config
249 249 ##################################
250 250 if [ "$SET_ARCH" = 32 ] ; then
251 251 echo "32 bit mode selected - Setting up enviroment"
252 252 #General 32bit configuration
253 253 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
254 254 KERNEL_ARCH=${KERNEL_ARCH:=arm}
255 255 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
256 256
257 257 #Raspberry setting grouped by board compability
258 258 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
259 259 echo "Setting settings for bcm2835 Raspberry PI boards"
260 260 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
261 261 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
262 262 RELEASE_ARCH=${RELEASE_ARCH:=armel}
263 263 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel.img}
264 264 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
265 265 fi
266 266 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
267 267 echo "Setting settings for bcm2837 Raspberry PI boards"
268 268 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
269 269 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
270 270 RELEASE_ARCH=${RELEASE_ARCH:=armhf}
271 271 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img}
272 272 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-}
273 273 fi
274 274 fi
275 275 #SET_ARCH not set
276 276 else
277 277 echo "error: Please set '32' or '64' as value for SET_ARCH"
278 278 exit 1
279 279 fi
280 280
281 281 #Device specific configuration
282 282 echo "Select DTB-File"
283 283 case "$RPI_MODEL" in
284 284 0)
285 285 DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb}
286 286 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
287 287 ;;
288 288 1)
289 289 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb}
290 290 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
291 291 ;;
292 292 1P)
293 293 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb}
294 294 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
295 295 ;;
296 296 2)
297 297 DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb}
298 298 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig}
299 299 ;;
300 300 3)
301 301 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
302 302 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
303 303 ;;
304 304 3P)
305 305 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
306 306 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
307 307 ;;
308 308 *)
309 309 echo "error: Raspberry Pi model $RPI_MODEL is not supported!"
310 310 exit 1
311 311 ;;
312 312 esac
313 313 echo "$DTB_FILE selected"
314 314
315 315 #DEBUG off
316 316 set +x
317 317
318 318 # Check if the internal wireless interface is supported by the RPi model
319 319 if [ "$ENABLE_WIRELESS" = true ] ; then
320 320 if [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 2 ] ; then
321 321 echo "error: The selected Raspberry Pi model has no internal wireless interface"
322 322 exit 1
323 323 else
324 324 echo "Raspberry Pi $RPI_MODEL has WIFI support"
325 325 fi
326 326 fi
327 327
328 328 # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported
329 329 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
330 330 if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then
331 331 echo "error: DISABLE_UNDERVOLT_WARNINGS=${DISABLE_UNDERVOLT_WARNINGS} is not supported"
332 332 exit 1
333 333 fi
334 334 fi
335 335
336 336 # Add libncurses5 to enable kernel menuconfig
337 337 if [ "$KERNEL_MENUCONFIG" = true ] ; then
338 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses5-dev"
338 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses-dev"
339 339 fi
340 340
341 341 # Add ccache compiler cache for (faster) kernel cross (re)compilation
342 342 if [ "$KERNEL_CCACHE" = true ] ; then
343 343 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ccache"
344 344 fi
345 345
346 346 # Add cryptsetup package to enable filesystem encryption
347 347 if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
348 348 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup"
349 349 APT_INCLUDES="${APT_INCLUDES},cryptsetup,busybox,console-setup"
350 350
351 351 if [ -z "$CRYPTFS_PASSWORD" ] ; then
352 352 echo "error: no password defined (CRYPTFS_PASSWORD)!"
353 353 exit 1
354 354 fi
355 355 ENABLE_INITRAMFS=true
356 356 fi
357 357
358 358 # Add initramfs generation tools
359 359 if [ "$ENABLE_INITRAMFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then
360 360 APT_INCLUDES="${APT_INCLUDES},initramfs-tools"
361 361 fi
362 362
363 363 # Add device-tree-compiler required for building the U-Boot bootloader
364 364 if [ "$ENABLE_UBOOT" = true ] ; then
365 365 APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc"
366 366 else
367 367 if [ "$ENABLE_UBOOTUSB" = true ] ; then
368 368 echo "error: Enabling UBOOTUSB requires u-boot to be enabled"
369 369 exit 1
370 370 fi
371 371 fi
372 372
373 373 # Check if root SSH (v2) public key file exists
374 374 if [ -n "$SSH_ROOT_PUB_KEY" ] ; then
375 375 if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then
376 376 echo "error: '$SSH_ROOT_PUB_KEY' specified SSH public key file not found (SSH_ROOT_PUB_KEY)!"
377 377 exit 1
378 378 fi
379 379 fi
380 380
381 381 # Check if $USER_NAME SSH (v2) public key file exists
382 382 if [ -n "$SSH_USER_PUB_KEY" ] ; then
383 383 if [ ! -f "$SSH_USER_PUB_KEY" ] ; then
384 384 echo "error: '$SSH_USER_PUB_KEY' specified SSH public key file not found (SSH_USER_PUB_KEY)!"
385 385 exit 1
386 386 fi
387 387 fi
388 388
389 389 # Check if all required packages are installed on the build system
390 390 for package in $REQUIRED_PACKAGES ; do
391 391 if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then
392 392 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
393 393 fi
394 394 done
395 395
396 396 # If there are missing packages ask confirmation for install, or exit
397 397 if [ -n "$MISSING_PACKAGES" ] ; then
398 398 echo "the following packages needed by this script are not installed:"
399 399 echo "$MISSING_PACKAGES"
400 400
401 401 printf "\ndo you want to install the missing packages right now? [y/n] "
402 402 read -r confirm
403 403 [ "$confirm" != "y" ] && exit 1
404 404
405 405 # Make sure all missing required packages are installed
406 406 apt-get -qq -y install "${MISSING_PACKAGES}"
407 407 fi
408 408
409 409 # Check if ./bootstrap.d directory exists
410 410 if [ ! -d "./bootstrap.d/" ] ; then
411 411 echo "error: './bootstrap.d' required directory not found!"
412 412 exit 1
413 413 fi
414 414
415 415 # Check if ./files directory exists
416 416 if [ ! -d "./files/" ] ; then
417 417 echo "error: './files' required directory not found!"
418 418 exit 1
419 419 fi
420 420
421 421 # Check if specified KERNELSRC_DIR directory exists
422 422 if [ -n "$KERNELSRC_DIR" ] && [ ! -d "$KERNELSRC_DIR" ] ; then
423 423 echo "error: '${KERNELSRC_DIR}' specified directory not found (KERNELSRC_DIR)!"
424 424 exit 1
425 425 fi
426 426
427 427 # Check if specified UBOOTSRC_DIR directory exists
428 428 if [ -n "$UBOOTSRC_DIR" ] && [ ! -d "$UBOOTSRC_DIR" ] ; then
429 429 echo "error: '${UBOOTSRC_DIR}' specified directory not found (UBOOTSRC_DIR)!"
430 430 exit 1
431 431 fi
432 432
433 433 # Check if specified FBTURBOSRC_DIR directory exists
434 434 if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then
435 435 echo "error: '${FBTURBOSRC_DIR}' specified directory not found (FBTURBOSRC_DIR)!"
436 436 exit 1
437 437 fi
438 438
439 439 # Check if specified CHROOT_SCRIPTS directory exists
440 440 if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
441 441 echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
442 442 exit 1
443 443 fi
444 444
445 445 # Check if specified device mapping already exists (will be used by cryptsetup)
446 446 if [ -r "/dev/mapping/${CRYPTFS_MAPPING}" ] ; then
447 447 echo "error: mapping /dev/mapping/${CRYPTFS_MAPPING} already exists, not proceeding"
448 448 exit 1
449 449 fi
450 450
451 451 # Don't clobber an old build
452 452 if [ -e "$BUILDDIR" ] ; then
453 453 echo "error: directory ${BUILDDIR} already exists, not proceeding"
454 454 exit 1
455 455 fi
456 456
457 457 # Setup chroot directory
458 458 mkdir -p "${R}"
459 459
460 460 # Check if build directory has enough of free disk space >512MB
461 461 if [ "$(df --output=avail "${BUILDDIR}" | sed "1d")" -le "524288" ] ; then
462 462 echo "error: ${BUILDDIR} not enough space left to generate the output image!"
463 463 exit 1
464 464 fi
465 465
466 466 # Call "cleanup" function on various signals and errors
467 467 trap cleanup 0 1 2 3 6
468 468
469 469 # Add required packages for the minbase installation
470 470 if [ "$ENABLE_MINBASE" = true ] ; then
471 471 APT_INCLUDES="${APT_INCLUDES},vim-tiny,netbase,net-tools,ifupdown"
472 472 fi
473 473
474 474 # Add parted package, required to get partprobe utility
475 475 if [ "$EXPANDROOT" = true ] ; then
476 476 APT_INCLUDES="${APT_INCLUDES},parted"
477 477 fi
478 478
479 479 # Add dbus package, recommended if using systemd
480 480 if [ "$ENABLE_DBUS" = true ] ; then
481 481 APT_INCLUDES="${APT_INCLUDES},dbus"
482 482 fi
483 483
484 484 # Add iptables IPv4/IPv6 package
485 485 if [ "$ENABLE_IPTABLES" = true ] ; then
486 486 APT_INCLUDES="${APT_INCLUDES},iptables,iptables-persistent"
487 487 fi
488 488
489 489 # Add openssh server package
490 490 if [ "$ENABLE_SSHD" = true ] ; then
491 491 APT_INCLUDES="${APT_INCLUDES},openssh-server"
492 492 fi
493 493
494 494 # Add alsa-utils package
495 495 if [ "$ENABLE_SOUND" = true ] ; then
496 496 APT_INCLUDES="${APT_INCLUDES},alsa-utils"
497 497 fi
498 498
499 499 # Add rng-tools package
500 500 if [ "$ENABLE_HWRANDOM" = true ] ; then
501 501 APT_INCLUDES="${APT_INCLUDES},rng-tools"
502 502 fi
503 503
504 504 # Add fbturbo video driver
505 505 if [ "$ENABLE_FBTURBO" = true ] ; then
506 506 # Enable xorg package dependencies
507 507 ENABLE_XORG=true
508 508 fi
509 509
510 510 # Add user defined window manager package
511 511 if [ -n "$ENABLE_WM" ] ; then
512 512 APT_INCLUDES="${APT_INCLUDES},${ENABLE_WM}"
513 513
514 514 # Enable xorg package dependencies
515 515 ENABLE_XORG=true
516 516 fi
517 517
518 518 # Add xorg package
519 519 if [ "$ENABLE_XORG" = true ] ; then
520 520 APT_INCLUDES="${APT_INCLUDES},xorg,dbus-x11"
521 521 fi
522 522
523 523 # Replace selected packages with smaller clones
524 524 if [ "$ENABLE_REDUCE" = true ] ; then
525 525 # Add levee package instead of vim-tiny
526 526 if [ "$REDUCE_VIM" = true ] ; then
527 527 APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
528 528 fi
529 529
530 530 # Add dropbear package instead of openssh-server
531 531 if [ "$REDUCE_SSHD" = true ] ; then
532 532 APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")"
533 533 fi
534 534 fi
535 535
536 536 # Configure kernel sources if no KERNELSRC_DIR
537 537 if [ "$BUILD_KERNEL" = true ] && [ -z "$KERNELSRC_DIR" ] ; then
538 538 KERNELSRC_CONFIG=true
539 539 fi
540 540
541 541 # Configure reduced kernel
542 542 if [ "$KERNEL_REDUCE" = true ] ; then
543 543 KERNELSRC_CONFIG=false
544 544 fi
545 545
546 546 set -x
547 547
548 548 # Execute bootstrap scripts
549 549 for SCRIPT in bootstrap.d/*.sh; do
550 550 head -n 4 "$SCRIPT"
551 551 . "$SCRIPT"
552 552 done
553 553
554 554 ## Execute custom bootstrap scripts
555 555 if [ -d "custom.d" ] ; then
556 556 for SCRIPT in custom.d/*.sh; do
557 557 . "$SCRIPT"
558 558 done
559 559 fi
560 560
561 561 # Execute custom scripts inside the chroot
562 562 if [ -n "$CHROOT_SCRIPTS" ] && [ -d "$CHROOT_SCRIPTS" ] ; then
563 563 cp -r "${CHROOT_SCRIPTS}" "${R}/chroot_scripts"
564 564 chroot_exec /bin/bash -x <<'EOF'
565 565 for SCRIPT in /chroot_scripts/* ; do
566 566 if [ -f $SCRIPT -a -x $SCRIPT ] ; then
567 567 $SCRIPT
568 568 fi
569 569 done
570 570 EOF
571 571 rm -rf "${R}/chroot_scripts"
572 572 fi
573 573
574 574 # Remove c/c++ build environment from the chroot
575 575 chroot_remove_cc
576 576
577 577 # Generate required machine-id
578 578 MACHINE_ID=$(dbus-uuidgen)
579 579 echo -n "${MACHINE_ID}" > "${R}/var/lib/dbus/machine-id"
580 580 echo -n "${MACHINE_ID}" > "${ETC_DIR}/machine-id"
581 581
582 582 # APT Cleanup
583 583 chroot_exec apt-get -y clean
584 584 chroot_exec apt-get -y autoclean
585 585 chroot_exec apt-get -y autoremove
586 586
587 587 # Unmount mounted filesystems
588 588 umount -l "${R}/proc"
589 589 umount -l "${R}/sys"
590 590
591 591 # Clean up directories
592 592 rm -rf "${R}/run/*"
593 593 rm -rf "${R}/tmp/*"
594 594
595 595 # Clean up files
596 596 rm -f "${ETC_DIR}/ssh/ssh_host_*"
597 597 rm -f "${ETC_DIR}/dropbear/dropbear_*"
598 598 rm -f "${ETC_DIR}/apt/sources.list.save"
599 599 rm -f "${ETC_DIR}/resolvconf/resolv.conf.d/original"
600 600 rm -f "${ETC_DIR}/*-"
601 601 rm -f "${ETC_DIR}/apt/apt.conf.d/10proxy"
602 602 rm -f "${ETC_DIR}/resolv.conf"
603 603 rm -f "${R}/root/.bash_history"
604 604 rm -f "${R}/var/lib/urandom/random-seed"
605 605 rm -f "${R}/initrd.img"
606 606 rm -f "${R}/vmlinuz"
607 607 rm -f "${R}${QEMU_BINARY}"
608 608
609 609 if [ "$ENABLE_QEMU" = true ] ; then
610 610 # Configure qemu compatible kernel
611 611 DTB_FILE=vexpress-v2p-ca15_a7.dtb
612 612 UBOOT_CONFIG=vexpress_ca15_tc2_defconfig
613 613 KERNEL_DEFCONFIG="vexpress_defconfig"
614 614 if [ "$KERNEL_MENUCONFIG" = false ] ; then
615 615 KERNEL_OLDDEFCONFIG=true
616 616 fi
617 617
618 618 # Setup QEMU directory
619 619 mkdir "${BASEDIR}/qemu"
620 620
621 621 # Copy kernel image to QEMU directory
622 622 install_readonly "${BOOT_DIR}/${KERNEL_IMAGE}" "${BASEDIR}/qemu/${KERNEL_IMAGE}"
623 623
624 624 # Copy kernel config to QEMU directory
625 625 install_readonly "${R}/boot/config-${KERNEL_VERSION}" "${BASEDIR}/qemu/config-${KERNEL_VERSION}"
626 626
627 627 # Copy kernel dtbs to QEMU directory
628 628 for dtb in "${BOOT_DIR}/"*.dtb ; do
629 629 if [ -f "${dtb}" ] ; then
630 630 install_readonly "${dtb}" "${BASEDIR}/qemu/"
631 631 fi
632 632 done
633 633
634 634 # Copy kernel overlays to QEMU directory
635 635 if [ -d "${BOOT_DIR}/overlays" ] ; then
636 636 # Setup overlays dtbs directory
637 637 mkdir "${BASEDIR}/qemu/overlays"
638 638
639 639 for dtb in "${BOOT_DIR}/overlays/"*.dtb ; do
640 640 if [ -f "${dtb}" ] ; then
641 641 install_readonly "${dtb}" "${BASEDIR}/qemu/overlays/"
642 642 fi
643 643 done
644 644 fi
645 645
646 646 # Copy u-boot files to QEMU directory
647 647 if [ "$ENABLE_UBOOT" = true ] ; then
648 648 if [ -f "${BOOT_DIR}/u-boot.bin" ] ; then
649 649 install_readonly "${BOOT_DIR}/u-boot.bin" "${BASEDIR}/qemu/u-boot.bin"
650 650 fi
651 651 if [ -f "${BOOT_DIR}/uboot.mkimage" ] ; then
652 652 install_readonly "${BOOT_DIR}/uboot.mkimage" "${BASEDIR}/qemu/uboot.mkimage"
653 653 fi
654 654 if [ -f "${BOOT_DIR}/boot.scr" ] ; then
655 655 install_readonly "${BOOT_DIR}/boot.scr" "${BASEDIR}/qemu/boot.scr"
656 656 fi
657 657 fi
658 658
659 659 # Copy initramfs to QEMU directory
660 660 if [ -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" ] ; then
661 661 install_readonly "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" "${BASEDIR}/qemu/initramfs-${KERNEL_VERSION}"
662 662 fi
663 663 fi
664 664
665 665 # Calculate size of the chroot directory in KB
666 666 CHROOT_SIZE=$(expr "$(du -s "${R}" | awk '{ print $1 }')")
667 667
668 668 # Calculate the amount of needed 512 Byte sectors
669 669 TABLE_SECTORS=$(expr 1 \* 1024 \* 1024 \/ 512)
670 670 FRMW_SECTORS=$(expr 64 \* 1024 \* 1024 \/ 512)
671 671 ROOT_OFFSET=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}")
672 672
673 673 # The root partition is EXT4
674 674 # This means more space than the actual used space of the chroot is used.
675 675 # As overhead for journaling and reserved blocks 35% are added.
676 676 ROOT_SECTORS=$(expr "$(expr "${CHROOT_SIZE}" + "${CHROOT_SIZE}" \/ 100 \* 35)" \* 1024 \/ 512)
677 677
678 678 # Calculate required image size in 512 Byte sectors
679 679 IMAGE_SECTORS=$(expr "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}")
680 680
681 681 # Prepare image file
682 682 if [ "$ENABLE_SPLITFS" = true ] ; then
683 683 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count="${TABLE_SECTORS}"
684 684 dd if=/dev/zero of="$IMAGE_NAME-frmw.img" bs=512 count=0 seek="${FRMW_SECTORS}"
685 685 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}"
686 686 dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}"
687 687
688 688 # Write firmware/boot partition tables
689 689 sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
690 690 "${TABLE_SECTORS}","${FRMW_SECTORS}",c,*
691 691 EOM
692 692
693 693 # Write root partition table
694 694 sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
695 695 "${TABLE_SECTORS}","${ROOT_SECTORS}",83
696 696 EOM
697 697
698 698 # Setup temporary loop devices
699 699 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)"
700 700 ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)"
701 701 else # ENABLE_SPLITFS=false
702 702 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}"
703 703 dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}"
704 704
705 705 # Write partition table
706 706 sfdisk -q -L -uS -f "$IMAGE_NAME.img" 2> /dev/null <<EOM
707 707 "${TABLE_SECTORS}","${FRMW_SECTORS}",c,*
708 708 "${ROOT_OFFSET}","${ROOT_SECTORS}",83
709 709 EOM
710 710
711 711 # Setup temporary loop devices
712 712 FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME".img)"
713 713 ROOT_LOOP="$(losetup -o 65M -f --show "$IMAGE_NAME".img)"
714 714 fi
715 715
716 716 if [ "$ENABLE_CRYPTFS" = true ] ; then
717 717 # Create dummy ext4 fs
718 718 mkfs.ext4 "$ROOT_LOOP"
719 719
720 720 # Setup password keyfile
721 721 touch .password
722 722 chmod 600 .password
723 723 echo -n "${CRYPTFS_PASSWORD}" > .password
724 724
725 725 # Initialize encrypted partition
726 726 echo "YES" | cryptsetup luksFormat "${ROOT_LOOP}" -c "${CRYPTFS_CIPHER}" -s "${CRYPTFS_XTSKEYSIZE}" .password
727 727
728 728 # Open encrypted partition and setup mapping
729 729 cryptsetup luksOpen "${ROOT_LOOP}" -d .password "${CRYPTFS_MAPPING}"
730 730
731 731 # Secure delete password keyfile
732 732 shred -zu .password
733 733
734 734 # Update temporary loop device
735 735 ROOT_LOOP="/dev/mapper/${CRYPTFS_MAPPING}"
736 736
737 737 # Wipe encrypted partition (encryption cipher is used for randomness)
738 738 dd if=/dev/zero of="${ROOT_LOOP}" bs=512 count="$(blockdev --getsz "${ROOT_LOOP}")"
739 739 fi
740 740
741 741 # Build filesystems
742 742 mkfs.vfat "$FRMW_LOOP"
743 743 mkfs.ext4 "$ROOT_LOOP"
744 744
745 745 # Mount the temporary loop devices
746 746 mkdir -p "$BUILDDIR/mount"
747 747 mount "$ROOT_LOOP" "$BUILDDIR/mount"
748 748
749 749 mkdir -p "$BUILDDIR/mount/boot/firmware"
750 750 mount "$FRMW_LOOP" "$BUILDDIR/mount/boot/firmware"
751 751
752 752 # Copy all files from the chroot to the loop device mount point directory
753 753 rsync -a "${R}/" "$BUILDDIR/mount/"
754 754
755 755 # Unmount all temporary loop devices and mount points
756 756 cleanup
757 757
758 758 # Create block map file(s) of image(s)
759 759 if [ "$ENABLE_SPLITFS" = true ] ; then
760 760 # Create block map files for "bmaptool"
761 761 bmaptool create -o "$IMAGE_NAME-frmw.bmap" "$IMAGE_NAME-frmw.img"
762 762 bmaptool create -o "$IMAGE_NAME-root.bmap" "$IMAGE_NAME-root.img"
763 763
764 764 # Image was successfully created
765 765 echo "$IMAGE_NAME-frmw.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
766 766 echo "$IMAGE_NAME-root.img ($(expr \( "${TABLE_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
767 767 else
768 768 # Create block map file for "bmaptool"
769 769 bmaptool create -o "$IMAGE_NAME.bmap" "$IMAGE_NAME.img"
770 770
771 771 # Image was successfully created
772 772 echo "$IMAGE_NAME.img ($(expr \( "${TABLE_SECTORS}" + "${FRMW_SECTORS}" + "${ROOT_SECTORS}" \) \* 512 \/ 1024 \/ 1024)M)" ": successfully created"
773 773
774 774 # Create qemu qcow2 image
775 775 if [ "$ENABLE_QEMU" = true ] ; then
776 776 QEMU_IMAGE=${QEMU_IMAGE:=${BASEDIR}/qemu/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
777 777 QEMU_SIZE=16G
778 778
779 779 qemu-img convert -f raw -O qcow2 "$IMAGE_NAME".img "$QEMU_IMAGE".qcow2
780 780 qemu-img resize "$QEMU_IMAGE".qcow2 $QEMU_SIZE
781 781
782 782 echo "$QEMU_IMAGE.qcow2 ($QEMU_SIZE)" ": successfully created"
783 783 fi
784 784 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant