xref: /openbmc/qemu/target/loongarch/README (revision 1f90ce64)
164baad62SSong Gao- Introduction
264baad62SSong Gao
364baad62SSong Gao  LoongArch is the general processor architecture of Loongson.
464baad62SSong Gao
564baad62SSong Gao  The following versions of the LoongArch core are supported
664baad62SSong Gao    core: 3A5000
764baad62SSong Gao    https://github.com/loongson/LoongArch-Documentation/releases/download/2021.08.17/LoongArch-Vol1-v1.00-EN.pdf
864baad62SSong Gao
964baad62SSong Gao  We can get the latest loongarch documents at https://github.com/loongson/LoongArch-Documentation/tags.
1064baad62SSong Gao
11d88b51dcSXiaojuan Yang
12d88b51dcSXiaojuan Yang- System emulation
13d88b51dcSXiaojuan Yang
14*1f90ce64SXiaojuan Yang  You can reference docs/system/loongarch/loongson3.rst to get the information about system emulation of LoongArch.
15d88b51dcSXiaojuan Yang
16227e73c9SSong Gao- Linux-user emulation
17227e73c9SSong Gao
18227e73c9SSong Gao  We already support Linux user emulation. We can use LoongArch cross-tools to build LoongArch executables on X86 machines,
19227e73c9SSong Gao  and We can also use qemu-loongarch64 to run LoongArch executables.
20227e73c9SSong Gao
21227e73c9SSong Gao  1. Config cross-tools env.
22227e73c9SSong Gao
23227e73c9SSong Gao     see System emulation.
24227e73c9SSong Gao
25227e73c9SSong Gao  2. Test tests/tcg/multiarch.
26227e73c9SSong Gao
27227e73c9SSong Gao     ./configure  --static  --prefix=/usr  --disable-werror --target-list="loongarch64-linux-user" --enable-debug
28227e73c9SSong Gao
29227e73c9SSong Gao     cd build
30227e73c9SSong Gao
31227e73c9SSong Gao     make && make check-tcg
32227e73c9SSong Gao
33227e73c9SSong Gao  3. Run LoongArch system basic command with loongarch-clfs-system.
34227e73c9SSong Gao
35227e73c9SSong Gao     - Config clfs env.
36227e73c9SSong Gao
37227e73c9SSong Gao       wget https://github.com/loongson/build-tools/releases/download/2022.05.29/loongarch64-clfs-system-5.0.tar.bz2
38227e73c9SSong Gao
39227e73c9SSong Gao       tar -vxf loongarch64-clfs-system-5.0.tar.bz2 -C /opt/clfs
40227e73c9SSong Gao
41227e73c9SSong Gao       cp /opt/clfs/lib64/ld-linux-loongarch-lp64d.so.1  /lib64
42227e73c9SSong Gao
43227e73c9SSong Gao       export LD_LIBRARY_PATH="/opt/clfs/lib64"
44227e73c9SSong Gao
45227e73c9SSong Gao     - Run LoongArch system basic command.
46227e73c9SSong Gao
47227e73c9SSong Gao       ./qemu-loongarch64  /opt/clfs/usr/bin/bash
48227e73c9SSong Gao       ./qemu-loongarch64  /opt/clfs/usr/bin/ls
49227e73c9SSong Gao       ./qemu-loongarch64  /opt/clfs/usr/bin/pwd
50227e73c9SSong Gao
51d88b51dcSXiaojuan Yang- Note.
52d88b51dcSXiaojuan Yang  We can get the latest LoongArch documents or LoongArch tools at https://github.com/loongson/
53