|
@@
-45,7
+45,7
RPI_MODEL=${RPI_MODEL:=3P}
|
|
45
|
# Debian release
|
|
45
|
# Debian release
|
|
46
|
RELEASE=${RELEASE:=buster}
|
|
46
|
RELEASE=${RELEASE:=buster}
|
|
47
|
if [ $RELEASE = "bullseye" ] ; then
|
|
47
|
if [ $RELEASE = "bullseye" ] ; then
|
|
48
|
RELEASE=testing
|
|
48
|
RELEASE=testing
|
|
49
|
fi
|
|
49
|
fi
|
|
50
|
|
|
50
|
|
|
51
|
# Kernel Branch
|
|
51
|
# Kernel Branch
|
|
@@
-270,14
+270,14
fi
|
|
270
|
|
|
270
|
|
|
271
|
# Setup architecture specific settings
|
|
271
|
# Setup architecture specific settings
|
|
272
|
if [ -n "$SET_ARCH" ] ; then
|
|
272
|
if [ -n "$SET_ARCH" ] ; then
|
|
273
|
# 64-bit configuration
|
|
273
|
## 64-bit configuration
|
|
274
|
if [ "$SET_ARCH" = 64 ] ; then
|
|
274
|
if [ "$SET_ARCH" = 64 ] ; then
|
|
275
|
# General 64-bit depended settings
|
|
275
|
### General 64-bit depended settings
|
|
276
|
QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
|
|
276
|
QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
|
|
277
|
KERNEL_ARCH=${KERNEL_ARCH:=arm64}
|
|
277
|
KERNEL_ARCH=${KERNEL_ARCH:=arm64}
|
|
278
|
KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
|
|
278
|
KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
|
|
279
|
|
|
279
|
|
|
280
|
# Raspberry Pi model specific settings
|
|
280
|
### Raspberry Pi model specific settings
|
|
281
|
if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
|
|
281
|
if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
|
|
282
|
if [ "$RPI_MODEL" != 4 ] ; then
|
|
282
|
if [ "$RPI_MODEL" != 4 ] ; then
|
|
283
|
KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
|
|
283
|
KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
|
|
@@
-289,20
+289,21
if [ -n "$SET_ARCH" ] ; then
|
|
289
|
RELEASE_ARCH=${RELEASE_ARCH:=arm64}
|
|
289
|
RELEASE_ARCH=${RELEASE_ARCH:=arm64}
|
|
290
|
KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
|
|
290
|
KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
|
|
291
|
CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
|
|
291
|
CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
|
|
|
|
|
292
|
|
|
292
|
else
|
|
293
|
else
|
|
293
|
echo "error: Only Raspberry PI 3, 3B+ and 4 support 64-bit"
|
|
294
|
echo "error: Only Raspberry PI 3, 3B+ and 4 support 64-bit"
|
|
294
|
exit 1
|
|
295
|
exit 1
|
|
295
|
fi
|
|
296
|
fi
|
|
296
|
fi
|
|
297
|
fi
|
|
297
|
|
|
298
|
|
|
298
|
# 32-bit configuration
|
|
299
|
## 32-bit configuration
|
|
299
|
if [ "$SET_ARCH" = 32 ] ; then
|
|
300
|
if [ "$SET_ARCH" = 32 ] ; then
|
|
300
|
# General 32-bit dependend settings
|
|
301
|
### General 32-bit dependend settings
|
|
301
|
QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
|
|
302
|
QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
|
|
302
|
KERNEL_ARCH=${KERNEL_ARCH:=arm}
|
|
303
|
KERNEL_ARCH=${KERNEL_ARCH:=arm}
|
|
303
|
KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
|
|
304
|
KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
|
|
304
|
|
|
305
|
|
|
305
|
# Raspberry Pi model specific settings
|
|
306
|
### Raspberry Pi (0-1P) model specific settings
|
|
306
|
if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
|
|
307
|
if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
|
|
307
|
REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
|
|
308
|
REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
|
|
308
|
KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
|
|
309
|
KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
|
|
@@
-320,7
+321,7
if [ -n "$SET_ARCH" ] ; then
|
|
320
|
fi
|
|
321
|
fi
|
|
321
|
fi
|
|
322
|
fi
|
|
322
|
fi
|
|
323
|
fi
|
|
323
|
# Raspberry Pi model specific settings
|
|
324
|
### Raspberry Pi (2-4) model specific settings
|
|
324
|
if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
|
|
325
|
if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
|
|
325
|
if [ "$RPI_MODEL" != 4 ] ; then
|
|
326
|
if [ "$RPI_MODEL" != 4 ] ; then
|
|
326
|
KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
|
|
327
|
KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
|
|
@@
-377,17
+378,18
case "$RPI_MODEL" in
|
|
377
|
;;
|
|
378
|
;;
|
|
378
|
esac
|
|
379
|
esac
|
|
379
|
|
|
380
|
|
|
380
|
# Raspberry PI 0,3,3P with Bluetooth and Wifi onboard
|
|
381
|
# Raspberry PI 0,3,3P,4 with Bluetooth and Wifi onboard
|
|
381
|
if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
|
|
382
|
if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then
|
|
382
|
# Include bluetooth packages on supported boards
|
|
383
|
## Include bluetooth packages on supported boards
|
|
383
|
if [ "$ENABLE_BLUETOOTH" = true ] ; then
|
|
384
|
if [ "$ENABLE_BLUETOOTH" = true ] ; then
|
|
384
|
APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
|
|
385
|
APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
|
|
385
|
fi
|
|
386
|
fi
|
|
386
|
if [ "$ENABLE_WIRELESS" = true ] ; then
|
|
387
|
if [ "$ENABLE_WIRELESS" = true ] ; then
|
|
387
|
APT_INCLUDES="${APT_INCLUDES},wireless-tools,crda,wireless-regdb,wpasupplicant"
|
|
388
|
APT_INCLUDES="${APT_INCLUDES},wireless-tools,crda,wireless-regdb,wpasupplicant"
|
|
388
|
fi
|
|
389
|
fi
|
|
389
|
else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard
|
|
390
|
# Raspberry PI 1,1P,2 without Wifi and bluetooth onboard
|
|
390
|
# Check if the internal wireless interface is not supported by the RPi model
|
|
391
|
else
|
|
|
|
|
392
|
## Check if the internal wireless interface is not supported by the RPi model
|
|
391
|
if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then
|
|
393
|
if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then
|
|
392
|
echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth"
|
|
394
|
echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth"
|
|
393
|
exit 1
|
|
395
|
exit 1
|
|
@@
-506,7
+508,7
if [ -n "$MISSING_PACKAGES" ] ; then
|
|
506
|
read -r confirm
|
|
508
|
read -r confirm
|
|
507
|
[ "$confirm" != "y" ] && exit 1
|
|
509
|
[ "$confirm" != "y" ] && exit 1
|
|
508
|
|
|
510
|
|
|
509
|
# Make sure all missing required packages are installed
|
|
511
|
## Make sure all missing required packages are installed
|
|
510
|
apt-get update && apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"`
|
|
512
|
apt-get update && apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"`
|
|
511
|
fi
|
|
513
|
fi
|
|
512
|
|
|
514
|
|
|
@@
-554,8
+556,8
fi
|
|
554
|
|
|
556
|
|
|
555
|
# Check if specified CHROOT_SCRIPTS directory exists
|
|
557
|
# Check if specified CHROOT_SCRIPTS directory exists
|
|
556
|
if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
|
|
558
|
if [ -n "$CHROOT_SCRIPTS" ] && [ ! -d "$CHROOT_SCRIPTS" ] ; then
|
|
557
|
echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
|
|
559
|
echo "error: ${CHROOT_SCRIPTS} specified directory not found (CHROOT_SCRIPTS)!"
|
|
558
|
exit 1
|
|
560
|
exit 1
|
|
559
|
fi
|
|
561
|
fi
|
|
560
|
|
|
562
|
|
|
561
|
# Check if specified device mapping already exists (will be used by cryptsetup)
|
|
563
|
# Check if specified device mapping already exists (will be used by cryptsetup)
|
|
@@
-649,12
+651,12
fi
|
|
649
|
|
|
651
|
|
|
650
|
# Replace selected packages with smaller clones
|
|
652
|
# Replace selected packages with smaller clones
|
|
651
|
if [ "$ENABLE_REDUCE" = true ] ; then
|
|
653
|
if [ "$ENABLE_REDUCE" = true ] ; then
|
|
652
|
# Add levee package instead of vim-tiny
|
|
654
|
## Add levee package instead of vim-tiny
|
|
653
|
if [ "$REDUCE_VIM" = true ] ; then
|
|
655
|
if [ "$REDUCE_VIM" = true ] ; then
|
|
654
|
APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
|
|
656
|
APT_INCLUDES="$(echo ${APT_INCLUDES} | sed "s/vim-tiny/levee/")"
|
|
655
|
fi
|
|
657
|
fi
|
|
656
|
|
|
658
|
|
|
657
|
# Add dropbear package instead of openssh-server
|
|
659
|
## Add dropbear package instead of openssh-server
|
|
658
|
if [ "$REDUCE_SSHD" = true ] ; then
|
|
660
|
if [ "$REDUCE_SSHD" = true ] ; then
|
|
659
|
APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")"
|
|
661
|
APT_INCLUDES="$(echo "${APT_INCLUDES}" | sed "s/openssh-server/dropbear/")"
|
|
660
|
fi
|
|
662
|
fi
|
|
@@
-821,20
+823,21
if [ "$ENABLE_SPLITFS" = true ] ; then
|
|
821
|
dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}"
|
|
823
|
dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count="${TABLE_SECTORS}"
|
|
822
|
dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}"
|
|
824
|
dd if=/dev/zero of="$IMAGE_NAME-root.img" bs=512 count=0 seek="${ROOT_SECTORS}"
|
|
823
|
|
|
825
|
|
|
824
|
# Write firmware/boot partition tables
|
|
826
|
## Write firmware/boot partition tables
|
|
825
|
sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
|
|
827
|
sfdisk -q -L -uS -f "$IMAGE_NAME-frmw.img" 2> /dev/null <<EOM
|
|
826
|
${TABLE_SECTORS},${FRMW_SECTORS},c,*
|
|
828
|
${TABLE_SECTORS},${FRMW_SECTORS},c,*
|
|
827
|
EOM
|
|
829
|
EOM
|
|
828
|
|
|
830
|
|
|
829
|
# Write root partition table
|
|
831
|
## Write root partition table
|
|
830
|
sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
|
|
832
|
sfdisk -q -L -uS -f "$IMAGE_NAME-root.img" 2> /dev/null <<EOM
|
|
831
|
${TABLE_SECTORS},${ROOT_SECTORS},83
|
|
833
|
${TABLE_SECTORS},${ROOT_SECTORS},83
|
|
832
|
EOM
|
|
834
|
EOM
|
|
833
|
|
|
835
|
|
|
834
|
# Setup temporary loop devices
|
|
836
|
## Setup temporary loop devices
|
|
835
|
FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)"
|
|
837
|
FRMW_LOOP="$(losetup -o 1M --sizelimit 64M -f --show "$IMAGE_NAME"-frmw.img)"
|
|
836
|
ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)"
|
|
838
|
ROOT_LOOP="$(losetup -o 1M -f --show "$IMAGE_NAME"-root.img)"
|
|
837
|
else # ENABLE_SPLITFS=false
|
|
839
|
# ENABLE_SPLITFS=false
|
|
|
|
|
840
|
else
|
|
838
|
dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}"
|
|
841
|
dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count="${TABLE_SECTORS}"
|
|
839
|
dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}"
|
|
842
|
dd if=/dev/zero of="$IMAGE_NAME.img" bs=512 count=0 seek="${IMAGE_SECTORS}"
|
|
840
|
|
|
843
|
|