aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSong Gao <gaosong@loongson.cn>2023-02-07 16:22:47 +0800
committerSong Gao <gaosong@loongson.cn>2023-03-03 09:37:30 +0800
commit5f4c96b779f9b556c3a0e925382a387c222df002 (patch)
treee9c0eefab5c962317f36bad773e4b39d9e90be2d
parent4934cc5850b66e3282b24e203c507330955601dd (diff)
downloadqemu-5f4c96b779f9b556c3a0e925382a387c222df002.zip
qemu-5f4c96b779f9b556c3a0e925382a387c222df002.tar.gz
qemu-5f4c96b779f9b556c3a0e925382a387c222df002.tar.bz2
docs/system/loongarch: update loongson3.rst and rename it to virt.rst
Since the EDK2 had already support LoongArch, update build bios, and update cpu type, cross-tools. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Song Gao <gaosong@loongson.cn> Message-Id: <20230227035905.1290953-1-gaosong@loongson.cn>
-rw-r--r--docs/system/loongarch/virt.rst (renamed from docs/system/loongarch/loongson3.rst)97
1 files changed, 38 insertions, 59 deletions
diff --git a/docs/system/loongarch/loongson3.rst b/docs/system/loongarch/virt.rst
index 489ea20..c37268b 100644
--- a/docs/system/loongarch/loongson3.rst
+++ b/docs/system/loongarch/virt.rst
@@ -19,14 +19,14 @@ The ``virt`` machine supports:
- Fw_cfg device
- PCI/PCIe devices
- Memory device
-- CPU device. Type: la464-loongarch-cpu.
+- CPU device. Type: la464.
CPU and machine Type
--------------------
The ``qemu-system-loongarch64`` provides emulation for virt
machine. You can specify the machine type ``virt`` and
-cpu type ``la464-loongarch-cpu``.
+cpu type ``la464``.
Boot options
------------
@@ -35,95 +35,74 @@ We can boot the LoongArch virt machine by specifying the uefi bios,
initrd, and linux kernel. And those source codes and binary files
can be accessed by following steps.
-(1) booting command:
+(1) Build qemu-system-loongarch64:
.. code-block:: bash
- $ qemu-system-loongarch64 -machine virt -m 4G -cpu la464-loongarch-cpu \
- -smp 1 -bios QEMU_EFI.fd -kernel vmlinuz.efi -initrd initrd.img \
- -append "root=/dev/ram rdinit=/sbin/init console=ttyS0,115200" \
- --nographic
-
-Note: The running speed may be a little slow, as the performance of our
-qemu and uefi bios is not perfect, and it is being fixed.
-
-(2) cross compiler tools:
-
-.. code-block:: bash
-
- wget https://github.com/loongson/build-tools/releases/download/ \
- 2022.05.29/loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz
-
- tar -vxf loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz
-
-(3) qemu compile configure option:
-
-.. code-block:: bash
-
- ./configure --disable-rdma --disable-pvrdma --prefix=usr \
+ ./configure --disable-rdma --disable-pvrdma --prefix=/usr \
--target-list="loongarch64-softmmu" \
--disable-libiscsi --disable-libnfs --disable-libpmem \
--disable-glusterfs --enable-libusb --enable-usb-redir \
--disable-opengl --disable-xen --enable-spice \
--enable-debug --disable-capstone --disable-kvm \
--enable-profiler
- make
+ make -j8
-(4) uefi bios source code and compile method:
+(2) Set cross tools:
.. code-block:: bash
- git clone https://github.com/loongson/edk2-LoongarchVirt.git
-
- cd edk2-LoongarchVirt
-
- git submodule update --init
-
- export PATH=$YOUR_COMPILER_PATH/bin:$PATH
-
- export WORKSPACE=`pwd`
+ wget https://github.com/loongson/build-tools/releases/download/2022.09.06/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz
- export PACKAGES_PATH=$WORKSPACE/edk2-LoongarchVirt
+ tar -vxf loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz -C /opt
- export GCC5_LOONGARCH64_PREFIX=loongarch64-unknown-linux-gnu-
+ export PATH=/opt/cross-tools/bin:$PATH
+ export LD_LIBRARY_PATH=/opt/cross-tools/lib:$LD_LIBRARY_PATH
+ export LD_LIBRARY_PATH=/opt/cross-tools/loongarch64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH
- edk2-LoongarchVirt/edksetup.sh
+Note: You need get the latest cross-tools at https://github.com/loongson/build-tools
- make -C edk2-LoongarchVirt/BaseTools
+(3) Build BIOS:
- build --buildtarget=DEBUG --tagname=GCC5 --arch=LOONGARCH64 --platform=OvmfPkg/LoongArchQemu/Loongson.dsc
+ See: https://github.com/tianocore/edk2-platforms/tree/master/Platform/Loongson/LoongArchQemuPkg#readme
- build --buildtarget=RELEASE --tagname=GCC5 --arch=LOONGARCH64 --platform=OvmfPkg/LoongArchQemu/Loongson.dsc
+Note: To build the release version of the bios, set --buildtarget=RELEASE,
+ the bios file path: Build/LoongArchQemu/RELEASE_GCC5/FV/QEMU_EFI.fd
-The efi binary file path:
-
- Build/LoongArchQemu/DEBUG_GCC5/FV/QEMU_EFI.fd
-
- Build/LoongArchQemu/RELEASE_GCC5/FV/QEMU_EFI.fd
-
-(5) linux kernel source code and compile method:
+(4) Build kernel:
.. code-block:: bash
git clone https://github.com/loongson/linux.git
- export PATH=$YOUR_COMPILER_PATH/bin:$PATH
-
- export LD_LIBRARY_PATH=$YOUR_COMPILER_PATH/lib:$LD_LIBRARY_PATH
+ cd linux
- export LD_LIBRARY_PATH=$YOUR_COMPILER_PATH/loongarch64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH
+ git checkout loongarch-next
make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- loongson3_defconfig
- make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu-
-
- make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- install
-
- make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- modules_install
+ make ARCH=loongarch CROSS_COMPILE=loongarch64-unknown-linux-gnu- -j32
Note: The branch of linux source code is loongarch-next.
+ the kernel file: arch/loongarch/boot/vmlinuz.efi
-(6) initrd file:
+(5) Get initrd:
You can use busybox tool and the linux modules to make a initrd file. Or you can access the
binary files: https://github.com/yangxiaojuan-loongson/qemu-binary
+
+.. code-block:: bash
+
+ git clone https://github.com/yangxiaojuan-loongson/qemu-binary
+
+Note: the initrd file is ramdisk
+
+(6) Booting LoongArch:
+
+.. code-block:: bash
+
+ $ ./build/qemu-system-loongarch64 -machine virt -m 4G -cpu la464 \
+ -smp 1 -bios QEMU_EFI.fd -kernel vmlinuz.efi -initrd ramdisk \
+ -serial stdio -monitor telnet:localhost:4495,server,nowait \
+ -append "root=/dev/ram rdinit=/sbin/init console=ttyS0,115200" \
+ --nographic