mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 12:32:15 +02:00
base: add support for loongarch64
(From OE-Core rev: 759baaceb4dd623d5da12ba0d01540fa080154ba) Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
69b8b7ef1b
commit
324b03e15f
@@ -39,6 +39,8 @@ def siteinfo_data_for_machine(arch, os, d):
|
||||
"i686": "endian-little bit-32 ix86-common",
|
||||
"ia64": "endian-little bit-64",
|
||||
"lm32": "endian-big bit-32",
|
||||
"loongarch32": "endian-little bit-32 loongarch",
|
||||
"loongarch64": "endian-little bit-64 loongarch",
|
||||
"m68k": "endian-big bit-32",
|
||||
"microblaze": "endian-big bit-32 microblaze-common",
|
||||
"microblazeel": "endian-little bit-32 microblaze-common",
|
||||
@@ -97,6 +99,8 @@ def siteinfo_data_for_machine(arch, os, d):
|
||||
"arm-linux-musleabi": "arm-linux",
|
||||
"armeb-linux-gnueabi": "armeb-linux",
|
||||
"armeb-linux-musleabi": "armeb-linux",
|
||||
"loongarch32-linux": "loongarch32-linux",
|
||||
"loongarch64-linux": "loongarch64-linux",
|
||||
"microblazeel-linux" : "microblaze-linux",
|
||||
"microblazeel-linux-musl" : "microblaze-linux",
|
||||
"mips-linux-musl": "mips-linux",
|
||||
|
||||
2
meta/conf/machine-sdk/loongarch64.conf
Normal file
2
meta/conf/machine-sdk/loongarch64.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
SDK_ARCH = "loongarch64"
|
||||
ABIEXTENSION:class-nativesdk = ""
|
||||
7
meta/conf/machine/include/loongarch/arch-loongarch.inc
Normal file
7
meta/conf/machine/include/loongarch/arch-loongarch.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
# LoongArch Architecture definition
|
||||
|
||||
DEFAULTTUNE ?= "loongarch64"
|
||||
|
||||
TUNE_ARCH = "${TUNE_ARCH:tune-${DEFAULTTUNE}}"
|
||||
TUNE_PKGARCH = "${TUNE_PKGARCH:tune-${DEFAULTTUNE}}"
|
||||
TUNE_CCARGS:append = "${@bb.utils.contains('TUNE_FEATURES', 'loongarch64', ' -march=la464 -mabi=lp64d', ' ', d)}"
|
||||
35
meta/conf/machine/include/loongarch/qemuloongarch.inc
Normal file
35
meta/conf/machine/include/loongarch/qemuloongarch.inc
Normal file
@@ -0,0 +1,35 @@
|
||||
PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
|
||||
|
||||
require conf/machine/include/qemu.inc
|
||||
require conf/machine/include/loongarch/tune-loongarch.inc
|
||||
|
||||
MACHINE_FEATURES = "screen keyboard ext2 ext3 serial"
|
||||
|
||||
KERNEL_IMAGETYPE = "vmlinuz"
|
||||
KERNEL_IMAGETYPES += "vmlinuz"
|
||||
KEEPUIMAGE = "no"
|
||||
|
||||
SERIAL_CONSOLES ?= "115200;ttyS0 115200;hvc0"
|
||||
|
||||
IMAGE_FSTYPES += "ext4 wic.qcow2"
|
||||
|
||||
WKS_FILE ?= "qemuloongarch.wks"
|
||||
|
||||
MACHINE_EXTRA_RRECOMMENDS += " kernel-modules"
|
||||
|
||||
#EXTRA_IMAGEDEPENDS += "opensbi"
|
||||
|
||||
UBOOT_ENTRYPOINT_loongarch32 = "0x80400000"
|
||||
UBOOT_ENTRYPOINT_loongarch64 = "0x80200000"
|
||||
|
||||
# qemuboot options
|
||||
QB_KERNEL_CMDLINE_APPEND = "earlycon=sbi"
|
||||
QB_MACHINE = "-machine virt"
|
||||
QB_DEFAULT_BIOS = "fw_jump.elf"
|
||||
QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
|
||||
QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@"
|
||||
QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0"
|
||||
QB_SERIAL_OPT = "-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
|
||||
QB_TCPSERIAL_OPT = " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
|
||||
# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
|
||||
QB_OPT_APPEND = " -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0"
|
||||
13
meta/conf/machine/include/loongarch/tune-loongarch.inc
Normal file
13
meta/conf/machine/include/loongarch/tune-loongarch.inc
Normal file
@@ -0,0 +1,13 @@
|
||||
require conf/machine/include/loongarch/arch-loongarch.inc
|
||||
|
||||
TUNEVALID[loongarch64] = "Enable 64-bit LoongArch optimizations"
|
||||
|
||||
TUNEVALID[littleendian] = "Little endian mode"
|
||||
|
||||
AVAILTUNES += "loongarch64"
|
||||
|
||||
# Default
|
||||
TUNE_FEATURES:tune-loongarch64 = "loongarch64"
|
||||
TUNE_ARCH:tune-loongarch64 = "loongarch64"
|
||||
TUNE_PKGARCH:tune-loongarch64 = "loongarch64"
|
||||
PACKAGE_EXTRA_ARCHS:tune-loongarch64 = "loongarch64"
|
||||
11
meta/conf/machine/qemuloongarch64.conf
Normal file
11
meta/conf/machine/qemuloongarch64.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
#@TYPE: Machine
|
||||
#@NAME: generic loongarch64 machine
|
||||
#@DESCRIPTION: Machine configuration for running a generic loongarch64
|
||||
|
||||
require conf/machine/include/loongarch/qemuloongarch.inc
|
||||
|
||||
XVISOR_PLAT = "loongarch/virt64"
|
||||
|
||||
EXTRA_IMAGEDEPENDS += "u-boot"
|
||||
UBOOT_MACHINE = "qemu-loongarch64_smode_defconfig"
|
||||
UBOOT_ELF = "u-boot"
|
||||
@@ -21,6 +21,7 @@ def machine_dict(d):
|
||||
"x86_64": (62, 0, 0, True, 64),
|
||||
"epiphany": (4643, 0, 0, True, 32),
|
||||
"lm32": (138, 0, 0, False, 32),
|
||||
"loongarch64":(258, 0, 0, True, 64),
|
||||
"mips": ( 8, 0, 0, False, 32),
|
||||
"mipsel": ( 8, 0, 0, True, 32),
|
||||
"microblaze": (189, 0, 0, False, 32),
|
||||
@@ -45,6 +46,7 @@ def machine_dict(d):
|
||||
"ia64": (50, 0, 0, True, 64),
|
||||
"alpha": (36902, 0, 0, True, 64),
|
||||
"hppa": (15, 3, 0, False, 32),
|
||||
"loongarch64":(258, 0, 0, True, 64),
|
||||
"m68k": ( 4, 0, 0, False, 32),
|
||||
"mips": ( 8, 0, 0, False, 32),
|
||||
"mipsel": ( 8, 0, 0, True, 32),
|
||||
|
||||
@@ -66,6 +66,8 @@ def generate_native_link_template(d):
|
||||
loader = 'ld-linux-aarch64.so.1'
|
||||
elif 'ppc64le' in build_arch:
|
||||
loader = 'ld64.so.2'
|
||||
elif 'loongarch64' in build_arch:
|
||||
loader = 'ld-linux-loongarch-lp64d.so.1'
|
||||
|
||||
if loader:
|
||||
val += ['-Wl,--dynamic-linker=@{OECORE_NATIVE_SYSROOT}${base_libdir_native}/' + loader]
|
||||
|
||||
@@ -86,7 +86,7 @@ do_install_ptest() {
|
||||
}
|
||||
|
||||
# QEMU_TARGETS is overridable variable
|
||||
QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
|
||||
QEMU_TARGETS ?= "arm aarch64 i386 loongarch64 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
|
||||
|
||||
EXTRA_OECONF = " \
|
||||
--prefix=${prefix} \
|
||||
|
||||
11
meta/site/loongarch64-linux
Normal file
11
meta/site/loongarch64-linux
Normal file
@@ -0,0 +1,11 @@
|
||||
# general
|
||||
ac_cv_alignof_guint32=4
|
||||
ac_cv_alignof_guint64=8
|
||||
ac_cv_alignof_unsigned_long=8
|
||||
|
||||
# glib-2.0
|
||||
glib_cv_stack_grows=${glib_cv_stack_grows=no}
|
||||
glib_cv_uscore=${glib_cv_uscore=no}
|
||||
|
||||
# startup-notification
|
||||
lf_cv_sane_realloc=${lf_cv_sane_realloc=yes}
|
||||
3
scripts/lib/wic/canned-wks/qemuloongarch.wks
Normal file
3
scripts/lib/wic/canned-wks/qemuloongarch.wks
Normal file
@@ -0,0 +1,3 @@
|
||||
# short-description: Create qcow2 image for LoongArch QEMU machines
|
||||
|
||||
part / --source rootfs --fstype=ext4 --label root --align 4096 --size 5G
|
||||
@@ -1313,7 +1313,7 @@ class BaseConfig(object):
|
||||
"""attempt to determine the appropriate qemu-system binary"""
|
||||
mach = self.get('MACHINE')
|
||||
if not mach:
|
||||
search = '.*(qemux86-64|qemux86|qemuarm64|qemuarm|qemumips64|qemumips64el|qemumipsel|qemumips|qemuppc).*'
|
||||
search = '.*(qemux86-64|qemux86|qemuarm64|qemuarm|qemuloongarch64|qemumips64|qemumips64el|qemumipsel|qemumips|qemuppc).*'
|
||||
if self.rootfs:
|
||||
match = re.match(search, self.rootfs)
|
||||
if match:
|
||||
@@ -1336,6 +1336,8 @@ class BaseConfig(object):
|
||||
qbsys = 'x86_64'
|
||||
elif mach == 'qemuppc':
|
||||
qbsys = 'ppc'
|
||||
elif mach == 'qemuloongarch64':
|
||||
qbsys = 'loongarch64'
|
||||
elif mach == 'qemumips':
|
||||
qbsys = 'mips'
|
||||
elif mach == 'qemumips64':
|
||||
|
||||
Reference in New Issue
Block a user