Add custom disk image

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2024-08-26 04:19:46 -04:00
parent 3c48251da1
commit 7fcf4d4eb1
4 changed files with 159 additions and 41 deletions

View File

@ -1,6 +1,7 @@
<image>
<users profiles="Cloud-Azure,Cloud-AmazonEC2,Cloud-GCE,Cloud-OpenStack,LiveInstall">
<users profiles="Cloud-Azure,Cloud-AmazonEC2,Cloud-GCE,Cloud-OpenStack,LiveInstall,Server">
<!-- The password here does not matter, it will be erased in config.sh -->
<user name="root" groups="root" password="linux" home="/root" pwdformat="plain" />
<user name="riscv" groups="wheel,mock" password="fedora_rocks!" home="/home/riscv" pwdformat="plain" />
</users>
</image>

135
config.sh
View File

@ -202,46 +202,6 @@ if [[ "$kiwi_profiles" == *"Container"* ]]; then
# https://pagure.io/atomic-wg/issue/308
printf "tsflags=nodocs\n" >>/etc/dnf/dnf.conf
# 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/f40/latest/riscv64/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/
enabled=1
gpgcheck=0
[fedora-riscv-debuginfo]
name=Fedora RISC-V - Debug
baseurl=http://fedora.riscv.rocks/repos-dist/f40/latest/riscv64/debug/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/debug/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/debug/
enabled=0
gpgcheck=0
[fedora-riscv-source]
name=Fedora RISC-V - Source
baseurl=http://fedora.riscv.rocks/repos-dist/f40/latest/src/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f40/latest/src/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f40/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/f40-build/latest/riscv64/
enabled=0
gpgcheck=0
EOF
if [[ "$kiwi_profiles" == *"Base-Generic-Minimal"* ]]; then
# remove some random help txt files
rm -fv /usr/share/gnupg/help*.txt
@ -317,4 +277,99 @@ 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/f40-staging/latest/riscv64/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/
enabled=1
gpgcheck=0
[fedora-riscv-debuginfo]
name=Fedora RISC-V - Debug
baseurl=http://fedora.riscv.rocks/repos-dist/f40-staging/latest/riscv64/debug/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/debug/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f40/latest/riscv64/debug/
enabled=0
gpgcheck=0
[fedora-riscv-source]
name=Fedora RISC-V - Source
baseurl=http://fedora.riscv.rocks/repos-dist/f40-staging/latest/src/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f40/latest/src/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f40/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/f40-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:40"
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

View File

@ -35,6 +35,7 @@
<include from="this://./teams/cloud/container.xml"/>
<include from="this://./teams/cloud/vagrant.xml"/>
<include from="this://./teams/workstation.xml"/>
<include from="this://./teams/server.xml"/>
<include from="this://./teams/kde.xml"/>
<include from="this://./teams/xfce.xml"/>
<include from="this://./teams/cinnamon.xml"/>

61
teams/server.xml Normal file
View File

@ -0,0 +1,61 @@
<image>
<profiles>
<profile name="Server" description="Server Disk Image">
<requires profile="BootCore"/>
</profile>
</profiles>
<preferences profiles="Server">
<type image="oem"
filesystem="btrfs" btrfs_root_is_subvolume="true" btrfs_set_default_volume="false" fsmountoptions="x-systemd.growfs,compress=zstd:1"
kernelcmdline="earlycon"
devicepersistency="by-uuid"
bootpartition="true" bootpartsize="1000" bootfilesystem="ext4" efipartsize="500" firmware="uefi"
rootfs_label="fedora"
>
<bootloader name="grub2" console="serial" timeout="5" timeout_style="menu"/>
<size unit="G">5</size>
<systemdisk name="fedora">
<volume name="@root=root"/>
<volume name="home" parent="/"/>
<volume name="var" parent="/"/>
</systemdisk>
<oemconfig>
<oem-resize>false</oem-resize>
</oemconfig>
</type>
</preferences>
<packages type="bootstrap" patternType="plusRecommended" profiles="Server">
<package name="fedora-release-server"/>
</packages>
<packages type="image" patternType="plusRecommended" profiles="Server">
<namedCollection name="container-management"/>
<namedCollection name="server-product-environment"/>
<namedCollection name="core"/>
<namedCollection name="standard"/>
<namedCollection name="hardware-support"/>
<namedCollection name="networkmanager-submodules"/>
<package name="chrony"/>
<package name="lm_sensors"/>
<package name="mtd-utils"/>
<package name="bdsync"/>
<package name="htop"/>
<package name="mock"/>
<package name="toolbox"/>
<package name="cloud-utils-growpart"/>
<package name="zstd"/>
<package name="haveged"/>
<package name="pciutils"/>
<package name="nvme-cli"/>
<package name="efibootmgr"/>
<package name="kernel"/>
<package name="kernel-core"/>
<package name="kernel-modules"/>
<package name="kernel-modules-core"/>
<package name="kernel-modules-extra"/>
<package name="opensbi-unstable" arch="riscv64"/>
<package name="glibc-langpack-en"/>
<ignore name="dracut-config-rescue"/>
<package name="uboot-images-riscv64" arch="riscv64"/>
<package name="uboot-tools"/>
</packages>
</image>