9

Boot an Arch Linux RISC-V using qemu-system

 1 year ago
source link: https://blog.jiejiss.com/Boot-an-Arch-Linux-RISC-V-using-qemu-system/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

CAUTION#

We (distro packagers) decided to modify GCC spec to get rid of just way too many atomic symbol missing error. AFAIK debian does the same thing in the same way.

So, you may notice that some program compiles without -latomic flag, but that's not the case if you switch to some other distros. I wrote another blog post explaining this in detail.

In short: For GCC you should add -latomic if you use std::atomic<T> where sizeof(T) is lower than 4. Also apply to those __atomic_compare_exchange_2() stuff. Clang is not affected.

Method#

This approach requires you to be on an non-RISC-V Arch Linux (x86_64 or aarch64, etc.) machine, because we use pacstrap and pacman.

# pacman -Syu then reboot is recommended before this
sudo pacman -S arch-install-scripts git qemu-img qemu-system-riscv riscv64-linux-gnu-gcc
git clone https://github.com/CoelacanthusHex/archriscv-scriptlet.git
cd archriscv-scriptlet
./mkrootfs
./mkimg
./startqemu.sh

If, in the last step, you find yourself stucked at [ OK ] Reached target Graphical Interface for over 5 minutes, just press Ctrl-C and re-run startqemu.sh.

After booting the machine, you may need to install necessary packages:

sudo pacman -S git vim gcc

Detailed Explanation#

TBD after my final examination ends (!)

来源:https://blog.jiejiss.com/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK