1 A plan for Fedora/RISC-V
2 ----------------------------------------------------------------------
3 by Richard W.M. Jones (rjones@redhat.com)
5 Project home page: https://fedoraproject.org/wiki/Architectures/RISC-V
11 Get Fedora running on the RISC-V architecture! This will just be an
12 initial pass, which we're calling an "experimental architecture". It
13 won't even be a secondary architecture for perhaps 1 to 3 years.
15 About Fedora: https://getfedora.org/
16 About RISC-V: https://riscv.org/
17 https://en.wikipedia.org/wiki/RISC-V
18 lowRISC: http://www.lowrisc.org/
19 SiFive: https://www.sifive.com/
22 How do we expect people to consume Fedora/RISC-V?
23 -------------------------------------------------
25 Most users will download binaries. Of course source will be available
26 for everything, buildable from source RPMS.
28 Currently no hardware is available, so you either have to run RISC-V
29 on an FPGA, or use emulation, either QEMU or Spike.
31 For the FPGA option, you will need a Nexys 4 DDR development kit
32 costing around US$341, plus an ordinary micro SD card (8+ GB), plus a
33 host Fedora/x86-64 computer.
35 - Maximum system RAM is 128 MB (1 GB is available if you use the
36 other far more expensive FPGA development kit)
38 - There is a 115200 bps 8n1 serial port.
40 - There is no ethernet and no display.
42 - Note that some parts of the FPGA toolchain are closed source.
44 For the QEMU emulation option, you will need Fedora 24 (x86_64).
46 - QEMU has unlimited system RAM.
50 - We hope to get virtio-net and maybe virtio-scsi working.
52 For the Spike emulation option, you will need Fedora 24 (x86_64).
54 - Spike has unlimited system RAM.
56 - Spike can emulate multiple virtual CPUs.
58 - Spike's single thread performance is a bit slower than QEMU.
63 What parts of Fedora are we aiming to build?
64 --------------------------------------------
66 The @Core packages (as RPMs), rpmbuild, gcc, and a bootable binary
69 Only 64 bit RISC-V ("riscv64") will be targeted.
71 Once those are done, we can declare victory.
74 What parts of Fedora are we *not* aiming to build?
75 --------------------------------------------------
77 Nothing outside @Core except for specific compilers and build tools.
81 Not Koji (at least, not at first).
83 Not Grub nor EDK2. We will initially use the Berkeley bootloader
84 (bbl), but aim for a standard bootloader later.
87 Where will we build it?
88 -----------------------
90 The packages which are run on the host (x86-64) computer are built in
91 COPR (http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv/).
93 However the majority of packages will be built on RISC-V itself.
94 Since there are no RISC-V builders, and we cannot provide any,
95 initially developers will be building them on their own FPGAs /
96 emulators and uploading them to somewhere central.
98 Getting build infrastructure would be a more long-term aim.
103 [This plan was loosely based on:
104 https://fedoraproject.org/wiki/Architectures/AArch64/Bootstrap]
107 Bootstrapping, Stage 1
108 ----------------------
110 (1a) riscv-qemu.x86_64: QEMU + RISC-V system emulation
112 Not upstream, fork of qemu 2.5.0.
113 https://github.com/riscv/riscv-qemu
114 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
116 Note this package runs on x86-64 hosts, and is intended for people who
117 want to run Fedora/RISC-V but who do not have FPGA/hardware.
119 (1b) riscv-isa-sim.x86_64: Spike system emulator
121 https://github.com/riscv/riscv-isa-sim
122 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
126 Various sources, see:
127 http://www.lowrisc.org/docs/untether-v0.2/fpga-demo/
130 Bootstrapping, Stage 2
131 ----------------------
133 (2a) GNU cross-compiler toolchain.
135 https://github.com/lowRISC/riscv-gnu-toolchain
136 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
138 (2b) Berkley Bootloader (bbl)
140 https://github.com/lowrisc/riscv-pk.git
141 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
143 Used to boot the kernel and mount the root filesystem on FPGAs and
147 Bootstrapping, Stage 3
148 ----------------------
150 (3a) kernel.riscv64: The Linux kernel, cross-compiled.
152 https://github.com/lowrisc/riscv-linux
153 Not upstream fork of Linux 4.1.
154 Status: done, see Makefile rule stage3-kernel/linux-*/vmlinux
156 (3b) "Just enough userspace"
158 We cross-compile packages from x86-64 host to riscv64 target
159 filesystem. The aim is to have a filesystem (not RPMs) that can be
160 booted on RISC-V hardware or under emulation, which will be sufficient
161 to use to compile RPMs.
163 Status: done, see Makefile rules stage3-chroot/* and
164 http://oirase.annexia.org/riscv/
167 Bootstrapping, Stage 4
168 ----------------------
172 We will build RPMs using "rpmbuild" on RISC-V itself (under emulation).
174 The usual command is:
176 rpmbuild --rebuild blah-xyz.src.rpm --define 'debug_package %{nil}'
178 We will build enough RPMs so that stage 4 can run rpmbuild, gcc.
179 Essentially it's the same list of packages as for (3b) above, so look
180 in the Makefile for "stage3-chroot/..." rules, plus any dependencies.
182 Some packages require non-upstream patches for RISC-V. Hopefully
183 only: kernel, glibc, binutils and gcc.
185 Some packages require modifications to the spec file to reduce
186 extraneous dependencies (eg. for generating documentation).
188 noarch RPMs do not need to be rebuilt, they can be copied from Koji/x86.
190 Status: ongoing, see stage3-prebuilt-rpms/*
192 (4b) Recreate the filesystem from RPMs.
194 Distribute an initial bootable binary disk image which is completely
195 built from RPMs (but note: not created by Anaconda, we'll use
198 (4c) kernel.riscv64: The Linux kernel, compiled as an RPM on RISC-V.
200 (4d) Continue compiling all other RPMs from @Core.
202 As more packages are compiled, distribute them as RPMs and distribute
203 updated bootable binary disk image.
205 (4e) Declare victory and celebrate!