init riscv64 stuff

This commit is contained in:
Pratham Patel 2024-04-28 18:28:51 +05:30
parent f420775701
commit d59c411fc6
No known key found for this signature in database
11 changed files with 30 additions and 159 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,3 +1 @@
%include sig-kernel.ksi
%include epel.ksi
%include rocky.ksi

View File

@ -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