>> 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 # Copyright (C) 2002,2011 Greg Ungerer <gerg@snapgear.com> >> 15 # 8 16 9 LDFLAGS_vmlinux := -z norelro !! 17 KBUILD_DEFCONFIG := multi_defconfig 10 ifeq ($(CONFIG_RELOCATABLE),y) << 11 LDFLAGS_vmlinux += -shared -Bsymbolic << 12 KBUILD_CFLAGS += -fPIE << 13 endif << 14 ifeq ($(CONFIG_DYNAMIC_FTRACE),y) << 15 LDFLAGS_vmlinux += --no-relax << 16 KBUILD_CPPFLAGS += -DCC_USING_PATCHABL << 17 ifeq ($(CONFIG_RISCV_ISA_C),y) << 18 CC_FLAGS_FTRACE := -fpatchable-functio << 19 else << 20 CC_FLAGS_FTRACE := -fpatchable-functio << 21 endif << 22 endif << 23 << 24 ifeq ($(CONFIG_CMODEL_MEDLOW),y) << 25 KBUILD_CFLAGS_MODULE += -mcmodel=medany << 26 endif << 27 << 28 export BITS << 29 ifeq ($(CONFIG_ARCH_RV64I),y) << 30 BITS := 64 << 31 UTS_MACHINE := riscv64 << 32 << 33 KBUILD_CFLAGS += -mabi=lp64 << 34 KBUILD_AFLAGS += -mabi=lp64 << 35 << 36 KBUILD_LDFLAGS += -melf64lriscv << 37 << 38 KBUILD_RUSTFLAGS += -Ctarget-cpu=gener << 39 -Cno-redzone << 40 else << 41 BITS := 32 << 42 UTS_MACHINE := riscv32 << 43 18 44 KBUILD_CFLAGS += -mabi=ilp32 !! 19 ifneq ($(SUBARCH),$(ARCH)) 45 KBUILD_AFLAGS += -mabi=ilp32 !! 20 ifeq ($(CROSS_COMPILE),) 46 KBUILD_LDFLAGS += -melf32lriscv !! 21 CROSS_COMPILE := $(call cc-cross-prefix, \ >> 22 m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-) >> 23 endif 47 endif 24 endif 48 25 49 ifndef CONFIG_RISCV_USE_LINKER_RELAXATION !! 26 # 50 KBUILD_CFLAGS += -mno-relax !! 27 # Enable processor type. Ordering of these is important - we want to 51 KBUILD_AFLAGS += -mno-relax !! 28 # use the minimum processor type of the range we support. The logic 52 ifndef CONFIG_AS_IS_LLVM !! 29 # for 680x0 will only allow use of the -m68060 or -m68040 if no other 53 KBUILD_CFLAGS += -Wa,-mno-relax !! 30 # 680x0 type is specified - and no option is specified for 68030 or 54 KBUILD_AFLAGS += -Wa,-mno-relax !! 31 # 68020. The other m68k/ColdFire types always specify some type of 55 endif !! 32 # compiler cpu type flag. 56 # LLVM has an issue with target-features and L !! 33 # 57 # Ensure it is aware of linker relaxation with !! 34 ifndef CONFIG_M68040 58 # be incorrect: https://github.com/llvm/llvm-p !! 35 cpuflags-$(CONFIG_M68060) := -m68060 59 else ifeq ($(CONFIG_LTO_CLANG),y) << 60 KBUILD_LDFLAGS += -mllvm -mattr=+c -ml << 61 endif 36 endif 62 !! 37 ifndef CONFIG_M68060 63 ifeq ($(CONFIG_SHADOW_CALL_STACK),y) !! 38 cpuflags-$(CONFIG_M68040) := -m68040 64 KBUILD_LDFLAGS += --no-relax-gp << 65 endif 39 endif 66 !! 40 cpuflags-$(CONFIG_M68030) := 67 # ISA string setting !! 41 cpuflags-$(CONFIG_M68020) := 68 riscv-march-$(CONFIG_ARCH_RV32I) := rv3 !! 42 cpuflags-$(CONFIG_M68360) := -m68332 69 riscv-march-$(CONFIG_ARCH_RV64I) := rv6 !! 43 cpuflags-$(CONFIG_M68000) := -m68000 70 riscv-march-$(CONFIG_FPU) := $(r !! 44 cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e) 71 riscv-march-$(CONFIG_RISCV_ISA_C) := $(r !! 45 cpuflags-$(CONFIG_M54xx) := $(call cc-option,-mcpu=5475,-m5200) 72 riscv-march-$(CONFIG_RISCV_ISA_V) := $(r !! 46 cpuflags-$(CONFIG_M5407) := $(call cc-option,-mcpu=5407,-m5200) 73 !! 47 cpuflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307) 74 ifneq ($(CONFIG_RISCV_ISA_C),y) !! 48 cpuflags-$(CONFIG_M537x) := $(call cc-option,-mcpu=537x,-m5307) 75 KBUILD_RUSTFLAGS += -Ctarget-feature=- !! 49 cpuflags-$(CONFIG_M5307) := $(call cc-option,-mcpu=5307,-m5200) >> 50 cpuflags-$(CONFIG_M528x) := $(call cc-option,-mcpu=528x,-m5307) >> 51 cpuflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307) >> 52 cpuflags-$(CONFIG_M5272) := $(call cc-option,-mcpu=5272,-m5307) >> 53 cpuflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307) >> 54 cpuflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307) >> 55 cpuflags-$(CONFIG_M525x) := $(call cc-option,-mcpu=5253,-m5200) >> 56 cpuflags-$(CONFIG_M5249) := $(call cc-option,-mcpu=5249,-m5200) >> 57 cpuflags-$(CONFIG_M520x) := $(call cc-option,-mcpu=5208,-m5200) >> 58 cpuflags-$(CONFIG_M5206e) := $(call cc-option,-mcpu=5206e,-m5200) >> 59 cpuflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200) >> 60 >> 61 KBUILD_AFLAGS += $(cpuflags-y) >> 62 KBUILD_CFLAGS += $(cpuflags-y) >> 63 >> 64 KBUILD_CFLAGS += -pipe -ffreestanding >> 65 >> 66 ifdef CONFIG_MMU >> 67 # without -fno-strength-reduce the 53c7xx.c driver fails ;-( >> 68 KBUILD_CFLAGS += -fno-strength-reduce -ffixed-a2 >> 69 else >> 70 # we can use a m68k-linux-gcc toolchain with these in place >> 71 KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\" >> 72 KBUILD_CFLAGS += -D__uClinux__ >> 73 KBUILD_AFLAGS += -D__uClinux__ >> 74 endif >> 75 >> 76 LDFLAGS := -m m68kelf >> 77 KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds >> 78 >> 79 ifdef CONFIG_SUN3 >> 80 LDFLAGS_vmlinux = -N >> 81 endif >> 82 >> 83 CHECKFLAGS += -D__mc68000__ >> 84 >> 85 >> 86 ifdef CONFIG_KGDB >> 87 # If configured for kgdb support, include debugging infos and keep the >> 88 # frame pointer >> 89 KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g 76 endif 90 endif 77 91 78 ifdef CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC !! 92 # 79 KBUILD_CFLAGS += -Wa,-misa-spec=2.2 !! 93 # Select the assembler head startup code. Order is important. The default 80 KBUILD_AFLAGS += -Wa,-misa-spec=2.2 !! 94 # head code is first, processor specific selections can override it after. >> 95 # >> 96 head-y := arch/m68k/kernel/head.o >> 97 head-$(CONFIG_SUN3) := arch/m68k/kernel/sun3-head.o >> 98 head-$(CONFIG_M68360) := arch/m68k/68360/head.o >> 99 head-$(CONFIG_M68000) := arch/m68k/68000/head.o >> 100 head-$(CONFIG_COLDFIRE) := arch/m68k/coldfire/head.o >> 101 >> 102 core-y += arch/m68k/kernel/ arch/m68k/mm/ >> 103 libs-y += arch/m68k/lib/ >> 104 >> 105 core-$(CONFIG_Q40) += arch/m68k/q40/ >> 106 core-$(CONFIG_AMIGA) += arch/m68k/amiga/ >> 107 core-$(CONFIG_ATARI) += arch/m68k/atari/ >> 108 core-$(CONFIG_MAC) += arch/m68k/mac/ >> 109 core-$(CONFIG_HP300) += arch/m68k/hp300/ >> 110 core-$(CONFIG_APOLLO) += arch/m68k/apollo/ >> 111 core-$(CONFIG_MVME147) += arch/m68k/mvme147/ >> 112 core-$(CONFIG_MVME16x) += arch/m68k/mvme16x/ >> 113 core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/ >> 114 core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/ >> 115 core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/ >> 116 core-$(CONFIG_NATFEAT) += arch/m68k/emu/ >> 117 core-$(CONFIG_M68040) += arch/m68k/fpsp040/ >> 118 core-$(CONFIG_M68060) += arch/m68k/ifpsp060/ >> 119 core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/ >> 120 core-$(CONFIG_M68360) += arch/m68k/68360/ >> 121 core-$(CONFIG_M68000) += arch/m68k/68000/ >> 122 core-$(CONFIG_COLDFIRE) += arch/m68k/coldfire/ >> 123 >> 124 >> 125 all: zImage >> 126 >> 127 lilo: vmlinux >> 128 if [ -f $(INSTALL_PATH)/vmlinux ]; then mv -f $(INSTALL_PATH)/vmlinux $(INSTALL_PATH)/vmlinux.old; fi >> 129 if [ -f $(INSTALL_PATH)/System.map ]; then mv -f $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi >> 130 cat vmlinux > $(INSTALL_PATH)/vmlinux >> 131 cp System.map $(INSTALL_PATH)/System.map >> 132 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi >> 133 >> 134 zImage compressed: vmlinux.gz >> 135 >> 136 vmlinux.gz: vmlinux >> 137 >> 138 ifndef CONFIG_KGDB >> 139 cp vmlinux vmlinux.tmp >> 140 $(STRIP) vmlinux.tmp >> 141 gzip -9c vmlinux.tmp >vmlinux.gz >> 142 rm vmlinux.tmp >> 143 else >> 144 gzip -9c vmlinux >vmlinux.gz >> 145 endif >> 146 >> 147 bzImage: vmlinux.bz2 >> 148 >> 149 vmlinux.bz2: vmlinux >> 150 >> 151 ifndef CONFIG_KGDB >> 152 cp vmlinux vmlinux.tmp >> 153 $(STRIP) vmlinux.tmp >> 154 bzip2 -1c vmlinux.tmp >vmlinux.bz2 >> 155 rm vmlinux.tmp 81 else 156 else 82 riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ !! 157 bzip2 -1c vmlinux >vmlinux.bz2 83 endif 158 endif 84 159 85 # Remove F,D,V from isa string for all. Keep e !! 160 archclean: 86 # matching non-v and non-multi-letter extensio !! 161 rm -f vmlinux.gz vmlinux.bz2 87 KBUILD_CFLAGS += -march=$(shell echo $(riscv-m << 88 << 89 KBUILD_AFLAGS += -march=$(riscv-march-y) << 90 << 91 # For C code built with floating-point support << 92 CC_FLAGS_FPU := -march=$(shell echo $(riscv-m << 93 << 94 KBUILD_CFLAGS += -mno-save-restore << 95 KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG << 96 << 97 ifeq ($(CONFIG_CMODEL_MEDLOW),y) << 98 KBUILD_CFLAGS += -mcmodel=medlow << 99 endif << 100 ifeq ($(CONFIG_CMODEL_MEDANY),y) << 101 KBUILD_CFLAGS += -mcmodel=medany << 102 endif << 103 << 104 # Avoid generating .eh_frame sections. << 105 KBUILD_CFLAGS += -fno-asynchronous-unwind-tabl << 106 << 107 # The RISC-V attributes frequently cause compa << 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 << 114 KBUILD_CFLAGS_MODULE += $(call cc-option,-mno- << 115 KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$( << 116 << 117 # GCC versions that support the "-mstrict-alig << 118 # unaligned accesses. While unaligned accesse << 119 # RISC-V ISA, they're emulated by machine mode << 120 # architectures. It's faster to have GCC emit << 121 ifneq ($(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCES << 122 KBUILD_CFLAGS += $(call cc-option,-mstrict-ali << 123 endif << 124 << 125 ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y) << 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 << 135 # arch specific predefines for sparse << 136 CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS) << 137 << 138 # Default target when executing plain make << 139 boot := arch/riscv/boot << 140 ifeq ($(CONFIG_XIP_KERNEL),y) << 141 KBUILD_IMAGE := $(boot)/xipImage << 142 else << 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 << 149 KBUILD_IMAGE := $(boot)/vmlinuz.efi << 150 endif << 151 endif << 152 endif << 153 162 154 boot := arc !! 163 install: 155 boot-image-y := Ima !! 164 sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)" 156 boot-image-$(CONFIG_KERNEL_BZIP2) := Ima << 157 boot-image-$(CONFIG_KERNEL_GZIP) := Ima << 158 boot-image-$(CONFIG_KERNEL_LZ4) := Ima << 159 boot-image-$(CONFIG_KERNEL_LZMA) := Ima << 160 boot-image-$(CONFIG_KERNEL_LZO) := Ima << 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.