stage3: Build xz before rpm, since rpm depends on xz.
[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 The aim of the project
9 ----------------------
10
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.
14
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/
20
21
22 How do we expect people to consume Fedora/RISC-V?
23 -------------------------------------------------
24
25 Most users will download binaries.  Of course source will be available
26 for everything, buildable from source RPMS.
27
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.
30
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.
34
35   - Maximum system RAM is 128 MB (1 GB is available if you use the
36     other far more expensive FPGA development kit)
37
38   - There is a 115200 bps 8n1 serial port.
39
40   - There is no ethernet and no display.
41
42   - Note that some parts of the FPGA toolchain are closed source.
43
44 For the QEMU emulation option, you will need Fedora 24 (x86_64).
45
46   - QEMU has unlimited system RAM.
47
48   - Single virtual CPU.
49
50   - We hope to get virtio-net and maybe virtio-scsi working.
51
52 For the Spike emulation option, you will need Fedora 24 (x86_64).
53
54   - Spike has unlimited system RAM.
55
56   - Spike can emulate multiple virtual CPUs.
57
58   - Spike's single thread performance is a bit slower than QEMU.
59
60   - No network.
61
62
63 What parts of Fedora are we aiming to build?
64 --------------------------------------------
65
66 The @Core packages (as RPMs), rpmbuild, gcc, and a bootable binary
67 disk image.
68
69 Only 64 bit RISC-V ("riscv64") will be targeted.
70
71 Once those are done, we can declare victory.
72
73
74 What parts of Fedora are we *not* aiming to build?
75 --------------------------------------------------
76
77 Nothing outside @Core except for specific compilers and build tools.
78
79 Not Anaconda.
80
81 Not Koji (at least, not at first).
82
83 Not Grub nor EDK2.  We will initially use the Berkeley bootloader
84 (bbl), but aim for a standard bootloader later.
85
86
87 Where will we build it?
88 -----------------------
89
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/).
92
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.
97
98 Getting build infrastructure would be a more long-term aim.
99
100
101 Bootstrapping stages
102 --------------------
103 [This plan was loosely based on:
104 https://fedoraproject.org/wiki/Architectures/AArch64/Bootstrap]
105
106
107 Bootstrapping, Stage 1
108 ----------------------
109
110 (1a) riscv-qemu.x86_64: QEMU + RISC-V system emulation
111
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
115
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.
118
119 (1b) riscv-isa-sim.x86_64: Spike system emulator
120
121 https://github.com/riscv/riscv-isa-sim
122 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
123
124 (1c) Nexys4 DDR FPGA
125
126 Various sources, see:
127 http://www.lowrisc.org/docs/untether-v0.2/fpga-demo/
128
129
130 Bootstrapping, Stage 2
131 ----------------------
132
133 (2a) GNU cross-compiler toolchain.
134
135 https://github.com/lowRISC/riscv-gnu-toolchain
136 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
137
138 (2b) Berkley Bootloader (bbl)
139
140 https://github.com/lowrisc/riscv-pk.git
141 Status: done http://copr-fe.cloud.fedoraproject.org/coprs/rjones/riscv
142
143 Used to boot the kernel and mount the root filesystem on FPGAs and
144 QEMU.
145
146
147 Bootstrapping, Stage 3
148 ----------------------
149
150 (3a) kernel.riscv64: The Linux kernel, cross-compiled.
151
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
155
156 (3b) "Just enough userspace"
157
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.
162
163 Status: done, see Makefile rules stage3-chroot/* and
164 http://oirase.annexia.org/riscv/
165
166
167 Bootstrapping, Stage 4
168 ----------------------
169
170 (4a) Userspace RPMs
171
172 We will build RPMs using "rpmbuild" on RISC-V itself (under emulation).
173
174 The usual command is:
175
176   rpmbuild --rebuild blah-xyz.src.rpm --define 'debug_package %{nil}'
177
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.
181
182 Some packages require non-upstream patches for RISC-V.  Hopefully
183 only: kernel, glibc, binutils and gcc.
184
185 Some packages require modifications to the spec file to reduce
186 extraneous dependencies (eg. for generating documentation).
187
188 noarch RPMs do not need to be rebuilt, they can be copied from Koji/x86.
189
190 Status: ongoing, see stage3-prebuilt-rpms/*
191
192 (4b) Recreate the filesystem from RPMs.
193
194 Distribute an initial bootable binary disk image which is completely
195 built from RPMs (but note: not created by Anaconda, we'll use
196 "rpm --root").
197
198 (4c) kernel.riscv64: The Linux kernel, compiled as an RPM on RISC-V.
199
200 (4d) Continue compiling all other RPMs from @Core.
201
202 As more packages are compiled, distribute them as RPMs and distribute
203 updated bootable binary disk image.
204
205 (4e) Declare victory and celebrate!
206
207
208 Open issues
209 -----------
210
211 (none at present)