build for loongarch64 qemu target

Signed-off-by: Wu Xiaotian <wuxiaotian@loongson.cn>
This commit is contained in:
Wu Xiaotian 2024-06-29 13:58:55 +08:00 committed by Xiaotian Wu
parent 3298bea772
commit 207806e149
4 changed files with 15 additions and 0 deletions

View File

@ -29,6 +29,8 @@ if (target_cpu == "arm") {
kernel_image = "Image"
} else if (target_cpu == "x86_64") {
kernel_image = "bzImage"
} else if (target_cpu == "loongarch64") {
kernel_image = "vmlinuz.efi"
}
if (os_level == "mini" || os_level == "small") {

View File

@ -41,6 +41,9 @@ elif [ "$5" == "arm64" ];then
elif [ "$5" == "riscv64" ];then
cp ${2}/kernel/OBJ/${8}/arch/riscv/boot/Image ${3}/Image
elif [ "$5" == "loongarch64" ];then
cp ${2}/kernel/OBJ/${8}/vmlinuz.efi ${3}/vmlinuz.efi
elif [ "$5" == "x86_64" ];then
cp ${2}/kernel/OBJ/${8}/arch/x86/boot/bzImage ${3}/bzImage
fi

View File

@ -49,13 +49,19 @@ else ifeq ($(KERNEL_ARCH), riscv64)
else ifeq ($(KERNEL_ARCH), x86_64)
KERNEL_TARGET_TOOLCHAIN := gcc
KERNEL_TARGET_TOOLCHAIN_PREFIX :=
else ifeq ($(KERNEL_ARCH), loongarch64)
KERNEL_TARGET_TOOLCHAIN := $(PREBUILTS_GCC_DIR)/linux-x86/loongarch64/gcc-loongarch64-linux-gnu/bin
KERNEL_TARGET_TOOLCHAIN_PREFIX := $(KERNEL_TARGET_TOOLCHAIN)/loongarch64-unknown-linux-gnu-
KERNEL_ARCH := loongarch
endif
ifeq ($(DEVICE_NAME), hispark_phoenix)
KERNEL_CROSS_COMPILE += CONFIG_MSP="y"
endif
ifneq ($(KERNEL_ARCH), loongarch)
KERNEL_CROSS_COMPILE += CC="$(CLANG_CC)"
endif
ifneq ($(KERNEL_ARCH), x86_64)
KERNEL_CROSS_COMPILE += CROSS_COMPILE="$(KERNEL_TARGET_TOOLCHAIN_PREFIX)"

View File

@ -38,11 +38,15 @@ elif [ "$KERNEL_ARCH" == "arm64" ];then
kernel_image="Image"
elif [ "$KERNEL_ARCH" == "x86_64" ];then
kernel_image="bzImage"
elif [ "$KERNEL_ARCH" == "loongarch64" ];then
kernel_image="vmlinuz.efi"
fi
export KERNEL_IMAGE=${kernel_image}
if [ "$KERNEL_ARCH" == "riscv64" ];then
LINUX_KERNEL_IMAGE_FILE=${LINUX_KERNEL_OBJ_OUT}/arch/riscv/boot/Image
elif [ "$KERNEL_ARCH" == "loongarch64" ];then
LINUX_KERNEL_IMAGE_FILE=${LINUX_KERNEL_OBJ_OUT}/${kernel_image}
else
LINUX_KERNEL_IMAGE_FILE=${LINUX_KERNEL_OBJ_OUT}/arch/${KERNEL_ARCH}/boot/${kernel_image}
fi