armbian-next: core extensions for xfs / f2fs / brtfs / LUKS/cryptroot hostdeps; enable in main-config

This commit is contained in:
Ricardo Pardini
2023-01-13 17:24:00 +01:00
parent 0ac6a8fc1d
commit 7879895049
6 changed files with 73 additions and 34 deletions

View File

@@ -0,0 +1,8 @@
# `btrfs` support is no longer included by default in prepare-host.sh.
# Enable this extension to include the required dependencies for building.
# This is automatically enabled if ROOTFS_TYPE is set to btrfs in main-config.sh.
function add_host_dependencies__add_btrfs_tooling() {
display_alert "Adding BTRFS to host dependencies" "BTRFS" "debug"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} btrfs-progs" # @TODO: convert to array later
}

View File

@@ -0,0 +1,8 @@
# `cryptroot` / LUKS support is no longer included by default in prepare-host.sh.
# Enable this extension to include the required dependencies for building.
# This is automatically enabled if CRYPTROOT_ENABLE is set to yes in main-config.sh.
function add_host_dependencies__add_cryptroot_tooling() {
display_alert "Adding cryptroot to host dependencies" "cryptsetup LUKS" "debug"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} cryptsetup" # @TODO: convert to array later
}

View File

@@ -0,0 +1,8 @@
# `f2fs` support is no longer included by default in prepare-host.sh.
# Enable this extension to include the required dependencies for building.
# This is automatically enabled if ROOTFS_TYPE is set to f2fs in main-config.sh.
function add_host_dependencies__add_f2fs_tooling() {
display_alert "Adding F2FS to host dependencies" "F2FS" "debug"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} f2fs-tools" # @TODO: convert to array later
}

View File

@@ -0,0 +1,8 @@
# `xfs` support is no longer included by default in prepare-host.sh.
# Enable this extension to include the required dependencies for building.
# This is automatically enabled if ROOTFS_TYPE is set to xfs in main-config.sh.
function add_host_dependencies__add_xfs_tooling() {
display_alert "Adding XFS to host dependencies" "XFS xfsprogs" "debug"
EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} xfsprogs" # @TODO: convert to array later
}

View File

@@ -83,27 +83,48 @@ function do_main_configuration() {
install -d "${FINALDEST}"
fi
# TODO: fixed name can't be used for parallel image building
ROOT_MAPPER="armbian-root"
# Prepare rootfs filesystem support
[[ -z $ROOTFS_TYPE ]] && ROOTFS_TYPE=ext4 # default rootfs type is ext4
[[ "ext4 f2fs btrfs xfs nfs fel" != *$ROOTFS_TYPE* ]] && exit_with_error "Unknown rootfs type" "$ROOTFS_TYPE"
case "$ROOTFS_TYPE" in
ext4 | fel) # nothing extra here
;;
nfs)
FIXED_IMAGE_SIZE=256 # small SD card with kernel, boot script and .dtb/.bin files
;;
f2fs)
enable_extension "fs-f2fs-support"
# Fixed image size is in 1M dd blocks (MiB)
# to get size of block device /dev/sdX execute as root: echo $(( $(blockdev --getsize64 /dev/sdX) / 1024 / 1024 ))
[[ -z $FIXED_IMAGE_SIZE ]] && exit_with_error "Please define FIXED_IMAGE_SIZE for use with f2fs"
;;
xfs)
enable_extension "fs-xfs-support"
;;
btrfs)
enable_extension "fs-btrfs-support"
[[ -z $BTRFS_COMPRESSION ]] && BTRFS_COMPRESSION=zlib # default btrfs filesystem compression method is zlib
[[ ! $BTRFS_COMPRESSION =~ zlib|lzo|zstd|none ]] && exit_with_error "Unknown btrfs compression method" "$BTRFS_COMPRESSION"
;;
*)
exit_with_error "Unknown rootfs type: ROOTFS_TYPE='${ROOTFS_TYPE}'"
;;
esac
# Fixed image size is in 1M dd blocks (MiB)
# to get size of block device /dev/sdX execute as root:
# echo $(( $(blockdev --getsize64 /dev/sdX) / 1024 / 1024 ))
[[ "f2fs" == *$ROOTFS_TYPE* && -z $FIXED_IMAGE_SIZE ]] && exit_with_error "Please define FIXED_IMAGE_SIZE"
# a passphrase is mandatory if rootfs encryption is enabled
if [[ $CRYPTROOT_ENABLE == yes && -z $CRYPTROOT_PASSPHRASE ]]; then
# Support for LUKS / cryptroot
if [[ $CRYPTROOT_ENABLE == yes ]]; then
enable_extension "fs-cryptroot-support" # add the tooling needed, cryptsetup
ROOT_MAPPER="armbian-root" # TODO: fixed name can't be used for parallel image building (rpardini: ?)
if [[ -z $CRYPTROOT_PASSPHRASE ]]; then # a passphrase is mandatory if rootfs encryption is enabled
exit_with_error "Root encryption is enabled but CRYPTROOT_PASSPHRASE is not set"
fi
# small SD card with kernel, boot script and .dtb/.bin files
[[ $ROOTFS_TYPE == nfs ]] && FIXED_IMAGE_SIZE=256
[[ -z $CRYPTROOT_SSH_UNLOCK ]] && CRYPTROOT_SSH_UNLOCK=yes
[[ -z $CRYPTROOT_SSH_UNLOCK_PORT ]] && CRYPTROOT_SSH_UNLOCK_PORT=2022
# Default to pdkdf2, this used to be the default with cryptroot <= 2.0, however
# cryptroot 2.1 changed that to Argon2i. Argon2i is a memory intensive
# algorithm which doesn't play well with SBCs (need 1GiB RAM by default !)
# https://gitlab.com/cryptsetup/cryptsetup/-/issues/372
[[ -z $CRYPTROOT_PARAMETERS ]] && CRYPTROOT_PARAMETERS="--pbkdf pbkdf2"
fi
# Since we are having too many options for mirror management,
# then here is yet another mirror related option.
@@ -181,13 +202,6 @@ function do_main_configuration() {
ARCH=armhf
KERNEL_IMAGE_TYPE=zImage
ATF_COMPILE=yes
[[ -z $CRYPTROOT_SSH_UNLOCK ]] && CRYPTROOT_SSH_UNLOCK=yes
[[ -z $CRYPTROOT_SSH_UNLOCK_PORT ]] && CRYPTROOT_SSH_UNLOCK_PORT=2022
# Default to pdkdf2, this used to be the default with cryptroot <= 2.0, however
# cryptroot 2.1 changed that to Argon2i. Argon2i is a memory intensive
# algorithm which doesn't play well with SBCs (need 1GiB RAM by default !)
# https://gitlab.com/cryptsetup/cryptsetup/-/issues/372
[[ -z $CRYPTROOT_PARAMETERS ]] && CRYPTROOT_PARAMETERS="--pbkdf pbkdf2"
[[ -z $WIREGUARD ]] && WIREGUARD="yes"
[[ -z $EXTRAWIFI ]] && EXTRAWIFI="yes"
[[ -z $SKIP_BOOTSPLASH ]] && SKIP_BOOTSPLASH="no"

View File

@@ -233,18 +233,11 @@ function adaptative_prepare_host_dependencies() {
display_alert "Using passed-in target_arch" "${target_arch}" "debug"
fi
# @TODO: move to extensions:
# btrfs-progs # @TODO: only needed if doing brtfs // causes initramfs rebuild
# cryptsetup - @TODO: this causes host-side initrd rebuild; only required for encrypted root stuff -- move to extension?
# f2fs-tools # @TODO: this is un-necessary if not building a f2fs rootfs // causes initramfs rebuild
# crossbuild-essential-arm64 @TODO: JetHub needs a c++ compiler, add "crossbuild-essential-arm64" there or ext
#### Common: for all releases, all host arches, and all target arches.
declare -a -g host_dependencies=(
# big bag of stuff from before
bc binfmt-support
bison
### build-essential # Composed of: libc6-dev make dpkg-dev gcc g++, we don't need g++ (C++ compiler)
libc6-dev make dpkg-dev gcc # build-essential, without g++
ca-certificates ccache cpio
debootstrap device-tree-compiler dialog dirmngr dosfstools
@@ -257,7 +250,7 @@ function adaptative_prepare_host_dependencies() {
libbison-dev libelf-dev libfdt-dev libfile-fcntllock-perl libmpc-dev libfl-dev liblz4-tool
libncurses-dev libssl-dev libusb-1.0-0-dev
linux-base locales
ncurses-base ncurses-term # why?
ncurses-base ncurses-term # for `make menuconfig`
ntpdate
patchutils pkg-config pv
qemu-user-static