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.
14 The ``virt`` machine supports:
22 - CPU device. Type: la464-loongarch-cpu.
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``.
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.
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" \
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:
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:
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 \
72 (4) uefi bios source code and compile method:
76 git clone https://github.com/loongson/edk2-LoongarchVirt.git
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:
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.
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