fc00daafb8c1078a16236c08f9e01110d4895f88
[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 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
58 [*] Some CPU peripherals use proprietary IP.  The aim is to replace
59 these with open equivalents eventually.  Building the FPGA bitstream
60 will require proprietary tools, although the source itself is free
61 software.
62
63
64 What parts of Fedora are we aiming to build?
65 --------------------------------------------
66
67 The @Core packages (as RPMs), rpmbuild, gcc, and a bootable binary
68 disk image.
69
70 Only 64 bit RISC-V will be targeted.
71
72 Once those are done, we can declare victory.
73
74
75 What parts of Fedora are we *not* aiming to build?
76 --------------------------------------------------
77
78 Nothing outside @Core except for specific compilers and build tools.
79
80 Not Anaconda.
81
82 Not Koji (at least, not at first).
83
84 Not Grub nor EDK2.  We will initially use the Berkeley bootloader
85 (bbl), but aim for a standard bootloader later.
86
87
88 Where will we build it?
89 -----------------------
90
91 The packages which are run on the host (x86-64) computer will be built
92 in COPR (https://copr.fedorainfracloud.org/).
93
94 However the majority of packages will be built on RISC-V itself.
95 Since there are no RISC-V builders, and we cannot really provide them,
96 initially developers will be building them on their own FPGAs / QEMUs
97 and uploading them.
98
99 Getting build infrastructure would be a more long-term aim.
100
101
102 Bootstrapping stages
103 --------------------
104 [See also: https://fedoraproject.org/wiki/Architectures/AArch64/Bootstrap]
105
106 * Stage 1
107
108 (1a) riscv-qemu.x86_64: QEMU + RISC-V system emulation
109
110 Not upstream, fork of qemu 2.5.0.
111 https://github.com/riscv/riscv-qemu
112 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
113
114 Note this package runs on x86-64 hosts, and is intended for people who
115 want to run Fedora/RISC-V but who do not have FPGA/hardware.
116
117 (1b) Nexys4 DDR FPGA
118
119 Various sources, see:
120 http://www.lowrisc.org/docs/untether-v0.2/fpga-demo/
121
122 * Stage 2
123
124 (2a) GNU cross-compiler toolchain.
125
126 https://github.com/lowRISC/riscv-gnu-toolchain
127 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
128
129 (2b) Berkley Bootloader (bbl)
130
131 https://github.com/lowrisc/riscv-pk.git
132 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
133
134 Used to boot the kernel and mount the root filesystem on FPGAs and
135 QEMU.
136
137 * Stage 3
138
139 (3a) kernel.riscv64: The Linux kernel, cross-compiled.
140
141 Current status: Not upstream, fork of Linux 4.6.
142 https://github.com/lowrisc/riscv-linux
143
144 (3b) "Just enough userspace"
145
146 The following packages, cross-compiled from x86-64 host to riscv64
147 target filesystem.  The aim is to have a filesystem (not RPMs) that
148 can be booted on RISC-V hardware or under QEMU, which will be
149 sufficient to use to compile RPMs.
150
151 bash.riscv64
152 glibc.riscv64
153 binutils.riscv64
154 gcc.riscv64
155 cpp.riscv64
156 rpm.riscv64
157 coreutils.riscv64
158 filesystem.riscv64 (?)
159 gawk.riscv64
160 grep.riscv64
161 gzip.riscv64
162 sed.riscv64
163 xz.riscv64
164 zlib.riscv64
165
166 We will also need to add the following noarch packages (these do not
167 need to be compiled, they can just be copied from another Fedora
168 system):
169
170 basesystem.noarch
171 ca-certificates.noarch
172 crypto-policies.noarch
173 emacs-filesystem.noarch
174 fedora-release.noarch
175 fedora-repos.noarch
176 setup.noarch
177 tzdata.noarch
178
179     ==== At this point, Fedora on RISC-V will be self-hosting ====
180
181 * Stage 4
182
183 (4a) kernel.riscv64: The Linux kernel, compiled as an RPM on RISC-V.
184
185 (4b) Userspace RPMs
186
187 (See the above list of packages, but built from SRPMs)
188
189 (4c) Recreate the filesystem from RPMs.
190
191 Distribute an initial bootable binary disk image which is completely
192 built from RPMs (but note, not created by Anaconda).
193
194 (4d) Continue compiling all other RPMs from @Core.
195
196 As more packages are compiled, distribute them as RPMs and distribute
197 updated bootable binary disk image.
198
199 (4e) Declare victory and celebrate!
200
201
202 Open issues
203 -----------
204
205 What architecture string to use (eg. in RPM package names)?  There are
206 32, 64 and (in theory) 128 bit variants of RISC-V.  GNU uses "riscv64".