Compare commits

...

7 Commits

Author SHA1 Message Date
David Abdurachmanov 76fdb7978f
Add minimal experimental image
This is for attempting to validate various configuration (e.g. sdboot +
UKI).

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2024-04-11 20:31:26 +03:00
Andrea Bolognani 5914755e3a Reintroduce minimal image
We used to have a minimal image back in the Fedora 32 days,
but it got lost along the way. Reintroduce it.

I didn't try too hard to make it as small as possible, but
simply by taking care of the low-hanging fruits I was able to
go from the ~7.5GB of the developer image to ~2.2GB, which is
already a significant improvement.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-04-09 19:29:31 +02:00
Andrea Bolognani 5d40792dd6 Remove trailing whitespace
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-04-09 19:29:31 +02:00
Andrea Bolognani e48413ad03 Install growpart
It's a tiny tool that's extremely useful to have in the image,
as the first thing that anyone will likely want to do after
booting it is to expand the installation to cover the entire
disk.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-04-09 19:29:31 +02:00
Andrea Bolognani 830392708b Install grub2 modules
The bootloader is fairly useless on its own.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-04-09 19:29:31 +02:00
Andrea Bolognani 85e99a468d Install passwd explicitly
It currently gets dragged in by some other package included in
the developer image, but that's not the case for the minimal
image that we're about to reintroduce.

Either way, since we use the command as part of %post, we
shouldn't be relying on an indirect dependency.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-04-09 19:28:55 +02:00
Andrea Bolognani 18b4bc146f Don't try to disable modular repositories
They no longer exist, so attempting to disable them results
in an error:

  Error: No matching repo to modify: rawhide-modular,
  updates-modular, updates-testing-modular, fedora-modular.

As a consequence, no repository is disabled, so dnf will not
work out of the box.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-04-09 19:04:28 +02:00
3 changed files with 463 additions and 3 deletions

View File

@ -38,9 +38,10 @@ poweroff
@development-tools
@anaconda-tools
# This is needed for appliance-tools, as it cannot see what packages are incl.
# This is needed for appliance-tools, as it cannot see what packages are incl.
# in the @anaconda-tools.
grub2-efi-riscv64
grub2-efi-riscv64-modules
# Add for sd-boot
systemd-boot-unsigned
@ -58,6 +59,8 @@ uboot-images-riscv64
dracut-config-generic
-dracut-config-rescue
passwd
openssh
openssh-server
glibc-langpack-en
@ -250,6 +253,8 @@ chkconfig
# Lets resize / on first boot
#dracut-modules-growroot
cloud-utils-growpart
dnscrypt-proxy
meson
cloud-utils-growpart
@ -401,7 +406,7 @@ libtirpc-devel
%post
# Disable default repositories (not riscv64 in upstream)
dnf config-manager --set-disabled rawhide updates updates-testing fedora fedora-modular fedora-cisco-openh264 updates-modular updates-testing-modular rawhide-modular
dnf config-manager --set-disabled rawhide updates updates-testing fedora fedora-cisco-openh264
dnf -y remove dracut-config-generic
@ -497,7 +502,7 @@ Kernel \r on an \m (\l)
The root password is 'fedora_rocks!'.
root password logins are disabled in SSH starting Fedora 31.
User 'riscv' with password 'fedora_rocks!' in 'wheel' and 'mock' groups
User 'riscv' with password 'fedora_rocks!' in 'wheel' and 'mock' groups
is provided.
To install new packages use 'dnf install ...'

View File

@ -0,0 +1,234 @@
# Kickstart file for Fedora RISC-V (riscv64) Minimal F40
#repo --name="koji-override-0" --baseurl=http://fedora.riscv.rocks/repos-dist/f40/latest/riscv64/
#install
text
#reboot
lang en_US.UTF-8
keyboard us
# short hostname still allows DHCP to assign domain name
network --bootproto dhcp --device=link --hostname=fedora-riscv --activate
rootpw --plaintext fedora_rocks!
firewall --enabled --ssh
timezone --utc US/Eastern
selinux --enforcing
services --enabled=sshd,NetworkManager,chronyd,haveged
zerombr
ignoredisk --only-use=vda
clearpart --all --initlabel --disklabel=gpt --drives=vda
part /boot/efi --size=500 --fstype=efi
part /boot --size=1000 --fstype=ext4 --label=boot
part btrfs.007 --size=8000 --fstype=btrfs --grow
btrfs none --label=fedora btrfs.007
btrfs /home --subvol --name=home LABEL=fedora
btrfs / --subvol --name=root LABEL=fedora
bootloader --location=mbr --timeout=5
# Halt the system once configuration has finished.
poweroff
%packages
@core
@hardware-support
@anaconda-tools
# This is needed for appliance-tools, as it cannot see what packages are incl.
# in the @anaconda-tools.
-grub2-efi-riscv64
-grub2-efi-riscv64-modules
efibootmgr
# Add for sd-boot
systemd-boot-unsigned
edk2-ext4
kernel-uki-virt
kernel
kernel-core
kernel-modules
linux-firmware
opensbi-unstable
uboot-tools
uboot-images-riscv64
# Remove this in %post
dracut-config-generic
-dracut-config-rescue
passwd
openssh
openssh-server
glibc-langpack-en
nano
chrony
haveged
watchdog
# No longer in @core since 2018-10, but needed for livesys script
initscripts
chkconfig
# Lets resize / on first boot
#dracut-modules-growroot
cloud-utils-growpart
# Avoid pulling these packages by default via COMPS
-valgrind
-s390utils
%end
%post
# Disable default repositories (not riscv64 in upstream)
dnf config-manager --set-disabled rawhide updates updates-testing fedora fedora-cisco-openh264
dnf -y remove dracut-config-generic
# systemd on no-SMP boots (i.e. single core) sometimes timeout waiting for storage
# devices. After entering emergency prompt all disk are mounted.
# For more information see:
# https://www.suse.com/support/kb/doc/?id=7018491
# https://www.freedesktop.org/software/systemd/man/systemd.mount.html
# https://github.com/systemd/systemd/issues/3446
# We modify /etc/fstab to give more time for device detection (the problematic part)
# and mounting processes. This should help on systems where boot takes longer.
sed -i 's|noatime|noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s|g' /etc/fstab
# Fedora 31
# https://fedoraproject.org/wiki/Changes/DisableRootPasswordLoginInSshd
cat > /etc/rc.d/init.d/livesys << EOF
#!/bin/bash
#
# live: Init script for live image
#
# chkconfig: 345 00 99
# description: Init script for live image.
### BEGIN INIT INFO
# X-Start-Before: display-manager chronyd
### END INIT INFO
. /etc/rc.d/init.d/functions
useradd -c "Fedora RISCV User" riscv
echo fedora_rocks! | passwd --stdin riscv > /dev/null
usermod -aG wheel riscv > /dev/null
usermod -aG mock riscv > /dev/null
exit 0
EOF
chmod 755 /etc/rc.d/init.d/livesys
/sbin/restorecon /etc/rc.d/init.d/livesys
/sbin/chkconfig --add livesys
# Create Fedora RISC-V repo
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
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
# systemd starts serial consoles on /dev/ttyS0 and /dev/hvc0. The
# only problem is they are the same serial console. Mask one.
systemctl mask serial-getty@hvc0.service
# Disable tmpfs for /tmp
# Most boards don't have a lot of RAM.
systemctl mask tmp.mount
# setup 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)
Kernel \r on an \m (\l)
The root password is 'fedora_rocks!'.
root password logins are disabled in SSH starting Fedora 31.
User 'riscv' with password 'fedora_rocks!' in 'wheel' and 'mock' groups
is provided.
To install new packages use 'dnf install ...'
To upgrade disk image use 'dnf upgrade --best'
If DNS isnt working, try editing /etc/yum.repos.d/fedora-riscv.repo.
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
# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id
# remove random seed, the newly installed instance should make it's own
rm -f /var/lib/systemd/random-seed
# Note that running rpm recreates the rpm db files which aren't needed or wanted
rm -f /var/lib/rpm/__db*
# go ahead and pre-make the man -k cache (#455968)
/usr/bin/mandb
# make sure there aren't core files lying around
rm -f /core*
releasever=$(rpm --eval '%{fedora}')
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-primary
echo "Packages within this disk image"
rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn
/usr/bin/bootctl install
cp -a /usr/share/edk2/drivers /boot/efi/EFI/systemd
echo "timeout 5" > /boot/efi/loader/loader.conf
# setup discoverable partitions
/usr/sbin/sfdisk --part-type /dev/vda 2 BC13C2FF-59E6-4262-A352-B275FD6F7172 # Linux extended boot
/usr/sbin/sfdisk --part-type /dev/vda 3 72ec70a6-cf74-40e6-bd49-4bda08e8f224 # Linux root (riscv64)
%end
# EOF

View File

@ -0,0 +1,221 @@
# Kickstart file for Fedora RISC-V (riscv64) Minimal F40
#repo --name="koji-override-0" --baseurl=http://fedora.riscv.rocks/repos-dist/f40/latest/riscv64/
#install
text
#reboot
lang en_US.UTF-8
keyboard us
# short hostname still allows DHCP to assign domain name
network --bootproto dhcp --device=link --hostname=fedora-riscv --activate
rootpw --plaintext fedora_rocks!
firewall --enabled --ssh
timezone --utc US/Eastern
selinux --enforcing
services --enabled=sshd,NetworkManager,chronyd,haveged
zerombr
clearpart --all --initlabel --disklabel=gpt
part /boot/efi --size=100 --fstype=efi
part /boot --size=1000 --fstype=ext4 --label=boot
part btrfs.007 --size=8000 --fstype=btrfs --grow
btrfs none --label=fedora btrfs.007
btrfs /home --subvol --name=home LABEL=fedora
btrfs / --subvol --name=root LABEL=fedora
bootloader --location=mbr --timeout=1
# Halt the system once configuration has finished.
poweroff
%packages
@core
@hardware-support
@anaconda-tools
# This is needed for appliance-tools, as it cannot see what packages are incl.
# in the @anaconda-tools.
grub2-efi-riscv64
grub2-efi-riscv64-modules
# Add for sd-boot
systemd-boot-unsigned
kernel
kernel-core
kernel-modules
linux-firmware
opensbi-unstable
uboot-tools
uboot-images-riscv64
# Remove this in %post
dracut-config-generic
-dracut-config-rescue
passwd
openssh
openssh-server
glibc-langpack-en
nano
chrony
haveged
watchdog
# No longer in @core since 2018-10, but needed for livesys script
initscripts
chkconfig
# Lets resize / on first boot
#dracut-modules-growroot
cloud-utils-growpart
# Avoid pulling these packages by default via COMPS
-valgrind
-s390utils
%end
%post
# Disable default repositories (not riscv64 in upstream)
dnf config-manager --set-disabled rawhide updates updates-testing fedora fedora-cisco-openh264
dnf -y remove dracut-config-generic
# systemd on no-SMP boots (i.e. single core) sometimes timeout waiting for storage
# devices. After entering emergency prompt all disk are mounted.
# For more information see:
# https://www.suse.com/support/kb/doc/?id=7018491
# https://www.freedesktop.org/software/systemd/man/systemd.mount.html
# https://github.com/systemd/systemd/issues/3446
# We modify /etc/fstab to give more time for device detection (the problematic part)
# and mounting processes. This should help on systems where boot takes longer.
sed -i 's|noatime|noatime,x-systemd.device-timeout=300s,x-systemd.mount-timeout=300s|g' /etc/fstab
# Fedora 31
# https://fedoraproject.org/wiki/Changes/DisableRootPasswordLoginInSshd
cat > /etc/rc.d/init.d/livesys << EOF
#!/bin/bash
#
# live: Init script for live image
#
# chkconfig: 345 00 99
# description: Init script for live image.
### BEGIN INIT INFO
# X-Start-Before: display-manager chronyd
### END INIT INFO
. /etc/rc.d/init.d/functions
useradd -c "Fedora RISCV User" riscv
echo fedora_rocks! | passwd --stdin riscv > /dev/null
usermod -aG wheel riscv > /dev/null
usermod -aG mock riscv > /dev/null
exit 0
EOF
chmod 755 /etc/rc.d/init.d/livesys
/sbin/restorecon /etc/rc.d/init.d/livesys
/sbin/chkconfig --add livesys
# Create Fedora RISC-V repo
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
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
# systemd starts serial consoles on /dev/ttyS0 and /dev/hvc0. The
# only problem is they are the same serial console. Mask one.
systemctl mask serial-getty@hvc0.service
# Disable tmpfs for /tmp
# Most boards don't have a lot of RAM.
systemctl mask tmp.mount
# setup 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)
Kernel \r on an \m (\l)
The root password is 'fedora_rocks!'.
root password logins are disabled in SSH starting Fedora 31.
User 'riscv' with password 'fedora_rocks!' in 'wheel' and 'mock' groups
is provided.
To install new packages use 'dnf install ...'
To upgrade disk image use 'dnf upgrade --best'
If DNS isnt working, try editing /etc/yum.repos.d/fedora-riscv.repo.
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
# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id
# remove random seed, the newly installed instance should make it's own
rm -f /var/lib/systemd/random-seed
# Note that running rpm recreates the rpm db files which aren't needed or wanted
rm -f /var/lib/rpm/__db*
# go ahead and pre-make the man -k cache (#455968)
/usr/bin/mandb
# make sure there aren't core files lying around
rm -f /core*
releasever=$(rpm --eval '%{fedora}')
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-primary
echo "Packages within this disk image"
rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn
%end
# EOF