>> 1 # >> 2 # m68k/Makefile >> 3 # 1 # This file is included by the global makefile 4 # This file is included by the global makefile so that you can add your own 2 # architecture-specific flags and dependencies !! 5 # architecture-specific flags and dependencies. Remember to do have actions >> 6 # for "archclean" and "archdep" for cleaning up and making dependencies for >> 7 # this architecture 3 # 8 # 4 # This file is subject to the terms and condit 9 # This file is subject to the terms and conditions of the GNU General Public 5 # License. See the file "COPYING" in the main 10 # License. See the file "COPYING" in the main directory of this archive 6 # for more details. 11 # for more details. 7 # 12 # >> 13 # Copyright (C) 1994 by Hamish Macdonald >> 14 # 8 15 9 LDFLAGS_vmlinux := -z norelro !! 16 # test for cross compiling 10 ifeq ($(CONFIG_RELOCATABLE),y) !! 17 COMPILE_ARCH = $(shell uname -m) 11 LDFLAGS_vmlinux += -shared -Bsymbolic !! 18 12 KBUILD_CFLAGS += -fPIE !! 19 # override top level makefile 13 endif !! 20 AS += -m68020 14 ifeq ($(CONFIG_DYNAMIC_FTRACE),y) !! 21 LD += -m m68kelf 15 LDFLAGS_vmlinux += --no-relax !! 22 ifneq ($(COMPILE_ARCH),$(ARCH)) 16 KBUILD_CPPFLAGS += -DCC_USING_PATCHABL !! 23 # prefix for cross-compiling binaries 17 ifeq ($(CONFIG_RISCV_ISA_C),y) !! 24 CROSS_COMPILE = m68k-linux- 18 CC_FLAGS_FTRACE := -fpatchable-functio << 19 else << 20 CC_FLAGS_FTRACE := -fpatchable-functio << 21 endif 25 endif >> 26 >> 27 ifndef CONFIG_SUN3 >> 28 LINKFLAGS = -T $(TOPDIR)/arch/m68k/vmlinux.lds >> 29 else >> 30 LINKFLAGS = -T $(TOPDIR)/arch/m68k/vmlinux-sun3.lds -N 22 endif 31 endif 23 32 24 ifeq ($(CONFIG_CMODEL_MEDLOW),y) !! 33 # without -fno-strength-reduce the 53c7xx.c driver fails ;-( 25 KBUILD_CFLAGS_MODULE += -mcmodel=medany !! 34 CFLAGS += -pipe -fno-strength-reduce -ffixed-a2 >> 35 >> 36 # enable processor switch if compiled only for a single cpu >> 37 ifndef CONFIG_M68020 >> 38 ifndef CONFIG_M68030 >> 39 >> 40 ifndef CONFIG_M68060 >> 41 CFLAGS := $(CFLAGS) -m68040 26 endif 42 endif 27 43 28 export BITS !! 44 ifndef CONFIG_M68040 29 ifeq ($(CONFIG_ARCH_RV64I),y) !! 45 CFLAGS := $(CFLAGS) -m68060 30 BITS := 64 !! 46 endif 31 UTS_MACHINE := riscv64 << 32 47 33 KBUILD_CFLAGS += -mabi=lp64 !! 48 endif 34 KBUILD_AFLAGS += -mabi=lp64 !! 49 endif 35 50 36 KBUILD_LDFLAGS += -melf64lriscv !! 51 ifdef CONFIG_KGDB >> 52 # If configured for kgdb support, include debugging infos and keep the >> 53 # frame pointer >> 54 CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g >> 55 endif 37 56 38 KBUILD_RUSTFLAGS += -Ctarget-cpu=gener !! 57 ifndef CONFIG_SUN3 39 -Cno-redzone !! 58 HEAD := arch/m68k/kernel/head.o 40 else 59 else 41 BITS := 32 !! 60 HEAD := arch/m68k/kernel/sun3-head.o 42 UTS_MACHINE := riscv32 !! 61 endif >> 62 >> 63 SUBDIRS += arch/m68k/kernel arch/m68k/mm arch/m68k/lib >> 64 CORE_FILES := arch/m68k/kernel/kernel.o arch/m68k/mm/mm.o $(CORE_FILES) >> 65 LIBS += arch/m68k/lib/lib.a >> 66 >> 67 ifdef CONFIG_Q40 >> 68 CORE_FILES := $(CORE_FILES) arch/m68k/q40/q40.o >> 69 SUBDIRS := $(SUBDIRS) arch/m68k/q40 >> 70 endif 43 71 44 KBUILD_CFLAGS += -mabi=ilp32 !! 72 ifdef CONFIG_AMIGA 45 KBUILD_AFLAGS += -mabi=ilp32 !! 73 CORE_FILES := $(CORE_FILES) arch/m68k/amiga/amiga.o 46 KBUILD_LDFLAGS += -melf32lriscv !! 74 SUBDIRS := $(SUBDIRS) arch/m68k/amiga 47 endif 75 endif 48 76 49 ifndef CONFIG_RISCV_USE_LINKER_RELAXATION !! 77 ifdef CONFIG_ATARI 50 KBUILD_CFLAGS += -mno-relax !! 78 CORE_FILES := $(CORE_FILES) arch/m68k/atari/atari.o 51 KBUILD_AFLAGS += -mno-relax !! 79 SUBDIRS := $(SUBDIRS) arch/m68k/atari 52 ifndef CONFIG_AS_IS_LLVM << 53 KBUILD_CFLAGS += -Wa,-mno-relax << 54 KBUILD_AFLAGS += -Wa,-mno-relax << 55 endif 80 endif 56 # LLVM has an issue with target-features and L !! 81 57 # Ensure it is aware of linker relaxation with !! 82 ifdef CONFIG_MAC 58 # be incorrect: https://github.com/llvm/llvm-p !! 83 CORE_FILES := $(CORE_FILES) arch/m68k/mac/mac.o 59 else ifeq ($(CONFIG_LTO_CLANG),y) !! 84 SUBDIRS := $(SUBDIRS) arch/m68k/mac 60 KBUILD_LDFLAGS += -mllvm -mattr=+c -ml << 61 endif 85 endif 62 86 63 ifeq ($(CONFIG_SHADOW_CALL_STACK),y) !! 87 ifdef CONFIG_HP300 64 KBUILD_LDFLAGS += --no-relax-gp !! 88 CORE_FILES := $(CORE_FILES) arch/m68k/hp300/hp300.o >> 89 SUBDIRS := $(SUBDIRS) arch/m68k/hp300 65 endif 90 endif 66 91 67 # ISA string setting !! 92 ifdef CONFIG_APOLLO 68 riscv-march-$(CONFIG_ARCH_RV32I) := rv3 !! 93 CORE_FILES := $(CORE_FILES) arch/m68k/apollo/apollo.o 69 riscv-march-$(CONFIG_ARCH_RV64I) := rv6 !! 94 SUBDIRS := $(SUBDIRS) arch/m68k/apollo 70 riscv-march-$(CONFIG_FPU) := $(r !! 95 endif 71 riscv-march-$(CONFIG_RISCV_ISA_C) := $(r << 72 riscv-march-$(CONFIG_RISCV_ISA_V) := $(r << 73 96 74 ifneq ($(CONFIG_RISCV_ISA_C),y) !! 97 ifdef CONFIG_MVME147 75 KBUILD_RUSTFLAGS += -Ctarget-feature=- !! 98 CORE_FILES := $(CORE_FILES) arch/m68k/mvme147/mvme147.o >> 99 SUBDIRS := $(SUBDIRS) arch/m68k/mvme147 76 endif 100 endif 77 101 78 ifdef CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC !! 102 ifdef CONFIG_MVME16x 79 KBUILD_CFLAGS += -Wa,-misa-spec=2.2 !! 103 CORE_FILES := $(CORE_FILES) arch/m68k/mvme16x/mvme16x.o 80 KBUILD_AFLAGS += -Wa,-misa-spec=2.2 !! 104 SUBDIRS := $(SUBDIRS) arch/m68k/mvme16x 81 else << 82 riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ << 83 endif 105 endif 84 106 85 # Remove F,D,V from isa string for all. Keep e !! 107 ifdef CONFIG_BVME6000 86 # matching non-v and non-multi-letter extensio !! 108 CORE_FILES := $(CORE_FILES) arch/m68k/bvme6000/bvme6000.o 87 KBUILD_CFLAGS += -march=$(shell echo $(riscv-m !! 109 SUBDIRS := $(SUBDIRS) arch/m68k/bvme6000 >> 110 endif 88 111 89 KBUILD_AFLAGS += -march=$(riscv-march-y) !! 112 ifdef CONFIG_SUN3X >> 113 CORE_FILES := $(CORE_FILES) arch/m68k/sun3x/sun3x.o arch/m68k/sun3/sun3.o >> 114 SUBDIRS := $(SUBDIRS) arch/m68k/sun3x arch/m68k/sun3 >> 115 endif 90 116 91 # For C code built with floating-point support !! 117 ifdef CONFIG_SUN3 92 CC_FLAGS_FPU := -march=$(shell echo $(riscv-m !! 118 CORE_FILES := $(CORE_FILES) arch/m68k/sun3/sun3.o arch/m68k/sun3/prom/promlib.a >> 119 SUBDIRS := $(SUBDIRS) arch/m68k/sun3 arch/m68k/sun3/prom >> 120 endif 93 121 94 KBUILD_CFLAGS += -mno-save-restore !! 122 ifdef CONFIG_M68040 95 KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG !! 123 CORE_FILES := $(CORE_FILES) arch/m68k/fpsp040/fpsp.o >> 124 SUBDIRS := $(SUBDIRS) arch/m68k/fpsp040 >> 125 endif 96 126 97 ifeq ($(CONFIG_CMODEL_MEDLOW),y) !! 127 ifdef CONFIG_M68060 98 KBUILD_CFLAGS += -mcmodel=medlow !! 128 CORE_FILES := $(CORE_FILES) arch/m68k/ifpsp060/ifpsp.o >> 129 SUBDIRS := $(SUBDIRS) arch/m68k/ifpsp060 99 endif 130 endif 100 ifeq ($(CONFIG_CMODEL_MEDANY),y) !! 131 101 KBUILD_CFLAGS += -mcmodel=medany !! 132 ifdef CONFIG_M68KFPU_EMU >> 133 CORE_FILES := $(CORE_FILES) arch/m68k/math-emu/mathemu.o >> 134 SUBDIRS := $(SUBDIRS) arch/m68k/math-emu 102 endif 135 endif 103 136 104 # Avoid generating .eh_frame sections. !! 137 lilo: vmlinux 105 KBUILD_CFLAGS += -fno-asynchronous-unwind-tabl !! 138 if [ -f $(INSTALL_PATH)/vmlinux ]; then mv -f $(INSTALL_PATH)/vmlinux $(INSTALL_PATH)/vmlinux.old; fi >> 139 if [ -f $(INSTALL_PATH)/System.map ]; then mv -f $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi >> 140 cat vmlinux > $(INSTALL_PATH)/vmlinux >> 141 cp System.map $(INSTALL_PATH)/System.map >> 142 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi 106 143 107 # The RISC-V attributes frequently cause compa !! 144 zImage compressed: vmlinux.gz 108 # information, so just turn them off. << 109 KBUILD_CFLAGS += $(call cc-option,-mno-riscv-a << 110 KBUILD_AFLAGS += $(call cc-option,-mno-riscv-a << 111 KBUILD_CFLAGS += $(call as-option,-Wa$(comma)- << 112 KBUILD_AFLAGS += $(call as-option,-Wa$(comma)- << 113 145 114 KBUILD_CFLAGS_MODULE += $(call cc-option,-mno- !! 146 vmlinux.gz: vmlinux 115 KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$( << 116 147 117 # GCC versions that support the "-mstrict-alig !! 148 ifndef CONFIG_KGDB 118 # unaligned accesses. While unaligned accesse !! 149 cp vmlinux vmlinux.tmp 119 # RISC-V ISA, they're emulated by machine mode !! 150 $(STRIP) vmlinux.tmp 120 # architectures. It's faster to have GCC emit !! 151 gzip -9c vmlinux.tmp >vmlinux.gz 121 ifneq ($(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCES !! 152 rm vmlinux.tmp 122 KBUILD_CFLAGS += $(call cc-option,-mstrict-ali !! 153 else >> 154 gzip -9c vmlinux >vmlinux.gz 123 endif 155 endif 124 156 125 ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y) !! 157 bzImage: vmlinux.bz2 126 prepare: stack_protector_prepare << 127 stack_protector_prepare: prepare0 << 128 $(eval KBUILD_CFLAGS += -mstack-protec << 129 -mstack-protec << 130 -mstack-protec << 131 awk '{if ($$2 == "TSK_ << 132 includ << 133 endif << 134 158 135 # arch specific predefines for sparse !! 159 vmlinux.bz2: vmlinux 136 CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS) << 137 160 138 # Default target when executing plain make !! 161 ifndef CONFIG_KGDB 139 boot := arch/riscv/boot !! 162 cp vmlinux vmlinux.tmp 140 ifeq ($(CONFIG_XIP_KERNEL),y) !! 163 $(STRIP) vmlinux.tmp 141 KBUILD_IMAGE := $(boot)/xipImage !! 164 bzip2 -1c vmlinux.tmp >vmlinux.bz2 142 else !! 165 rm vmlinux.tmp 143 ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAA << 144 KBUILD_IMAGE := $(boot)/loader.bin << 145 else << 146 ifeq ($(CONFIG_EFI_ZBOOT),) << 147 KBUILD_IMAGE := $(boot)/Image.gz << 148 else 166 else 149 KBUILD_IMAGE := $(boot)/vmlinuz.efi !! 167 bzip2 -1c vmlinux >vmlinux.bz2 150 endif << 151 endif << 152 endif 168 endif 153 169 154 boot := arc !! 170 archclean: 155 boot-image-y := Ima !! 171 rm -f vmlinux.gz vmlinux.bz2 156 boot-image-$(CONFIG_KERNEL_BZIP2) := Ima !! 172 rm -f arch/m68k/kernel/m68k_defs.h arch/m68k/kernel/m68k_defs.d 157 boot-image-$(CONFIG_KERNEL_GZIP) := Ima !! 173 158 boot-image-$(CONFIG_KERNEL_LZ4) := Ima !! 174 archmrproper: 159 boot-image-$(CONFIG_KERNEL_LZMA) := Ima !! 175 160 boot-image-$(CONFIG_KERNEL_LZO) := Ima !! 176 archdep: 161 boot-image-$(CONFIG_KERNEL_ZSTD) := Ima << 162 boot-image-$(CONFIG_KERNEL_XZ) := Ima << 163 ifdef CONFIG_RISCV_M_MODE << 164 boot-image-$(CONFIG_ARCH_CANAAN) := loa << 165 endif << 166 boot-image-$(CONFIG_EFI_ZBOOT) := vml << 167 boot-image-$(CONFIG_XIP_KERNEL) := xip << 168 KBUILD_IMAGE := $(b << 169 << 170 libs-y += arch/riscv/lib/ << 171 libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/ << 172 << 173 ifeq ($(KBUILD_EXTMOD),) << 174 ifeq ($(CONFIG_MMU),y) << 175 prepare: vdso_prepare << 176 vdso_prepare: prepare0 << 177 $(Q)$(MAKE) $(build)=arch/riscv/kernel << 178 $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ << 179 $(build)=arch/riscv/kernel/com << 180 << 181 endif << 182 endif << 183 << 184 vdso-install-y += arch/riscv/ << 185 vdso-install-$(CONFIG_COMPAT) += arch/riscv/ << 186 << 187 BOOT_TARGETS := Image Image.gz Image.bz2 Image << 188 << 189 all: $(notdir $(KBUILD_IMAGE)) << 190 << 191 loader.bin: loader << 192 Image.gz Image.bz2 Image.lz4 Image.lzma Image. << 193 << 194 $(BOOT_TARGETS): vmlinux << 195 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$ << 196 @$(kecho) ' Kernel: $(boot)/$@ is rea << 197 << 198 # the install target always installs KBUILD_IM << 199 # but keep the zinstall target for compatibili << 200 install zinstall: << 201 $(call cmd,install) << 202 << 203 PHONY += rv32_randconfig << 204 rv32_randconfig: << 205 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctre << 206 -f $(srctree)/Makefile randcon << 207 << 208 PHONY += rv64_randconfig << 209 rv64_randconfig: << 210 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctre << 211 -f $(srctree)/Makefile randcon << 212 << 213 PHONY += rv32_defconfig << 214 rv32_defconfig: << 215 $(Q)$(MAKE) -f $(srctree)/Makefile def << 216 << 217 PHONY += rv32_nommu_virt_defconfig << 218 rv32_nommu_virt_defconfig: << 219 $(Q)$(MAKE) -f $(srctree)/Makefile nom << 220 << 221 define archhelp << 222 echo ' Image - Uncompressed << 223 echo ' Image.gz - Compressed kernel im << 224 echo ' Image.bz2 - Compressed kernel im << 225 echo ' Image.lz4 - Compressed kernel im << 226 echo ' Image.lzma - Compressed kernel im << 227 echo ' Image.lzo - Compressed kernel im << 228 echo ' Image.zst - Compressed kernel im << 229 echo ' Image.xz - Compressed kernel im << 230 echo ' vmlinuz.efi - Compressed EFI kerne << 231 echo ' Default when CONFIG_ << 232 echo ' xipImage - Execute-in-place ker << 233 echo ' Default when CONFIG_ << 234 echo ' install - Install kernel using << 235 echo ' (distribution) /sbin << 236 echo ' $$(INSTALL_PATH)' << 237 endef <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.