From Fedora Project Wiki
(Created page with "= Build Fedora Image for RISC-V development board = == Environment == We use [http://fedora.riscv.rocks/kojifiles/work/tasks/8517/1128517/Fedora-Developer-Rawhide-20210421.n...")
 
No edit summary
Line 10: Line 10:


* Download image and Uncompress
* Download image and Uncompress
 
<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
$ xz -d Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz
$ xz -d Fedora-Developer-Rawhide-20210421.n.0-sda.raw.xz
</pre>


* Download Firmware
* Download Firmware


<pre>
$ wget  
$ wget  
</pre>


* Resize images
* Resize images
Line 23: Line 25:
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.


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


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


<pre>
qemu-system-riscv64    -nographic \
qemu-system-riscv64    -nographic \
                       -machine virt \
                       -machine virt \
Line 39: Line 44:
                       -device virtio-net-device,netdev=usernet \
                       -device virtio-net-device,netdev=usernet \
                       -netdev user,id=usernet,hostfwd=tcp::10000-:22
                       -netdev user,id=usernet,hostfwd=tcp::10000-:22
</pre>


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


<pre>
# growpart /dev/vda 2
# growpart /dev/vda 2
# resize2fs /dev/vda2
# resize2fs /dev/vda2
</pre>


* Prepare kick start file
* Prepare kick start file
Line 50: Line 59:


* Run appliance tool to build new image
* Run appliance tool to build new image
 
<pre>
# appliance-creator -c kickstartfile.ks --cache /cache/dir --format raw --name image-name --version image-version --release image-release -o /output/dir
# appliance-creator -c kickstartfile.ks \
                    --cache /cache/dir \
                    --format raw --name image-name \
                    --version image-version \
                    --release image-release \
                    -o /output/dir
</pre>

Revision as of 09:43, 5 September 2021

Build Fedora Image for RISC-V development board

Environment

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

Appliance

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

  • Download 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 
  • Resize images

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 root file system on Qemu
# growpart /dev/vda 2
# resize2fs /dev/vda2
  • Prepare kick start file

Kick start files from [riscv.rocks](https://riscv.rocks) is [here](http://fedora.riscv.rocks:3000/davidlt/fedora-riscv-kickstarts.git). Your own kick start file can be modified from these files.

  • Run appliance tool to build new image
# appliance-creator -c kickstartfile.ks \
                    --cache /cache/dir \
                    --format raw --name image-name \
                    --version image-version \
                    --release image-release \
                    -o /output/dir