Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new branch #1

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ ARG proxy_port="7890"

ENV DNF_PROXY=""

RUN if [ "${proxy_ipv4}" != "0.0.0.0" ]; then \
echo "proxy=http://${proxy_ipv4}:${proxy_port}" >> /etc/dnf/dnf.conf; \
fi && \
dnf update -y && \
dnf install -y util-linux mock qemu-system-riscv git vim qemu-user-static \
wget gdisk dosfstools e2fsprogs util-linux-core xz kpartx && \
# 安装构建所需的系列工具 由于mock工具的要求 需单独创建mock用户组和用户 并在该用户空间中执行构建任务
RUN dnf update -y && \
dnf install -y util-linux mock qemu-system-riscv git vim qemu-user-static wget gdisk dosfstools e2fsprogs util-linux-core xz kpartx && \
adduser riscv && \
echo "riscv ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
usermod -aG root riscv && \
usermod -aG mock riscv

USER riscv
RUN cd ${HOME} && cat >> ./fedora-38-riscv64.cfg <<EOF
config_opts['target_arch'] = 'riscv64'
Expand All @@ -35,14 +33,10 @@ config_opts['cleanup_on_success'] = True
config_opts['cleanup_on_failure'] = True
config_opts['package_manager_max_attempts'] = 2
config_opts['package_manager_attempt_delay'] = 10

config_opts['http_proxy'] = os.getenv("http_proxy")
config_opts['https_proxy'] = os.getenv("https_proxy")
config_opts['docker_host'] = os.getenv("DOCKER_HOST")

config_opts['forcearch'] = 'riscv64'
config_opts['releasever'] = '38'
config_opts['root'] = 'rivai-fedora-{{ releasever }}-{{ target_arch }}'
config_opts['mirrored'] = config_opts['target_arch'] != 'i686'
config_opts['mirrored'] = config_opts['target_arch'] != 'riscv64'
config_opts['chroot_setup_cmd'] = 'install @{% if mirrored %}buildsys-{% endif %}build'
config_opts['dist'] = 'fc{{ releasever }}'
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
This is new branch for code6004
```bash
# 系统扩容
/bin/echo "d
Expand Down
298 changes: 298 additions & 0 deletions fedora-riscv64-developer-p600v4.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
# Generated by pykickstart v3.52
#version=DEVEL
# Use text mode install
text
# Firewall configuration
firewall --enabled --service=mdns,ssh,dns,https
# Keyboard layouts
keyboard 'us'
# System language
lang en_US.UTF-8

# Network information
network --bootproto=dhcp --device=link --hostname=fedora-riscv --activate
# Shutdown after installation
shutdown
repo --name="Openkoji-1" --baseurl=http://openkoji.iscas.ac.cn/kojifiles/repos/f38-build/latest/riscv64/
repo --name="Openkoji-2" --baseurl=http://openkoji.iscas.ac.cn/kojifiles/repos/f38-build-side-42-init-devel/latest/riscv64/
repo --name="Openkoji-3" --baseurl=http://openkoji.iscas.ac.cn/repos/fc38dist/riscv64/
repo --name="Openkoji-4" --baseurl=http://openkoji.iscas.ac.cn/repos/fc38-noarches-repo/riscv64/
repo --name="Openkoji-5" --baseurl=http://openkoji.iscas.ac.cn/pub/temp-f38-repo/riscv64/
repo --name="Openkoji-6" --baseurl=http://openkoji.iscas.ac.cn/pub/temp-python311-repo/riscv64/
repo --name="Openkoji-7" --baseurl=http://openkoji.iscas.ac.cn/pub/temp-python311-repo/riscv64/
repo --name="FedoraRocks-1" --baseurl=http://fedora.riscv.rocks/repos-dist/f38/latest/riscv64/
# Root password
rootpw --plaintext rivai
user --name=rivai --password=rivai --plaintext --gecos="Rivai User"
# SELinux configu
selinux --disabled
# System services
services --disabled="lm_sensors,libvirtd" --enabled="sshd,NetworkManager,chronyd,haveged,lightdm"
# System timezone
timezone Asia/Shanghai --utc
# X Window System configuration information
xconfig --startxonboot
# System bootloader configuration
bootloader --append="console=tty0 console=ttyS0,115200 earlycon rootwait selinux=0" --location=none --extlinux
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel --disklabel=gpt
# Disk partitioning information
part /boot --asprimary --fstype="vfat" --size=512
part / --fstype="ext4" --size=12288

%post
# Enable livesys services
systemctl enable livesys.service
systemctl enable livesys-late.service

# enable tmpfs for /tmp
systemctl enable tmp.mount

# make it so that we don't do writing to the overlay for things which
# are just tmpdirs/caches
# note https://bugzilla.redhat.com/show_bug.cgi?id=1135475
cat >> /etc/fstab << EOF
vartmp /var/tmp tmpfs defaults 0 0
EOF

# work around for poor key import UI in PackageKit
rm -f /var/lib/rpm/__db*
echo "Packages within this LiveCD"
rpm -qa --qf '%{size}\t%{name}-%{version}-%{release}.%{arch}\n' |sort -rn
# 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*

# remove random seed, the newly installed instance should make it's own
rm -f /var/lib/systemd/random-seed

# convince readahead not to collect
# FIXME: for systemd

echo 'File created by kickstart. See systemd-update-done.service(8).' \
| tee /etc/.updated >/var/.updated

# Drop the rescue kernel and initramfs, we don't need them on the live media itself.
# See bug 1317709
rm -f /boot/*-rescue*

# Disable network service here, as doing it in the services line
# fails due to RHBZ #1369794
systemctl disable network

# Remove machine-id on pre generated images
rm -f /etc/machine-id
touch /etc/machine-id

%end

%post
systemctl enable postgresql
systemctl enable sshd
systemctl enable systemd-networkd
systemctl enable systemd-resolved
# Configure DNS lookups to go through systemd-resolved
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

### Add dns server configuration
echo "===]> Info: Printing PWD"
echo "===]> Info: Printing /etc/resolv.conf"
cat /etc/resolv.conf
echo "===]> Info: Listing /etc/resolv.conf"
ls -la /etc/resolv.conf
echo "===]> Info: Renaming default /etc/resolv.conf"
mv /etc/resolv.conf /etc/resolv.conf_backup
echo "===]> Info: Add Google DNS to /etc/resolv.conf"
echo 'nameserver 8.8.8.8' > /etc/resolv.conf
echo 'nameserver 8.8.4.4' >> /etc/resolv.conf
echo "===]> Info: Print /etc/resolv.conf"
cat /etc/resolv.conf

systemctl restart systemd-resolved
dnf config-manager --set-disabled updates fedora fedora-modular fedora-cisco-openh264 updates-modular
dnf -y remove dracut-config-generic

# 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/f38/latest/riscv64/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f38/latest/riscv64/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f38/latest/riscv64/
enabled=1
gpgcheck=0

[fedora-riscv-debuginfo]
name=Fedora RISC-V - Debug
baseurl=http://fedora.riscv.rocks/repos-dist/f38/latest/riscv64/debug/
#baseurl=https://dl.fedoraproject.org/pub/alt/risc-v/repo/fedora/f38/latest/riscv64/debug/
#baseurl=https://mirror.math.princeton.edu/pub/alt/risc-v/repo/fedora/f38/latest/riscv64/debug/
enabled=0
gpgcheck=0

[fedora-riscv-openkoji]
name=Fedora RISC-V - Source
baseurl=http://openkoji.iscas.ac.cn/repos/rocks-f38-latest-mirror/fedora.riscv.rocks/kojifiles/repos-dist/f38/latest/riscv64/
enabled=1
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/f38-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 [email protected]

sudo systemctl enable mysqld

releasever=39
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora--primary

# 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

# remove unnecessary entry in /etc/fstab

sed -i '/swap/d' /etc/fstab
sed -i '/efi/d' /etc/fstab

%end

%post
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" rivai
echo rivai | passwd --stdin rivai > /dev/null
echo "rivai ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

exit 0
EOF

chmod 755 /etc/rc.d/init.d/livesys
/sbin/restorecon /etc/rc.d/init.d/livesys
/sbin/chkconfig --add livesys

# 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: Wed Mar 20 06:51:46 AM UTC 2024

Kernel \r on an \m (\l)

The root password is 'fedora_rocks!'.
root password logins are disabled in SSH starting Fedora 38.
User 'rivai' with password 'rivai' is provided.

To install new packages use 'dnf install ...'

To upgrade disk image use 'dnf upgrade --best'

If DNS isn’t 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
%end

%post

sed -i -e 's/^ui/# ui/g' -e 's/^menu autoboot/# menu autoboot/g' -e 's/^menu hidden/# menu hidden/g' -e 's/^totaltimeout/# totaltimeout/g' /boot/extlinux/extlinux.conf

# replace the auto-generated boot partition
pushd /tmp
/usr/bin/wget -P boot --progress=dot "https://mirror.ghproxy.com/https://raw.githubusercontent.com/PennixRv/mock_fedora_builder/main/prebuild/vf2_kernel_pack_6.1.31.tar.xz.0"
/usr/bin/wget -P boot --progress=dot "https://mirror.ghproxy.com/https://raw.githubusercontent.com/PennixRv/mock_fedora_builder/main/prebuild/vf2_kernel_pack_6.1.31.tar.xz.1"
/usr/bin/wget -P boot --progress=dot "https://mirror.ghproxy.com/https://raw.githubusercontent.com/PennixRv/mock_fedora_builder/main/prebuild/vf2_kernel_pack_6.1.31.tar.xz.2"
pushd boot
cat vf2_kernel_pack_6.1.31.tar.xz.* | tar -xJv
tar xJvf 6.1.31.tar.xz
popd
sudo rm -rf /boot/*
sudo rm -rf /boot/.*
sudo rm -rf /lib/modules/*
sudo mv -vf boot/6.1.31 /lib/modules/
sudo mv -vf boot/Image.gz /boot
sudo mv -vf boot/initramfs.cpio.gz /boot
sudo mkdir -p /boot/dtbs/starfive
sudo mv -vf boot/jh7110-visionfive-v2.dtb /boot/dtbs/starfive
sudo mv -vf boot/vf2_uEnv.txt /boot
sudo mkdir -p /boot/extlinux/
sudo mv -vf boot/extlinux.conf /boot/extlinux/extlinux.conf
sudo rm -rf boot
ROOT_UUID=$(grep ' / ' /etc/fstab | awk '{printf $1}' | sed -e 's/^UUID=//g')
sudo sed -i -e "s/@@ROOTUUID@@/${ROOT_UUID}/g" /boot/extlinux/extlinux.conf
popd

%end

%packages
@core
@dns-server
anaconda
anaconda-install-env-deps
appliance-tools
dracut-config-generic
kernel
kernel-core
kernel-modules
kernel-modules-extra
openssh
openssh-server
openssl
openssl-devel
postgresql
pykickstart
python-imgcreate-sysdeps
sudo
-@dial-up
-@input-methods
-@standard
-device-mapper-multipath
-dracut-config-rescue
-fcoe-utils
-gfs2-utils
-reiserfs-utils
-sdubby

%end
Loading