--- /dev/null
+A plan for Fedora/RISC-V
+----------------------------------------------------------------------
+by Richard W.M. Jones (rjones@redhat.com)
+
+Project home page: https://fedoraproject.org/wiki/Architectures/RISC-V
+
+
+The aim of the project
+----------------------
+
+Get Fedora running on the RISC-V architecture! This will just be an
+initial pass, which we're calling an "experimental architecture". It
+won't even be a secondary architecture for perhaps 1 to 3 years.
+
+About Fedora: https://getfedora.org/
+About RISC-V: https://riscv.org/
+ https://en.wikipedia.org/wiki/RISC-V
+ lowRISC: http://www.lowrisc.org/
+
+
+How do we expect people to consume Fedora/RISC-V?
+-------------------------------------------------
+
+Most users will download binaries. Of course source will be available
+for [almost*] everything, buildable from source RPMS.
+
+Currently no hardware is available, so you either have to run RISC-V
+on an FPGA, or use QEMU emulation.
+
+For the FPGA option, you will need a Nexys 4 DDR development kit
+costing around US$341, plus an ordinary micro SD card (8+ GB), plus a
+host Fedora/x86-64 computer.
+
+ - Maximum system RAM is 128 MB (1 GB is available if you use the
+ other far more expensive FPGA development kit)
+
+ - There is a 115200 bps 8n1 serial port.
+
+ - There is no ethernet and no display.
+
+For the QEMU emulation option, see below.
+
+ - QEMU has unlimited system RAM.
+
+ - Network access is available.
+
+
+[*] Some CPU peripherals use proprietary IP. The aim is to replace
+these with open equivalents eventually. Building the FPGA bitstream
+will require proprietary tools, although the source itself is free
+software.
+
+
+What parts of Fedora are we aiming to build?
+--------------------------------------------
+
+The @Core packages (as RPMs), rpmbuild, gcc, and a bootable binary
+disk image.
+
+Only 64 bit RISC-V will be targeted.
+
+Once those are done, we can declare victory.
+
+
+What parts of Fedora are we *not* aiming to build?
+--------------------------------------------------
+
+Nothing outside @Core except for specific compilers and build tools.
+
+Not Anaconda.
+
+Not Koji (at least, not at first).
+
+Not Grub nor EDK2. We will initially use the Berkeley bootloader
+(bbl), but aim for a standard bootloader later.
+
+
+Where will we build it?
+-----------------------
+
+The packages which are run on the host (x86-64) computer will be built
+in COPR (https://copr.fedorainfracloud.org/).
+
+However the majority of packages will be built on RISC-V itself.
+Since there are no RISC-V builders, and we cannot really provide them,
+initially developers will be building them on their own FPGAs / QEMUs
+and uploading them.
+
+Getting build infrastructure would be a more long-term aim.
+
+
+Bootstrapping stages
+--------------------
+[See also: https://fedoraproject.org/wiki/Architectures/AArch64/Bootstrap]
+
+* Stage 1
+
+(1a) riscv-qemu.x86_64: QEMU + RISC-V system emulation
+
+Current status: Not upstream, fork of qemu 2.5.0.
+https://github.com/riscv/riscv-qemu
+
+Note this package runs on x86-64 hosts, and is intended for people who
+want to run Fedora/RISC-V but who do not have FPGA/hardware.
+
+(1b) Nexys4 DDR FPGA
+
+Various sources, see:
+http://www.lowrisc.org/docs/untether-v0.2/fpga-demo/
+
+(1c) Berkley Bootloader (bbl)
+
+Used to boot the kernel and mount the root filesystem on FPGAs and
+QEMU. See link above.
+
+* Stage 2
+
+(2a) GNU cross-compiler toolchain.
+
+https://github.com/lowRISC/riscv-gnu-toolchain
+
+* Stage 3
+
+(3a) kernel.riscv64: The Linux kernel, cross-compiled.
+
+Current status: Not upstream, fork of Linux 4.6.
+https://github.com/lowrisc/riscv-linux
+
+(3b) "Just enough userspace"
+
+The following packages, cross-compiled from x86-64 host to riscv64
+target filesystem. The aim is to have a filesystem (not RPMs) that
+can be booted on RISC-V hardware or under QEMU, which will be
+sufficient to use to compile RPMs.
+
+bash.riscv64
+glibc.riscv64
+binutils.riscv64
+gcc.riscv64
+cpp.riscv64
+rpm.riscv64
+coreutils.riscv64
+filesystem.riscv64 (?)
+gawk.riscv64
+grep.riscv64
+gzip.riscv64
+sed.riscv64
+xz.riscv64
+zlib.riscv64
+
+We will also need to add the following noarch packages (these do not
+need to be compiled, they can just be copied from another Fedora
+system):
+
+basesystem.noarch
+ca-certificates.noarch
+crypto-policies.noarch
+emacs-filesystem.noarch
+fedora-release.noarch
+fedora-repos.noarch
+setup.noarch
+tzdata.noarch
+
+ ==== At this point, Fedora on RISC-V will be self-hosting ====
+
+* Stage 4
+
+(4a) kernel.riscv64: The Linux kernel, compiled as an RPM on RISC-V.
+
+(4b) Userspace RPMs
+
+(See the above list of packages, but built from SRPMs)
+
+(4c) Recreate the filesystem from RPMs.
+
+Distribute an initial bootable binary disk image which is completely
+built from RPMs (but note, not created by Anaconda).
+
+(4d) Continue compiling all other RPMs from @Core.
+
+As more packages are compiled, distribute them as RPMs and distribute
+updated bootable binary disk image.
+
+(4e) Declare victory and celebrate!
+
+
+Open issues
+-----------
+
+What architecture string to use (eg. in RPM package names)? There are
+32, 64 and (in theory) 128 bit variants of RISC-V. GNU uses "riscv64".
--- /dev/null
+%global debug_package %{nil}
+
+%global commit 94f5eb73091fb4fe272db3e943f173ecc0f78ffd
+%global shortcommit 94f5eb73
+
+Name: riscv-qemu
+Version: 2.5.0
+Release: 0.git%{shortcommit}.1%{?dist}
+Summary: RISC-V fork of QEMU
+License: GPLv2+ and LGPLv2+ and BSD
+
+URL: https://github.com/riscv/riscv-qemu
+Source0: https://github.com/riscv/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
+
+# These were just copied from qemu.spec, they are probably not
+# all required.
+BuildRequires: texi2html
+BuildRequires: texinfo
+BuildRequires: perl-podlators
+BuildRequires: qemu-sanity-check-nodeps
+BuildRequires: kernel
+BuildRequires: iasl
+BuildRequires: chrpath
+BuildRequires: SDL2-devel
+BuildRequires: zlib-devel
+BuildRequires: gnutls-devel
+BuildRequires: cyrus-sasl-devel
+BuildRequires: libaio-devel
+BuildRequires: pulseaudio-libs-devel
+BuildRequires: alsa-lib-devel
+BuildRequires: libiscsi-devel
+BuildRequires: libnfs-devel
+BuildRequires: snappy-devel
+BuildRequires: lzo-devel
+BuildRequires: ncurses-devel
+BuildRequires: libattr-devel
+BuildRequires: libcap-devel
+BuildRequires: libcap-ng-devel
+BuildRequires: usbredir-devel >= 0.5.2
+BuildRequires: gperftools-devel
+BuildRequires: spice-protocol >= 0.12.2
+BuildRequires: spice-server-devel >= 0.12.0
+BuildRequires: libseccomp-devel >= 2.3.0
+BuildRequires: libcurl-devel
+BuildRequires: ceph-devel >= 0.61
+BuildRequires: systemtap
+BuildRequires: systemtap-sdt-devel
+BuildRequires: libjpeg-devel
+BuildRequires: libpng-devel
+BuildRequires: libuuid-devel
+BuildRequires: bluez-libs-devel
+BuildRequires: brlapi-devel
+BuildRequires: libfdt-devel
+BuildRequires: pixman-devel
+BuildRequires: glusterfs-devel >= 3.4.0
+BuildRequires: glusterfs-api-devel >= 3.4.0
+BuildRequires: libusbx-devel
+BuildRequires: libssh2-devel
+BuildRequires: gtk3-devel
+BuildRequires: vte3-devel
+BuildRequires: gettext
+BuildRequires: librdmacm-devel
+BuildRequires: xen-devel
+BuildRequires: numactl-devel
+BuildRequires: bzip2-devel
+BuildRequires: libepoxy-devel
+BuildRequires: libtasn1-devel
+BuildRequires: libcacard-devel >= 2.5.0
+BuildRequires: virglrenderer-devel
+BuildRequires: mesa-libgbm-devel
+BuildRequires: glibc-static pcre-static glib2-static zlib-static
+
+# We don't bother packaging ancillary files; use the ones provided by
+# the real QEMU.
+Requires: qemu-system-x86
+
+%description
+This is the RISC-V fork of QEMU.
+
+
+%prep
+%setup -q -n %{name}-%{commit}
+
+
+%build
+./configure --prefix=%{_prefix} --target-list=riscv-softmmu --disable-werror
+make
+
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT
+
+# Remove ancillary files.
+rm $RPM_BUILD_ROOT%{_bindir}/ivshmem*
+rm $RPM_BUILD_ROOT%{_bindir}/qemu-{ga,img,io,nbd}
+rm $RPM_BUILD_ROOT%{_bindir}/virtfs-proxy-helper
+rm -r $RPM_BUILD_ROOT%{_libexecdir}
+rm -r $RPM_BUILD_ROOT%{_datadir}
+
+
+%files
+%doc README COPYING
+%{_bindir}/qemu-system-riscv
+
+
+%changelog