start riscv64 support, rename fix_aarch64_network to fix_network

This commit is contained in:
Tobias Powalowski 2022-09-12 22:00:21 +02:00
parent 0edf62bbeb
commit d43b0d4989
12 changed files with 230 additions and 4 deletions

View file

@ -50,10 +50,14 @@ _SERVER_SOURCE_DIR="${_SERVER_PUBLIC}/src/iso"
_PACMAN_AARCH64="pacman-aarch64-chroot"
_PACMAN_AARCH64_CHROOT="${_PACMAN_AARCH64}-latest.tar.zst"
_SERVER_PACMAN_AARCH64="${_SERVER_PUBLIC}/src/${_PACMAN_AARCH64}"
_PACMAN_RISCV64="pacman-RISCV64-chroot"
_PACMAN_RISCV64_CHROOT="${_PACMAN_RISCV64}-latest.tar.zst"
_SERVER_PACMAN_RISCV64="${_SERVER_PUBLIC}/src/${_PACMAN_RISCV64}"
# public download paths
_ARCHBOOT_PUBLIC="https://pkgbuild.com/~tpowa/archboot"
_ARCHBOOT_SOURCE="${_ARCHBOOT_PUBLIC}/src/iso"
_ARCHBOOT_AARCH64_CHROOT_PUBLIC="${_ARCHBOOT_PUBLIC}/src/${_PACMAN_AARCH64}"
_ARCHBOOT_RISCV64_CHROOT_PUBLIC="${_ARCHBOOT_PUBLIC}/src/${_PACMAN_RISCV64}"
# local user and group
_USER="tobias"
_GROUP="users"

View file

@ -0,0 +1,9 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/riscv64.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/boot/vmlinuz-linux"

View file

@ -0,0 +1,9 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/riscv64-latest.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/boot/vmlinuz-linux"

View file

@ -0,0 +1,9 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# mkinitcpio config file, defaulted to stock config file
MKINITCPIO_CONFIG="/etc/archboot/riscv64-local.conf"
# kernel version, defaulted to build for runtime kernel
ALL_kver="/boot/vmlinuz-linux"

View file

@ -0,0 +1,31 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# For more information on how using mkinitcpio please refer to the main config file
# or check the wiki.
MODULES=()
BINARIES=()
FILES=()
# SETUP
#
# Please change the hooks only if you know what you are doing.
HOOKS=(udev keyboard archboot_base_common archboot_base_latest archboot_installer_common \
archboot_net_common archboot_remote archboot_kexec archboot_licenses)
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
COMPRESSION="zstd"
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
# COMPRESSION_OPTIONS
# Additional options for the compressor
COMPRESSION_OPTIONS=(-19)
MODULES_DECOMPRESS="no"

View file

@ -0,0 +1,30 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# For more information on how using mkinitcpio please refer to the main config file
# or check the wiki.
MODULES=()
BINARIES=()
FILES=()
# SETUP
#
# Please change the hooks only if you know what you are doing.
HOOKS=(udev keyboard archboot_base_common archboot_base_latest \
archboot_installer_common archboot_net_common archboot_remote archboot_kexec archboot_licenses archboot_cache)
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
COMPRESSION="zstd"
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
# COMPRESSION_OPTIONS
# Additional options for the compressor
COMPRESSION_OPTIONS=(-19)
MODULES_DECOMPRESS="no"

View file

@ -0,0 +1,41 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# For more information on how using mkinitcpio please refer to the main config file
# or check the wiki.
MODULES=()
BINARIES=()
FILES=()
# SETUP
#
# Please change the hooks only if you know what you are doing.
HOOKS=(archboot_cache archboot_cache_cleanup archboot_base archboot_base_cleanup \
archboot_firmware archboot_firmware_cleanup archboot_base_common archboot_base_common_cleanup \
archboot_filesystems archboot_filesystems_cleanup archboot_net archboot_net_cleanup \
block dmraid lvm2 encrypt btrfs keyboard archboot_acpi archboot_kms udev \
archboot_devicemapper archboot_hypervisor archboot_net_common archboot_platform archboot_wireless \
archboot_wireless_staging archboot_installer_common archboot_installer archboot_installer_cleanup \
archboot_tz archboot_keymap archboot_motd archboot_hwdetect archboot_mdadm mdadm_udev \
archboot_lvm2 archboot_remote archboot_kexec archboot_grub archboot_efibootmgr archboot_pciutils \
archboot_usbutils archboot_smartmontools archboot_licenses archboot_netctl \
archboot_fsarchiver archboot_vim archboot_wipe archboot_testdisk archboot_ddrescue \
archboot_nmap archboot_tcpdump archboot_dnsmasq \
archboot_usb_modeswitch archboot_secure_boot archboot_efivar archboot_lshw)
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
COMPRESSION="zstd"
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()
MODULES_DECOMPRESS="no"

38
etc/archboot/riscv64.conf Normal file
View file

@ -0,0 +1,38 @@
# vim:set ft=sh:
# Created by Tobias Powalowski <tpowa@archlinux.org>
# For more information on how using mkinitcpio please refer to the main config file
# or check the wiki.
MODULES=()
BINARIES=()
FILES=()
# SETUP
#
# Please change the hooks only if you know what you are doing.
HOOKS=(archboot_kms udev archboot_base_common archboot_base archboot_installer_common \
archboot_installer archboot_tz archboot_keymap archboot_acpi archboot_motd archboot_hwdetect \
block archboot_net_common archboot_net keyboard dmraid archboot_devicemapper archboot_mdadm \
mdadm_udev lvm2 archboot_lvm2 encrypt btrfs archboot_filesystems archboot_remote \
archboot_kexec archboot_grub archboot_efibootmgr archboot_pciutils archboot_usbutils \
archboot_smartmontools archboot_licenses archboot_wireless archboot_wireless_staging \
archboot_netctl archboot_fsarchiver archboot_vim archboot_wipe archboot_testdisk \
archboot_ddrescue archboot_nmap archboot_tcpdump archboot_dnsmasq \
archboot_platform archboot_hypervisor archboot_usb_modeswitch archboot_secure_boot \
archboot_efivar archboot_lshw archboot_firmware)
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
COMPRESSION="zstd"
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
# COMPRESSION_OPTIONS
# Additional options for the compressor
COMPRESSION_OPTIONS=(-19)
MODULES_DECOMPRESS="no"

View file

@ -31,13 +31,13 @@ bsdtar -xf ArchLinuxARM-aarch64-latest.tar.gz -C "${1}"
echo "Removing installation tarball ..."
rm ArchLinuxARM-aarch64-latest.tar.gz
_generate_keyring "${1}" || exit 1
_fix_aarch64_network "${1}"
_fix_network "${1}"
# update container to latest packages
echo "Installing pacman to container ..."
mkdir -p "${1}/${_PACMAN_AARCH64}/var/lib/pacman"
systemd-nspawn -D "${1}" pacman --root "/${_PACMAN_AARCH64}" -Sy awk pacman --ignore systemd-resolvconf --noconfirm >/dev/null 2>&1
_generate_keyring "${1}/${_PACMAN_AARCH64}" || exit 1
_fix_aarch64_network "${1}/${_PACMAN_AARCH64}"
_fix_network "${1}/${_PACMAN_AARCH64}"
_CLEANUP_CONTAINER="1" _clean_container "${1}/${_PACMAN_AARCH64}" 2>/dev/null
_CLEANUP_CACHE="1" _clean_cache "${1}/${_PACMAN_AARCH64}" 2>/dev/null
echo "Generating tarball ..."

View file

@ -0,0 +1,55 @@
#!/usr/bin/env bash
# created by Tobias Powalowski <tpowa@archlinux.org>
_ARCH="riscv64"
. /etc/archboot/defaults
. /usr/lib/archboot/common.sh
. /usr/lib/archboot/container.sh
_RISCV64_VERSION="archriscv-20220727"
_LATEST_RISCV64="https://archriscv.felixc.at/images/${_RISCV64_VERSION}.tar.zst"
_KEYRING="archlinux"
_usage () {
echo "CREATE RISCV64 PACMAN CHROOT"
echo "-----------------------------"
echo "This will create an riscv64 pacman chroot tarball on x86_64"
echo "Usage: ${_BASENAME} <build-directory>"
exit 0
}
[[ -z "${1}" ]] && _usage
_root_check
_x86_64_check
echo "Starting container creation ..."
# remove old files
[[ -f ${_PACMAN_RISCV64_CHROOT} ]] && rm ${_PACMAN_RISCV64_CHROOT}{,.sig} 2>/dev/null
echo "Create directory ${1} ..."
mkdir -p "${1}"/"${_PACMAN_RISCV64}"
echo "Downloading archlinux riscv64 ..."
! [[ -f ${_RISCV64_VERSION}.tar.zst ]] && wget "${_LATEST_RISCV64}" >/dev/null 2>&1
bsdtar -xf ${_RISCV64_VERSION}.tar.zst -C "${1}"
echo "Removing installation tarball ..."
rm ${_RISCV64_VERSION}.tar.zst
_generate_keyring "${1}" || exit 1
_fix_network "${1}"
# update container to latest packages
echo "Installing pacman to container ..."
mkdir -p "${1}/${_PACMAN_RISCV64}/var/lib/pacman"
systemd-nspawn -D "${1}" pacman --root "/${_PACMAN_RISCV64}" -Sy awk pacman --ignore systemd-resolvconf --noconfirm >/dev/null 2>&1
_generate_keyring "${1}/${_PACMAN_RISCV64}" || exit 1
_fix_network "${1}/${_PACMAN_RISCV64}"
_CLEANUP_CONTAINER="1" _clean_container "${1}/${_PACMAN_RISCV64}" 2>/dev/null
_CLEANUP_CACHE="1" _clean_cache "${1}/${_PACMAN_RISCV64}" 2>/dev/null
echo "Generating tarball ..."
tar -acf ${_PACMAN_RISCV64_CHROOT} -C "${1}"/"${_PACMAN_RISCV64}" . >/dev/null 2>&1 || exit 1
echo "Removing ${1} ..."
rm -r "${1}"
echo "Finished container tarball."
echo "Sign tarball ..."
#shellcheck disable=SC2086
sudo -u "${_USER}" gpg ${_GPG} ${_PACMAN_RISCV64_CHROOT} || exit 1
chown "${_USER}":"${_GROUP}" ${_PACMAN_RISCV64_CHROOT}{,.sig} || exit 1
echo "Uploading tarball to ${_SERVER}:${_SERVER_PACMAN_RISCV64} ..."
sudo -u "${_USER}" scp ${_PACMAN_RISCV64_CHROOT}{,.sig} ${_SERVER}:${_SERVER_PACMAN_RISCV64} || exit 1
echo "Finished."

View file

@ -93,7 +93,7 @@ _x86_64_pacman_restore() {
fi
}
_fix_aarch64_network() {
_fix_network() {
echo "Fix network settings in ${1} ..."
# enable parallel downloads
sed -i -e 's:^#ParallelDownloads:ParallelDownloads:g' "${1}"/etc/pacman.conf

View file

@ -19,7 +19,7 @@ _update_aarch64_pacman_chroot() {
# update container to latest packages
echo "Update container to latest packages..."
systemd-nspawn -D "${_PACMAN_AARCH64}" pacman -Syu --noconfirm >/dev/null 2>&1 || exit 1
_fix_aarch64_network "${_PACMAN_AARCH64}"
_fix_network "${_PACMAN_AARCH64}"
_CLEANUP_CONTAINER="1" _clean_container "${_PACMAN_AARCH64}" >/dev/null 2>&1
_CLEANUP_CACHE="1" _clean_cache "${_PACMAN_AARCH64}" >/dev/null 2>&1
echo "Generating tarball ..."