I am using the [riscv-gnu-toolchain](https://github.com/riscv/riscv-gnu-toolchain), configured with `--with-arch=rv32im --disable-linux --disable-gdb --disable-multilib` and built using `make -j <number of threads>`.
To generate such an image, run `python3 package.py out/kernel <user bin 1> <usr bin 2> ... output/path/memory.img`. You can edit the script to change various variables. They atre somewhat well documented.