From Fedora Project Wiki
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{lang|en|zh-cn|page=Architectures/RISC-V/Build_Bootable_Image}}
= Build Fedora Image for RISC-V development board =
= Build Fedora Image for RISC-V development board =


== Setup Environment ==
== Making Image by Appliance-tools ==
Appliance-tools is used to build Fedora images, which has already installed in the image.


We use [http://fedora.riscv.rocks/kojifiles/work/tasks/8517/1128517/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz latest Fedora Qemu image for RISC-V64] from [https://riscv.rocks riscv.rocks] or [http://openkoji.iscas.ac.cn/pub/dl/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz a mirror in China] to boot a RISC-V Qemu for building a Fedora Remix image.
=== Setup Environment ===


== Making Image by Appliance-tools ==
We use [http://fedora.riscv.rocks/kojifiles/work/tasks/8517/1128517/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz latest Fedora Qemu image for RISC-V64] from [https://riscv.rocks riscv.rocks] or [https://openkoji.iscas.ac.cn/pub/dl/riscv/qemu/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz a mirror in China] to boot a RISC-V Qemu for building a Fedora Remix image.


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


=== Download Pre-build image and Uncompress ===
==== Download Pre-build image and Uncompress ====
<pre>
<pre>
$ wget https://openkoji.iscas.ac.cn/pub/dl/riscv/qemu/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz
$ wget https://openkoji.iscas.ac.cn/pub/dl/riscv/qemu/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz
Line 15: Line 18:
</pre>
</pre>


=== Download Firmware ===
==== Download Firmware ====


<pre>
<pre>
$ wget http://openkoji.iscas.ac.cn/pub/dl/fw_payload-uboot-qemu-virt-smode.bin
$ wget https://openkoji.iscas.ac.cn/pub/dl/riscv/qemu/fw_payload-uboot-qemu-virt-smode.bin
</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 32:
</pre>
</pre>


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


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


=== Resize rootfs '''on Qemu''' ===
==== Resize rootfs '''on Qemu''' ====


<pre>
<pre>
Line 64: Line 67:
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 on QEMU ===
=== Run appliance tool to build a new image on QEMU ===
On QEMU, boot into Fedora Image, then
 
<pre>
<pre>
IMAGE_NAME=Fedora-d1-riscv64-developer-xfce-with-esp-Rawhide
IMAGE_NAME=Fedora-d1-riscv64-developer-xfce-with-esp-Rawhide
IMAGE_VERSION=Rawhide
IMAGE_VERSION=Rawhide
IMAGE_RELEASE=f33
IMAGE_RELEASE=`date +%Y%m%d-%H%M%S`
OUTPUT_DIR=./images
OUTPUT_DIR=./images
CACHE_DIR=./cache
CACHE_DIR=./cache
Line 80: Line 85:
                   -o ${OUTPUT_DIR}
                   -o ${OUTPUT_DIR}
</pre>
</pre>
The result will be in the current dir, named Fedora-d1-riscv64-developer-xfce-with-esp-Rawhide-*.raw.xz
== '''Alternative''': build Image by oepkgs.net ==
We also can build RISC-V images by [https://oepkgs.net/en oepkgs.net]
Please follow [https://oepkgs.net/en/rpm_services/user/register/ register work flow] to register an account in [https://oepkgs.net/en oepkgs.net].
==== Gitee.com ====
Repo to control tasks on [oepkgs.net](https://oepkgs.net) should be hosting on [Gitee.com](https://gitee.com) site. The repo URL should be sent to admin of  [oepkgs.net](https://oepkgs.net) on register.
[This file](https://gitee.com/ocean8192/prjtst/blob/master/d1_xfce_img.json) is an example of for image build task.
==== kickstart ====
We need proper kickstart files to control image build.
* [https://gitee.com/etux/fedora_on_riscv64_allwinner_d1_kickstart.git kickstarts repo for Allwinner D1 images]
Follow [https://oepkgs.net/en/rpm_services/user/jobs-management/gitee_webhook_config/ web hook setup workflow] to configure task trigger web hooks.
The instruction can be found on [https://koji.oepkgs.net oepkgs.net koji web].

Latest revision as of 14:17, 6 September 2021

Build Fedora Image for RISC-V development board

Making Image by Appliance-tools

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

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.

Run Fedora on QEMU

Download Pre-build image and Uncompress

$ wget https://openkoji.iscas.ac.cn/pub/dl/riscv/qemu/Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz
$ xz -d Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz

Download Firmware

$ wget https://openkoji.iscas.ac.cn/pub/dl/riscv/qemu/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 a new image on QEMU

On QEMU, boot into Fedora Image, then

IMAGE_NAME=Fedora-d1-riscv64-developer-xfce-with-esp-Rawhide
IMAGE_VERSION=Rawhide
IMAGE_RELEASE=`date +%Y%m%d-%H%M%S`
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}

The result will be in the current dir, named Fedora-d1-riscv64-developer-xfce-with-esp-Rawhide-*.raw.xz

Alternative: build Image by oepkgs.net

We also can build RISC-V images by oepkgs.net

Please follow register work flow to register an account in oepkgs.net.

Gitee.com

Repo to control tasks on [oepkgs.net](https://oepkgs.net) should be hosting on [Gitee.com](https://gitee.com) site. The repo URL should be sent to admin of [oepkgs.net](https://oepkgs.net) on register.

[This file](https://gitee.com/ocean8192/prjtst/blob/master/d1_xfce_img.json) is an example of for image build task.

kickstart

We need proper kickstart files to control image build.

Follow web hook setup workflow to configure task trigger web hooks.

The instruction can be found on oepkgs.net koji web.