This page contains information about Debian and RISC-V that has been removed from the main RISC-V page due to being only of historic interest.

Historic package repositories

While today all packages are hosted in the Debian-Ports infrastructure, this hadn't been the case during the early bootstrapping phase. At that time, the port has used the following package repositories which may be of historic interest.

Historic cross-bootstrap repository, based on upstream gcc/glibc/kernel

A number of Debian packages that have been cross-built for riscv64 with a cross-toolchain based on upstream gcc/glibc/kernel are available in an apt repository. This repository is work-in-progress, incomplete and packages in it may well be broken - use at your own risk! It targets Debian developers working on riscv64 support and cross-bootstrappability issues in Debian and is neither suitable nor intended for use by end-users.

For more detailed information, please read the README.riscv64-bootstrap in the repository.

Historic repository, based on pre-upstream glibc/gcc/kernel

IMPORTANT NOTE: Due to ABI breaks during the kernel and glibc upstreaming process, the packages in this repository are ABI-incompatible with modern toolchains and modern kernels.

Unofficial repository (WIP, incomplete and probably not working for you at the moment): http://riscv.mit.edu/

See https://people.debian.org/~mafm/posts/2017/20170422_debian-gnulinux-port-for-risc-v-64-bit-riscv64/ for more details.

To use it, in /etc/apt/sources.list:

  deb [ arch=riscv64 signed-by=/usr/share/keyrings/debian-keyring.gpg ] http://riscv.mit.edu/debian unstable main
  deb-src [ signed-by=/usr/share/keyrings/debian-keyring.gpg ] http://riscv.mit.edu/debian unstable main

The repository is signed with the key from Manuel as Debian Developer, contained in the file /usr/share/keyrings/debian-keyring.gpg, which is part of the package debian-keyring (available from Debian and derivatives).

Creating a riscv64 chroot

multistrap

To build a bare-bones riscv64 chroot on a Debian/unstable system of a different architecture with multistrap, you can perform the following steps, but you have to be extremely careful while doing that - various parts need to run with root permissions and if you e.g forget to export the CHROOT_PATH variable, you can end up with overwriting parts of your host system!

export CHROOT_PATH=/tmp/riscv64-chroot

sudo apt-get install multistrap debian-ports-archive-keyring qemu-user-static

cat >/tmp/multistrap-riscv64.conf <<EOF
[General]
arch=riscv64
aptsources=Unstable Unreleased Sid-main
bootstrap=Unstable Unreleased Sid-main base-packages

[Sid-main]
source=http://deb.debian.org/debian
suite=unstable
omitdebsrc=true
keyring=debian-archive-keyring

[Unstable]
source=http://deb.debian.org/debian-ports
suite=unstable
omitdebsrc=true
keyring=debian-ports-archive-keyring

[Unreleased]
source=http://deb.debian.org/debian-ports
suite=unreleased
omitdebsrc=true

[base-packages]
packages=adduser apt base-files base-passwd bash bsdutils coreutils dash debconf debian-archive-keyring debian-ports-archive-keyring debianutils diffutils dpkg e2fsprogs fdisk findutils gcc-8-base gpgv grep gzip hostname init-system-helpers libacl1 libapt-pkg5.0 libattr1 libaudit-common libaudit1 libblkid1 libbz2-1.0 libc-bin libc6 libcap-ng0 libcom-err2 libdb5.3 libdebconfclient0 libext2fs2 libfdisk1 libffi7 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libhogweed4 libidn2-0 liblz4-1 liblzma5 libmount1 libncursesw5 libnettle6 libp11-kit0 libpam-modules libpam-modules-bin libpam-runtime libpam0g libpcre3 libselinux1 libsemanage-common libsemanage1 libsepol1 libsmartcols1 libss2 libstdc++6 libsystemd0 libtasn1-6 libtinfo5 libudev1 libunistring2 libuuid1 login mawk mount ncurses-base ncurses-bin passwd perl-base sed sysvinit-utils tar tzdata util-linux zlib1g openssl1.1 nvi wget busybox net-tools ifupdown sysvinit-core iputils-ping isc-dhcp-client locales ntp lynx whiptail dialog ca-certificates
suite=unstable
EOF

sudo multistrap -d ${CHROOT_PATH} -f /tmp/multistrap-riscv64.conf

sudo sh -c "cat >${CHROOT_PATH}/etc/fstab <<EOF
proc    /proc   proc    defaults        0       0
sysfs   /sys    sysfs   defaults,nofail 0       0
devpts  /dev/pts        devpts  defaults,nofail 0       0
EOF
"

sudo sh -c "cat >${CHROOT_PATH}/etc/network/interfaces <<EOF
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp
EOF
"

sudo mknod -m 666 "${CHROOT_PATH}/dev/null" c 1 3
sudo mknod -m 666 "${CHROOT_PATH}/dev/zero" c 1 5
sudo mknod -m 666 "${CHROOT_PATH}/dev/random" c 1 8
sudo mknod -m 666 "${CHROOT_PATH}/dev/urandom" c 1 9
sudo mknod -m 666 "${CHROOT_PATH}/dev/tty" c 5 0
sudo mknod -m 666 "${CHROOT_PATH}/dev/ptmx" c 5 2
sudo mknod -m 666 "${CHROOT_PATH}/dev/full" c 1 7
sudo mknod -m 600 "${CHROOT_PATH}/dev/console" c 5 1
sudo mknod -m 660 "${CHROOT_PATH}/dev/ttyS0" c 4 64
sudo mkdir -p "${CHROOT_PATH}/dev/pts/"
sudo mkdir -p "${CHROOT_PATH}/dev/shm/"
sudo mknod -m 666 "${CHROOT_PATH}/dev/ptmx" c 5 2
sudo ln -s /proc/self/fd   "${CHROOT_PATH}/dev/fd"
sudo ln -s /proc/self/fd/0 "${CHROOT_PATH}/dev/stdin"
sudo ln -s /proc/self/fd/1 "${CHROOT_PATH}/dev/stdout"
sudo ln -s /proc/self/fd/2 "${CHROOT_PATH}/dev/stderr"

This provides a (still unconfigured) riscv64 chroot in /tmp/riscv64-chroot - with sysvinit instead of systemd as there are still a few packages missing that are required for properly running systemd on riscv64 at the time of writing. Performing these steps on a Debian/stable system requires installing the debian-ports-archive-keyring package from unstable beforehand.

As the next step, copy /usr/bin/qemu-riscv64-static (cf. the qemu section) to ${CHROOT_PATH}/usr/bin. If you use Debian's qemu-user-static package from unstable, this step can be omitted.

To complete the chroot setup, it is necessary to execute the postinst scripts for all packages inside the chroot with the help of qemu-riscv64-static and to perform a bit of local configuration:

sudo chroot ${CHROOT_PATH}
export TERM=vt102
dpkg --configure -a
echo "S0:23:respawn:/sbin/getty -L ttyS0 115200 vt102" >> /etc/inittab
echo "riscv64" > /etc/hostname
passwd
exit

If the dash package's postinst asks whether you want dash to be the default system sh, answer with "no", otherwise the postinst fails in this setup.