Compare commits

...

2 commits

Author SHA1 Message Date
Tobias Powalowski
1f9bab0af0 same name scheme for UKI images lime ISO names 2024-09-06 21:53:42 +02:00
Tobias Powalowski
0c6e6c6448 code cleanup, movr common paramters to common.sh 2024-09-06 20:29:40 +02:00
9 changed files with 30 additions and 37 deletions

View file

@ -3,6 +3,7 @@ On the road to 2024.09:
- added custom autorun script support
- added archboot-x86_64-uki.sh script
- added archboot-aarch64-uki.sh script
- switched name scheme for UKI images
setup:
- switched to new limine 8.0 config layout (issue #4)
- switched to mkinitcpio uki generation (issue #3)

View file

@ -26,6 +26,9 @@ else
_ARCHBOOT="archboot"
_ARCH="x86_64"
fi
_CONFIG_DIR="/etc/archboot"
_AMD_UCODE="/boot/amd-ucode.img"
_INTEL_UCODE="/boot/intel-ucode.img"
_PACMAN_MIRROR="/etc/pacman.d/mirrorlist"
_PACMAN_CONF="/etc/pacman.conf"
_PACMAN_LIB="/var/lib/pacman"
@ -359,3 +362,8 @@ _create_cpio() {
popd >"${_NO_LOG}" || return 1
echo "Build complete."
}
_reproducibility() {
# Reproducibility: set all timestamps to 0
fd . "${1}" -u --min-depth 1 -X touch -hcd "@0"
}

View file

@ -232,7 +232,7 @@ _copy_archboot_defaults() {
cp /etc/archboot/defaults "${1}"/etc/archboot/defaults
}
_reproducibility() {
_container_reproducibility() {
echo "Reproducibility changes..."
#shellcheck disable=SC2016
sd '(INSTALLDATE%)\n.*' '$1\n0' "${1}""${_PACMAN_LIB}"/local/*/desc

View file

@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
. /etc/archboot/defaults
_CONFIG_DIR="/etc/archboot"
_ISODIR="$(mktemp -d ISODIR.XXX)"
_BOOTLOADER="/usr/share/archboot/bootloader"
@ -107,14 +106,14 @@ _prepare_ucode() {
# only x86_64
if [[ "${_ARCH}" == "x86_64" ]]; then
echo "Preparing intel-ucode..."
cp /boot/intel-ucode.img "${_ISODIR}/boot/"
cp "${_INTEL_UCODE}" "${_ISODIR}/boot/"
mkdir -p "${_ISODIR}"/licenses/intel-ucode
cp /usr/share/licenses/intel-ucode/LICENSE "${_ISODIR}/licenses/intel-ucode"
fi
# both x86_64 and aarch64
if ! [[ "${_ARCH}" == "riscv64" ]]; then
echo "Preparing amd-ucode..."
cp /boot/amd-ucode.img "${_ISODIR}/boot/"
cp "${_AMD_UCODE}" "${_ISODIR}/boot/"
mkdir -p "${_ISODIR}"/licenses/amd-ucode
cp /usr/share/licenses/amd-ucode/LICENSE.amd-ucode "${_ISODIR}/licenses/amd-ucode"
fi
@ -175,11 +174,6 @@ _prepare_background() {
cp ${_GRUB_BACKGROUND} "${_ISODIR}/boot/grub/archboot-background.png"
}
_reproducibility() {
# Reproducibility: set all timestamps to 0
fd . "${_ISODIR}" -u --min-depth 1 -X touch -hcd "@0"
}
_prepare_uefi_image() {
echo "Preparing UEFI image..."
## get size of boot files

View file

@ -2,8 +2,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
. /etc/archboot/defaults
_AMD_UCODE="boot/amd-ucode.img"
_INTEL_UCODE="boot/intel-ucode.img"
_INITRD="boot/initrd-${_ARCH}.img"
_INITRD_LATEST="boot/initrd-latest-${_ARCH}.img"
_INITRD_LOCAL="boot/initrd-local-${_ARCH}.img"
@ -41,7 +39,7 @@ _create_iso() {
. "${_W_DIR}/etc/archboot/${_ARCH}.conf"
#shellcheck disable=SC2116,SC2046,2086
_KVER="$(_kver $(echo ${_W_DIR}${_KERNEL}))"
_ISONAME="archboot-$(date +%Y.%m.%d-%H.%M)-${_KVER}"
_NAME="archboot-$(date +%Y.%m.%d-%H.%M)-${_KVER}"
if ! [[ "${_RUNNING_ARCH}" == "${_ARCH}" ]]; then
### to speedup build for riscv64 and aarch64 on x86_64, run compressor on host system
echo "Generating initramdisks..."
@ -70,16 +68,16 @@ _create_iso() {
echo "Generating local ISO..."
# generate local iso in container
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*;archboot-${_ARCH}-iso.sh -g -s \
-c=${_CONFIG_LOCAL} -i=${_ISONAME}-local-${_ARCH}" || exit 1
-c=${_CONFIG_LOCAL} -i=${_NAME}-local-${_ARCH}" || exit 1
echo "Generating latest ISO..."
# generate latest iso in container
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*;archboot-${_ARCH}-iso.sh -g \
-c=${_CONFIG_LATEST} -i=${_ISONAME}-latest-${_ARCH}" || exit 1
-c=${_CONFIG_LATEST} -i=${_NAME}-latest-${_ARCH}" || exit 1
fi
echo "Generating normal ISO..."
# generate iso in container
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;archboot-${_ARCH}-iso.sh -g -s \
-i=${_ISONAME}-${_ARCH}" || exit 1
-i=${_NAME}-${_ARCH}" || exit 1
# move iso out of container
mv "${_W_DIR}"/*.iso ./ &>"${_NO_LOG}"
mv "${_W_DIR}"/*.img ./ &>"${_NO_LOG}"
@ -102,8 +100,8 @@ _create_iso() {
for i in *.iso; do
if echo "${i}" | rg -v 'local' | rg -vq 'latest'; then
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
mcopy -m -i efi.img ::/"${_AMD_UCODE}" ./"${_AMD_UCODE}"
[[ "${_ARCH}" == "aarch64" ]] || mcopy -m -i efi.img ::/"${_INTEL_UCODE}" ./"${_INTEL_UCODE}"
mcopy -m -i efi.img ::"${_AMD_UCODE}" ."${_AMD_UCODE}"
[[ "${_ARCH}" == "aarch64" ]] || mcopy -m -i efi.img ::"${_INTEL_UCODE}" ."${_INTEL_UCODE}"
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD}"
mcopy -m -i efi.img ::/"${_KERNEL_ARCHBOOT}" ./"${_KERNEL_ARCHBOOT}"
elif echo "${i}" | rg -q 'latest'; then
@ -137,14 +135,14 @@ _create_iso() {
cp "${_W_DIR}/boot/Image" "boot/Image-${_ARCH}"
_KERNEL_ARCHBOOT="boot/Image-${_ARCH}"
fi
[[ -n "${_INTEL_UCODE}" ]] && _INTEL_UCODE="--initrd=${_INTEL_UCODE}"
[[ -n "${_AMD_UCODE}" ]] && _AMD_UCODE="--initrd=${_AMD_UCODE}"
[[ -n "${_INTEL_UCODE}" ]] && _INTEL_UCODE="--initrd=.${_INTEL_UCODE}"
[[ -n "${_AMD_UCODE}" ]] && _AMD_UCODE="--initrd=.${_AMD_UCODE}"
rm -r "${_W_DIR:?}"/boot
mv boot "${_W_DIR}"
for initrd in ${_INITRD} ${_INITRD_LATEST} ${_INITRD_LOCAL}; do
[[ "${initrd}" == "${_INITRD}" ]] && _UKI="boot/archboot-${_ARCH}.efi"
[[ "${initrd}" == "${_INITRD_LATEST}" ]] && _UKI="boot/archboot-latest-${_ARCH}.efi"
[[ "${initrd}" == "${_INITRD_LOCAL}" ]] && _UKI="boot/archboot-local-${_ARCH}.efi"
[[ "${initrd}" == "${_INITRD}" ]] && _UKI="boot/${_NAME}-${_ARCH}.efi"
[[ "${initrd}" == "${_INITRD_LATEST}" ]] && _UKI="boot/${_NAME}-latest-${_ARCH}.efi"
[[ "${initrd}" == "${_INITRD_LOCAL}" ]] && _UKI="boot/${_NAME}-local-${_ARCH}.efi"
#shellcheck disable=SC2086
${_NSPAWN} "${_W_DIR}" /usr/lib/systemd/ukify build --linux=${_KERNEL_ARCHBOOT} \
${_INTEL_UCODE} ${_AMD_UCODE} --initrd=${initrd} --cmdline=@${_CMDLINE} \

View file

@ -53,7 +53,7 @@ else
fi
fi
_change_pacman_conf "${1}" || exit 1
_reproducibility "${1}"
_container_reproducibility "${1}"
_set_hostname "${1}" || exit 1
_ssh_keys "${1}" || exit 1
echo "Finished container setup in ${1}."

View file

@ -26,9 +26,9 @@ if echo "${_BASENAME}" | rg -qw 'aarch64' || echo "${_BASENAME}" | rg -qw 'x86_6
_prepare_memtest || exit 1
fi
_prepare_background || exit 1
_reproducibility
_reproducibility "${_ISODIR}"
_prepare_uefi_image || exit 1
_reproducibility
_reproducibility "${_ISODIR}"
_grub_mkrescue || exit 1
_unify_gpt_partitions || exit 1
else
@ -36,7 +36,7 @@ else
echo "Starting Image creation..."
_prepare_kernel_initrd_files || exit 1
_prepare_extlinux_conf || exit 1
_reproducibility
_reproducibility "${_ISODIR}"
_uboot || exit 1
fi
_create_cksum || exit 1

View file

@ -12,9 +12,9 @@ _config
echo "Starting UKI creation..."
_prepare_kernel_initramfs || exit 1
_prepare_ucode || exit 1
_prepare_background || exit 1
_prepare_splash || exit 1
_prepare_osrelease || exit 1
_reproducibility || exit 1
_reproducibility "${_UKIDIR}"
_systemd_ukify || exit 1
_create_cksum || exit 1
_cleanup_uki || exit 1

View file

@ -2,11 +2,8 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
. /etc/archboot/defaults
_AMD_UCODE="/boot/amd-ucode.img"
_INTEL_UCODE="/boot/intel-ucode.img"
_SPLASH="/usr/share/archboot/uki/archboot-background.bmp"
_OSREL="/usr/share/archboot/base/etc/os-release"
_CONFIG_DIR="/etc/archboot"
_UKIDIR="$(mktemp -d UKIDIR.XXX)"
_usage () {
@ -72,7 +69,7 @@ _prepare_ucode() {
cp "${_AMD_UCODE}" "${_UKIDIR}/"
}
_prepare_background() {
_prepare_splash() {
echo "Preparing UKI splash..."
cp "${_SPLASH}" "${_UKIDIR}/splash.bmp"
}
@ -82,11 +79,6 @@ _prepare_osrelease() {
cp "${_OSREL}" "${_UKIDIR}/os-release"
}
_reproducibility() {
# Reproducibility: set all timestamps to 0
fd . "${_UKIDIR}" -u --min-depth 1 -X touch -hcd "@0"
}
_systemd_ukify() {
echo "Generating ${_ARCH} UKI image..."
pushd "${_UKIDIR}" &>"${_NO_LOG}" || exit 1