Merge tag 'pull-request-2022-10-28' of https://gitlab.com/thuth/qemu into staging
[qemu/ar7.git] / docs / system / loongarch / loongson3.rst
blob1bdab44e2728a88d2bc2db37d7dc7310d2c5c3dc
1 :orphan:
3 ==========================================
4 loongson3 virt generic platform (``virt``)
5 ==========================================
7 The ``virt`` machine use gpex host bridge, and there are some
8 emulated devices on virt board, such as loongson7a RTC device,
9 IOAPIC device, ACPI device and so on.
11 Supported devices
12 -----------------
14 The ``virt`` machine supports:
15 - Gpex host bridge
16 - Ls7a RTC device
17 - Ls7a IOAPIC device
18 - ACPI GED device
19 - Fw_cfg device
20 - PCI/PCIe devices
21 - Memory device
22 - CPU device. Type: la464-loongarch-cpu.
24 CPU and machine Type
25 --------------------
27 The ``qemu-system-loongarch64`` provides emulation for virt
28 machine. You can specify the machine type ``virt`` and
29 cpu type ``la464-loongarch-cpu``.
31 Boot options
32 ------------
34 We can boot the LoongArch virt machine by specifying the uefi bios,
35 initrd, and linux kernel. And those source codes and binary files
36 can be accessed by following steps.
38 (1) booting command:
40 .. code-block:: bash
42   $ qemu-system-loongarch64 -machine virt -m 4G -cpu la464-loongarch-cpu \
43       -smp 1 -bios QEMU_EFI.fd -kernel vmlinuz.efi -initrd initrd.img \
44       -append "root=/dev/ram rdinit=/sbin/init consol e=ttyS0,115200" \
45       --nographic
47 Note: The running speed may be a little slow, as the performance of our
48 qemu and uefi bios is not perfect, and it is being fixed.
50 (2) cross compiler tools:
52 .. code-block:: bash
54   wget https://github.com/loongson/build-tools/releases/download/ \
55   2022.05.29/loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz
57   tar -vxf loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz
59 (3) qemu compile configure option:
61 .. code-block:: bash
63   ./configure --disable-rdma --disable-pvrdma --prefix=usr \
64               --target-list="loongarch64-softmmu" \
65               --disable-libiscsi --disable-libnfs --disable-libpmem \
66               --disable-glusterfs --enable-libusb --enable-usb-redir \
67               --disable-opengl --disable-xen --enable-spice \
68               --enable-debug --disable-capstone --disable-kvm \
69               --enable-profiler
70   make
72 (4) uefi bios source code and compile method:
74 .. code-block:: bash
76   git clone https://github.com/loongson/edk2-LoongarchVirt.git
78   cd edk2-LoongarchVirt
80   git submodule update --init
82   export PATH=$YOUR_COMPILER_PATH/bin:$PATH
84   export WORKSPACE=`pwd`
86   export PACKAGES_PATH=$WORKSPACE/edk2-LoongarchVirt
88   export GCC5_LOONGARCH64_PREFIX=loongarch64-unknown-linux-gnu-
90   edk2-LoongarchVirt/edksetup.sh
92   make -C edk2-LoongarchVirt/BaseTools
94   build --buildtarget=DEBUG --tagname=GCC5 --arch=LOONGARCH64  --platform=OvmfPkg/LoongArchQemu/Loongson.dsc
96   build --buildtarget=RELEASE --tagname=GCC5 --arch=LOONGARCH64  --platform=OvmfPkg/LoongArchQemu/Loongson.dsc
98 The efi binary file path:
100   Build/LoongArchQemu/DEBUG_GCC5/FV/QEMU_EFI.fd
102   Build/LoongArchQemu/RELEASE_GCC5/FV/QEMU_EFI.fd
104 (5) linux kernel source code and compile method:
106 .. code-block:: bash
108   git clone https://github.com/loongson/linux.git
110   export PATH=$YOUR_COMPILER_PATH/bin:$PATH
112   export LD_LIBRARY_PATH=$YOUR_COMPILER_PATH/lib:$LD_LIBRARY_PATH
114   export LD_LIBRARY_PATH=$YOUR_COMPILER_PATH/loongarch64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH
116   make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- loongson3_defconfig
118   make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu-
120   make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- install
122   make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- modules_install
124 Note: The branch of linux source code is loongarch-next.
126 (6) initrd file:
128   You can use busybox tool and the linux modules to make a initrd file. Or you can access the
129   binary files: https://github.com/yangxiaojuan-loongson/qemu-binary