>> 1 # >> 2 # i386/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" cleaning up for this architecture. 3 # 7 # 4 # This file is subject to the terms and condit 8 # This file is subject to the terms and conditions of the GNU General Public 5 # License. See the file "COPYING" in the main 9 # License. See the file "COPYING" in the main directory of this archive 6 # for more details. 10 # for more details. 7 # 11 # >> 12 # Copyright (C) 1994 by Linus Torvalds >> 13 # >> 14 # 19990713 Artur Skawina <skawina@geocities.com> >> 15 # Added '-march' and '-mpreferred-stack-boundary' support >> 16 # >> 17 >> 18 LDFLAGS := -m elf_i386 >> 19 OBJCOPYFLAGS := -O binary -R .note -R .comment -S >> 20 LDFLAGS_vmlinux := >> 21 >> 22 CFLAGS += -pipe >> 23 >> 24 # prevent gcc from keeping the stack 16 byte aligned >> 25 CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,) >> 26 >> 27 align := $(subst -functions=0,,$(call check_gcc,-falign-functions=0,-malign-functions=0)) >> 28 >> 29 cflags-$(CONFIG_M386) += -march=i386 >> 30 cflags-$(CONFIG_M486) += -march=i486 >> 31 cflags-$(CONFIG_M586) += -march=i586 >> 32 cflags-$(CONFIG_M586TSC) += -march=i586 >> 33 cflags-$(CONFIG_M586MMX) += $(call check_gcc,-march=pentium-mmx,-march=i586) >> 34 cflags-$(CONFIG_M686) += -march=i686 >> 35 cflags-$(CONFIG_MPENTIUMII) += $(call check_gcc,-march=pentium2,-march=i686) >> 36 cflags-$(CONFIG_MPENTIUMIII) += $(call check_gcc,-march=pentium3,-march=i686) >> 37 cflags-$(CONFIG_MPENTIUM4) += $(call check_gcc,-march=pentium4,-march=i686) >> 38 cflags-$(CONFIG_MK6) += $(call check_gcc,-march=k6,-march=i586) >> 39 # Please note, that patches that add -march=athlon-xp and friends are pointless. >> 40 # They make zero difference whatsosever to performance at this time. >> 41 cflags-$(CONFIG_MK7) += $(call check_gcc,-march=athlon,-march=i686 $(align)-functions=4) >> 42 cflags-$(CONFIG_MK8) += $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 $(align)-functions=4)) >> 43 cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 >> 44 cflags-$(CONFIG_MWINCHIPC6) += $(call check_gcc,-march=winchip-c6,-march=i586) >> 45 cflags-$(CONFIG_MWINCHIP2) += $(call check_gcc,-march=winchip2,-march=i586) >> 46 cflags-$(CONFIG_MWINCHIP3D) += $(call check_gcc,-march=winchip2,-march=i586) >> 47 cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-march=c3,-march=i486) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 >> 48 cflags-$(CONFIG_MVIAC3_2) += $(call check_gcc,-march=c3-2,-march=i686) >> 49 >> 50 CFLAGS += $(cflags-y) >> 51 >> 52 # Default subarch .c files >> 53 mcore-y := mach-default >> 54 >> 55 # Voyager subarch support >> 56 mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-i386/mach-voyager >> 57 mcore-$(CONFIG_X86_VOYAGER) := mach-voyager >> 58 >> 59 # VISWS subarch support >> 60 mflags-$(CONFIG_X86_VISWS) := -Iinclude/asm-i386/mach-visws >> 61 mcore-$(CONFIG_X86_VISWS) := mach-visws >> 62 >> 63 # NUMAQ subarch support >> 64 mflags-$(CONFIG_X86_NUMAQ) := -Iinclude/asm-i386/mach-numaq >> 65 mcore-$(CONFIG_X86_NUMAQ) := mach-default >> 66 >> 67 # BIGSMP subarch support >> 68 mflags-$(CONFIG_X86_BIGSMP) := -Iinclude/asm-i386/mach-bigsmp >> 69 mcore-$(CONFIG_X86_BIGSMP) := mach-default >> 70 >> 71 #Summit subarch support >> 72 mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit >> 73 mcore-$(CONFIG_X86_SUMMIT) := mach-default >> 74 >> 75 # generic subarchitecture >> 76 mflags-$(CONFIG_X86_GENERICARCH) := -Iinclude/asm-i386/mach-generic >> 77 mcore-$(CONFIG_X86_GENERICARCH) := mach-default >> 78 core-$(CONFIG_X86_GENERICARCH) += arch/i386/mach-generic/ >> 79 >> 80 # ES7000 subarch support >> 81 mflags-$(CONFIG_X86_ES7000) := -Iinclude/asm-i386/mach-es7000 >> 82 mcore-$(CONFIG_X86_ES7000) := mach-es7000 8 83 9 LDFLAGS_vmlinux := -z norelro !! 84 # default subarch .h files 10 ifeq ($(CONFIG_RELOCATABLE),y) !! 85 mflags-y += -Iinclude/asm-i386/mach-default 11 LDFLAGS_vmlinux += -shared -Bsymbolic !! 86 12 KBUILD_CFLAGS += -fPIE !! 87 head-y := arch/i386/kernel/head.o arch/i386/kernel/init_task.o 13 endif !! 88 14 ifeq ($(CONFIG_DYNAMIC_FTRACE),y) !! 89 libs-y += arch/i386/lib/ 15 LDFLAGS_vmlinux += --no-relax !! 90 core-y += arch/i386/kernel/ \ 16 KBUILD_CPPFLAGS += -DCC_USING_PATCHABL !! 91 arch/i386/mm/ \ 17 ifeq ($(CONFIG_RISCV_ISA_C),y) !! 92 arch/i386/$(mcore-y)/ 18 CC_FLAGS_FTRACE := -fpatchable-functio !! 93 drivers-$(CONFIG_MATH_EMULATION) += arch/i386/math-emu/ 19 else !! 94 drivers-$(CONFIG_PCI) += arch/i386/pci/ 20 CC_FLAGS_FTRACE := -fpatchable-functio !! 95 # must be linked after kernel/ 21 endif !! 96 drivers-$(CONFIG_OPROFILE) += arch/i386/oprofile/ 22 endif !! 97 drivers-$(CONFIG_PM) += arch/i386/power/ 23 !! 98 24 ifeq ($(CONFIG_CMODEL_MEDLOW),y) !! 99 CFLAGS += $(mflags-y) 25 KBUILD_CFLAGS_MODULE += -mcmodel=medany !! 100 AFLAGS += $(mflags-y) 26 endif !! 101 27 !! 102 boot := arch/i386/boot 28 export BITS !! 103 29 ifeq ($(CONFIG_ARCH_RV64I),y) !! 104 .PHONY: zImage bzImage compressed zlilo bzlilo \ 30 BITS := 64 !! 105 zdisk bzdisk fdimage fdimage144 fdimage288 install 31 UTS_MACHINE := riscv64 !! 106 32 !! 107 all: bzImage 33 KBUILD_CFLAGS += -mabi=lp64 !! 108 34 KBUILD_AFLAGS += -mabi=lp64 !! 109 BOOTIMAGE=arch/i386/boot/bzImage 35 !! 110 zImage zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage 36 KBUILD_LDFLAGS += -melf64lriscv !! 111 37 !! 112 zImage bzImage: vmlinux 38 KBUILD_RUSTFLAGS += -Ctarget-cpu=gener !! 113 $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE) 39 -Cno-redzone !! 114 40 else !! 115 compressed: zImage 41 BITS := 32 !! 116 42 UTS_MACHINE := riscv32 !! 117 zlilo bzlilo: vmlinux 43 !! 118 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo 44 KBUILD_CFLAGS += -mabi=ilp32 !! 119 45 KBUILD_AFLAGS += -mabi=ilp32 !! 120 zdisk bzdisk: vmlinux 46 KBUILD_LDFLAGS += -melf32lriscv !! 121 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk 47 endif !! 122 48 !! 123 install fdimage fdimage144 fdimage288: vmlinux 49 ifndef CONFIG_RISCV_USE_LINKER_RELAXATION !! 124 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ 50 KBUILD_CFLAGS += -mno-relax !! 125 51 KBUILD_AFLAGS += -mno-relax !! 126 prepare: include/asm-$(ARCH)/asm_offsets.h 52 ifndef CONFIG_AS_IS_LLVM !! 127 CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h 53 KBUILD_CFLAGS += -Wa,-mno-relax !! 128 54 KBUILD_AFLAGS += -Wa,-mno-relax !! 129 arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \ 55 endif !! 130 include/config/MARKER 56 # LLVM has an issue with target-features and L !! 131 57 # Ensure it is aware of linker relaxation with !! 132 include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s 58 # be incorrect: https://github.com/llvm/llvm-p !! 133 $(call filechk,gen-asm-offsets) 59 else ifeq ($(CONFIG_LTO_CLANG),y) !! 134 60 KBUILD_LDFLAGS += -mllvm -mattr=+c -ml !! 135 archclean: 61 endif !! 136 $(Q)$(MAKE) $(clean)=arch/i386/boot 62 << 63 ifeq ($(CONFIG_SHADOW_CALL_STACK),y) << 64 KBUILD_LDFLAGS += --no-relax-gp << 65 endif << 66 << 67 # ISA string setting << 68 riscv-march-$(CONFIG_ARCH_RV32I) := rv3 << 69 riscv-march-$(CONFIG_ARCH_RV64I) := rv6 << 70 riscv-march-$(CONFIG_FPU) := $(r << 71 riscv-march-$(CONFIG_RISCV_ISA_C) := $(r << 72 riscv-march-$(CONFIG_RISCV_ISA_V) := $(r << 73 << 74 ifneq ($(CONFIG_RISCV_ISA_C),y) << 75 KBUILD_RUSTFLAGS += -Ctarget-feature=- << 76 endif << 77 << 78 ifdef CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC << 79 KBUILD_CFLAGS += -Wa,-misa-spec=2.2 << 80 KBUILD_AFLAGS += -Wa,-misa-spec=2.2 << 81 else << 82 riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ << 83 endif << 84 << 85 # Remove F,D,V from isa string for all. Keep e << 86 # matching non-v and non-multi-letter extensio << 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 << 154 boot := arc << 155 boot-image-y := Ima << 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 137 221 define archhelp 138 define archhelp 222 echo ' Image - Uncompressed !! 139 echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' 223 echo ' Image.gz - Compressed kernel im !! 140 echo ' install - Install kernel using' 224 echo ' Image.bz2 - Compressed kernel im !! 141 echo ' (your) ~/bin/installkernel or' 225 echo ' Image.lz4 - Compressed kernel im !! 142 echo ' (distribution) /sbin/installkernel or' 226 echo ' Image.lzma - Compressed kernel im !! 143 echo ' install to $$(INSTALL_PATH) and run lilo' 227 echo ' Image.lzo - Compressed kernel im !! 144 echo ' bzdisk - Create a boot floppy in /dev/fd0' 228 echo ' Image.zst - Compressed kernel im !! 145 echo ' fdimage - Create a boot floppy image' 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 146 endef >> 147 >> 148 CLEAN_FILES += arch/$(ARCH)/boot/fdimage arch/$(ARCH)/boot/mtools.conf
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.