Package the RISCV emulator (Spike).
[fedora-riscv.git] / README
1 A plan for Fedora/RISC-V
2 ----------------------------------------------------------------------
3 by Richard W.M. Jones (rjones@redhat.com)
4
5 Project home page: https://fedoraproject.org/wiki/Architectures/RISC-V
6
7
8 Current status
9 --------------
10
11 Stuck getting QEMU to work.  See:
12 https://groups.google.com/a/groups.riscv.org/forum/#!topic/sw-dev/fdbhLufxezA
13
14 Will likely wait until September when we may see a working QEMU that
15 is compatible with the latest RISC-V software.
16
17
18 The aim of the project
19 ----------------------
20
21 Get Fedora running on the RISC-V architecture!  This will just be an
22 initial pass, which we're calling an "experimental architecture".  It
23 won't even be a secondary architecture for perhaps 1 to 3 years.
24
25 About Fedora: https://getfedora.org/
26 About RISC-V: https://riscv.org/
27               https://en.wikipedia.org/wiki/RISC-V
28      lowRISC: http://www.lowrisc.org/
29
30
31 How do we expect people to consume Fedora/RISC-V?
32 -------------------------------------------------
33
34 Most users will download binaries.  Of course source will be available
35 for [almost*] everything, buildable from source RPMS.
36
37 Currently no hardware is available, so you either have to run RISC-V
38 on an FPGA, or use QEMU/Spike emulation.
39
40 For the FPGA option, you will need a Nexys 4 DDR development kit
41 costing around US$341, plus an ordinary micro SD card (8+ GB), plus a
42 host Fedora/x86-64 computer.
43
44   - Maximum system RAM is 128 MB (1 GB is available if you use the
45     other far more expensive FPGA development kit)
46
47   - There is a 115200 bps 8n1 serial port.
48
49   - There is no ethernet and no display.
50
51 For the QEMU emulation option, see below.
52
53   - QEMU has unlimited system RAM.
54
55   - Network access is available.
56
57 For the Spike emulation option, see below.
58
59   - Spike has unlimited system RAM.
60
61   - No network.
62
63
64 [*] Some CPU peripherals use proprietary IP.  The aim is to replace
65 these with open equivalents eventually.  Building the FPGA bitstream
66 will require proprietary tools, although the source itself is free
67 software.
68
69
70 What parts of Fedora are we aiming to build?
71 --------------------------------------------
72
73 The @Core packages (as RPMs), rpmbuild, gcc, and a bootable binary
74 disk image.
75
76 Only 64 bit RISC-V will be targeted.
77
78 Once those are done, we can declare victory.
79
80
81 What parts of Fedora are we *not* aiming to build?
82 --------------------------------------------------
83
84 Nothing outside @Core except for specific compilers and build tools.
85
86 Not Anaconda.
87
88 Not Koji (at least, not at first).
89
90 Not Grub nor EDK2.  We will initially use the Berkeley bootloader
91 (bbl), but aim for a standard bootloader later.
92
93
94 Where will we build it?
95 -----------------------
96
97 The packages which are run on the host (x86-64) computer will be built
98 in COPR (https://copr.fedorainfracloud.org/).
99
100 However the majority of packages will be built on RISC-V itself.
101 Since there are no RISC-V builders, and we cannot really provide them,
102 initially developers will be building them on their own FPGAs /
103 emulators and uploading them.
104
105 Getting build infrastructure would be a more long-term aim.
106
107
108 Bootstrapping stages
109 --------------------
110 [See also: https://fedoraproject.org/wiki/Architectures/AArch64/Bootstrap]
111
112 * Stage 1
113
114 (1a) riscv-qemu.x86_64: QEMU + RISC-V system emulation
115
116 Not upstream, fork of qemu 2.5.0.
117 https://github.com/riscv/riscv-qemu
118 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
119
120 Note this package runs on x86-64 hosts, and is intended for people who
121 want to run Fedora/RISC-V but who do not have FPGA/hardware.
122
123 (1b) riscv-isa-sim.x86_64: Spike system emulator
124
125 Since QEMU is broken at the moment, we must use the slower Spike
126 emulator instead.
127
128 (1c) Nexys4 DDR FPGA
129
130 Various sources, see:
131 http://www.lowrisc.org/docs/untether-v0.2/fpga-demo/
132
133 * Stage 2
134
135 (2a) GNU cross-compiler toolchain.
136
137 https://github.com/lowRISC/riscv-gnu-toolchain
138 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
139
140 (2b) Berkley Bootloader (bbl)
141
142 https://github.com/lowrisc/riscv-pk.git
143 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
144
145 Used to boot the kernel and mount the root filesystem on FPGAs and
146 QEMU.
147
148 * Stage 3
149
150 (3a) kernel.riscv64: The Linux kernel, cross-compiled.
151
152 Current status: Not upstream, fork of Linux 4.6.
153 https://github.com/lowrisc/riscv-linux
154
155 (3b) "Just enough userspace"
156
157 The following packages, cross-compiled from x86-64 host to riscv64
158 target filesystem.  The aim is to have a filesystem (not RPMs) that
159 can be booted on RISC-V hardware or under QEMU, which will be
160 sufficient to use to compile RPMs.
161
162 bash.riscv64
163 glibc.riscv64
164 binutils.riscv64
165 gcc.riscv64
166 cpp.riscv64
167 rpm.riscv64
168 coreutils.riscv64
169 filesystem.riscv64 (?)
170 gawk.riscv64
171 grep.riscv64
172 gzip.riscv64
173 sed.riscv64
174 xz.riscv64
175 zlib.riscv64
176
177 We will also need to add the following noarch packages (these do not
178 need to be compiled, they can just be copied from another Fedora
179 system):
180
181 basesystem.noarch
182 ca-certificates.noarch
183 crypto-policies.noarch
184 emacs-filesystem.noarch
185 fedora-release.noarch
186 fedora-repos.noarch
187 setup.noarch
188 tzdata.noarch
189
190     ==== At this point, Fedora on RISC-V will be self-hosting ====
191
192 * Stage 4
193
194 (4a) kernel.riscv64: The Linux kernel, compiled as an RPM on RISC-V.
195
196 (4b) Userspace RPMs
197
198 (See the above list of packages, but built from SRPMs)
199
200 (4c) Recreate the filesystem from RPMs.
201
202 Distribute an initial bootable binary disk image which is completely
203 built from RPMs (but note, not created by Anaconda).
204
205 (4d) Continue compiling all other RPMs from @Core.
206
207 As more packages are compiled, distribute them as RPMs and distribute
208 updated bootable binary disk image.
209
210 (4e) Declare victory and celebrate!
211
212
213 Open issues
214 -----------
215
216 What architecture string to use (eg. in RPM package names)?  There are
217 32, 64 and (in theory) 128 bit variants of RISC-V.  GNU uses "riscv64".