mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
Compare commits
No commits in common. "7493e8859f28c1dee97875c3d6a3ca23c3f2a04d" and "1f9bab0af0c3ceaa1e2f20d802069d97ef7eeab2" have entirely different histories.
7493e8859f
...
1f9bab0af0
6 changed files with 115 additions and 82 deletions
|
@ -2,38 +2,19 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# created by Tobias Powalowski <tpowa@archlinux.org>
|
# created by Tobias Powalowski <tpowa@archlinux.org>
|
||||||
. /etc/archboot/defaults
|
. /etc/archboot/defaults
|
||||||
_AMD_UCODE="boot/amd-ucode.img"
|
_BASENAME=${0##*/}
|
||||||
_CACHEDIR="/var/cache/pacman/pkg"
|
|
||||||
_CONFIG_DIR="/etc/archboot"
|
|
||||||
_DLPROG="curl -L -s"
|
|
||||||
_FIX_PACKAGES="libelf libevent talloc gcc-libs glibc glib2 icu pcre2 nss terminus-font"
|
|
||||||
_INTEL_UCODE="boot/intel-ucode.img"
|
|
||||||
_KERNELPKG="linux"
|
|
||||||
_KEYRING="archlinux-keyring"
|
|
||||||
_LABEL="Exit"
|
|
||||||
_LOCAL_DB="${_CACHEDIR}/archboot.db"
|
|
||||||
_LOG="/dev/tty11"
|
|
||||||
_MAN_INFO_PACKAGES="man-db man-pages texinfo"
|
|
||||||
_MEM_TOTAL="$(rg -o 'MemTotal.* (\d+)' -r '$1' /proc/meminfo)"
|
|
||||||
_NO_LOG="/dev/null"
|
|
||||||
_OSREL="/usr/share/archboot/base/etc/os-release"
|
|
||||||
_PACMAN_CONF="/etc/pacman.conf"
|
|
||||||
_PACMAN_LIB="/var/lib/pacman"
|
|
||||||
_PACMAN_MIRROR="/etc/pacman.d/mirrorlist"
|
|
||||||
_PUB="public_html"
|
|
||||||
_RSYNC="rsync -a -q --delete --delete-delay"
|
|
||||||
_RUNNING_ARCH="$(uname -m)"
|
_RUNNING_ARCH="$(uname -m)"
|
||||||
_RUNNING_KERNEL="$(uname -r)"
|
_RUNNING_KERNEL="$(uname -r)"
|
||||||
_SPLASH="/usr/share/archboot/uki/archboot-background.bmp"
|
_LOG="/dev/tty11"
|
||||||
_STANDARD_PACKAGES="gparted xorg-xhost mtools noto-fonts"
|
_NO_LOG="/dev/null"
|
||||||
_VNC_PACKAGE="tigervnc"
|
|
||||||
_WAYLAND_PACKAGE="egl-wayland"
|
|
||||||
_XORG_PACKAGE="xorg"
|
|
||||||
|
|
||||||
_BASENAME=${0##*/}
|
|
||||||
_ANSWER="/.${_BASENAME}"
|
|
||||||
_VC_NUM="${_LOG/\/dev\/tty/}"
|
_VC_NUM="${_LOG/\/dev\/tty/}"
|
||||||
_VC="VC${_VC_NUM}"
|
_VC="VC${_VC_NUM}"
|
||||||
|
_ANSWER="/.${_BASENAME}"
|
||||||
|
_LABEL="Exit"
|
||||||
|
_DLPROG="curl -L -s"
|
||||||
|
_KERNELPKG="linux"
|
||||||
|
_KEYRING="archlinux-keyring"
|
||||||
|
_MEM_TOTAL="$(rg -o 'MemTotal.* (\d+)' -r '$1' /proc/meminfo)"
|
||||||
if echo "${_BASENAME}" | rg -qw aarch64; then
|
if echo "${_BASENAME}" | rg -qw aarch64; then
|
||||||
_ARCHBOOT="archboot-arm"
|
_ARCHBOOT="archboot-arm"
|
||||||
_KEYRING="${_KEYRING} archlinuxarm-keyring"
|
_KEYRING="${_KEYRING} archlinuxarm-keyring"
|
||||||
|
@ -45,6 +26,21 @@ else
|
||||||
_ARCHBOOT="archboot"
|
_ARCHBOOT="archboot"
|
||||||
_ARCH="x86_64"
|
_ARCH="x86_64"
|
||||||
fi
|
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"
|
||||||
|
_CACHEDIR="/var/cache/pacman/pkg"
|
||||||
|
_LOCAL_DB="${_CACHEDIR}/archboot.db"
|
||||||
|
_PUB="public_html"
|
||||||
|
_RSYNC="rsync -a -q --delete --delete-delay"
|
||||||
|
_FIX_PACKAGES="libelf libevent talloc gcc-libs glibc glib2 icu pcre2 nss terminus-font"
|
||||||
|
_XORG_PACKAGE="xorg"
|
||||||
|
_VNC_PACKAGE="tigervnc"
|
||||||
|
_WAYLAND_PACKAGE="egl-wayland"
|
||||||
|
_STANDARD_PACKAGES="gparted xorg-xhost mtools noto-fonts"
|
||||||
# chromium is now working on riscv64
|
# chromium is now working on riscv64
|
||||||
[[ "${_RUNNING_ARCH}" == "riscv64" ]] && _STANDARD_BROWSER="firefox"
|
[[ "${_RUNNING_ARCH}" == "riscv64" ]] && _STANDARD_BROWSER="firefox"
|
||||||
if [[ -d "${_ISO_HOME}" ]]; then
|
if [[ -d "${_ISO_HOME}" ]]; then
|
||||||
|
@ -52,13 +48,7 @@ if [[ -d "${_ISO_HOME}" ]]; then
|
||||||
else
|
else
|
||||||
_NSPAWN="systemd-nspawn -q -D"
|
_NSPAWN="systemd-nspawn -q -D"
|
||||||
fi
|
fi
|
||||||
|
_MAN_INFO_PACKAGES="man-db man-pages texinfo"
|
||||||
if [[ "${_ARCH}" == "x86_64" ]]; then
|
|
||||||
_CMDLINE="console=ttyS0,115200 console=tty0 audit=0 systemd.show_status=auto"
|
|
||||||
elif [[ "${_ARCH}" == "aarch64" ]]; then
|
|
||||||
_INTEL_UCODE=""
|
|
||||||
_CMDLINE="nr_cpus=1 console=ttyAMA0,115200 console=tty0 loglevel=4 audit=0 systemd.show_status=auto"
|
|
||||||
fi
|
|
||||||
|
|
||||||
### check for root
|
### check for root
|
||||||
_root_check() {
|
_root_check() {
|
||||||
|
|
|
@ -106,14 +106,14 @@ _prepare_ucode() {
|
||||||
# only x86_64
|
# only x86_64
|
||||||
if [[ "${_ARCH}" == "x86_64" ]]; then
|
if [[ "${_ARCH}" == "x86_64" ]]; then
|
||||||
echo "Preparing intel-ucode..."
|
echo "Preparing intel-ucode..."
|
||||||
cp "/${_INTEL_UCODE}" "${_ISODIR}/boot/"
|
cp "${_INTEL_UCODE}" "${_ISODIR}/boot/"
|
||||||
mkdir -p "${_ISODIR}"/licenses/intel-ucode
|
mkdir -p "${_ISODIR}"/licenses/intel-ucode
|
||||||
cp /usr/share/licenses/intel-ucode/LICENSE "${_ISODIR}/licenses/intel-ucode"
|
cp /usr/share/licenses/intel-ucode/LICENSE "${_ISODIR}/licenses/intel-ucode"
|
||||||
fi
|
fi
|
||||||
# both x86_64 and aarch64
|
# both x86_64 and aarch64
|
||||||
if ! [[ "${_ARCH}" == "riscv64" ]]; then
|
if ! [[ "${_ARCH}" == "riscv64" ]]; then
|
||||||
echo "Preparing amd-ucode..."
|
echo "Preparing amd-ucode..."
|
||||||
cp "/${_AMD_UCODE}" "${_ISODIR}/boot/"
|
cp "${_AMD_UCODE}" "${_ISODIR}/boot/"
|
||||||
mkdir -p "${_ISODIR}"/licenses/amd-ucode
|
mkdir -p "${_ISODIR}"/licenses/amd-ucode
|
||||||
cp /usr/share/licenses/amd-ucode/LICENSE.amd-ucode "${_ISODIR}/licenses/amd-ucode"
|
cp /usr/share/licenses/amd-ucode/LICENSE.amd-ucode "${_ISODIR}/licenses/amd-ucode"
|
||||||
fi
|
fi
|
||||||
|
@ -171,7 +171,7 @@ _prepare_memtest() {
|
||||||
_prepare_background() {
|
_prepare_background() {
|
||||||
echo "Preparing grub background..."
|
echo "Preparing grub background..."
|
||||||
[[ -d "${_ISODIR}/boot/grub" ]] || mkdir -p "${_ISODIR}/boot/grub"
|
[[ -d "${_ISODIR}/boot/grub" ]] || mkdir -p "${_ISODIR}/boot/grub"
|
||||||
cp "${_GRUB_BACKGROUND}" "${_ISODIR}/boot/grub/archboot-background.png"
|
cp ${_GRUB_BACKGROUND} "${_ISODIR}/boot/grub/archboot-background.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
_prepare_uefi_image() {
|
_prepare_uefi_image() {
|
||||||
|
|
|
@ -137,7 +137,6 @@ _run_autorun() {
|
||||||
echo "Waiting for pacman keyring..."
|
echo "Waiting for pacman keyring..."
|
||||||
_pacman_keyring
|
_pacman_keyring
|
||||||
echo "Updating pacman keyring..."
|
echo "Updating pacman keyring..."
|
||||||
#shellcheck disable=SC2086
|
|
||||||
pacman -Sy --noconfirm ${_KEYRING} &>"${_LOG}"
|
pacman -Sy --noconfirm ${_KEYRING} &>"${_LOG}"
|
||||||
chmod 755 /etc/archboot/run/autorun.sh
|
chmod 755 /etc/archboot/run/autorun.sh
|
||||||
echo "Running custom autorun.sh..."
|
echo "Running custom autorun.sh..."
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
_INITRD="boot/initrd-${_ARCH}.img"
|
_INITRD="boot/initrd-${_ARCH}.img"
|
||||||
_INITRD_LATEST="boot/initrd-latest-${_ARCH}.img"
|
_INITRD_LATEST="boot/initrd-latest-${_ARCH}.img"
|
||||||
_INITRD_LOCAL="boot/initrd-local-${_ARCH}.img"
|
_INITRD_LOCAL="boot/initrd-local-${_ARCH}.img"
|
||||||
|
if [[ "${_ARCH}" == "aarch64" ]]; then
|
||||||
|
_KERNEL_ARCHBOOT="boot/Image-${_ARCH}.gz"
|
||||||
|
else
|
||||||
|
_KERNEL_ARCHBOOT="boot/vmlinuz-${_ARCH}"
|
||||||
|
fi
|
||||||
_CONFIG_LATEST="${_ARCH}-latest.conf"
|
_CONFIG_LATEST="${_ARCH}-latest.conf"
|
||||||
_CONFIG_LOCAL="${_ARCH}-local.conf"
|
_CONFIG_LOCAL="${_ARCH}-local.conf"
|
||||||
_W_DIR="$(mktemp -u archboot-release.XXX)"
|
_W_DIR="$(mktemp -u archboot-release.XXX)"
|
||||||
|
@ -33,8 +38,8 @@ _create_iso() {
|
||||||
#shellcheck disable=SC1090
|
#shellcheck disable=SC1090
|
||||||
. "${_W_DIR}/etc/archboot/${_ARCH}.conf"
|
. "${_W_DIR}/etc/archboot/${_ARCH}.conf"
|
||||||
#shellcheck disable=SC2116,SC2046,2086
|
#shellcheck disable=SC2116,SC2046,2086
|
||||||
_KERNEL="$(echo ${_W_DIR}${_KERNEL})"
|
_KVER="$(_kver $(echo ${_W_DIR}${_KERNEL}))"
|
||||||
_NAME="archboot-$(date +%Y.%m.%d-%H.%M)-$(_kver "${_KERNEL}")"
|
_NAME="archboot-$(date +%Y.%m.%d-%H.%M)-${_KVER}"
|
||||||
if ! [[ "${_RUNNING_ARCH}" == "${_ARCH}" ]]; then
|
if ! [[ "${_RUNNING_ARCH}" == "${_ARCH}" ]]; then
|
||||||
### to speedup build for riscv64 and aarch64 on x86_64, run compressor on host system
|
### to speedup build for riscv64 and aarch64 on x86_64, run compressor on host system
|
||||||
echo "Generating initramdisks..."
|
echo "Generating initramdisks..."
|
||||||
|
@ -83,7 +88,7 @@ _create_iso() {
|
||||||
if [[ "${_ARCH}" == "riscv64" ]]; then
|
if [[ "${_ARCH}" == "riscv64" ]]; then
|
||||||
for i in *.img; do
|
for i in *.img; do
|
||||||
if echo "${i}" | rg -v 'local' | rg -vq 'latest'; then
|
if echo "${i}" | rg -v 'local' | rg -vq 'latest'; then
|
||||||
mv "${_KERNEL}" boot/
|
mcopy -m -i "${i}"@@1048576 ::/"${_KERNEL_ARCHBOOT}" ./"${_KERNEL_ARCHBOOT}"
|
||||||
mcopy -m -i "${i}"@@1048576 ::/"${_INITRD}" ./"${_INITRD}"
|
mcopy -m -i "${i}"@@1048576 ::/"${_INITRD}" ./"${_INITRD}"
|
||||||
elif echo "${i}" | rg -q 'latest'; then
|
elif echo "${i}" | rg -q 'latest'; then
|
||||||
mcopy -m -i "${i}"@@1048576 ::/"${_INITRD}" ./"${_INITRD_LATEST}"
|
mcopy -m -i "${i}"@@1048576 ::/"${_INITRD}" ./"${_INITRD_LATEST}"
|
||||||
|
@ -94,18 +99,11 @@ _create_iso() {
|
||||||
else
|
else
|
||||||
for i in *.iso; do
|
for i in *.iso; do
|
||||||
if echo "${i}" | rg -v 'local' | rg -vq 'latest'; then
|
if echo "${i}" | rg -v 'local' | rg -vq 'latest'; then
|
||||||
mv "${_W_DIR}/${_AMD_UCODE}" boot/
|
|
||||||
mv "${_KERNEL}" boot/
|
|
||||||
if [[ "${_ARCH}" == "aarch64" ]]; then
|
|
||||||
# replace aarch64 Image.gz with Image kernel for UKI
|
|
||||||
# compressed image is not working at the moment
|
|
||||||
_KERNEL="$(echo "${_KERNEL}" | sd '\.gz' '')"
|
|
||||||
mv "${_KERNEL}" boot/
|
|
||||||
else
|
|
||||||
mv "${_W_DIR}/${_INTEL_UCODE}" boot/
|
|
||||||
fi
|
|
||||||
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
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 ::/"${_INITRD}" ./"${_INITRD}"
|
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD}"
|
||||||
|
mcopy -m -i efi.img ::/"${_KERNEL_ARCHBOOT}" ./"${_KERNEL_ARCHBOOT}"
|
||||||
elif echo "${i}" | rg -q 'latest'; then
|
elif echo "${i}" | rg -q 'latest'; then
|
||||||
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
||||||
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD_LATEST}"
|
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD_LATEST}"
|
||||||
|
@ -115,27 +113,44 @@ _create_iso() {
|
||||||
fi
|
fi
|
||||||
rm efi.img
|
rm efi.img
|
||||||
done
|
done
|
||||||
# add ucode licenses
|
|
||||||
mkdir -p licenses/
|
|
||||||
mv "${_W_DIR}/usr/share/licenses/amd-ucode" licenses/
|
|
||||||
[[ "${_ARCH}" == "x86_64" ]] && mv "${_W_DIR}/usr/share/licenses/intel-ucode" licenses/
|
|
||||||
echo "Generating Unified Kernel Images..."
|
echo "Generating Unified Kernel Images..."
|
||||||
_KERNEL="boot/${_KERNEL##*/}"
|
# create unified kernel image UKI, code adapted from wiki
|
||||||
[[ -n "${_INTEL_UCODE}" ]] && _INTEL_UCODE="--initrd=${_INTEL_UCODE}"
|
# https://wiki.archlinux.org/title/Unified_kernel_image
|
||||||
_AMD_UCODE="--initrd=${_AMD_UCODE}"
|
_SPLASH="/usr/share/archboot/uki/archboot-background.bmp"
|
||||||
|
_OSREL="/usr/share/archboot/base/etc/os-release"
|
||||||
|
# add AMD ucode license
|
||||||
|
mkdir -p licenses/amd-ucode
|
||||||
|
cp /usr/share/licenses/amd-ucode/* licenses/amd-ucode/
|
||||||
|
_CMDLINE="boot/cmdline.txt"
|
||||||
|
if [[ "${_ARCH}" == "x86_64" ]]; then
|
||||||
|
# add INTEL ucode license
|
||||||
|
mkdir -p licenses/intel-ucode
|
||||||
|
cp /usr/share/licenses/intel-ucode/* licenses/intel-ucode/
|
||||||
|
echo "console=ttyS0,115200 console=tty0 audit=0 systemd.show_status=auto" > ${_CMDLINE}
|
||||||
|
fi
|
||||||
|
if [[ "${_ARCH}" == "aarch64" ]]; then
|
||||||
|
echo "nr_cpus=1 console=ttyAMA0,115200 console=tty0 loglevel=4 audit=0 systemd.show_status=auto" > ${_CMDLINE}
|
||||||
|
_INTEL_UCODE=""
|
||||||
|
# replace aarch64 Image.gz with Image kernel for UKI, compressed image is not working at the moment
|
||||||
|
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}"
|
||||||
rm -r "${_W_DIR:?}"/boot
|
rm -r "${_W_DIR:?}"/boot
|
||||||
mv boot "${_W_DIR}"
|
mv boot "${_W_DIR}"
|
||||||
for initrd in ${_INITRD} ${_INITRD_LATEST} ${_INITRD_LOCAL}; do
|
for initrd in ${_INITRD} ${_INITRD_LATEST} ${_INITRD_LOCAL}; do
|
||||||
[[ "${initrd}" == "${_INITRD}" ]] && _UKI="/boot/${_NAME}-${_ARCH}.efi"
|
[[ "${initrd}" == "${_INITRD}" ]] && _UKI="boot/${_NAME}-${_ARCH}.efi"
|
||||||
[[ "${initrd}" == "${_INITRD_LATEST}" ]] && _UKI="/boot/${_NAME}-latest-${_ARCH}.efi"
|
[[ "${initrd}" == "${_INITRD_LATEST}" ]] && _UKI="boot/${_NAME}-latest-${_ARCH}.efi"
|
||||||
[[ "${initrd}" == "${_INITRD_LOCAL}" ]] && _UKI="/boot/${_NAME}-local-${_ARCH}.efi"
|
[[ "${initrd}" == "${_INITRD_LOCAL}" ]] && _UKI="boot/${_NAME}-local-${_ARCH}.efi"
|
||||||
#shellcheck disable=SC2086
|
#shellcheck disable=SC2086
|
||||||
${_NSPAWN} "${_W_DIR}" /usr/lib/systemd/ukify build --linux="${_KERNEL}" \
|
${_NSPAWN} "${_W_DIR}" /usr/lib/systemd/ukify build --linux=${_KERNEL_ARCHBOOT} \
|
||||||
${_INTEL_UCODE} ${_AMD_UCODE} --initrd="${initrd}" --cmdline="${_CMDLINE}" \
|
${_INTEL_UCODE} ${_AMD_UCODE} --initrd=${initrd} --cmdline=@${_CMDLINE} \
|
||||||
--os-release=@"${_OSREL}" --splash="${_SPLASH}" --output="${_UKI}" &>"${_NO_LOG}" || exit 1
|
--os-release=@${_OSREL} --splash=${_SPLASH} --output=${_UKI} &>"${_NO_LOG}" || exit 1
|
||||||
done
|
done
|
||||||
# fix permission and timestamp
|
# fix permission and timestamp
|
||||||
mv "${_W_DIR}"/boot ./
|
mv "${_W_DIR}"/boot ./
|
||||||
|
rm "${_CMDLINE}"
|
||||||
chmod 644 boot/*.efi
|
chmod 644 boot/*.efi
|
||||||
fi
|
fi
|
||||||
touch boot/*
|
touch boot/*
|
||||||
|
@ -165,17 +180,17 @@ _create_iso() {
|
||||||
${_NSPAWN} "${_W_DIR}" pacman -Q | sd '\r|\x1b\[[0-9;]*m|\x1b\[.[0-9]+[h;l]' '') >>Release.txt
|
${_NSPAWN} "${_W_DIR}" pacman -Q | sd '\r|\x1b\[[0-9;]*m|\x1b\[.[0-9]+[h;l]' '') >>Release.txt
|
||||||
echo "Removing container ${_W_DIR}..."
|
echo "Removing container ${_W_DIR}..."
|
||||||
rm -r "${_W_DIR}"
|
rm -r "${_W_DIR}"
|
||||||
if [[ "${_ARCH}" == "riscv64" ]]; then
|
if ! [[ "${_ARCH}" == "riscv64" ]]; then
|
||||||
echo "Creating img/ directory..."
|
|
||||||
mkdir img
|
|
||||||
mv ./*.img img/
|
|
||||||
else
|
|
||||||
echo "Creating iso/ directory..."
|
echo "Creating iso/ directory..."
|
||||||
mkdir iso
|
mkdir iso
|
||||||
mv ./*.iso iso/
|
mv ./*.iso iso/
|
||||||
echo "Creating uki/ directory..."
|
echo "Creating uki/ directory..."
|
||||||
mkdir uki
|
mkdir uki
|
||||||
mv boot/*.efi uki/
|
mv boot/*.efi uki/
|
||||||
|
else
|
||||||
|
echo "Creating img/ directory..."
|
||||||
|
mkdir img
|
||||||
|
mv ./*.img img/
|
||||||
fi
|
fi
|
||||||
echo "Generating b2sum..."
|
echo "Generating b2sum..."
|
||||||
for i in *; do
|
for i in *; do
|
||||||
|
|
|
@ -10,7 +10,11 @@ _root_check
|
||||||
_architecture_check
|
_architecture_check
|
||||||
_config
|
_config
|
||||||
echo "Starting UKI creation..."
|
echo "Starting UKI creation..."
|
||||||
_prepare_initramfs || exit 1
|
_prepare_kernel_initramfs || exit 1
|
||||||
|
_prepare_ucode || exit 1
|
||||||
|
_prepare_splash || exit 1
|
||||||
|
_prepare_osrelease || exit 1
|
||||||
|
_reproducibility "${_UKIDIR}"
|
||||||
_systemd_ukify || exit 1
|
_systemd_ukify || exit 1
|
||||||
_create_cksum || exit 1
|
_create_cksum || exit 1
|
||||||
_cleanup_uki || exit 1
|
_cleanup_uki || exit 1
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# created by Tobias Powalowski <tpowa@archlinux.org>
|
# created by Tobias Powalowski <tpowa@archlinux.org>
|
||||||
. /etc/archboot/defaults
|
. /etc/archboot/defaults
|
||||||
|
_SPLASH="/usr/share/archboot/uki/archboot-background.bmp"
|
||||||
|
_OSREL="/usr/share/archboot/base/etc/os-release"
|
||||||
_UKIDIR="$(mktemp -d UKIDIR.XXX)"
|
_UKIDIR="$(mktemp -d UKIDIR.XXX)"
|
||||||
|
|
||||||
_usage () {
|
_usage () {
|
||||||
|
@ -41,30 +43,53 @@ _config() {
|
||||||
#shellcheck disable=SC1090
|
#shellcheck disable=SC1090
|
||||||
. "${_CONFIG}"
|
. "${_CONFIG}"
|
||||||
#shellcheck disable=SC2116,2086
|
#shellcheck disable=SC2116,2086
|
||||||
# aarch64 .gz kernel is not supported!
|
_KERNEL="$(echo ${_KERNEL})"
|
||||||
_KERNEL="$(echo ${_KERNEL} | sd '\.gz' '')"
|
|
||||||
#shellcheck disable=SC2154
|
#shellcheck disable=SC2154
|
||||||
[[ -z "${_UKI}" ]] && _UKI="archboot-$(date +%Y.%m.%d-%H.%M)-$(_kver "${_KERNEL}")-${_ARCH}".efi
|
[[ -z "${_UKI}" ]] && _UKI="archboot-$(date +%Y.%m.%d-%H.%M)-$(_kver "${_KERNEL}")-${_ARCH}".efi
|
||||||
}
|
}
|
||||||
|
|
||||||
_prepare_initramfs() {
|
_prepare_kernel_initramfs() {
|
||||||
# needed to hash the kernel for secureboot enabled systems
|
# needed to hash the kernel for secureboot enabled systems
|
||||||
echo "Preparing initramfs..."
|
echo "Preparing kernel and initramfs..."
|
||||||
_INITRD="${_UKIDIR}/initrd.img"
|
install -m644 "${_KERNEL}" "${_UKIDIR}/kernel"
|
||||||
|
_INITRD="initrd-${_ARCH}.img"
|
||||||
echo "Running archboot-cpio.sh for ${_INITRD}..."
|
echo "Running archboot-cpio.sh for ${_INITRD}..."
|
||||||
#shellcheck disable=SC2154
|
#shellcheck disable=SC2154
|
||||||
archboot-cpio.sh -c "${_CONFIG}" -k "${_KERNEL}" \
|
archboot-cpio.sh -c "${_CONFIG}" -k "${_KERNEL}" \
|
||||||
-g "${_INITRD}" || exit 1
|
-g "${_UKIDIR}/${_INITRD}" || exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_prepare_ucode() {
|
||||||
|
# only x86_64
|
||||||
|
if [[ "${_ARCH}" == "x86_64" ]]; then
|
||||||
|
echo "Preparing intel-ucode..."
|
||||||
|
cp "${_INTEL_UCODE}" "${_UKIDIR}/"
|
||||||
|
fi
|
||||||
|
echo "Preparing amd-ucode..."
|
||||||
|
cp "${_AMD_UCODE}" "${_UKIDIR}/"
|
||||||
|
}
|
||||||
|
|
||||||
|
_prepare_splash() {
|
||||||
|
echo "Preparing UKI splash..."
|
||||||
|
cp "${_SPLASH}" "${_UKIDIR}/splash.bmp"
|
||||||
|
}
|
||||||
|
|
||||||
|
_prepare_osrelease() {
|
||||||
|
echo "Preparing os-release..."
|
||||||
|
cp "${_OSREL}" "${_UKIDIR}/os-release"
|
||||||
}
|
}
|
||||||
|
|
||||||
_systemd_ukify() {
|
_systemd_ukify() {
|
||||||
echo "Generating ${_ARCH} UKI image..."
|
echo "Generating ${_ARCH} UKI image..."
|
||||||
[[ -n "/${_INTEL_UCODE}" ]] && _INTEL_UCODE="--initrd=/${_INTEL_UCODE}"
|
pushd "${_UKIDIR}" &>"${_NO_LOG}" || exit 1
|
||||||
_AMD_UCODE="--initrd=/${_AMD_UCODE}"
|
[[ "${_ARCH}" == "x86_64" && -z "${_CMDLINE}" ]] && _CMDLINE="console=ttyS0,115200 console=tty0 audit=0 systemd.show_status=auto"
|
||||||
#shellcheck disable=SC2086
|
[[ "${_ARCH}" == "aarch64" && -z "${_CMDLINE}" ]] && _CMDLINE="nr_cpus=1 console=ttyAMA0,115200 console=tty0 loglevel=4 audit=0 systemd.show_status=auto"
|
||||||
/usr/lib/systemd/ukify build --linux="${_KERNEL}" \
|
[[ -n "${_INTEL_UCODE}" ]] && _INTEL_UCODE="--initrd=intel-ucode.img"
|
||||||
|
[[ -n "${_AMD_UCODE}" ]] && _AMD_UCODE="--initrd=amd-ucode.img"
|
||||||
|
/usr/lib/systemd/ukify build --linux=kernel \
|
||||||
${_INTEL_UCODE} ${_AMD_UCODE} --initrd="${_INITRD}" --cmdline="${_CMDLINE}" \
|
${_INTEL_UCODE} ${_AMD_UCODE} --initrd="${_INITRD}" --cmdline="${_CMDLINE}" \
|
||||||
--os-release=@"${_OSREL}" --splash="${_SPLASH}" --output="${_UKI}" &>"${_NO_LOG}" || exit 1
|
--os-release=@os-release --splash=splash.bmp --output="../${_UKI}" &>"${_NO_LOG}" || exit 1
|
||||||
|
popd &>"${_NO_LOG}" || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
_create_cksum() {
|
_create_cksum() {
|
||||||
|
|
Loading…
Reference in a new issue