Last active
January 22, 2019 22:18
-
-
Save ingenieroariel/68fbdc0bd28bcd843a26558869234963 to your computer and use it in GitHub Desktop.
nix on riscv development vm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download riscv bbl | |
curl -O https://fedorapeople.org/groups/risc-v/disk-images/bbl | |
# download linux image | |
curl -O https://fedorapeople.org/groups/risc-v/disk-images/stage4-disk.img.xz | |
# uncompress linux image | |
unxz stage4-disk.img.xz | |
# run fedora inside riscv64 emulator | |
qemu-system-riscv64 \ | |
-nographic \ | |
-machine virt \ | |
-smp 4 \ | |
-m 2G \ | |
-kernel bbl \ | |
-object rng-random,filename=/dev/urandom,id=rng0 \ | |
-device virtio-rng-device,rng=rng0 \ | |
-append "console=ttyS0 ro root=/dev/vda" \ | |
-device virtio-blk-device,drive=hd0 \ | |
-drive file=stage4-disk.img,format=raw,id=hd0 \ | |
-device virtio-net-device,netdev=usernet \ | |
-netdev user,id=usernet,hostfwd=tcp::10000-:22 | |
# user root, password riscv | |
# as root, install nix dependencies | |
dnf install git autoconf automake libtool bison boost-devel flex openssl-devel bzip2-devel sqlite-devel curl-devel libedit-devel readline-devel lzma-devel xz-devel brotli-devel | |
# editline is not available for riscv but it is a required dependency, we build from source. | |
git clone https://github.com/laserpants/editline | |
cd editline | |
./autogen.sh | |
./configure | |
make | |
make install | |
git clone https://github.com/nixos/nix | |
cd nix | |
./bootstrap.sh | |
# editline puts library in /usr/local/lib and we have to tell nix to look for pkgconfig file in the right location. | |
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig | |
# seccomp is not available for riscv yet, so we disable sandboxing | |
# doc generation is disabled too due to attempts to load stuff via the network | |
./configure --disable-seccomp-sandboxing --disable-doc-gen | |
make |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Final output should look like:
[root@stage4 nix]# make
CXX src/build-remote/build-remote.o
CXX src/nix-build/nix-build.o
CXX src/nix-channel/nix-channel.o
CXX src/nix-collect-garbage/nix-collect-garbage.o
CXX src/nix-copy-closure/nix-copy-closure.o
CXX src/nix-daemon/nix-daemon.o
CXX src/nix-env/nix-env.o
CXX src/nix-env/user-env.o
CXX src/nix-instantiate/nix-instantiate.o
CXX src/nix-prefetch-url/nix-prefetch-url.o
CXX src/nix-store/dotgraph.o
CXX src/nix-store/graphml.o
CXX src/nix-store/nix-store.o
CXX src/nix/add-to-store.o
CXX src/nix/build.o
CXX src/nix/cat.o
CXX src/nix/command.o