From de1a80f184090ce0045308b39ee7dc44d13d8b4d Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Thu, 28 Nov 2024 16:31:59 +0200 Subject: [PATCH] Initial draft for riscv64 (F41) Signed-off-by: David Abdurachmanov --- Fedora.kiwi | 4 +- components/boot.xml | 8 +++- components/liveinstall.xml | 10 ++++ components/users.xml | 6 +++ config.sh | 90 +++++++++++++++++++++++++++++++++++ grub-riscv64.cfg.iso-template | 41 ++++++++++++++++ repositories/core-riscv64.xml | 11 +++++ teams/cloud/cloud.xml | 4 +- teams/cloud/container.xml | 2 +- teams/riscv.xml | 62 ++++++++++++++++++++++++ uki-editbootconfig.sh | 1 + 11 files changed, 234 insertions(+), 5 deletions(-) create mode 100644 grub-riscv64.cfg.iso-template create mode 100644 repositories/core-riscv64.xml create mode 100644 teams/riscv.xml diff --git a/Fedora.kiwi b/Fedora.kiwi index 010402f..e8fa10e 100644 --- a/Fedora.kiwi +++ b/Fedora.kiwi @@ -14,7 +14,8 @@ UTC 41 - + + @@ -47,6 +48,7 @@ + diff --git a/components/boot.xml b/components/boot.xml index 7d3b3ea..c2beb17 100644 --- a/components/boot.xml +++ b/components/boot.xml @@ -6,7 +6,7 @@ - + + + @@ -75,6 +77,7 @@ + @@ -82,6 +85,7 @@ + @@ -91,6 +95,7 @@ + @@ -102,5 +107,6 @@ + diff --git a/components/liveinstall.xml b/components/liveinstall.xml index 12891ff..df964aa 100644 --- a/components/liveinstall.xml +++ b/components/liveinstall.xml @@ -22,6 +22,16 @@ + + + + + + + + + + + + diff --git a/config.sh b/config.sh index 0f090d5..9ed98d9 100755 --- a/config.sh +++ b/config.sh @@ -302,4 +302,94 @@ EOF /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas fi +# Find the architecture we are on +installarch=$(uname -m) + +# Do custom Fedora/RISCV changes +if [[ $installarch == "riscv64" ]]; then + # Disable default branched fedora repos + # We only want to have Fedora/RISCV Koji repos + sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/{fedora.repo,fedora-updates.repo,fedora-updates-testing.repo,fedora-cisco-openh264.repo} + + # Create Fedora/RISCV repos + cat << EOF > /etc/yum.repos.d/fedora-riscv.repo +[fedora-riscv] +name=Fedora RISC-V +baseurl=http://fedora.riscv.rocks/repos-dist/f41-staging/latest/riscv64/ +enabled=1 +gpgcheck=0 + +[fedora-riscv-debuginfo] +name=Fedora RISC-V - Debug +baseurl=http://fedora.riscv.rocks/repos-dist/f41-staging/latest/riscv64/debug/ +enabled=0 +gpgcheck=0 + +[fedora-riscv-source] +name=Fedora RISC-V - Source +baseurl=http://fedora.riscv.rocks/repos-dist/f41-staging/latest/src/ +enabled=0 +gpgcheck=0 +EOF + + # Create Fedora/RISC-V Koji repo (pulling directly from Koji) + cat << EOF > /etc/yum.repos.d/fedora-riscv-koji.repo +[fedora-riscv-koji] +name=Fedora RISC-V Koji +baseurl=http://fedora.riscv.rocks/repos/f41-staging/latest/riscv64/ +enabled=0 +gpgcheck=0 +EOF + + # Disable tmpfs for /tmp + # Most boards don't have a lot of RAM. + systemctl mask tmp.mount + + # We most likely don't have HW random number generator + systemctl enable haveged.service + + # Update login message + cat << EOF | tee /etc/issue /etc/issue.net +Welcome to the Fedora/RISC-V disk image +https://fedoraproject.org/wiki/Architectures/RISC-V + +Build date: $(date --utc) + +\S +Kernel \r on an \m (\l) + +User 'root' with password is 'linux'. +User 'riscv' with password 'fedora_rocks!' in 'wheel' +and 'mock' groups. + +For updates and latest information read: +https://fedoraproject.org/wiki/Architectures/RISC-V + +Fedora/RISC-V +------------- +Koji: http://fedora.riscv.rocks/koji/ +SCM: http://fedora.riscv.rocks:3000/ +Distribution rep.: http://fedora.riscv.rocks/repos-dist/ +Koji internal rep.: http://fedora.riscv.rocks/repos/ + +EOF + + # Setup toolbox container to use + cat << EOF | tee -a /etc/containers/toolbox.conf +image = "fedora.riscv.rocks:3000/davidlt/fedora-toolbox:41" +EOF + + # Add insecure (HTTP) Fedora/RISCV registry (Gitea) + cat << EOF | tee -a /etc/containers/registries.conf +[[registry]] +location="fedora.riscv.rocks:3000" +insecure=true +EOF + + # Add Fedora/RISCV registry for search + sed -i -r 's/(unqualified-search-registries = \[")/\1fedora.riscv.rocks:3000", "/' /etc/containers/registries.conf + + +fi + exit 0 diff --git a/grub-riscv64.cfg.iso-template b/grub-riscv64.cfg.iso-template new file mode 100644 index 0000000..037ae79 --- /dev/null +++ b/grub-riscv64.cfg.iso-template @@ -0,0 +1,41 @@ +# Inspired by the config used for lorax-built live media + +set default="1" + +function load_video { + insmod efi_gop + insmod efi_uga + insmod video_bochs + insmod video_cirrus + insmod all_video +} +set basicgfx="nomodeset" + +load_video +set gfxpayload=keep +insmod gzio +insmod part_gpt +insmod ext2 + +terminal_input console +terminal_output ${terminal_output} + +set timeout=${boot_timeout} +set timeout_style=${boot_timeout_style} + +search ${search_params} + +menuentry "Start ${title}" --class fedora --class gnu-linux --class gnu --class os { + linux ($$root)${bootpath}/${kernel_file} ${boot_options} + initrd ($$root)${bootpath}/${initrd_file} +} +menuentry "Test this media & start ${title}" --class fedora --class gnu-linux --class gnu --class os { + linux ($$root)${bootpath}/${kernel_file} ${boot_options} rd.live.check + initrd ($$root)${bootpath}/${initrd_file} +} +submenu "Troubleshooting -->" { + menuentry "Start ${title} in basic graphics mode" --class fedora --class gnu-linux --class gnu --class os { + linux ($$root)${bootpath}/${kernel_file} ${boot_options} $${basicgfx} + initrd ($$root)${bootpath}/${initrd_file} + } +} diff --git a/repositories/core-riscv64.xml b/repositories/core-riscv64.xml new file mode 100644 index 0000000..f7101f9 --- /dev/null +++ b/repositories/core-riscv64.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/teams/cloud/cloud.xml b/teams/cloud/cloud.xml index 597975a..439728c 100644 --- a/teams/cloud/cloud.xml +++ b/teams/cloud/cloud.xml @@ -89,7 +89,7 @@ - + - + - + diff --git a/teams/riscv.xml b/teams/riscv.xml new file mode 100644 index 0000000..7ab19e4 --- /dev/null +++ b/teams/riscv.xml @@ -0,0 +1,62 @@ + + + + + + + + + + 5 + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/uki-editbootconfig.sh b/uki-editbootconfig.sh index 32cb463..582af0f 100755 --- a/uki-editbootconfig.sh +++ b/uki-editbootconfig.sh @@ -5,6 +5,7 @@ echo "###" "$0" "$@" case "$(uname -m)" in aarch64) arch="aa64"; ARCH="AA64";; x86_64) arch="x64"; ARCH="X64";; + riscv64) arch="riscv64"; ARCH="RISCV64";; esac # figure where shim.efi and BOOT.CSV are located