arch/loongarch/Makefile

Source file repositories/reference/linux-study-clean/arch/loongarch/Makefile

File Facts

System
Linux kernel
Corpus path
arch/loongarch/Makefile
Extension
[no extension]
Size
7894 bytes
Lines
230
Domain
Architecture Layer
Bucket
arch/loongarch
Inferred role
Architecture Layer: build/configuration rule
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

# SPDX-License-Identifier: GPL-2.0
#
# Author: Huacai Chen <chenhuacai@loongson.cn>
# Copyright (C) 2020-2022 Loongson Technology Corporation Limited

boot	:= arch/loongarch/boot

ifeq ($(shell uname -m),loongarch32)
KBUILD_DEFCONFIG := loongson32_defconfig
else
KBUILD_DEFCONFIG := loongson64_defconfig
endif

KBUILD_DTBS      := dtbs

image-name-y			:= vmlinux
image-name-$(CONFIG_EFI_ZBOOT)	:= vmlinuz

ifndef CONFIG_EFI_STUB
KBUILD_IMAGE	:= $(boot)/vmlinux.elf
else
KBUILD_IMAGE	:= $(boot)/$(image-name-y).efi
endif

#
# Select the object file format to substitute into the linker script.
#
32bit-tool-archpref	= loongarch32
64bit-tool-archpref	= loongarch64
32bit-bfd		= elf32-loongarch
64bit-bfd		= elf64-loongarch
32bit-emul		= elf32loongarch
64bit-emul		= elf64loongarch

CC_FLAGS_FPU		:= -mfpu=64
CC_FLAGS_NO_FPU		:= -msoft-float

ifdef CONFIG_UNWINDER_ORC
orc_hash_h := arch/$(SRCARCH)/include/generated/asm/orc_hash.h
orc_hash_sh := $(srctree)/scripts/orc_hash.sh
targets += $(orc_hash_h)
quiet_cmd_orc_hash = GEN     $@
      cmd_orc_hash = mkdir -p $(dir $@); \
		     $(CONFIG_SHELL) $(orc_hash_sh) < $< > $@
$(orc_hash_h): $(srctree)/arch/loongarch/include/asm/orc_types.h $(orc_hash_sh) FORCE
	$(call if_changed,orc_hash)
archprepare: $(orc_hash_h)
endif

ifdef CONFIG_DYNAMIC_FTRACE
KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
CC_FLAGS_FTRACE := -fpatchable-function-entry=2
endif

ifdef CONFIG_32BIT
tool-archpref		= $(32bit-tool-archpref)
UTS_MACHINE		:= loongarch32
cflags-y		+= $(call cc-option,-m32)
else
tool-archpref		= $(64bit-tool-archpref)
UTS_MACHINE		:= loongarch64
cflags-y		+= $(call cc-option,-m64)
endif

ifneq ($(SUBARCH),$(ARCH))
  ifeq ($(CROSS_COMPILE),)
    CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux-  $(tool-archpref)-linux-gnu-  $(tool-archpref)-unknown-linux-gnu-)
  endif
endif

Annotation

Implementation Notes