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 pushd "${APPLIANCE_NAME}" || exit 1
mv "../${APPLIANCE_NAME}.log" . mv "../${APPLIANCE_NAME}.log" .
mv "${APPLIANCE_NAME}-sda.raw" "${IMAGE_NAME}" mv "${APPLIANCE_NAME}-sda.raw" "${IMAGE_NAME}"
create_new_image
zstd --compress -9 "${IMAGE_NAME}" zstd --compress -9 "${IMAGE_NAME}"
sha512sum -- *.raw* > SHA512SUMS sha512sum -- *.raw* > SHA512SUMS
sha256sum -- *.raw* > SHA256SUMS sha256sum -- *.raw* > SHA256SUMS

View File

@ -7,5 +7,5 @@ timezone Asia/Kolkata
selinux --enforcing selinux --enforcing
firewall --enabled --ssh firewall --enabled --ssh
network --device=link --activate --bootproto=dhcp --onboot=on --hostname=altarchdevel 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 shutdown # power-off after the installation completes

View File

@ -10,6 +10,6 @@ clearpart --drives=sda --disklabel=gpt --all
# 1073.74 MB = 1024 MiB # 1073.74 MB = 1024 MiB
# 3758.09 MB = 3584 MiB # 3758.09 MB = 3584 MiB
# Keep /boot formatted as ext4 since that's what U-Boot can read # 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/efi --asprimary --ondisk=sda --size=133 --label=rvefi --fstype=efi
part /boot --asprimary --ondisk=sda --size=1072 --label=rockyboot --fstype=ext4 part /boot --asprimary --ondisk=sda --size=1072 --label=rvboot --fstype=ext4
part / --asprimary --ondisk=sda --size=3757 --label=rockyroot --fstype=ext4 part / --asprimary --ondisk=sda --size=3757 --label=rvroot --fstype=ext4

View File

@ -1,5 +1,5 @@
%packages --exclude-weakdeps %packages --exclude-weakdeps
rocky-release fedora-release
# The '@core' group installs, as it's name suggests, packages that are core # The '@core' group installs, as it's name suggests, packages that are core
# to _any_:tm: Linux distribution. This includes packages like system, passwd, # to _any_:tm: Linux distribution. This includes packages like system, passwd,
@ -8,7 +8,7 @@ rocky-release
@standard @standard
# Kernel selection # Kernel selection
kernel-mainline-sbc kernel-core
# Other necessary packages # Other necessary packages
cloud-utils-growpart cloud-utils-growpart
@ -18,6 +18,7 @@ NetworkManager-wifi
# Extra add-ons # Extra add-ons
git git
openssh
pciutils pciutils
tmux tmux
util-linux util-linux
@ -25,32 +26,33 @@ util-linux
# Extra packages to do 'U-Boot -> GRUB -> Linux' # Extra packages to do 'U-Boot -> GRUB -> Linux'
dracut-config-generic dracut-config-generic
efibootmgr efibootmgr
grub2-common # systemd-boot
grub2-efi-aa64 sdubby
grub2-efi-aa64-modules systemd-boot-unsigned
grubby # GRUB2
openssh #grub2-common
shim-aa64 #grub2-efi-aa64
#grub2-efi-aa64-modules
#grubby
#shim-aa64
# Packages from SIG/AltArch # 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 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! # Trust me, they're nice!
appliance-tools appliance-tools
aria2 #aria2
bat #bat
btop #btop
dash #dash
epel-release #epel-release
gzip gzip
hdparm hdparm
htop htop
mock mock
parallel #parallel
perl-Digest-SHA perl-Digest-SHA
picocom #picocom
procps-ng procps-ng
pykickstart pykickstart
ripgrep ripgrep
@ -64,54 +66,13 @@ xz
yt-dlp yt-dlp
zstd 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 # Remove some packages
-abrt-cli
-cockpit* -cockpit*
-dracut-config-rescue -dracut-config-rescue
-java-11-* -java-11-*
-plymouth -plymouth
-smartmontools
# no "stock" EL kernel # no "stock" EL kernel
-kernel-core -kernel-core
-kmod-kvdo -kmod-kvdo

View File

@ -1,12 +1,2 @@
%post %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 %end

View File

@ -1,17 +1,6 @@
%post %post
set -x 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 cat << EOF > /etc/sysconfig/kernel
# the latest kernel should be the first entry in the bootloader # the latest kernel should be the first entry in the bootloader
# this should be the default, but here we are # this should be the default, but here we are
@ -22,7 +11,4 @@ DEFAULTKERNEL=kernel-core
EOF EOF
chmod 644 /etc/sysconfig/kernel chmod 644 /etc/sysconfig/kernel
grubby --update-kernel=ALL --args='systemd.show_status=false'
%end %end

View File

@ -1,9 +1,2 @@
%post %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 %end

View File

@ -1,47 +1,4 @@
%post --erroronfail %post --erroronfail
set -x 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 dnf clean expire-cache
%end %end

View File

@ -28,12 +28,8 @@ cat << EOF > get-dotfiles.sh
#!/usr/bin/env bash #!/usr/bin/env bash
set -x set -x
if [[ "$(id -u)" -eq 0 ]]; then HOME='/home/pratham'
echo "Not gonna run as root" [[ -d "$HOME" ]] || exit 1
exit 1
fi
echo "Hi $USER"
git clone --bare https://gitlab.com/thefossguy/dotfiles.git "${HOME}/.dotfiles" git clone --bare https://gitlab.com/thefossguy/dotfiles.git "${HOME}/.dotfiles"
git --git-dir="${HOME}/.dotfiles" --work-tree="${HOME}" checkout -f git --git-dir="${HOME}/.dotfiles" --work-tree="${HOME}" checkout -f
rm -rf "${HOME}/.config/nvim" rm -rf "${HOME}/.config/nvim"
@ -44,5 +40,4 @@ rm -vf get-dotfiles.sh
# Lock the root account # Lock the root account
passwd -l root passwd -l root
%end %end

View File

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

View File

@ -1,11 +1,3 @@
# Specify where our (EL distro) "base" resides # Specify where our (EL distro) "base" resides
url --url=https://download.rockylinux.org/pub/rocky/$releasever/BaseOS/$basearch/os 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
# 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