From 9a7bed4c9439e8abcdd3674738dd6ffcfe03ed56 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 21 Mar 2024 13:18:39 -0400 Subject: [PATCH 01/13] build-x86-images: rename to mkiso --- Makefile | 10 +++++----- README.md | 12 ++++++------ README.md.in | 6 +++--- build-x86-images.sh => mkiso.sh | 0 mklive.sh | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) rename build-x86-images.sh => mkiso.sh (100%) diff --git a/Makefile b/Makefile index 447c06af94..45abcb1016 100644 --- a/Makefile +++ b/Makefile @@ -34,16 +34,16 @@ COMPRESSOR_THREADS:=$(shell nproc) all: -README.md: README.md.in build-x86-images.sh mklive.sh mkrootfs.sh mkplatformfs.sh mkimage.sh mknet.sh +README.md: README.md.in mkiso.sh mklive.sh mkrootfs.sh mkplatformfs.sh mkimage.sh mknet.sh printf '\n\n' > README.md cat README.md.in >> README.md - for script in build-x86-images mklive mkrootfs mkplatformfs mkimage mknet; do \ + for script in mkiso mklive mkrootfs mkplatformfs mkimage mknet; do \ printf '### %s.sh\n\n```\n' "$${script}" >> README.md ; \ "./$${script}.sh" -h 2>/dev/null >> README.md ; \ printf '```\n\n' >> README.md ; \ done -build-x86-images.sh: mklive.sh +mkiso.sh: mklive.sh checksum: distdir-$(DATECODE) cd distdir-$(DATECODE)/ && sha256 * > sha256sum.txt @@ -59,9 +59,9 @@ live-iso-all: $(ALL_LIVE_ISO) live-iso-all-print: @echo $(ALL_LIVE_ISO) | sed "s: :\n:g" -void-live-%.iso: build-x86-images.sh +void-live-%.iso: mkiso.sh @[ -n "${CI}" ] && printf "::group::\x1b[32mBuilding $@...\x1b[0m\n" || true - $(SUDO) ./build-x86-images.sh -r $(REPOSITORY) -t $* + $(SUDO) ./mkiso.sh -r $(REPOSITORY) -t $* @[ -n "${CI}" ] && printf '::endgroup::\n' || true rootfs-all: $(ALL_ROOTFS) diff --git a/README.md b/README.md index ee5615b311..7530157d90 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ This repository contains several utilities: * [*mklive.sh*](#mklivesh) - The Void Linux live image generator for x86 -* [*build-x86-images.sh*](#build-x86-imagessh) - Wrapper script to generate bootable - and installable live images for x86 +* [*mkiso.sh*](#mkisosh) - Wrapper script to generate bootable and installable live + images for i686, x86_64, and aarch64. * [*mkrootfs.sh*](#mkrootfssh) - The Void Linux rootfs generator for all platforms * [*mkplatformfs.sh*](#mkplatformfssh) - The Void Linux filesystem tool to produce a rootfs for a particular platform @@ -22,7 +22,7 @@ This repository contains several utilities: #### Generating x86 live ISOs To generate a live ISO like the officially-published ones, use -[*build-x86-images.sh*](#build-x86-imagessh). To generate a more basic live ISO +[*mkiso.sh*](#mkisosh). To generate a more basic live ISO (which does not include things like `void-installer`), use [*mklive.sh*](#mklivesh). #### Generating ROOTFS tarballs @@ -90,10 +90,10 @@ that can change the behavior of the live system: ## Usage -### build-x86-images.sh +### mkiso.sh ``` -Usage: build-x86-images.sh [options ...] [-- mklive options ...] +Usage: mkiso.sh [options ...] [-- mklive options ...] Wrapper script around mklive.sh for several standard flavors of live images. Adds void-installer and other helpful utilities to the generated images. @@ -122,7 +122,7 @@ Usage: mklive.sh [options] Generates a basic live ISO image of Void Linux. This ISO image can be written to a CD/DVD-ROM or any USB stick. -To generate a more complete live ISO image, use build-x86-images.sh. +To generate a more complete live ISO image, use mkiso.sh. OPTIONS -a Set XBPS_ARCH in the ISO image diff --git a/README.md.in b/README.md.in index b6dfb65f3a..2b37a0f60d 100644 --- a/README.md.in +++ b/README.md.in @@ -5,8 +5,8 @@ This repository contains several utilities: * [*mklive.sh*](#mklivesh) - The Void Linux live image generator for x86 -* [*build-x86-images.sh*](#build-x86-imagessh) - Wrapper script to generate bootable - and installable live images for x86 +* [*mkiso.sh*](#mkisosh) - Wrapper script to generate bootable and installable live + images for i686, x86_64, and aarch64. * [*mkrootfs.sh*](#mkrootfssh) - The Void Linux rootfs generator for all platforms * [*mkplatformfs.sh*](#mkplatformfssh) - The Void Linux filesystem tool to produce a rootfs for a particular platform @@ -20,7 +20,7 @@ This repository contains several utilities: #### Generating x86 live ISOs To generate a live ISO like the officially-published ones, use -[*build-x86-images.sh*](#build-x86-imagessh). To generate a more basic live ISO +[*mkiso.sh*](#mkisosh). To generate a more basic live ISO (which does not include things like `void-installer`), use [*mklive.sh*](#mklivesh). #### Generating ROOTFS tarballs diff --git a/build-x86-images.sh b/mkiso.sh similarity index 100% rename from build-x86-images.sh rename to mkiso.sh diff --git a/mklive.sh b/mklive.sh index fe87e13520..e80db169cc 100755 --- a/mklive.sh +++ b/mklive.sh @@ -72,7 +72,7 @@ usage() { Generates a basic live ISO image of Void Linux. This ISO image can be written to a CD/DVD-ROM or any USB stick. - To generate a more complete live ISO image, use build-x86-images.sh. + To generate a more complete live ISO image, use mkiso.sh. OPTIONS -a Set XBPS_ARCH in the ISO image From 2fec2365a5820234424492312c49e31cf26c2676 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 21 Mar 2024 17:58:56 -0400 Subject: [PATCH 02/13] mklive, mkiso: support aarch64 --- .gitignore | 1 + grub/grub_void.cfg.in | 47 +++++--- mkiso.sh | 5 +- mklive.sh | 251 +++++++++++++++++++++++++++--------------- 4 files changed, 195 insertions(+), 109 deletions(-) diff --git a/.gitignore b/.gitignore index 538c33fbd5..fb75b6b65f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ distdir-*/ release/ packer/cloud-*/ packer/vagrant-*/ +mklive-build*/ diff --git a/grub/grub_void.cfg.in b/grub/grub_void.cfg.in index 50bde11411..994e936273 100644 --- a/grub/grub_void.cfg.in +++ b/grub/grub_void.cfg.in @@ -2,6 +2,17 @@ set pager="1" set locale_dir="(${voidlive})/boot/grub/locale" +if [ "${grub_cpu}" == "x86_64" ]; then + set kernel_img="vmlinuz" + set memtest="yes" +elif [ "${grub_cpu}" == "i386" ]; then + set kernel_img="vmlinuz" + set memtest="yes" +elif [ "${grub_cpu}" == "arm64" ]; then + set kernel_img="vmlinux" + set memtest="" +fi + if [ -e "${prefix}/${grub_cpu}-${grub_platform}/all_video.mod" ]; then insmod all_video else @@ -35,7 +46,7 @@ play 600 988 1 1319 4 if [ cpuid -l ]; then menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@)" --id "linux" { set gfxpayload="keep" - linux (${voidlive})/boot/vmlinuz \ + linux (${voidlive})/boot/${kernel_img} \ root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ @@ -44,7 +55,7 @@ if [ cpuid -l ]; then } menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) (RAM)" --id "linuxram" { set gfxpayload="keep" - linux (${voidlive})/boot/vmlinuz \ + linux (${voidlive})/boot/${kernel_img} \ root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ @@ -62,7 +73,7 @@ if [ cpuid -l ]; then } menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) with speech" --hotkey s --id "linuxa11y" { set gfxpayload="keep" - linux (${voidlive})/boot/vmlinuz \ + linux (${voidlive})/boot/${kernel_img} \ root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ @@ -71,7 +82,7 @@ if [ cpuid -l ]; then } menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) with speech (RAM)" --hotkey r --id "linuxa11yram" { set gfxpayload="keep" - linux (${voidlive})/boot/vmlinuz \ + linux (${voidlive})/boot/${kernel_img} \ root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ @@ -87,19 +98,21 @@ if [ cpuid -l ]; then locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ live.accessibility live.autologin nomodeset initrd (${voidlive})/boot/initrd } - if [ "${grub_platform}" == "efi" ]; then - menuentry "Run Memtest86+ (RAM test)" --hotkey m --id memtest { - set gfxpayload="keep" - linux (${voidlive})/boot/memtest.efi - } - menuentry 'UEFI Firmware Settings' --hotkey f --id uefifw { - fwsetup - } - else - menuentry "Run Memtest86+ (RAM test)" --id memtest { - set gfxpayload="keep" - linux (${voidlive})/boot/memtest.bin - } + if [ "${memtest}" == "yes" ]; then + if [ "${grub_platform}" == "efi" ]; then + menuentry "Run Memtest86+ (RAM test)" --id memtest { + set gfxpayload="keep" + linux (${voidlive})/boot/memtest.efi + } + menuentry 'UEFI Firmware Settings' --id uefifw { + fwsetup + } + else + menuentry "Run Memtest86+ (RAM test)" --id memtest { + set gfxpayload="keep" + linux (${voidlive})/boot/memtest.bin + } + fi fi menuentry "System restart" --hotkey b --id restart { diff --git a/mkiso.sh b/mkiso.sh index d09ae99737..b280dc382d 100755 --- a/mkiso.sh +++ b/mkiso.sh @@ -72,7 +72,10 @@ build_variant() { variant="$1" shift IMG=void-live-${ARCH}-${DATE}-${variant}.iso - GRUB_PKGS="grub-i386-efi grub-x86_64-efi" + case "$ARCH" in + x86_64*|i686*) GRUB_PKGS="grub-i386-efi grub-x86_64-efi" ;; + aarch64*) GRUB_PKGS="grub-arm64-efi" ;; + esac A11Y_PKGS="espeakup void-live-audio brltty" PKGS="dialog cryptsetup lvm2 mdadm void-docs-browse xtools-minimal xmirror chrony tmux $A11Y_PKGS $GRUB_PKGS" XORG_PKGS="xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf orca" diff --git a/mklive.sh b/mklive.sh index e80db169cc..64c1f19504 100755 --- a/mklive.sh +++ b/mklive.sh @@ -28,9 +28,12 @@ umask 022 . ./lib.sh -readonly REQUIRED_PKGS="base-files libgcc dash coreutils sed tar gawk syslinux grub-i386-efi grub-x86_64-efi memtest86+ squashfs-tools xorriso" -readonly INITRAMFS_PKGS="binutils xz device-mapper dhclient dracut-network openresolv" -readonly PROGNAME=$(basename "$0") +REQUIRED_PKGS=(base-files libgcc dash coreutils sed tar gawk squashfs-tools xorriso) +TARGET_PKGS=(base-files) +INITRAMFS_PKGS=(binutils xz device-mapper dhclient dracut-network openresolv) +PACKAGE_LIST=() +IGNORE_PKGS=() +readonly PROGNAME="$(basename "$0")" declare -a INCLUDE_DIRS=() info_msg() { @@ -117,8 +120,14 @@ copy_autoinstaller_files() { } install_prereqs() { - XBPS_ARCH=$ARCH "$XBPS_INSTALL_CMD" -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} \ - -c "$XBPS_HOST_CACHEDIR" -y $REQUIRED_PKGS + XBPS_ARCH=$HOST_ARCH "$XBPS_INSTALL_CMD" -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} \ + -c "$XBPS_HOST_CACHEDIR" -y "${REQUIRED_PKGS[@]}" + [ $? -ne 0 ] && die "Failed to install required software, exiting..." +} + +install_target_pkgs() { + XBPS_ARCH=$TARGET_ARCH "$XBPS_INSTALL_CMD" -r "$VOIDTARGETDIR" ${XBPS_REPOSITORY} \ + -c "$XBPS_HOST_CACHEDIR" -y "${TARGET_PKGS[@]}" [ $? -ne 0 ] && die "Failed to install required software, exiting..." } @@ -134,15 +143,15 @@ post_install_packages() { } install_packages() { - XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -r "$ROOTFS" \ - ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -yn $PACKAGE_LIST $INITRAMFS_PKGS + XBPS_ARCH=$TARGET_ARCH "${XBPS_INSTALL_CMD}" -r "$ROOTFS" \ + ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -yn "${PACKAGE_LIST[@]}" "${INITRAMFS_PKGS[@]}" [ $? -ne 0 ] && die "Missing required binary packages, exiting..." mount_pseudofs - LANG=C XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \ - ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -y $PACKAGE_LIST $INITRAMFS_PKGS - [ $? -ne 0 ] && die "Failed to install $PACKAGE_LIST" + LANG=C XBPS_ARCH=$TARGET_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \ + ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -y "${PACKAGE_LIST[@]}" "${INITRAMFS_PKGS[@]}" + [ $? -ne 0 ] && die "Failed to install ${PACKAGE_LIST[*]}" xbps-reconfigure -r "$ROOTFS" -f base-files >/dev/null 2>&1 chroot "$ROOTFS" env -i xbps-reconfigure -f base-files @@ -163,7 +172,7 @@ install_packages() { ignore_packages() { mkdir -p "$ROOTFS"/etc/xbps.d - for pkg in $IGNORE_PKGS; do + for pkg in "${IGNORE_PKGS[@]}"; do echo "ignorepkg=$pkg" >> "$ROOTFS"/etc/xbps.d/mklive-ignore.conf done } @@ -200,11 +209,14 @@ generate_initramfs() { [ $? -ne 0 ] && die "Failed to generate the initramfs" mv "$ROOTFS"/boot/initrd "$BOOT_DIR" - cp "$ROOTFS"/boot/vmlinuz-$KERNELVERSION "$BOOT_DIR"/vmlinuz + case "$TARGET_ARCH" in + i686*|x86_64*) cp "$ROOTFS/boot/vmlinuz-$KERNELVERSION" "$BOOT_DIR"/vmlinuz ;; + aarch64*) cp "$ROOTFS/boot/vmlinux-$KERNELVERSION" "$BOOT_DIR"/vmlinux ;; + esac } cleanup_rootfs() { - for f in ${INITRAMFS_PKGS}; do + for f in "${INITRAMFS_PKGS[@]}"; do revdeps=$(xbps-query -r "$ROOTFS" -X $f) if [ -n "$revdeps" ]; then xbps-pkgdb -r "$ROOTFS" -m auto $f @@ -231,23 +243,27 @@ generate_isolinux_boot() { sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \ -e "s|@@KERNVER@@|${KERNELVERSION}|" \ -e "s|@@KEYMAP@@|${KEYMAP}|" \ - -e "s|@@ARCH@@|$BASE_ARCH|" \ + -e "s|@@ARCH@@|$TARGET_ARCH|" \ -e "s|@@LOCALE@@|${LOCALE}|" \ -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \ -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \ "$ISOLINUX_DIR"/isolinux.cfg # include memtest86+ - cp -f "$VOIDHOSTDIR"/boot/memtest86+/memtest.bin "$BOOT_DIR" + if [ -e "$VOIDTARGETDIR"/boot/memtest86+/memtest.bin ]; then + cp "$VOIDTARGETDIR"/boot/memtest86+/memtest.bin "$BOOT_DIR" + fi } generate_grub_efi_boot() { + set -x cp -f grub/grub.cfg "$GRUB_DIR" + cp -f "${SPLASH_IMAGE}" "$ISOLINUX_DIR" cp -f grub/grub_void.cfg.in "$GRUB_DIR"/grub_void.cfg sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \ -e "s|@@KERNVER@@|${KERNELVERSION}|" \ -e "s|@@KEYMAP@@|${KEYMAP}|" \ - -e "s|@@ARCH@@|$BASE_ARCH|" \ + -e "s|@@ARCH@@|$TARGET_ARCH|" \ -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \ -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \ -e "s|@@LOCALE@@|${LOCALE}|" "$GRUB_DIR"/grub_void.cfg @@ -260,40 +276,45 @@ generate_grub_efi_boot() { truncate -s 32M "$GRUB_DIR"/efiboot.img >/dev/null 2>&1 mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1 - GRUB_EFI_TMPDIR="$(mktemp --tmpdir="$HOME" -d)" + GRUB_EFI_TMPDIR="$(mktemp --tmpdir="$BUILDDIR" -dt grub-efi.XXXXX)" LOOP_DEVICE="$(losetup --show --find "${GRUB_DIR}"/efiboot.img)" mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1 - cp -a "$IMAGEDIR"/boot "$VOIDHOSTDIR" - xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \ - --directory="/usr/lib/grub/i386-efi" \ - --format="i386-efi" \ - --output="/tmp/bootia32.efi" \ - "boot/grub/grub.cfg" - if [ $? -ne 0 ]; then - umount "$GRUB_EFI_TMPDIR" - losetup --detach "${LOOP_DEVICE}" - die "Failed to generate EFI loader" - fi - mkdir -p "${GRUB_EFI_TMPDIR}"/EFI/BOOT - cp -f "$VOIDHOSTDIR"/tmp/bootia32.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTIA32.EFI - xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \ - --directory="/usr/lib/grub/x86_64-efi" \ - --format="x86_64-efi" \ - --output="/tmp/bootx64.efi" \ - "boot/grub/grub.cfg" - if [ $? -ne 0 ]; then - umount "$GRUB_EFI_TMPDIR" - losetup --detach "${LOOP_DEVICE}" - die "Failed to generate EFI loader" - fi - cp -f "$VOIDHOSTDIR"/tmp/bootx64.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTX64.EFI + build_grub_image() { + local GRUB_ARCH="$1" EFI_ARCH="$2" + xbps-uchroot "$VOIDTARGETDIR" grub-mkstandalone -- \ + --directory="/usr/lib/grub/${GRUB_ARCH}-efi" \ + --format="${GRUB_ARCH}-efi" \ + --output="/tmp/boot${EFI_ARCH,,}.efi" \ + "boot/grub/grub.cfg" + if [ $? -ne 0 ]; then + umount "$GRUB_EFI_TMPDIR" + losetup --detach "${LOOP_DEVICE}" + die "Failed to generate EFI loader" + fi + mkdir -p "${GRUB_EFI_TMPDIR}"/EFI/BOOT + cp -f "$VOIDTARGETDIR/tmp/boot${EFI_ARCH,,}.efi" "${GRUB_EFI_TMPDIR}/EFI/BOOT/BOOT${EFI_ARCH^^}.EFI" + } + + cp -a "$IMAGEDIR"/boot "$VOIDTARGETDIR" + + case "$TARGET_ARCH" in + i686*|x86_64*) + # XXX: why are both built on both arches? + build_grub_image i386 ia32 + build_grub_image x86_64 x64 + # include memtest86+ + if [ -e "$VOIDTARGETDIR"/boot/memtest86+/memtest.efi ]; then + cp "$VOIDTARGETDIR"/boot/memtest86+/memtest.efi "$BOOT_DIR" + fi + ;; + aarch64*) + build_grub_image arm64 aa64 + ;; + esac umount "$GRUB_EFI_TMPDIR" losetup --detach "${LOOP_DEVICE}" rm -rf "$GRUB_EFI_TMPDIR" - - # include memtest86+ - cp -f "$VOIDHOSTDIR"/boot/memtest86+/memtest.efi "$BOOT_DIR" } generate_squashfs() { @@ -320,17 +341,47 @@ generate_squashfs() { } generate_iso_image() { - "$VOIDHOSTDIR"/usr/bin/xorriso -as mkisofs \ - -iso-level 3 -rock -joliet \ - -max-iso9660-filenames -omit-period \ - -omit-version-number -relaxed-filenames -allow-lowercase \ - -volid "VOID_LIVE" \ - -eltorito-boot boot/isolinux/isolinux.bin \ - -eltorito-catalog boot/isolinux/boot.cat \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - -eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot \ - -isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin \ - -output "$OUTPUT_FILE" "$IMAGEDIR" || die "Failed to generate ISO image" + local bootloader n + XORRISO_ARGS=( + -iso-level 3 -rock -joliet -joliet-long -max-iso9660-filenames -omit-period + -omit-version-number -relaxed-filenames -allow-lowercase + -volid VOID_LIVE + ) + + if [ "$IMAGE_TYPE" = hybrid ]; then + XORRISO_ARGS+=(-isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin) + fi + + n=1 + for bootloader in "${BOOTLOADERS[@]}"; do + if (( n > 1 )); then + XORRISO_ARGS+=(-eltorito-alt-boot) + fi + + case "${bootloader}" in + grub) + XORRISO_ARGS+=( + -e boot/grub/efiboot.img -no-emul-boot + -isohybrid-gpt-basdat -isohybrid-apm-hfsplus + ) + ;; + syslinux) + XORRISO_ARGS+=( + -eltorito-boot boot/isolinux/isolinux.bin + -eltorito-catalog boot/isolinux/boot.cat + -no-emul-boot -boot-load-size 4 -boot-info-table + ) + ;; + esac + + n=$(( n + 1 )) + done + + XORRISO_ARGS+=( + -output "$OUTPUT_FILE" "$IMAGEDIR" + ) + + "$VOIDHOSTDIR"/usr/bin/xorriso -as mkisofs "${XORRISO_ARGS[@]}" || die "Failed to generate ISO image" } # @@ -338,11 +389,11 @@ generate_iso_image() { # while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do case $opt in - a) BASE_ARCH="$OPTARG";; + a) TARGET_ARCH="$OPTARG";; b) BASE_SYSTEM_PKG="$OPTARG";; r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY";; c) XBPS_CACHEDIR="$OPTARG";; - g) IGNORE_PKGS="$IGNORE_PKGS $OPTARG" ;; + g) IGNORE_PKGS+=($OPTARG) ;; K) readonly KEEP_BUILDDIR=1;; k) KEYMAP="$OPTARG";; l) LOCALE="$OPTARG";; @@ -352,7 +403,7 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do e) ROOT_SHELL="$OPTARG";; s) SQUASHFS_COMPRESSION="$OPTARG";; o) OUTPUT_FILE="$OPTARG";; - p) PACKAGE_LIST="$PACKAGE_LIST $OPTARG";; + p) PACKAGE_LIST+=($OPTARG);; C) BOOT_CMDLINE="$OPTARG";; T) BOOT_TITLE="$OPTARG";; v) LINUX_VERSION="$OPTARG";; @@ -362,17 +413,17 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do esac done shift $((OPTIND - 1)) -XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=https://repo-default.voidlinux.org/current --repository=https://repo-default.voidlinux.org/current/musl" +XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=https://repo-default.voidlinux.org/current --repository=https://repo-default.voidlinux.org/current/musl --repository=https://repo-default.voidlinux.org/current/aarch64" # Configure dracut to use overlayfs for the writable overlay. BOOT_CMDLINE="$BOOT_CMDLINE rd.live.overlay.overlayfs=1 " -ARCH=$(xbps-uhelper arch) +HOST_ARCH=$(xbps-uhelper arch) # Set defaults -: ${BASE_ARCH:=$(xbps-uhelper arch 2>/dev/null || uname -m)} -: ${XBPS_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${BASE_ARCH}} -: ${XBPS_HOST_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${ARCH}} +: ${TARGET_ARCH:=$(xbps-uhelper arch 2>/dev/null || uname -m)} +: ${XBPS_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${TARGET_ARCH}} +: ${XBPS_HOST_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${HOST_ARCH}} : ${KEYMAP:=us} : ${LOCALE:=en_US.UTF-8} : ${INITRAMFS_COMPRESSION:=xz} @@ -381,13 +432,22 @@ ARCH=$(xbps-uhelper arch) : ${BOOT_TITLE:="Void Linux"} : ${LINUX_VERSION:=linux} -case $BASE_ARCH in - x86_64*|i686*) ;; - *) >&2 echo architecture $BASE_ARCH not supported by mklive.sh; exit 1;; +case "$TARGET_ARCH" in + x86_64*|i686*) + BOOTLOADERS=(syslinux grub) + IMAGE_TYPE='hybrid' + TARGET_PKGS+=(syslinux grub-i386-efi grub-x86_64-efi memtest86+) + ;; + aarch64*) + BOOTLOADERS=(grub) + IMAGE_TYPE='efi' + TARGET_PKGS+=(grub-arm64-efi) + ;; + *) >&2 echo "architecture $TARGET_ARCH not supported by mklive.sh"; exit 1;; esac # Required packages in the image for a working system. -PACKAGE_LIST="$BASE_SYSTEM_PKG $PACKAGE_LIST" +PACKAGE_LIST+=("$BASE_SYSTEM_PKG") # Check for root permissions. if [ "$(id -u)" -ne 0 ]; then @@ -397,25 +457,27 @@ fi trap 'error_out $? $LINENO' INT TERM 0 if [ -n "$ROOTDIR" ]; then - BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d) + BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -dt mklive-build.XXXXX) else - BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d) + BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -dt mklive-build.XXXXX) fi BUILDDIR=$(readlink -f "$BUILDDIR") IMAGEDIR="$BUILDDIR/image" ROOTFS="$IMAGEDIR/rootfs" VOIDHOSTDIR="$BUILDDIR/void-host" +VOIDTARGETDIR="$BUILDDIR/void-target" BOOT_DIR="$IMAGEDIR/boot" ISOLINUX_DIR="$BOOT_DIR/isolinux" GRUB_DIR="$BOOT_DIR/grub" CURRENT_STEP=0 STEP_COUNT=10 +[ "${IMAGE_TYPE}" = hybrid ] && STEP_COUNT=$((STEP_COUNT+1)) [ "${#INCLUDE_DIRS[@]}" -gt 0 ] && STEP_COUNT=$((STEP_COUNT+1)) -[ -n "${IGNORE_PKGS}" ] && STEP_COUNT=$((STEP_COUNT+1)) +[ "${#IGNORE_PKGS[@]}" -gt 0 ] && STEP_COUNT=$((STEP_COUNT+1)) [ -n "$ROOT_SHELL" ] && STEP_COUNT=$((STEP_COUNT+1)) -: ${SYSLINUX_DATADIR:="$VOIDHOSTDIR"/usr/lib/syslinux} -: ${GRUB_DATADIR:="$VOIDHOSTDIR"/usr/share/grub} +: ${SYSLINUX_DATADIR:="$VOIDTARGETDIR"/usr/lib/syslinux} +: ${GRUB_DATADIR:="$VOIDTARGETDIR"/usr/share/grub} : ${SPLASH_IMAGE:=data/splash.png} : ${XBPS_INSTALL_CMD:=xbps-install} : ${XBPS_REMOVE_CMD:=xbps-remove} @@ -424,30 +486,32 @@ STEP_COUNT=10 : ${XBPS_UHELPER_CMD:=xbps-uhelper} : ${XBPS_RECONFIGURE_CMD:=xbps-reconfigure} -mkdir -p "$ROOTFS" "$VOIDHOSTDIR" "$ISOLINUX_DIR" "$GRUB_DIR" +mkdir -p "$ROOTFS" "$VOIDHOSTDIR" "$VOIDTARGETDIR" "$GRUB_DIR" "$ISOLINUX_DIR" print_step "Synchronizing XBPS repository data..." copy_void_keys "$ROOTFS" +XBPS_ARCH=$TARGET_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S copy_void_keys "$VOIDHOSTDIR" -XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S -XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S +XBPS_ARCH=$HOST_ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S +copy_void_keys "$VOIDTARGETDIR" +XBPS_ARCH=$TARGET_ARCH $XBPS_INSTALL_CMD -r "$VOIDTARGETDIR" ${XBPS_REPOSITORY} -S # Get linux version for ISO # If linux version option specified use shopt -s extglob case "$LINUX_VERSION" in linux+([0-9.])) - IGNORE_PKGS+=" linux" - PACKAGE_LIST+=" $LINUX_VERSION linux-base" + IGNORE_PKGS+=(linux) + PACKAGE_LIST+=("$LINUX_VERSION" linux-base) ;; linux-@(mainline|lts)) - IGNORE_PKGS+=" linux" - PACKAGE_LIST+=" $LINUX_VERSION" - LINUX_VERSION="$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x "$LINUX_VERSION" | grep 'linux[0-9._]\+')" + IGNORE_PKGS+=(linux) + PACKAGE_LIST+=("$LINUX_VERSION") + LINUX_VERSION="$(XBPS_ARCH=$TARGET_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x "$LINUX_VERSION" | grep 'linux[0-9._]\+')" ;; linux) - PACKAGE_LIST+=" linux" - LINUX_VERSION="$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux | grep 'linux[0-9._]\+')" + PACKAGE_LIST+=(linux) + LINUX_VERSION="$(XBPS_ARCH=$TARGET_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux | grep 'linux[0-9._]\+')" ;; *) die "-v option must be in format linux or linux-" @@ -455,28 +519,31 @@ case "$LINUX_VERSION" in esac shopt -u extglob -_kver="$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver $LINUX_VERSION)" +_kver="$(XBPS_ARCH=$TARGET_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver $LINUX_VERSION)" KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver}) if [ "$?" -ne "0" ]; then die "Failed to find kernel package version" fi -: ${OUTPUT_FILE="void-live-${BASE_ARCH}-${KERNELVERSION}-$(date -u +%Y%m%d).iso"} +: ${OUTPUT_FILE="void-live-${TARGET_ARCH}-${KERNELVERSION}-$(date -u +%Y%m%d).iso"} -print_step "Installing software to generate the image: ${REQUIRED_PKGS} ..." -install_prereqs +print_step "Installing software to generate the image: ${REQUIRED_PKGS[*]} ..." +install_prereqs "${REQUIRED_PKGS[@]}" + +print_step "Installing software to generate the image: ${TARGET_PKGS[*]} ..." +install_target_pkgs "${TARGET_PKGS[@]}" mkdir -p "$ROOTFS"/etc [ -s data/motd ] && cp data/motd "$ROOTFS"/etc [ -s data/issue ] && cp data/issue "$ROOTFS"/etc -if [ -n "$IGNORE_PKGS" ]; then - print_step "Ignoring packages in the rootfs: ${IGNORE_PKGS} ..." +if [ "${#IGNORE_PKGS[@]}" -gt 0 ]; then + print_step "Ignoring packages in the rootfs: ${IGNORE_PKGS[*]} ..." ignore_packages fi -print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..." +print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST[*]} ..." install_packages : ${DEFAULT_SERVICE_LIST:=agetty-tty1 agetty-tty2 agetty-tty3 agetty-tty4 agetty-tty5 agetty-tty6 udevd} @@ -496,8 +563,10 @@ fi print_step "Generating initramfs image ($INITRAMFS_COMPRESSION)..." generate_initramfs -print_step "Generating isolinux support for PC-BIOS systems..." -generate_isolinux_boot +if [ "$IMAGE_TYPE" = hybrid ]; then + print_step "Generating isolinux support for PC-BIOS systems..." + generate_isolinux_boot +fi print_step "Generating GRUB support for EFI systems..." generate_grub_efi_boot From b7e8132c947274b395e5cf62736093c8717d21e5 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Mon, 28 Oct 2024 14:43:48 -0400 Subject: [PATCH 03/13] mklive, grub: add support for "platforms" in live isos this can be used to define special platform-specific support things, like extra packages, a device tree, and cmdline. This allows creating live isos that support generic arm64 UEFI as well as ones that require special care (like the x13s) --- grub/grub_void.cfg.in | 127 ------------------------------------- grub/grub_void.cfg.post | 1 + grub/grub_void.cfg.pre | 36 +++++++++++ mklive.sh | 137 ++++++++++++++++++++++++++++++++++++---- platforms/README.md | 22 +++++++ platforms/x13s.sh | 4 ++ 6 files changed, 187 insertions(+), 140 deletions(-) delete mode 100644 grub/grub_void.cfg.in create mode 100644 grub/grub_void.cfg.post create mode 100644 grub/grub_void.cfg.pre create mode 100644 platforms/README.md create mode 100644 platforms/x13s.sh diff --git a/grub/grub_void.cfg.in b/grub/grub_void.cfg.in deleted file mode 100644 index 994e936273..0000000000 --- a/grub/grub_void.cfg.in +++ /dev/null @@ -1,127 +0,0 @@ - -set pager="1" -set locale_dir="(${voidlive})/boot/grub/locale" - -if [ "${grub_cpu}" == "x86_64" ]; then - set kernel_img="vmlinuz" - set memtest="yes" -elif [ "${grub_cpu}" == "i386" ]; then - set kernel_img="vmlinuz" - set memtest="yes" -elif [ "${grub_cpu}" == "arm64" ]; then - set kernel_img="vmlinux" - set memtest="" -fi - -if [ -e "${prefix}/${grub_cpu}-${grub_platform}/all_video.mod" ]; then - insmod all_video -else - insmod efi_gop - insmod efi_uga - insmod video_bochs - insmod video_cirrus -fi - -insmod font - -if loadfont "(${voidlive})/boot/grub/fonts/unicode.pf2" ; then - insmod gfxterm - set gfxmode="auto" - - terminal_input console - terminal_output gfxterm - - insmod png - background_image "(${voidlive})/boot/isolinux/@@SPLASHIMAGE@@" -fi - -# Set default menu entry -default=linux -timeout=15 -timeout_style=menu - -# GRUB init tune for accessibility -play 600 988 1 1319 4 - -if [ cpuid -l ]; then - menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@)" --id "linux" { - set gfxpayload="keep" - linux (${voidlive})/boot/${kernel_img} \ - root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ - rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ - vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ - locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ - initrd (${voidlive})/boot/initrd - } - menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) (RAM)" --id "linuxram" { - set gfxpayload="keep" - linux (${voidlive})/boot/${kernel_img} \ - root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ - rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ - vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ - locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ rd.live.ram - initrd (${voidlive})/boot/initrd - } - menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) (graphics disabled)" --id "linuxnogfx" { - set gfxpayload="keep" - linux (${voidlive})/boot/vmlinuz \ - root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ - rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ - vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ - locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ nomodeset - initrd (${voidlive})/boot/initrd - } - menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) with speech" --hotkey s --id "linuxa11y" { - set gfxpayload="keep" - linux (${voidlive})/boot/${kernel_img} \ - root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ - rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ - vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ - locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ live.accessibility live.autologin - initrd (${voidlive})/boot/initrd - } - menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) with speech (RAM)" --hotkey r --id "linuxa11yram" { - set gfxpayload="keep" - linux (${voidlive})/boot/${kernel_img} \ - root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ - rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ - vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ - locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ live.accessibility live.autologin rd.live.ram - initrd (${voidlive})/boot/initrd - } - menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@) (graphics disabled)" --hotkey g --id "linuxa11ynogfx" { - set gfxpayload="keep" - linux (${voidlive})/boot/vmlinuz \ - root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \ - rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \ - vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \ - locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ live.accessibility live.autologin nomodeset - initrd (${voidlive})/boot/initrd - } - if [ "${memtest}" == "yes" ]; then - if [ "${grub_platform}" == "efi" ]; then - menuentry "Run Memtest86+ (RAM test)" --id memtest { - set gfxpayload="keep" - linux (${voidlive})/boot/memtest.efi - } - menuentry 'UEFI Firmware Settings' --id uefifw { - fwsetup - } - else - menuentry "Run Memtest86+ (RAM test)" --id memtest { - set gfxpayload="keep" - linux (${voidlive})/boot/memtest.bin - } - fi - fi - - menuentry "System restart" --hotkey b --id restart { - echo "System rebooting..." - reboot - } - - menuentry "System shutdown" --hotkey p --id poweroff { - echo "System shutting down..." - halt - } -fi diff --git a/grub/grub_void.cfg.post b/grub/grub_void.cfg.post new file mode 100644 index 0000000000..81b91623e1 --- /dev/null +++ b/grub/grub_void.cfg.post @@ -0,0 +1 @@ +fi # for if [ cpuid -l ] in grub_void.cfg.pre diff --git a/grub/grub_void.cfg.pre b/grub/grub_void.cfg.pre new file mode 100644 index 0000000000..dc59be7b16 --- /dev/null +++ b/grub/grub_void.cfg.pre @@ -0,0 +1,36 @@ +export voidlive + +set pager="1" +set locale_dir="(${voidlive})/boot/grub/locale" + +if [ -e "${prefix}/${grub_cpu}-${grub_platform}/all_video.mod" ]; then + insmod all_video +else + insmod efi_gop + insmod efi_uga + insmod video_bochs + insmod video_cirrus +fi + +insmod font + +if loadfont "(${voidlive})/boot/grub/fonts/unicode.pf2" ; then + insmod gfxterm + set gfxmode="auto" + + terminal_input console + terminal_output gfxterm + + insmod png + background_image "(${voidlive})/boot/isolinux/@@SPLASHIMAGE@@" +fi + +# Set default menu entry +default=linux +timeout=15 +timeout_style=menu + +# GRUB init tune for accessibility +play 600 988 1 1319 4 + +if [ cpuid -l ]; then diff --git a/mklive.sh b/mklive.sh index 64c1f19504..b6e32e699f 100755 --- a/mklive.sh +++ b/mklive.sh @@ -33,26 +33,31 @@ TARGET_PKGS=(base-files) INITRAMFS_PKGS=(binutils xz device-mapper dhclient dracut-network openresolv) PACKAGE_LIST=() IGNORE_PKGS=() +PLATFORMS=() readonly PROGNAME="$(basename "$0")" declare -a INCLUDE_DIRS=() info_msg() { printf "\033[1m$@\n\033[m" } + die() { info_msg "ERROR: $@" error_out 1 $LINENO } + print_step() { CURRENT_STEP=$((CURRENT_STEP+1)) info_msg "[${CURRENT_STEP}/${STEP_COUNT}] $@" } + mount_pseudofs() { for f in sys dev proc; do mkdir -p "$ROOTFS"/$f mount --rbind /$f "$ROOTFS"/$f done } + umount_pseudofs() { for f in sys dev proc; do if [ -d "$ROOTFS/$f" ] && ! umount -R -f "$ROOTFS/$f"; then @@ -61,6 +66,7 @@ umount_pseudofs() { fi done } + error_out() { trap - INT TERM 0 umount_pseudofs || exit "${1:-0}" @@ -76,7 +82,7 @@ usage() { to a CD/DVD-ROM or any USB stick. To generate a more complete live ISO image, use mkiso.sh. - + OPTIONS -a Set XBPS_ARCH in the ISO image -b Set an alternative base package (default: base-system) @@ -95,6 +101,8 @@ usage() { -e Default shell of the root user (must be absolute path). Set the live.shell kernel argument to change the default shell of anon. -C " ..." Add additional kernel command line arguments + -P " ..." + Platforms to enable for aarch64 EFI ISO images (available: x13s) -T Modify the bootloader title (default: Void Linux) -v linux<version> Install a custom Linux version on ISO image (default: linux metapackage). Also accepts linux metapackages (linux-mainline, linux-lts). @@ -149,9 +157,9 @@ install_packages() { mount_pseudofs - LANG=C XBPS_ARCH=$TARGET_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \ + LANG=C XBPS_TARGET_ARCH=$TARGET_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \ ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -y "${PACKAGE_LIST[@]}" "${INITRAMFS_PKGS[@]}" - [ $? -ne 0 ] && die "Failed to install ${PACKAGE_LIST[*]}" + [ $? -ne 0 ] && die "Failed to install ${PACKAGE_LIST[*]} ${INITRAMFS_PKGS[*]}" xbps-reconfigure -r "$ROOTFS" -f base-files >/dev/null 2>&1 chroot "$ROOTFS" env -i xbps-reconfigure -f base-files @@ -256,18 +264,109 @@ generate_isolinux_boot() { } generate_grub_efi_boot() { - set -x cp -f grub/grub.cfg "$GRUB_DIR" cp -f "${SPLASH_IMAGE}" "$ISOLINUX_DIR" - cp -f grub/grub_void.cfg.in "$GRUB_DIR"/grub_void.cfg - sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \ - -e "s|@@KERNVER@@|${KERNELVERSION}|" \ - -e "s|@@KEYMAP@@|${KEYMAP}|" \ - -e "s|@@ARCH@@|$TARGET_ARCH|" \ - -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \ - -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \ - -e "s|@@LOCALE@@|${LOCALE}|" "$GRUB_DIR"/grub_void.cfg + cp -f grub/grub_void.cfg.pre "$GRUB_DIR"/grub_void.cfg + + case "$TARGET_ARCH" in + i686*|x86_64*) KERNEL_IMG=vmlinuz; WANT_MEMTEST=yes ;; + aarch64*) KERNEL_IMG=vmlinux; WANT_MEMTEST=no ;; + esac + + write_entry() { + local entrytitle="$1" id="$2" cmdline="$3" dtb="$4" hotkey="$5" + cat << EOF >> "$GRUB_DIR"/grub_void.cfg +menuentry "${entrytitle}" --id "${id}" ${hotkey:+--hotkey $hotkey} { + set gfxpayload="keep" + linux (\${voidlive})/boot/${KERNEL_IMG} \\ + root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \\ + rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \\ + vconsole.unicode=1 vconsole.keymap=${KEYMAP} locale.LANG=${LOCALE} ${cmdline} + initrd (\${voidlive})/boot/initrd +EOF + if [ -n "${dtb}" ]; then + printf ' devicetree (${voidlive})/boot/dtbs/%s\n' "${dtb}" >> "$GRUB_DIR"/grub_void.cfg + fi + printf '}\n' >> "$GRUB_DIR"/grub_void.cfg + } + + write_entries() { + local title_sfx="$1" id_sfx="$2" cmdline="$3" dtb="$4" + + ENTRY_TITLE="${BOOT_TITLE} ${KERNELVERSION} ${title_sfx}(${TARGET_ARCH})" + + write_entry "${ENTRY_TITLE}" "linux${id_sfx}" \ + "$BOOT_CMDLINE $cmdline" "$dtb" + write_entry "${ENTRY_TITLE} (RAM)" "linuxram${id_sfx}" \ + "rd.live.ram $BOOT_CMDLINE $cmdline" "$dtb" + write_entry "${ENTRY_TITLE} (graphics disabled)" "linuxnogfx${id_sfx}" \ + "nomodeset $BOOT_CMDLINE $cmdline" "$dtb" + write_entry "${ENTRY_TITLE} with speech" "linuxa11y${id_sfx}" \ + "live.accessibility live.autologin $BOOT_CMDLINE $cmdline" "$dtb" 's' + write_entry "${ENTRY_TITLE} with speech (RAM)" "linuxa11yram${id_sfx}" \ + "live.accessibility live.autologin rd.live.ram $BOOT_CMDLINE $cmdline" "$dtb" 'r' + write_entry "${ENTRY_TITLE} with speech (graphics disabled)" "linuxa11ynogfx${id_sfx}" \ + "live.accessibility live.autologin nomodeset $BOOT_CMDLINE $cmdline" "$dtb" 'g' + + } + + write_entries + + for platform in "${PLATFORMS[@]}"; do + ( + . "platforms/${platform}.sh" + + if [ -n "$PLATFORM_DTB" ]; then + mkdir -p "${BOOT_DIR}/dtbs/${PLATFORM_DTB%/*}" + cp "${ROOTFS}/boot/dtbs/dtbs-${KERNVER}"*/"${PLATFORM_DTB}" "${BOOT_DIR}/dtbs/${PLATFORM_DTB}" + fi + + printf 'submenu "%s" --id platform-%s {\n' \ + "${BOOT_TITLE} for ${PLATFORM_NAME:-$platform} >" "${platform}" >> "$GRUB_DIR"/grub_void.cfg + write_entries "for ${PLATFORM_NAME:-$platform} " "-$platform" "$PLATFORM_CMDLINE" "${PLATFORM_DTB}" + printf '}\n' >> "$GRUB_DIR"/grub_void.cfg + ) + done + + if [ "$WANT_MEMTEST" = yes ]; then + cat << 'EOF' >> "$GRUB_DIR"/grub_void.cfg + if [ "${grub_platform}" == "efi" ]; then + menuentry "Run Memtest86+ (RAM test)" --id memtest { + set gfxpayload="keep" + linux (${voidlive})/boot/memtest.efi + } + else + menuentry "Run Memtest86+ (RAM test)" --id memtest { + set gfxpayload="keep" + linux (${voidlive})/boot/memtest.bin + } + fi +EOF + fi + + cat << 'EOF' >> "$GRUB_DIR"/grub_void.cfg +if [ "${grub_platform}" == "efi" ]; then + menuentry 'UEFI Firmware Settings' --hotkey f --id uefifw { + fwsetup + } +fi + +menuentry "System restart" --hotkey b --id restart { + echo "System rebooting..." + reboot +} + +menuentry "System shutdown" --hotkey p --id poweroff { + echo "System shutting down..." + halt +} +EOF + cat grub/grub_void.cfg.post >> "$GRUB_DIR"/grub_void.cfg + + sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" "$GRUB_DIR"/grub_void.cfg + mkdir -p "$GRUB_DIR"/fonts + cp -f "$GRUB_DATADIR"/unicode.pf2 "$GRUB_DIR"/fonts modprobe -q loop || : @@ -387,7 +486,7 @@ generate_iso_image() { # # main() # -while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do +while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:P:Vh" opt; do case $opt in a) TARGET_ARCH="$OPTARG";; b) BASE_SYSTEM_PKG="$OPTARG";; @@ -404,6 +503,7 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do s) SQUASHFS_COMPRESSION="$OPTARG";; o) OUTPUT_FILE="$OPTARG";; p) PACKAGE_LIST+=($OPTARG);; + P) PLATFORMS+=($OPTARG) ;; C) BOOT_CMDLINE="$OPTARG";; T) BOOT_TITLE="$OPTARG";; v) LINUX_VERSION="$OPTARG";; @@ -437,11 +537,22 @@ case "$TARGET_ARCH" in BOOTLOADERS=(syslinux grub) IMAGE_TYPE='hybrid' TARGET_PKGS+=(syslinux grub-i386-efi grub-x86_64-efi memtest86+) + PLATFORMS=() # arm only ;; aarch64*) BOOTLOADERS=(grub) IMAGE_TYPE='efi' TARGET_PKGS+=(grub-arm64-efi) + for platform in "${PLATFORMS[@]}"; do + if [ -r "platforms/${platform}.sh" ]; then + . "platforms/${platform}.sh" + else + die "unknown platform: ${platform}" + fi + PACKAGE_LIST+=("${PLATFORM_PKGS[@]}") + unset PLATFORM_PKGS PLATFORM_CMDLINE PLATFORM_DTB + done + ;; *) >&2 echo "architecture $TARGET_ARCH not supported by mklive.sh"; exit 1;; esac diff --git a/platforms/README.md b/platforms/README.md new file mode 100644 index 0000000000..aa8a8d1153 --- /dev/null +++ b/platforms/README.md @@ -0,0 +1,22 @@ +## mklive platforms + +To allow for platform-specific customization (and platform-specific/generic +images all-in-one) on aarch64, `mklive.sh -P "platform1 platform2 ..."` can be +used. That will, in turn, source `platform1.sh` and `platform2.sh` from this +directory to do a few things: + +1. add packages to the image +2. add menu entries in GRUB + +### File format + +```bash +# an optional pretty name +PLATFORM_NAME="Thinkpad X13s" +# any additional packages to add (bash array) +PLATFORM_PKGS=(x13s-base) +# any special kernel cmdline arguments +PLATFORM_CMDLINE="rd.driver.blacklist=qcom_q6v5_pas arm64.nopauth clk_ignore_unused pd_ignore_unused" +# device tree (path relative to /boot/dtbs/dtbs-$version/) +PLATFORM_DTB="qcom/sc8280xp-lenovo-thinkpad-x13s.dtb" +``` diff --git a/platforms/x13s.sh b/platforms/x13s.sh new file mode 100644 index 0000000000..081eb01a25 --- /dev/null +++ b/platforms/x13s.sh @@ -0,0 +1,4 @@ +PLATFORM_NAME="Thinkpad X13s" +PLATFORM_PKGS=(x13s-base) +PLATFORM_CMDLINE="rd.driver.blacklist=qcom_q6v5_pas arm64.nopauth clk_ignore_unused pd_ignore_unused" +PLATFORM_DTB="qcom/sc8280xp-lenovo-thinkpad-x13s.dtb" From 29832646e6f5ccc3948e07cbea30f1d393ebd945 Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Fri, 20 Dec 2024 10:22:06 -0500 Subject: [PATCH 04/13] platforms: add pinebookpro --- mklive.sh | 2 +- platforms/pinebookpro.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 platforms/pinebookpro.sh diff --git a/mklive.sh b/mklive.sh index b6e32e699f..518b72595c 100755 --- a/mklive.sh +++ b/mklive.sh @@ -102,7 +102,7 @@ usage() { Set the live.shell kernel argument to change the default shell of anon. -C "<arg> ..." Add additional kernel command line arguments -P "<platform> ..." - Platforms to enable for aarch64 EFI ISO images (available: x13s) + Platforms to enable for aarch64 EFI ISO images (available: pinebookpro, x13s) -T <title> Modify the bootloader title (default: Void Linux) -v linux<version> Install a custom Linux version on ISO image (default: linux metapackage). Also accepts linux metapackages (linux-mainline, linux-lts). diff --git a/platforms/pinebookpro.sh b/platforms/pinebookpro.sh new file mode 100644 index 0000000000..ddca53e602 --- /dev/null +++ b/platforms/pinebookpro.sh @@ -0,0 +1,4 @@ +PLATFORM_NAME="Pinebook Pro" +PLATFORM_PKGS=(pinebookpro-base) +PLATFORM_CMDLINE="console=ttyS2,115200 video=eDP-1:1920x1080x60" +PLATFORM_DTB="rockchip/rk3399-pinebook-pro.dtb" From d7d3268e24edd5eecd31e44d8e934efcbf76da6d Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Thu, 26 Dec 2024 12:13:26 -0500 Subject: [PATCH 05/13] lib.sh: update binfmt handling, add riscv recent qemu updates mean we don't need to hardcode the binfmts, as they are shipped as files generated by qemu, importable by update-binfmts. ref: #386 --- lib.sh | 26 ++++++++------------------ mkrootfs.sh | 1 + 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/lib.sh b/lib.sh index 43d7329e32..075010417c 100755 --- a/lib.sh +++ b/lib.sh @@ -210,52 +210,39 @@ register_binfmt() { return fi _cpu=arm - _magic="\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00" - _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" ;; aarch64) _cpu=aarch64 - _magic="\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7" - _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" ;; ppc64le) _cpu=ppc64le - _magic="\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00" - _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00" ;; ppc64) _cpu=ppc64 - _magic="\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15" - _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" ;; ppc) if [ "$_hostarch" = "ppc64" ] ; then return fi _cpu=ppc - _magic="\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14" - _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" ;; mipsel) if [ "$_hostarch" = "mips64el" ] ; then return fi _cpu=mipsel - _magic="\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00" - _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" ;; x86_64) _cpu=x86_64 - _magic="\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00" - _mask="\xff\xff\xff\xff\xff\xfe\xfe\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" ;; i686) if [ "$_hostarch" = "x86_64" ] ; then return fi _cpu=i386 - _magic="\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00" - _mask="\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" + ;; + riscv64) + _cpu=riscv64 ;; *) die "Unknown target architecture!" @@ -264,7 +251,7 @@ register_binfmt() { # For builds that do not match the host architecture, the correct # qemu binary will be required. - QEMU_BIN="qemu-${_cpu}-static" + QEMU_BIN="qemu-${_cpu}" if ! $QEMU_BIN -version >/dev/null 2>&1; then die "$QEMU_BIN binary is missing in your system, exiting." fi @@ -278,7 +265,10 @@ register_binfmt() { # Only register if the map is incomplete if [ ! -f /proc/sys/fs/binfmt_misc/qemu-$_cpu ] ; then - echo ":qemu-$_cpu:M::$_magic:$_mask:/usr/bin/$QEMU_BIN:F" > /proc/sys/fs/binfmt_misc/register 2>/dev/null + if ! command -v update-binfmts >/dev/null 2>&1; then + die "could not add binfmt: update-binfmts binary is missing in your system" + fi + update-binfmts --import "qemu-$_cpu" fi } diff --git a/mkrootfs.sh b/mkrootfs.sh index dbdd693013..54e101b7ef 100755 --- a/mkrootfs.sh +++ b/mkrootfs.sh @@ -57,6 +57,7 @@ usage() { aarch64, aarch64-musl, mipsel, mipsel-musl, ppc, ppc-musl, ppc64le, ppc64le-musl, ppc64, ppc64-musl + riscv64, riscv64-musl OPTIONS -b <system-pkg> Set an alternative base-system package (default: base-container-full) From 311d4fc5b19565716bbace03a32fbec97eeb17ec Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Thu, 26 Dec 2024 12:15:03 -0500 Subject: [PATCH 06/13] mklive.sh: use lib.sh more but don't use it for everything, as some things seem a bit broken with mklive specifically closes: #322 --- lib.sh | 2 -- mklive.sh | 10 ++++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib.sh b/lib.sh index 075010417c..d76495e888 100755 --- a/lib.sh +++ b/lib.sh @@ -323,8 +323,6 @@ rk33xx_flash_uboot() { --repository=https://repo-default.voidlinux.org/current/musl \ --repository=https://repo-default.voidlinux.org/current/aarch64}" - - # This library is the authoritative source of the platform map, # because of this we may need to get this information from the command # line. This select allows us to get that information out. This diff --git a/mklive.sh b/mklive.sh index 518b72595c..fc109ea3ea 100755 --- a/mklive.sh +++ b/mklive.sh @@ -37,18 +37,14 @@ PLATFORMS=() readonly PROGNAME="$(basename "$0")" declare -a INCLUDE_DIRS=() -info_msg() { - printf "\033[1m$@\n\033[m" -} - die() { - info_msg "ERROR: $@" + info_msg "ERROR: $*" error_out 1 $LINENO } print_step() { CURRENT_STEP=$((CURRENT_STEP+1)) - info_msg "[${CURRENT_STEP}/${STEP_COUNT}] $@" + info_msg "[${CURRENT_STEP}/${STEP_COUNT}] $*" } mount_pseudofs() { @@ -532,6 +528,8 @@ HOST_ARCH=$(xbps-uhelper arch) : ${BOOT_TITLE:="Void Linux"} : ${LINUX_VERSION:=linux} +XBPS_TARGET_ARCH="$TARGET_ARCH" register_binfmt + case "$TARGET_ARCH" in x86_64*|i686*) BOOTLOADERS=(syslinux grub) From db0a74aecfc2fbf5248f6d80c3f5cdb92aef571f Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Thu, 26 Dec 2024 14:08:46 -0500 Subject: [PATCH 07/13] mklive.sh: ensure dash is /bin/sh if installed --- mklive.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mklive.sh b/mklive.sh index fc109ea3ea..ab327d311e 100755 --- a/mklive.sh +++ b/mklive.sh @@ -164,13 +164,21 @@ install_packages() { if [ -f "$ROOTFS"/etc/default/libc-locales ]; then sed -e "s/\#\(${LOCALE}.*\)/\1/g" -i "$ROOTFS"/etc/default/libc-locales fi + if XBPS_ARCH=$BASE_ARCH "$XBPS_QUERY_CMD" -r "$ROOTFS" dkms >/dev/null 2>&1; then # dkms modules alphabetically before dkms can't configure # if dkms hasn't configured beforehand to create /var/lib/dkms chroot "$ROOTFS" env -i xbps-reconfigure dkms fi + chroot "$ROOTFS" env -i xbps-reconfigure -a + if XBPS_ARCH=$BASE_ARCH "$XBPS_QUERY_CMD" -r "$ROOTFS" dash >/dev/null 2>&1; then + # bash configures alphabetically before dash, + # so if it's installed we should ensure it's /bin/sh + chroot "$ROOTFS" env -i xbps-alternatives -s dash + fi + post_install_packages } From dcf4e6e9adfaa22f2b47ef29df45f6b2bfbb1471 Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Thu, 26 Dec 2024 19:58:10 -0500 Subject: [PATCH 08/13] mkiso: don't install void-installer on aarch64 aarch64 is full of special cases that void-installer doesn't know about, especially for real platforms. Users should just do chroot installs for now. --- mkiso.sh | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/mkiso.sh b/mkiso.sh index b280dc382d..db5bf22c58 100755 --- a/mkiso.sh +++ b/mkiso.sh @@ -56,6 +56,19 @@ cleanup() { rm -rf "$INCLUDEDIR" } +include_installer() { + if [ -x installer.sh ]; then + MKLIVE_VERSION="$(PROGNAME='' version)" + installer=$(mktemp) + sed "s/@@MKLIVE_VERSION@@/${MKLIVE_VERSION}/" installer.sh > "$installer" + install -Dm755 "$installer" "$INCLUDEDIR"/usr/bin/void-installer + rm "$installer" + else + echo installer.sh not found >&2 + exit 1 + fi +} + setup_pipewire() { PKGS="$PKGS pipewire alsa-pipewire" mkdir -p "$INCLUDEDIR"/etc/xdg/autostart @@ -72,10 +85,16 @@ build_variant() { variant="$1" shift IMG=void-live-${ARCH}-${DATE}-${variant}.iso + + # el-cheapo installer is unsupported on arm because arm doesn't install a kernel by default + # and to work around that would add too much complexity to it + # thus everyone should just do a chroot install anyways + WANT_INSTALLER=no case "$ARCH" in - x86_64*|i686*) GRUB_PKGS="grub-i386-efi grub-x86_64-efi" ;; + x86_64*|i686*) GRUB_PKGS="grub-i386-efi grub-x86_64-efi"; WANT_INSTALLER=yes ;; aarch64*) GRUB_PKGS="grub-arm64-efi" ;; esac + A11Y_PKGS="espeakup void-live-audio brltty" PKGS="dialog cryptsetup lvm2 mdadm void-docs-browse xtools-minimal xmirror chrony tmux $A11Y_PKGS $GRUB_PKGS" XORG_PKGS="xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf orca" @@ -140,6 +159,14 @@ indicators = ~host;~spacer;~clock;~spacer;~layout;~session;~a11y;~power EOF fi + if [ "$WANT_INSTALLER" = yes ]; then + include_installer + else + mkdir -p "$INCLUDEDIR"/usr/bin + printf "#!/bin/sh\necho 'void-installer is not supported on this live image'\n" > "$INCLUDEDIR"/usr/bin/void-installer + chmod 755 "$INCLUDEDIR"/usr/bin/void-installer + fi + if [ "$variant" != base ]; then setup_pipewire fi @@ -154,17 +181,6 @@ if [ ! -x mklive.sh ]; then exit 1 fi -if [ -x installer.sh ]; then - MKLIVE_VERSION="$(PROGNAME='' version)" - installer=$(mktemp) - sed "s/@@MKLIVE_VERSION@@/${MKLIVE_VERSION}/" installer.sh > "$installer" - install -Dm755 "$installer" "$INCLUDEDIR"/usr/bin/void-installer - rm "$installer" -else - echo installer.sh not found >&2 - exit 1 -fi - if [ -n "$TRIPLET" ]; then VARIANT="${TRIPLET##*-}" REST="${TRIPLET%-*}" From a601fa6797bdb5fe78ae97382aed53c8c685afdc Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Thu, 26 Dec 2024 19:57:32 -0500 Subject: [PATCH 09/13] Makefile: add arm64 live isos --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 45abcb1016..0a547a5f51 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ DATECODE:=$(shell date -u "+%Y%m%d") SHELL=/bin/bash -T_LIVE_ARCHS=i686 x86_64{,-musl} +T_LIVE_ARCHS=i686 x86_64{,-musl} aarch64{,-musl} T_PLATFORMS=rpi-{armv{6,7}l,aarch64}{,-musl} GCP{,-musl} pinebookpro{,-musl} T_ARCHS=i686 x86_64{,-musl} armv{6,7}l{,-musl} aarch64{,-musl} @@ -13,6 +13,7 @@ T_PXE_ARCHS=x86_64{,-musl} LIVE_ARCHS:=$(shell echo $(T_LIVE_ARCHS)) LIVE_FLAVORS:=base enlightenment xfce mate cinnamon gnome kde lxde lxqt +LIVE_PLATFORMS:=pinebookpro x13s ARCHS:=$(shell echo $(T_ARCHS)) PLATFORMS:=$(shell echo $(T_PLATFORMS)) SBC_IMGS:=$(shell echo $(T_SBC_IMGS)) @@ -61,7 +62,7 @@ live-iso-all-print: void-live-%.iso: mkiso.sh @[ -n "${CI}" ] && printf "::group::\x1b[32mBuilding $@...\x1b[0m\n" || true - $(SUDO) ./mkiso.sh -r $(REPOSITORY) -t $* + $(SUDO) ./mkiso.sh -r $(REPOSITORY) -t $* -- -P "$(LIVE_PLATFORMS)" @[ -n "${CI}" ] && printf '::endgroup::\n' || true rootfs-all: $(ALL_ROOTFS) From 879d495ca2f33a3103730f8fd08e02d8b1f488cb Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Tue, 29 Oct 2024 19:04:29 -0400 Subject: [PATCH 10/13] README: regenerate --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7530157d90..00c29d2ed9 100644 --- a/README.md +++ b/README.md @@ -139,9 +139,14 @@ OPTIONS -g "<pkg> ..." Ignore packages when building the ISO image -I <includedir> Include directory structure under given path in the ROOTFS -S "<service> ..." Enable services in the ISO image + -e <shell> Default shell of the root user (must be absolute path). + Set the live.shell kernel argument to change the default shell of anon. -C "<arg> ..." Add additional kernel command line arguments + -P "<platform> ..." + Platforms to enable for aarch64 EFI ISO images (available: pinebookpro, x13s) -T <title> Modify the bootloader title (default: Void Linux) - -v linux<version> Install a custom Linux version on ISO image (default: linux metapackage) + -v linux<version> Install a custom Linux version on ISO image (default: linux metapackage). + Also accepts linux metapackages (linux-mainline, linux-lts). -K Do not remove builddir -h Show this help and exit -V Show version and exit @@ -160,6 +165,7 @@ Supported architectures: aarch64, aarch64-musl, mipsel, mipsel-musl, ppc, ppc-musl, ppc64le, ppc64le-musl, ppc64, ppc64-musl + riscv64, riscv64-musl OPTIONS -b <system-pkg> Set an alternative base-system package (default: base-container-full) @@ -182,7 +188,7 @@ generated by mkrootfs.sh. Supported platforms: i686, x86_64, GCP, rpi-armv6l, rpi-armv7l, rpi-aarch64, - pinebookpro, pinephone, rock64 + pinebookpro, pinephone, rock64, rockpro64 OPTIONS -b <system-pkg> Set an alternative base-system package (default: base-system) @@ -212,7 +218,7 @@ OPTIONS -b <fstype> /boot filesystem type (default: vfat) -B <bsize> /boot filesystem size (default: 256MiB) -r <fstype> / filesystem type (default: ext4) - -s <totalsize> Total image size (default: 2GiB) + -s <totalsize> Total image size (default: 768MiB) -o <output> Image filename (default: guessed automatically) -x <num> Number of threads to use for image compression (default: dynamic) -h Show this help and exit From f5d308a6843088ebd667af1ba264b458911c826f Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Fri, 27 Dec 2024 13:58:16 -0500 Subject: [PATCH 11/13] isolinux: add more rows to accomodate more entries --- isolinux/isolinux.cfg.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isolinux/isolinux.cfg.in b/isolinux/isolinux.cfg.in index 5849e9f90b..6094bd561a 100644 --- a/isolinux/isolinux.cfg.in +++ b/isolinux/isolinux.cfg.in @@ -8,7 +8,7 @@ MENU AUTOBOOT BIOS default device boot in # second{,s}... MENU BACKGROUND @@SPLASHIMAGE@@ MENU WIDTH 78 MENU MARGIN 1 -MENU ROWS 9 +MENU ROWS 12 MENU VSHIFT 2 MENU TIMEOUTROW 13 MENU TABMSGROW 2 From fc7b3a13465e48b0b121c2412d41ec7ea903c9e1 Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Fri, 27 Dec 2024 14:55:46 -0500 Subject: [PATCH 12/13] .github/workflows/gen-images: add aarch64* live isos, matrixify jobs also simplify environment prep and fix qemu dependencies the matrix should ensure we never run out of space while building unfortunately, github limits us to 10 inputs so we can't add a selector for live iso platforms --- .github/workflows/gen-images.yml | 83 +++++++++++++++++++------------- 1 file changed, 50 insertions(+), 33 deletions(-) diff --git a/.github/workflows/gen-images.yml b/.github/workflows/gen-images.yml index b057249f2a..e69a54d4d9 100644 --- a/.github/workflows/gen-images.yml +++ b/.github/workflows/gen-images.yml @@ -14,7 +14,7 @@ on: type: boolean live_archs: description: "Archs to build live ISOs for" - default: "x86_64 x86_64-musl i686" + default: "x86_64 x86_64-musl i686 aarch64 aarch64-musl" required: false type: string live_flavors: @@ -69,6 +69,11 @@ jobs: datecode: ${{ steps.prep.outputs.datecode }} revision: ${{ steps.prep.outputs.revision }} mirror: ${{ steps.prep.outputs.mirror }} + live_archs: ${{ steps.prep.outputs.live_archs }} + live_flavors: ${{ steps.prep.outputs.live_flavors }} + rootfs: ${{ steps.prep.outputs.rootfs }} + platformfs: ${{ steps.prep.outputs.platformfs }} + sbc_imgs: ${{ steps.prep.outputs.sbc_imgs }} steps: - name: Prepare Environment @@ -82,12 +87,28 @@ jobs: echo "revision=${GITHUB_SHA:0:8}" >> $GITHUB_OUTPUT echo "mirror=https://repo-ci.voidlinux.org/current" >> $GITHUB_OUTPUT + jsonify() { + sed 's/\s\+/ /g' | jq -Rrc 'split(" ")' + } + + echo "live_archs=$(echo "${{ inputs.live_archs }}" | jsonify)" >> $GITHUB_OUTPUT + echo "live_flavors=$(echo "${{ inputs.live_flavors }}" | jsonify)" >> $GITHUB_OUTPUT + + echo "rootfs=$(echo "${{ inputs.rootfs }}" | jsonify)" >> $GITHUB_OUTPUT + echo "platformfs=$(echo "${{ inputs.platformfs }}" | jsonify)" >> $GITHUB_OUTPUT + echo "sbc_imgs=$(echo "${{ inputs.sbc_imgs }}" | jsonify)" >> $GITHUB_OUTPUT + build-live-isos: name: Build Live ISOs runs-on: ubuntu-latest needs: prepare if: ${{ inputs.live_iso_flag }} + strategy: + matrix: + arch: ${{ fromJson(needs.prepare.outputs.live_archs) }} + flavor: ${{ fromJson(needs.prepare.outputs.live_flavors) }} + container: image: 'ghcr.io/void-linux/void-glibc-full:20231230R1' options: --privileged @@ -105,12 +126,8 @@ jobs: mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/ sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \ /etc/xbps.d/*-repository-*.conf - # Sync and upgrade once, assume error comes from xbps update - xbps-install -Syu || xbps-install -yu xbps - # Upgrade again (in case there was a xbps update) - xbps-install -yu - # Install depedencies - xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs + xbps-install -Syu xbps && xbps-install -yu + xbps-install -yu bash make git kmod xz lzo qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs - name: Clone and checkout uses: classabbyamp/treeless-checkout-action@v1 @@ -119,7 +136,7 @@ jobs: make live-iso-all-print live-iso-all \ SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \ DATECODE="${{ needs.prepare.outputs.datecode }}" \ - LIVE_ARCHS="${{ inputs.live_archs }}" LIVE_FLAVORS="${{ inputs.live_flavors }}" + LIVE_ARCHS="${{ matrix.arch }}" LIVE_FLAVORS="${{ matrix.flavor }}" - name: Prepare artifacts for upload run: | @@ -127,7 +144,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: void-iso-${{ needs.prepare.outputs.datecode }} + name: void-iso-${{ matrix.arch }}-${{ matrix.flavor }}-${{ needs.prepare.outputs.datecode }} path: | distdir-${{ needs.prepare.outputs.datecode }}/* if-no-files-found: error @@ -138,6 +155,10 @@ jobs: needs: prepare if: ${{ inputs.rootfs_flag }} + strategy: + matrix: + arch: ${{ fromJson(needs.prepare.outputs.rootfs) }} + container: image: 'ghcr.io/void-linux/void-glibc-full:20231230R1' options: --privileged @@ -155,12 +176,8 @@ jobs: mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/ sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \ /etc/xbps.d/*-repository-*.conf - # Sync and upgrade once, assume error comes from xbps update - xbps-install -Syu || xbps-install -yu xbps - # Upgrade again (in case there was a xbps update) - xbps-install -yu - # Install depedencies - xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs + xbps-install -Syu xbps && xbps-install -yu + xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs - name: Clone and checkout uses: classabbyamp/treeless-checkout-action@v1 @@ -169,7 +186,7 @@ jobs: make rootfs-all-print rootfs-all \ SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \ DATECODE="${{ needs.prepare.outputs.datecode }}" \ - ARCHS="${{ inputs.rootfs }}" + ARCHS="${{ matrix.arch }}" - name: Prepare artifacts for upload run: | @@ -177,7 +194,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: void-rootfs-${{ needs.prepare.outputs.datecode }} + name: void-rootfs-${{ matrix.arch }}-${{ needs.prepare.outputs.datecode }} path: | distdir-${{ needs.prepare.outputs.datecode }}/* if-no-files-found: error @@ -188,6 +205,10 @@ jobs: needs: prepare if: ${{ inputs.platformfs_flag }} + strategy: + matrix: + platform: ${{ fromJson(needs.prepare.outputs.platformfs) }} + container: image: 'ghcr.io/void-linux/void-glibc-full:20231230R1' options: --privileged @@ -205,12 +226,8 @@ jobs: mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/ sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \ /etc/xbps.d/*-repository-*.conf - # Sync and upgrade once, assume error comes from xbps update - xbps-install -Syu || xbps-install -yu xbps - # Upgrade again (in case there was a xbps update) - xbps-install -yu - # Install depedencies - xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs + xbps-install -Syu xbps && xbps-install -yu + xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs - name: Clone and checkout uses: classabbyamp/treeless-checkout-action@v1 @@ -219,7 +236,7 @@ jobs: make platformfs-all-print platformfs-all \ SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \ DATECODE="${{ needs.prepare.outputs.datecode }}" \ - PLATFORMS="${{ inputs.platformfs }}" + PLATFORMS="${{ matrix.platform }}" - name: Prepare artifacts for upload run: | @@ -227,7 +244,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: void-platformfs-${{ needs.prepare.outputs.datecode }} + name: void-platformfs-${{ matrix.platform }}-${{ needs.prepare.outputs.datecode }} path: | distdir-${{ needs.prepare.outputs.datecode }}/* !distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS* @@ -239,6 +256,10 @@ jobs: needs: prepare if: ${{ inputs.sbc_img_flag }} + strategy: + matrix: + platform: ${{ fromJson(needs.prepare.outputs.sbc_imgs) }} + container: image: 'ghcr.io/void-linux/void-glibc-full:20231230R1' options: --privileged @@ -256,12 +277,8 @@ jobs: mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/ sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \ /etc/xbps.d/*-repository-*.conf - # Sync and upgrade once, assume error comes from xbps update - xbps-install -Syu || xbps-install -yu xbps - # Upgrade again (in case there was a xbps update) - xbps-install -yu - # Install depedencies - xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs + xbps-install -Syu xbps && xbps-install -yu + xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs - name: Clone and checkout uses: classabbyamp/treeless-checkout-action@v1 @@ -270,7 +287,7 @@ jobs: make images-all-sbc-print images-all-sbc \ SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \ DATECODE="${{ needs.prepare.outputs.datecode }}" \ - SBC_IMGS="${{ inputs.sbc_imgs }}" + SBC_IMGS="${{ matrix.platform }}" - name: Prepare artifacts for upload run: | @@ -278,7 +295,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: void-sbc-img-${{ needs.prepare.outputs.datecode }} + name: void-sbc-img-${{ matrix.platform }}-${{ needs.prepare.outputs.datecode }} path: | distdir-${{ needs.prepare.outputs.datecode }}/* !distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS* From bc74f06eda0a2e60ca9aaa7e39c0f42c4a57fe0d Mon Sep 17 00:00:00 2001 From: classabbyamp <void@placeviolette.net> Date: Fri, 27 Dec 2024 18:59:56 -0500 Subject: [PATCH 13/13] .gitattributes: only root readme is generated --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 4981a65851..9eb82cdfc0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -README.md linguist-generated=true +/README.md linguist-generated=true