From Fedora Project Wiki
No edit summary
Line 9: Line 9:
Appliance-tools is used to build Fedora images, which has already installed in the image.
Appliance-tools is used to build Fedora images, which has already installed in the image.


* Download Pre-build image and Uncompress
=== Download Pre-build image and Uncompress ===
<pre>
<pre>
$ wget http://fedora.riscv.rocks/kojifiles/work/tasks/8517/1128517/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz
$ wget http://fedora.riscv.rocks/kojifiles/work/tasks/8517/1128517/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz
Line 15: Line 15:
</pre>
</pre>


* Download Firmware
=== Download Firmware ===


<pre>
<pre>
Line 21: Line 21:
</pre>
</pre>


* Resize image
=== Resize Image ===


The original image size is not enough for image building, we need enlarge it first.
The original image size is not enough for image building, we need enlarge it first.
Line 29: Line 29:
</pre>
</pre>


* Boot RISC-V Qemu
=== Boot RISC-V Qemu ===


<pre>
<pre>
Line 46: Line 46:
</pre>
</pre>


 
=== Resize rootfs '''on Qemu''' ===
* Resize root file system '''on Qemu'''


<pre>
<pre>
Line 55: Line 54:
</pre>
</pre>


* Prepare kick start file
=== Prepare kick start file ===


The original Kickstart files is from [https://riscv.rocks riscv.rocks]: [http://fedora.riscv.rocks:3000/davidlt/fedora-riscv-kickstarts.git  fedora-riscv-kickstarts].
The original Kickstart files is from [https://riscv.rocks riscv.rocks]: [http://fedora.riscv.rocks:3000/davidlt/fedora-riscv-kickstarts.git  fedora-riscv-kickstarts].
Line 65: Line 64:
For StarFive Starlight Board, the example kickstart file REPO is [https://gitee.com/etux/fedora_on_riscv64_jh7100_kickstart here] .
For StarFive Starlight Board, the example kickstart file REPO is [https://gitee.com/etux/fedora_on_riscv64_jh7100_kickstart here] .


* Run appliance tool to build new image
=== Run appliance tool to build new image on QEMU ===
<pre>
<pre>
IMAGE_NAME=Fedora-d1-riscv64-developer-xfce-with-esp-Rawhide-sda.raw
IMAGE_NAME=Fedora-d1-riscv64-developer-xfce-with-esp-Rawhide-sda.raw
IMAGE_VERSION=1.0
IMAGE_VERSION=1.0
IMAGE_RELEASE=f33
IMAGE_RELEASE=rawhide
OUTPUT_DIR=./images
OUTPUT_DIR=./images
CACHE_DIR=./cache
CACHE_DIR=./cache

Revision as of 12:59, 5 September 2021

Build Fedora Image for RISC-V development board

Setup Environment

We use latest Fedora Qemu image for RISC-V64 from riscv.rocks or a mirror in China to boot a RISC-V Qemu for building a Fedora Remix image.

Making Image by Appliance-tools

Appliance-tools is used to build Fedora images, which has already installed in the image.

Download Pre-build image and Uncompress

$ wget http://fedora.riscv.rocks/kojifiles/work/tasks/8517/1128517/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz
$ xz -d Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz

Download Firmware

$ wget http://openkoji.iscas.ac.cn/pub/dl/fw_payload-uboot-qemu-virt-smode.bin

Resize Image

The original image size is not enough for image building, we need enlarge it first.

$ qemu-img resize Fedora-Developer-Rawhide-20210421.n.0-sda.raw +40G

Boot RISC-V Qemu

qemu-system-riscv64    -nographic \
                       -machine virt \
                       -smp 4 \
                       -m 2G \
                       -kernel fw_payload-uboot-qemu-virt-smode.bin \
                       -bios none \
                       -object rng-random,filename=/dev/urandom,id=rng0 \
                       -device virtio-rng-device,rng=rng0 \
                       -device virtio-blk-device,drive=hd0 \
                       -drive file=Fedora-Developer-Rawhide-20210421.n.0-sda.raw,format=raw,id=hd0 \
                       -device virtio-net-device,netdev=usernet \
                       -netdev user,id=usernet,hostfwd=tcp::10000-:22

Resize rootfs on Qemu

# growpart /dev/vda 2
# resize2fs /dev/vda2
# reboot

Prepare kick start file

The original Kickstart files is from riscv.rocks: fedora-riscv-kickstarts.

The kick start file for a specific board can be modified from these files.

For Allwinner D1, the example kickstart file REPO is here .

For StarFive Starlight Board, the example kickstart file REPO is here .

Run appliance tool to build new image on QEMU

IMAGE_NAME=Fedora-d1-riscv64-developer-xfce-with-esp-Rawhide-sda.raw
IMAGE_VERSION=1.0
IMAGE_RELEASE=rawhide
OUTPUT_DIR=./images
CACHE_DIR=./cache
KS_FILE=./fedora-riscv64-d1-developer-xfce-rawhide.ks
appliance-creator -c kickstartfile.ks \
                  --cache ${CACHE_DIR} \
                  --format raw \
                  --name ${IMAGE_NAME} \
                  --version ${IMAGE_VERSION} \
                  --release ${IMAGE_RELEASE} \
                  -o ${OUTPUT_DIR}