mirror of
https://github.com/torvalds/linux.git
synced 2024-12-13 22:53:20 +00:00
95b8b5953a
1, Use EXPLICIT_RELOCS (ABIv2.0); 2, Use generic BUG() handler; 3, Refactor TLB/Cache operations; 4, Add qspinlock support; 5, Add perf events support; 6, Add kexec/kdump support; 7, Add BPF JIT support; 8, Add ACPI-based laptop driver; 9, Update the default config file. -----BEGIN PGP SIGNATURE----- iQJKBAABCAA0FiEEzOlt8mkP+tbeiYy5AoYrw/LiJnoFAmNGi5oWHGNoZW5odWFj YWlAa2VybmVsLm9yZwAKCRAChivD8uImepPHD/46x1ocan1UetPrPoyjBonsSSEL GclmC+fDS0WL76XlG45ncAaGv/8002RD7YaOYVAPC48f7EyexwLDre7xalGfpq65 48RMsC4tI64wn6AgFVXjNXvIYoGfuTWOonHFi9CHiZcwzPymaiv7F77YOTcA/PfL WEMeitvJuPtE8u6phUxT5NAyOgsTVnTPR+bG9UCS2RN4sqD40oJJAAykp5D5d0pG 32YjHA1kE+Cl1hLCWWlYUY6Cba96Pja03pRWS2i0h503V7RnvhuLz1aEG6HTs0ch A22W95dN2y7Rp+mtaI5LtBFq92qDrf51lb90zufCXWroe3LcDpGYBbH5chkMPDRY g1c7+dTZXZu4p70HZtd0if2Nkd8K+RaKWnsqoB7cPPFplH3Rr3Dz14t/yvrWlRV7 sYZDw60fQpLR88HhU+VuHF1uY7dqTr2YNCBuTR2lhpkFTP5dQrZ/PzanB3wrN+Bb UfGpRNSsTk0EwneVVyAGZRo55sIQq+MjqJZOcOrnsoscipPM6Z/xlxGncvB2z3Dg XiFH4+tOkGwpZpj+NMcNKOmrceNEwadhjo/yNaDpe6cf0SI1SQmj/mgGaX5DqVfk K+JGNzVmP4+OltzyjhTpzP7mLtm3tJcygNVxik+AnG/R+8Qw848r0ar5SJorcaQn 8naSRGsS5lzLk1KHQw== =l++s -----END PGP SIGNATURE----- Merge tag 'loongarch-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson Pull LoongArch updates from Huacai Chen: - Use EXPLICIT_RELOCS (ABIv2.0) - Use generic BUG() handler - Refactor TLB/Cache operations - Add qspinlock support - Add perf events support - Add kexec/kdump support - Add BPF JIT support - Add ACPI-based laptop driver - Update the default config file * tag 'loongarch-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: (25 commits) LoongArch: Update Loongson-3 default config file LoongArch: Add ACPI-based generic laptop driver LoongArch: Add BPF JIT support LoongArch: Add some instruction opcodes and formats LoongArch: Move {signed,unsigned}_imm_check() to inst.h LoongArch: Add kdump support LoongArch: Add kexec support LoongArch: Use generic BUG() handler LoongArch: Add SysRq-x (TLB Dump) support LoongArch: Add perf events support LoongArch: Add qspinlock support LoongArch: Use TLB for ioremap() LoongArch: Support access filter to /dev/mem interface LoongArch: Refactor cache probe and flush methods LoongArch: mm: Refactor TLB exception handlers LoongArch: Support R_LARCH_GOT_PC_{LO12,HI20} in modules LoongArch: Support PC-relative relocations in modules LoongArch: Define ELF relocation types added in ABIv2.0 LoongArch: Adjust symbol addressing for AS_HAS_EXPLICIT_RELOCS LoongArch: Add Kconfig option AS_HAS_EXPLICIT_RELOCS ...
131 lines
3.9 KiB
Makefile
131 lines
3.9 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Author: Huacai Chen <chenhuacai@loongson.cn>
|
|
# Copyright (C) 2020-2022 Loongson Technology Corporation Limited
|
|
|
|
boot := arch/loongarch/boot
|
|
|
|
KBUILD_DEFCONFIG := loongson3_defconfig
|
|
|
|
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.
|
|
#
|
|
64bit-tool-archpref = loongarch64
|
|
32bit-bfd = elf32-loongarch
|
|
64bit-bfd = elf64-loongarch
|
|
32bit-emul = elf32loongarch
|
|
64bit-emul = elf64loongarch
|
|
|
|
ifdef CONFIG_64BIT
|
|
tool-archpref = $(64bit-tool-archpref)
|
|
UTS_MACHINE := loongarch64
|
|
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
|
|
|
|
ifdef CONFIG_64BIT
|
|
ld-emul = $(64bit-emul)
|
|
cflags-y += -mabi=lp64s
|
|
endif
|
|
|
|
cflags-y += -G0 -pipe -msoft-float
|
|
LDFLAGS_vmlinux += -G0 -static -n -nostdlib
|
|
|
|
# When the assembler supports explicit relocation hint, we must use it.
|
|
# GCC may have -mexplicit-relocs off by default if it was built with an old
|
|
# assembler, so we force it via an option.
|
|
#
|
|
# When the assembler does not supports explicit relocation hint, we can't use
|
|
# it. Disable it if the compiler supports it.
|
|
#
|
|
# If you've seen "unknown reloc hint" message building the kernel and you are
|
|
# now wondering why "-mexplicit-relocs" is not wrapped with cc-option: the
|
|
# combination of a "new" assembler and "old" compiler is not supported. Either
|
|
# upgrade the compiler or downgrade the assembler.
|
|
ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
|
|
cflags-y += -mexplicit-relocs
|
|
KBUILD_CFLAGS_KERNEL += -mdirect-extern-access
|
|
else
|
|
cflags-y += $(call cc-option,-mno-explicit-relocs)
|
|
KBUILD_AFLAGS_KERNEL += -Wa,-mla-global-with-pcrel
|
|
KBUILD_CFLAGS_KERNEL += -Wa,-mla-global-with-pcrel
|
|
KBUILD_AFLAGS_MODULE += -Wa,-mla-global-with-abs
|
|
KBUILD_CFLAGS_MODULE += -fplt -Wa,-mla-global-with-abs,-mla-local-with-abs
|
|
endif
|
|
|
|
cflags-y += -ffreestanding
|
|
cflags-y += $(call cc-option, -mno-check-zero-division)
|
|
|
|
ifndef CONFIG_PHYSICAL_START
|
|
load-y = 0x9000000000200000
|
|
else
|
|
load-y = $(CONFIG_PHYSICAL_START)
|
|
endif
|
|
bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y)
|
|
|
|
drivers-$(CONFIG_PCI) += arch/loongarch/pci/
|
|
|
|
KBUILD_AFLAGS += $(cflags-y)
|
|
KBUILD_CFLAGS += $(cflags-y)
|
|
KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
|
|
|
|
# This is required to get dwarf unwinding tables into .debug_frame
|
|
# instead of .eh_frame so we don't discard them.
|
|
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
|
|
|
|
# Don't emit unaligned accesses.
|
|
# Not all LoongArch cores support unaligned access, and as kernel we can't
|
|
# rely on others to provide emulation for these accesses.
|
|
KBUILD_CFLAGS += $(call cc-option,-mstrict-align)
|
|
|
|
KBUILD_CFLAGS += -isystem $(shell $(CC) -print-file-name=include)
|
|
|
|
KBUILD_LDFLAGS += -m $(ld-emul)
|
|
|
|
ifdef CONFIG_LOONGARCH
|
|
CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
|
|
egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
|
|
sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
|
|
endif
|
|
|
|
libs-y += arch/loongarch/lib/
|
|
libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
prepare: vdso_prepare
|
|
vdso_prepare: prepare0
|
|
$(Q)$(MAKE) $(build)=arch/loongarch/vdso include/generated/vdso-offsets.h
|
|
endif
|
|
|
|
PHONY += vdso_install
|
|
vdso_install:
|
|
$(Q)$(MAKE) $(build)=arch/loongarch/vdso $@
|
|
|
|
all: $(notdir $(KBUILD_IMAGE))
|
|
|
|
vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
|
|
$(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@
|
|
|
|
install:
|
|
$(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/$(image-name-y)-$(KERNELRELEASE)
|
|
$(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
|
|
$(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
|
|
|
|
define archhelp
|
|
echo ' install - install kernel into $(INSTALL_PATH)'
|
|
echo
|
|
endef
|