merge initramfs_RISCV64 into regular function

This commit is contained in:
Tobias Powalowski 2023-04-30 11:52:53 +02:00
parent e2fa2c201b
commit cf74f38a2a
2 changed files with 22 additions and 28 deletions

View file

@ -41,27 +41,6 @@ _config() {
[[ -z "${_IMAGENAME}" ]] && _IMAGENAME="archboot-$(date +%Y.%m.%d-%H.%M)-${_ARCH}" [[ -z "${_IMAGENAME}" ]] && _IMAGENAME="archboot-$(date +%Y.%m.%d-%H.%M)-${_ARCH}"
} }
_prepare_kernel_initramfs_files() {
echo "Preparing kernel and initramfs..."
#shellcheck disable=SC1090
source "${_PRESET}"
mkdir -p "${_ISODIR}"/EFI/{BOOT,TOOLS}
mkdir -p "${_ISODIR}/boot"
archboot-cpio.sh -c "/etc/archboot/${_ARCH}-init.conf" -k "${ALL_kver}" -g "${_ISODIR}/boot/init-${_ARCH}.img" || exit 1
#shellcheck disable=SC2154
archboot-cpio.sh -c "${MKINITCPIO_CONFIG}" -k "${ALL_kver}" -g "${_ISODIR}/boot/initramfs-${_ARCH}.img" || exit 1
# delete cachedir on archboot environment
[[ "$(cat /etc/hostname)" == "archboot" ]] && rm -rf /var/cache/pacman/pkg
# needed to hash the kernel for secureboot enabled systems
# all uppercase to avoid issues with firmware and hashing eg. DELL firmware is case sensitive!
if [[ "${_ARCH}" == "x86_64" || "${_ARCH}" == "riscv64" ]]; then
install -m644 "${ALL_kver}" "${_ISODIR}/boot/vmlinuz-${_ARCH}"
fi
if [[ "${_ARCH}" == "aarch64" ]]; then
install -m644 "${ALL_kver}" "${_ISODIR}/boot/Image-${_ARCH}.gz"
fi
}
### EFI status of RISCV64: ### EFI status of RISCV64:
#---------------------------------------------------- #----------------------------------------------------
# EFI is not yet working for RISCV64! # EFI is not yet working for RISCV64!
@ -72,14 +51,26 @@ _prepare_kernel_initramfs_files() {
# - unified EFI is not possible because of this: # - unified EFI is not possible because of this:
# https://sourceware.org/bugzilla/show_bug.cgi?id=29009 # https://sourceware.org/bugzilla/show_bug.cgi?id=29009
# - only left option is extlinux support in u-boot loader # - only left option is extlinux support in u-boot loader
_prepare_kernel_initramfs_files_RISCV64() { _prepare_kernel_initramfs_files() {
echo "Preparing RISCV64 u-boot..." echo "Preparing kernel and initramfs..."
#shellcheck disable=SC1090 #shellcheck disable=SC1090
source "${_PRESET}" source "${_PRESET}"
mkdir -p "${_ISODIR}"/boot mkdir -p "${_ISODIR}"/EFI/{BOOT,TOOLS}
install -m644 "${ALL_kver}" "${_ISODIR}/boot/vmlinuz-${_ARCH}" mkdir -p "${_ISODIR}/boot"
archboot-cpio.sh -c "/etc/archboot/${_ARCH}-init.conf" -k "${ALL_kver}" -g "${_ISODIR}/boot/initramfs.img" || exit 1 archboot-cpio.sh -c "/etc/archboot/${_ARCH}-init.conf" -k "${ALL_kver}" -g "${_ISODIR}/boot/init-${_ARCH}.img" || exit 1
# save init ramdisk for further images
cp ${_ISODIR}/boot/init-${_ARCH}.img ./
#shellcheck disable=SC2154
archboot-cpio.sh -c "${MKINITCPIO_CONFIG}" -k "${ALL_kver}" -g "${_ISODIR}/boot/initramfs-${_ARCH}.img" || exit 1 archboot-cpio.sh -c "${MKINITCPIO_CONFIG}" -k "${ALL_kver}" -g "${_ISODIR}/boot/initramfs-${_ARCH}.img" || exit 1
# delete cachedir on archboot environment
[[ "$(cat /etc/hostname)" == "archboot" ]] && rm -rf /var/cache/pacman/pkg
# needed to hash the kernel for secureboot enabled systems
if [[ "${_ARCH}" == "x86_64" || "${_ARCH}" == "riscv64" ]]; then
install -m644 "${ALL_kver}" "${_ISODIR}/boot/vmlinuz-${_ARCH}"
fi
if [[ "${_ARCH}" == "aarch64" ]]; then
install -m644 "${ALL_kver}" "${_ISODIR}/boot/Image-${_ARCH}.gz"
fi
} }
_prepare_ucode() { _prepare_ucode() {
@ -200,7 +191,7 @@ default linux
label linux label linux
menu label Boot System (automatic boot in 10 seconds...) menu label Boot System (automatic boot in 10 seconds...)
kernel /boot/vmlinuz-${_ARCH} kernel /boot/vmlinuz-${_ARCH}
initrd /boot/initramfs.img initrd /boot/init-${_ARCH}.img
append console=ttyS0,115200 console=tty0 audit=0 ${_SMP} append console=ttyS0,115200 console=tty0 audit=0 ${_SMP}
EOF EOF
} }
@ -267,5 +258,8 @@ _cleanup_iso() {
# cleanup # cleanup
echo "Cleanup... removing ${_ISODIR}..." echo "Cleanup... removing ${_ISODIR}..."
[[ -d "${_ISODIR}" ]] && rm -r "${_ISODIR}" [[ -d "${_ISODIR}" ]] && rm -r "${_ISODIR}"
if ! [[ "$0" == "archboot-$ARCH-release.sh" ]]; then
rm ./init-${_ARCH}.img
} }
# vim: set ft=sh ts=4 sw=4 et: # vim: set ft=sh ts=4 sw=4 et:

View file

@ -35,7 +35,7 @@ if echo "${_BASENAME}" | grep -qw aarch64 || echo "${_BASENAME}" | grep -qw x86_
else else
# running system = riscv64 # running system = riscv64
echo "Starting Image creation..." echo "Starting Image creation..."
_prepare_kernel_initramfs_files_RISCV64 || exit 1 _prepare_kernel_initramfs_files || exit 1
_prepare_extlinux_conf || exit 1 _prepare_extlinux_conf || exit 1
_reproducibility _reproducibility
_uboot || exit 1 _uboot || exit 1