[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/5] docs/system/loongarch: update loongson3.rst and rename it to
From: |
Song Gao |
Subject: |
[PULL 3/5] docs/system/loongarch: update loongson3.rst and rename it to virt.rst |
Date: |
Fri, 3 Mar 2023 10:41:01 +0800 |
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>
---
.../loongarch/{loongson3.rst => virt.rst} | 97 ++++++++-----------
1 file changed, 38 insertions(+), 59 deletions(-)
rename docs/system/loongarch/{loongson3.rst => virt.rst} (51%)
diff --git a/docs/system/loongarch/loongson3.rst
b/docs/system/loongarch/virt.rst
similarity index 51%
rename from docs/system/loongarch/loongson3.rst
rename to docs/system/loongarch/virt.rst
index 489ea20f8f..c37268b404 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
--
2.31.1
- [PULL 0/5] loongarch-to-apply queue, Song Gao, 2023/03/02
- [PULL 5/5] hw/loongarch/virt: add system_powerdown hmp command support, Song Gao, 2023/03/02
- [PULL 1/5] hw/loongarch/virt: rename PCH_PIC_IRQ_OFFSET with VIRT_GSI_BASE, Song Gao, 2023/03/02
- [PULL 4/5] target/loongarch: Implement Chip Configuraiton Version Register(0x0000), Song Gao, 2023/03/02
- [PULL 3/5] docs/system/loongarch: update loongson3.rst and rename it to virt.rst,
Song Gao <=
- [PULL 2/5] loongarch: Add smbios command line option., Song Gao, 2023/03/02
- Re: [PULL 0/5] loongarch-to-apply queue, Peter Maydell, 2023/03/04