From d59c411fc64915496f18f8283277c567a27aeffa Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Sun, 28 Apr 2024 18:28:51 +0530 Subject: [PATCH] init riscv64 stuff --- create-image.sh | 1 - includes/base-configuration.ksi | 2 +- includes/disk-layout.ksi | 6 +-- includes/package-list.ksi | 83 ++++++++---------------------- includes/post/expand-rootfs.ksi | 10 ---- includes/post/grub-setup.ksi | 14 ----- includes/post/rpi-setup.ksi | 7 --- includes/post/rpm-repos-enable.ksi | 43 ---------------- includes/post/user-setup.ksi | 9 +--- includes/repos/repos-master.ksi | 2 - includes/repos/rocky.ksi | 12 +---- 11 files changed, 30 insertions(+), 159 deletions(-) diff --git a/create-image.sh b/create-image.sh index 6b7a9e8..1fa5872 100755 --- a/create-image.sh +++ b/create-image.sh @@ -90,7 +90,6 @@ if [[ -d "${APPLIANCE_NAME}" ]]; then pushd "${APPLIANCE_NAME}" || exit 1 mv "../${APPLIANCE_NAME}.log" . mv "${APPLIANCE_NAME}-sda.raw" "${IMAGE_NAME}" - create_new_image zstd --compress -9 "${IMAGE_NAME}" sha512sum -- *.raw* > SHA512SUMS sha256sum -- *.raw* > SHA256SUMS diff --git a/includes/base-configuration.ksi b/includes/base-configuration.ksi index 7041a9c..9de4d4c 100644 --- a/includes/base-configuration.ksi +++ b/includes/base-configuration.ksi @@ -7,5 +7,5 @@ timezone Asia/Kolkata selinux --enforcing firewall --enabled --ssh network --device=link --activate --bootproto=dhcp --onboot=on --hostname=altarchdevel -bootloader --location=mbr --boot-drive=sda +bootloader --location=mbr --boot-drive=sda --sdboot shutdown # power-off after the installation completes diff --git a/includes/disk-layout.ksi b/includes/disk-layout.ksi index 545bf7c..d052308 100644 --- a/includes/disk-layout.ksi +++ b/includes/disk-layout.ksi @@ -10,6 +10,6 @@ clearpart --drives=sda --disklabel=gpt --all # 1073.74 MB = 1024 MiB # 3758.09 MB = 3584 MiB # Keep /boot formatted as ext4 since that's what U-Boot can read -part /boot/efi --asprimary --ondisk=sda --size=133 --label=rockyefi --fstype=efi -part /boot --asprimary --ondisk=sda --size=1072 --label=rockyboot --fstype=ext4 -part / --asprimary --ondisk=sda --size=3757 --label=rockyroot --fstype=ext4 +part /boot/efi --asprimary --ondisk=sda --size=133 --label=rvefi --fstype=efi +part /boot --asprimary --ondisk=sda --size=1072 --label=rvboot --fstype=ext4 +part / --asprimary --ondisk=sda --size=3757 --label=rvroot --fstype=ext4 diff --git a/includes/package-list.ksi b/includes/package-list.ksi index 63e8549..b35f3d8 100644 --- a/includes/package-list.ksi +++ b/includes/package-list.ksi @@ -1,5 +1,5 @@ %packages --exclude-weakdeps -rocky-release +fedora-release # The '@core' group installs, as it's name suggests, packages that are core # to _any_:tm: Linux distribution. This includes packages like system, passwd, @@ -8,7 +8,7 @@ rocky-release @standard # Kernel selection -kernel-mainline-sbc +kernel-core # Other necessary packages cloud-utils-growpart @@ -18,6 +18,7 @@ NetworkManager-wifi # Extra add-ons git +openssh pciutils tmux util-linux @@ -25,32 +26,33 @@ util-linux # Extra packages to do 'U-Boot -> GRUB -> Linux' dracut-config-generic efibootmgr -grub2-common -grub2-efi-aa64 -grub2-efi-aa64-modules -grubby -openssh -shim-aa64 +# systemd-boot +sdubby +systemd-boot-unsigned +# GRUB2 +#grub2-common +#grub2-efi-aa64 +#grub2-efi-aa64-modules +#grubby +#shim-aa64 # Packages from SIG/AltArch -uboot-images-armv8 # This provides actual U-Boot binaries for SBCs +uboot-images-riscv64 # This provides actual U-Boot binaries for SBCs uboot-tools # This provides tools to interact with U-Boot (if stored on SPI) like fw_printenv, fw_setenv, mkimage, gen_eth_addr, etc -# Raspberry Pi firmware (needed to boot $OS on a Raspberry Pi) -bcm283x-firmware # This will pull in other RPi related firmware and bcm283x-overlays # Trust me, they're nice! appliance-tools -aria2 -bat -btop -dash -epel-release +#aria2 +#bat +#btop +#dash +#epel-release gzip hdparm htop mock -parallel +#parallel perl-Digest-SHA -picocom +#picocom procps-ng pykickstart ripgrep @@ -64,54 +66,13 @@ xz yt-dlp zstd -# for building Linux & U-Boot -arm-trusted-firmware-armv8 -asciidoc -audit-libs-devel -binutils-devel -bison -dwarves -elfutils-devel -flex -gcc -gcc-c++ -gcc-plugin-devel -glibc-static -gnutls-devel -kernel-rpm-macros -libbabeltrace-devel -libbpf-devel -libcap-devel -libcap-ng-devel -libnl3-devel -libtraceevent-devel -libuuid-devel -m4 -make -ncurses-devel -newt-devel -numactl-devel -opencsd-devel -openssl-devel -pciutils-devel -perl(ExtUtils::Embed) -perl-devel -perl-generators -python3-devel -python3-docutils -python3-libfdt -python3-pyelftools -SDL2-devel -swig -xmlto -xz-devel -zlib-devel - # Remove some packages +-abrt-cli -cockpit* -dracut-config-rescue -java-11-* -plymouth +-smartmontools # no "stock" EL kernel -kernel-core -kmod-kvdo diff --git a/includes/post/expand-rootfs.ksi b/includes/post/expand-rootfs.ksi index e5923d7..48edd7c 100644 --- a/includes/post/expand-rootfs.ksi +++ b/includes/post/expand-rootfs.ksi @@ -1,12 +1,2 @@ %post -set -x - -# The script that expands root partition -[ -d /usr/local/bin ] || mkdir --verbose /usr/local/bin -curl 'https://git.resf.org/thefossguy/sbc-images/raw/branch/rocky-generic/scripts/expand-rootfs.sh' --output /usr/local/bin/expand-rootfs.sh || exit 1 -curl 'https://git.resf.org/thefossguy/sbc-images/raw/branch/rocky-generic/scripts/expand-rootfs.service' --output /etc/systemd/system/expand-rootfs.service || exit 1 -[ -f /usr/local/bin/expand-rootfs.sh ] && \ - chmod --verbose +x /usr/local/bin/expand-rootfs.sh -systemctl enable expand-rootfs.service - %end diff --git a/includes/post/grub-setup.ksi b/includes/post/grub-setup.ksi index 38f4e9e..fb81ef6 100644 --- a/includes/post/grub-setup.ksi +++ b/includes/post/grub-setup.ksi @@ -1,17 +1,6 @@ %post set -x -if [[ -d /boot/efi/EFI/rocky ]] && [[ -f /boot/efi/EFI/rocky/grubaa64.efi ]]; then - mv -vf /boot/grub2/grub.cfg /boot/efi/EFI/rocky/grub.cfg - ln -s ../efi/EFI/rocky/grub.cfg /boot/grub2/grub.cfg - - [[ -d /boot/efi/EFI/BOOT ]] || mkdir -vp /boot/efi/EFI/BOOT - cp -vf /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI -else - echo "Something is wrong with the current GRUB install. Have fun debugging. Bye." - exit 1 -fi - cat << EOF > /etc/sysconfig/kernel # the latest kernel should be the first entry in the bootloader # this should be the default, but here we are @@ -22,7 +11,4 @@ DEFAULTKERNEL=kernel-core EOF chmod 644 /etc/sysconfig/kernel - -grubby --update-kernel=ALL --args='systemd.show_status=false' - %end diff --git a/includes/post/rpi-setup.ksi b/includes/post/rpi-setup.ksi index 8d5f899..48edd7c 100644 --- a/includes/post/rpi-setup.ksi +++ b/includes/post/rpi-setup.ksi @@ -1,9 +1,2 @@ %post -set -x - -# U-Boot binaries for 32-bit and 64-bit Raspberry Pi models -# (these are loaded by /boot/efi/config.txt) -cp -v -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin -cp -v -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin - %end diff --git a/includes/post/rpm-repos-enable.ksi b/includes/post/rpm-repos-enable.ksi index 0866cdb..e80caa4 100644 --- a/includes/post/rpm-repos-enable.ksi +++ b/includes/post/rpm-repos-enable.ksi @@ -1,47 +1,4 @@ %post --erroronfail set -x - -MACHINE_ARCH="$(uname -m)" -VERSION_ID="$(source <(grep VERSION_ID /etc/os-release) && awk -F '.' '{print $1}' <<< $VERSION_ID)" - -# This repository is a given since it provides 'uboot-images-armv8' and -# 'uboot-tools', which are **required**. -dnf config-manager --assumeyes --add-repo "https://download.rockylinux.org/pub/sig/${VERSION_ID}/altarch/${MACHINE_ARCH}/altarch-common" -if ! dnf repolist --enabled | grep "download.rockylinux.org_pub_sig_${VERSION_ID}_altarch_${MACHINE_ARCH}_altarch-common" > /dev/null; then - dnf config-manager --set-enabled "download.rockylinux.org_pub_sig_${VERSION_ID}_altarch_${MACHINE_ARCH}_altarch-common" || exit 1 -fi - -# import the SIG/AltArch key manually, since it does not get automatically get imported... -wget "https://download.rockylinux.org/pub/sig/${VERSION_ID}/altarch/${MACHINE_ARCH}/altarch-common/RPM-GPG-KEY-Rocky-SIG-AltArch" -rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 -rpm --import RPM-GPG-KEY-Rocky-SIG-AltArch -rm RPM-GPG-KEY-Rocky-SIG-AltArch - -# Enable EPEL if packages are installed from EPEL -if dnf list installed | grep '@epel' > /dev/null || dnf list installed | grep 'epel-release' > /dev/null; then - dnf install --assumeyes epel-release - - if ! dnf repolist --enabled | grep 'crb' > /dev/null; then - dnf config-manager --set-enabled crb || exit 1 - fi - - if ! dnf repolist --enabled | grep 'epel' > /dev/null; then - dnf config-manager --set-enabled epel || exit 1 - fi -fi - -# SIG/kernel's kernel-mainline-sbc -dnf copr enable --assumeyes prathampatel/kernel-rocky "rhel-${VERSION_ID}-${MACHINE_ARCH}" -if ! dnf repolist --enabled | grep 'copr:copr.fedorainfracloud.org:prathampatel:kernel-rocky' > /dev/null; then - dnf config-manager --set-enabled 'copr:copr.fedorainfracloud.org:prathampatel:kernel-rocky' || exit 1 -fi -echo 'metadata_expire=2400' | tee -a '/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:prathampatel:kernel-rocky.repo' - -# manually import the GPG keys for my COPRs -wget 'https://download.copr.fedorainfracloud.org/results/prathampatel/kernel-rocky/pubkey.gpg' -O kernel-rocky-pubkey.gpg -rpm --import kernel-elrepo-pubkey.gpg -rm -vf kernel-elrepo-pubkey.gpg - dnf clean expire-cache - %end diff --git a/includes/post/user-setup.ksi b/includes/post/user-setup.ksi index 0b1e831..ba44347 100644 --- a/includes/post/user-setup.ksi +++ b/includes/post/user-setup.ksi @@ -28,12 +28,8 @@ cat << EOF > get-dotfiles.sh #!/usr/bin/env bash set -x -if [[ "$(id -u)" -eq 0 ]]; then - echo "Not gonna run as root" - exit 1 -fi - -echo "Hi $USER" +HOME='/home/pratham' +[[ -d "$HOME" ]] || exit 1 git clone --bare https://gitlab.com/thefossguy/dotfiles.git "${HOME}/.dotfiles" git --git-dir="${HOME}/.dotfiles" --work-tree="${HOME}" checkout -f rm -rf "${HOME}/.config/nvim" @@ -44,5 +40,4 @@ rm -vf get-dotfiles.sh # Lock the root account passwd -l root - %end diff --git a/includes/repos/repos-master.ksi b/includes/repos/repos-master.ksi index e1e5453..ba0df39 100644 --- a/includes/repos/repos-master.ksi +++ b/includes/repos/repos-master.ksi @@ -1,3 +1 @@ -%include sig-kernel.ksi -%include epel.ksi %include rocky.ksi diff --git a/includes/repos/rocky.ksi b/includes/repos/rocky.ksi index 3a8a4b9..f3d8cc6 100644 --- a/includes/repos/rocky.ksi +++ b/includes/repos/rocky.ksi @@ -1,11 +1,3 @@ # Specify where our (EL distro) "base" resides -url --url=https://download.rockylinux.org/pub/rocky/$releasever/BaseOS/$basearch/os - -# BaseURLs for the default repositories -# The 'kernel-*' packages are disabled from these "default" repositories -# because many of the SBCs require a kernel (be it LTS or stable) that is -# newer than what our EL distro provide -repo --install --name=AppStream --baseurl=https://download.rockylinux.org/pub/rocky/$releasever/AppStream/$basearch/os -repo --install --name=BaseOS --baseurl=https://download.rockylinux.org/pub/rocky/$releasever/BaseOS/$basearch/os -repo --install --name=CRB --baseurl=https://download.rockylinux.org/pub/rocky/$releasever/CRB/$basearch/os -repo --install --name=SIG-AltArch --baseurl=https://download.rockylinux.org/pub/sig/$releasever/altarch/$basearch/altarch-common +url --url=http://fedora.riscv.rocks/repos-dist/$releasever/latest/$basearch +repo --install --name=Fedora --baseurl=http://fedora.riscv.rocks/repos-dist/$releasever/latest/$basearch