I try to compile Busybox but it occurs some issues, here are my steps.
Step 1. Get the RISC-V toolchain
$ vim nix.shell
let
pkgs = import <nixpkgs> {
crossSystem = (import <nixpkgs/lib>).systems.examples.riscv64;
};
shell = { mkShell, gdb, qemu, dtc }: mkShell {
nativeBuildInputs = [ gdb qemu dtc ];
};
in
pkgs.callPackage shell { }
$ nix-shell shell.nix
Step 2. Get Busybox source code
$ git clone https://git.busybox.net/busybox
Step 3. Try to compile Busybox source code
$ mv busybox busybox_build
$ cd busybox_build
$ CROSS_COMPILE=riscv64-unknown-linux-gnu- make defconfig
$ CROSS_COMPILE=riscv64-unknown-linux-gnu- make -j $(nproc)
But it occurs the following messages
CC libbb/xfuncs_printf.o
CC libbb/xgetcwd.o
CC libbb/xgethostbyname.o
CC libbb/xreadlink.o
CC libbb/xrealloc_vector.o
CC libbb/xregcomp.o
AR libbb/lib.a
LINK busybox_unstripped
Trying libraries: crypt m resolv rt
Library crypt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Library rt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
So I think I need to install the libraries
- crypt
- m
- resolv
- rt
And I try to search for them in NixOS Packages but it seems they don’t exist. Does anyone know more information? Thank you.