>> 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" 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 Linus Torvalds >> 14 # >> 15 # 19990713 Artur Skawina <skawina@geocities.com> >> 16 # Added '-march' and '-mpreferred-stack-boundary' support >> 17 # 8 18 9 LDFLAGS_vmlinux := -z norelro !! 19 LD=$(CROSS_COMPILE)ld -m elf_i386 10 ifeq ($(CONFIG_RELOCATABLE),y) !! 20 OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S 11 LDFLAGS_vmlinux += -shared -Bsymbolic !! 21 LDFLAGS=-e stext 12 KBUILD_CFLAGS += -fPIE !! 22 LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinux.lds $(LDFLAGS) 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 23 24 ifeq ($(CONFIG_CMODEL_MEDLOW),y) !! 24 CFLAGS += -pipe 25 KBUILD_CFLAGS_MODULE += -mcmodel=medany << 26 endif << 27 25 28 export BITS !! 26 # prevent gcc from keeping the stack 16 byte aligned 29 ifeq ($(CONFIG_ARCH_RV64I),y) !! 27 CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,) 30 BITS := 64 << 31 UTS_MACHINE := riscv64 << 32 28 33 KBUILD_CFLAGS += -mabi=lp64 !! 29 ifdef CONFIG_M386 34 KBUILD_AFLAGS += -mabi=lp64 !! 30 CFLAGS += -march=i386 >> 31 endif 35 32 36 KBUILD_LDFLAGS += -melf64lriscv !! 33 ifdef CONFIG_M486 >> 34 CFLAGS += -march=i486 >> 35 endif 37 36 38 KBUILD_RUSTFLAGS += -Ctarget-cpu=gener !! 37 ifdef CONFIG_M586 39 -Cno-redzone !! 38 CFLAGS += -march=i586 40 else !! 39 endif 41 BITS := 32 << 42 UTS_MACHINE := riscv32 << 43 40 44 KBUILD_CFLAGS += -mabi=ilp32 !! 41 ifdef CONFIG_M586TSC 45 KBUILD_AFLAGS += -mabi=ilp32 !! 42 CFLAGS += -march=i586 46 KBUILD_LDFLAGS += -melf32lriscv << 47 endif 43 endif 48 44 49 ifndef CONFIG_RISCV_USE_LINKER_RELAXATION !! 45 ifdef CONFIG_M586MMX 50 KBUILD_CFLAGS += -mno-relax !! 46 CFLAGS += -march=i586 51 KBUILD_AFLAGS += -mno-relax << 52 ifndef CONFIG_AS_IS_LLVM << 53 KBUILD_CFLAGS += -Wa,-mno-relax << 54 KBUILD_AFLAGS += -Wa,-mno-relax << 55 endif 47 endif 56 # LLVM has an issue with target-features and L !! 48 57 # Ensure it is aware of linker relaxation with !! 49 ifdef CONFIG_M686 58 # be incorrect: https://github.com/llvm/llvm-p !! 50 CFLAGS += -march=i686 59 else ifeq ($(CONFIG_LTO_CLANG),y) << 60 KBUILD_LDFLAGS += -mllvm -mattr=+c -ml << 61 endif 51 endif 62 52 63 ifeq ($(CONFIG_SHADOW_CALL_STACK),y) !! 53 ifdef CONFIG_MPENTIUMIII 64 KBUILD_LDFLAGS += --no-relax-gp !! 54 CFLAGS += -march=i686 65 endif 55 endif 66 56 67 # ISA string setting !! 57 ifdef CONFIG_MPENTIUM4 68 riscv-march-$(CONFIG_ARCH_RV32I) := rv3 !! 58 CFLAGS += -march=i686 69 riscv-march-$(CONFIG_ARCH_RV64I) := rv6 !! 59 endif 70 riscv-march-$(CONFIG_FPU) := $(r << 71 riscv-march-$(CONFIG_RISCV_ISA_C) := $(r << 72 riscv-march-$(CONFIG_RISCV_ISA_V) := $(r << 73 60 74 ifneq ($(CONFIG_RISCV_ISA_C),y) !! 61 ifdef CONFIG_MK6 75 KBUILD_RUSTFLAGS += -Ctarget-feature=- !! 62 CFLAGS += $(call check_gcc,-march=k6,-march=i586) 76 endif 63 endif 77 64 78 ifdef CONFIG_TOOLCHAIN_NEEDS_OLD_ISA_SPEC !! 65 ifdef CONFIG_MK7 79 KBUILD_CFLAGS += -Wa,-misa-spec=2.2 !! 66 CFLAGS += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4) 80 KBUILD_AFLAGS += -Wa,-misa-spec=2.2 << 81 else << 82 riscv-march-$(CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ << 83 endif 67 endif 84 68 85 # Remove F,D,V from isa string for all. Keep e !! 69 ifdef CONFIG_MCRUSOE 86 # matching non-v and non-multi-letter extensio !! 70 CFLAGS += -march=i686 87 KBUILD_CFLAGS += -march=$(shell echo $(riscv-m !! 71 CFLAGS += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0) >> 72 endif 88 73 89 KBUILD_AFLAGS += -march=$(riscv-march-y) !! 74 ifdef CONFIG_MGEODE_LX >> 75 CFLAGS += -march=i686 >> 76 endif 90 77 91 # For C code built with floating-point support !! 78 ifdef CONFIG_MWINCHIPC6 92 CC_FLAGS_FPU := -march=$(shell echo $(riscv-m !! 79 CFLAGS += -march=i586 >> 80 endif 93 81 94 KBUILD_CFLAGS += -mno-save-restore !! 82 ifdef CONFIG_MWINCHIP2 95 KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG !! 83 CFLAGS += -march=i586 >> 84 endif 96 85 97 ifeq ($(CONFIG_CMODEL_MEDLOW),y) !! 86 ifdef CONFIG_MWINCHIP3D 98 KBUILD_CFLAGS += -mcmodel=medlow !! 87 CFLAGS += -march=i586 99 endif 88 endif 100 ifeq ($(CONFIG_CMODEL_MEDANY),y) !! 89 101 KBUILD_CFLAGS += -mcmodel=medany !! 90 ifdef CONFIG_MCYRIXIII >> 91 CFLAGS += $(call check_gcc,-march=c3,-march=i486) >> 92 CFLAGS += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0) 102 endif 93 endif 103 94 104 # Avoid generating .eh_frame sections. !! 95 ifdef CONFIG_MVIAC3_2 105 KBUILD_CFLAGS += -fno-asynchronous-unwind-tabl !! 96 CFLAGS += $(call check_gcc,-march=c3-2,-march=i686) >> 97 endif 106 98 107 # The RISC-V attributes frequently cause compa !! 99 # Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use 108 # information, so just turn them off. !! 100 # a lot more stack due to the lack of sharing of stacklots. 109 KBUILD_CFLAGS += $(call cc-option,-mno-riscv-a !! 101 # CFLAGS += $(call if_gcc4,,$(call check_gcc,-fno-unit-at-a-time,)) 110 KBUILD_AFLAGS += $(call cc-option,-mno-riscv-a !! 102 # Disable unit-at-a-time on gcc >= 4 too, because it removes seemingly unused 111 KBUILD_CFLAGS += $(call as-option,-Wa$(comma)- !! 103 # variables which are indeed module params. 112 KBUILD_AFLAGS += $(call as-option,-Wa$(comma)- !! 104 CFLAGS += $(call check_gcc,-fno-unit-at-a-time,) 113 105 114 KBUILD_CFLAGS_MODULE += $(call cc-option,-mno- !! 106 HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o 115 KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$( << 116 107 117 # GCC versions that support the "-mstrict-alig !! 108 SUBDIRS += arch/i386/kernel arch/i386/mm arch/i386/lib 118 # unaligned accesses. While unaligned accesse !! 109 119 # RISC-V ISA, they're emulated by machine mode !! 110 CORE_FILES := arch/i386/kernel/kernel.o arch/i386/mm/mm.o $(CORE_FILES) 120 # architectures. It's faster to have GCC emit !! 111 LIBS := $(TOPDIR)/arch/i386/lib/lib.a $(LIBS) $(TOPDIR)/arch/i386/lib/lib.a 121 ifneq ($(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCES << 122 KBUILD_CFLAGS += $(call cc-option,-mstrict-ali << 123 endif << 124 112 125 ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y) !! 113 ifdef CONFIG_MATH_EMULATION 126 prepare: stack_protector_prepare !! 114 SUBDIRS += arch/i386/math-emu 127 stack_protector_prepare: prepare0 !! 115 DRIVERS += arch/i386/math-emu/math.o 128 $(eval KBUILD_CFLAGS += -mstack-protec << 129 -mstack-protec << 130 -mstack-protec << 131 awk '{if ($$2 == "TSK_ << 132 includ << 133 endif 116 endif 134 117 135 # arch specific predefines for sparse !! 118 arch/i386/kernel: dummy 136 CHECKFLAGS += -D__riscv -D__riscv_xlen=$(BITS) !! 119 $(MAKE) linuxsubdirs SUBDIRS=arch/i386/kernel 137 120 138 # Default target when executing plain make !! 121 arch/i386/mm: dummy 139 boot := arch/riscv/boot !! 122 $(MAKE) linuxsubdirs SUBDIRS=arch/i386/mm 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 123 154 boot := arc !! 124 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot 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 125 170 libs-y += arch/riscv/lib/ !! 126 vmlinux: arch/i386/vmlinux.lds 171 libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/ << 172 127 173 ifeq ($(KBUILD_EXTMOD),) !! 128 FORCE: ; 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 129 181 endif !! 130 .PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \ 182 endif !! 131 clean archclean archmrproper archdep 183 132 184 vdso-install-y += arch/riscv/ !! 133 zImage: vmlinux 185 vdso-install-$(CONFIG_COMPAT) += arch/riscv/ !! 134 @$(MAKEBOOT) zImage 186 135 187 BOOT_TARGETS := Image Image.gz Image.bz2 Image !! 136 bzImage: vmlinux >> 137 @$(MAKEBOOT) bzImage 188 138 189 all: $(notdir $(KBUILD_IMAGE)) !! 139 compressed: zImage 190 140 191 loader.bin: loader !! 141 zlilo: vmlinux 192 Image.gz Image.bz2 Image.lz4 Image.lzma Image. !! 142 @$(MAKEBOOT) BOOTIMAGE=zImage zlilo 193 143 194 $(BOOT_TARGETS): vmlinux !! 144 tmp: 195 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$ !! 145 @$(MAKEBOOT) BOOTIMAGE=bzImage zlilo 196 @$(kecho) ' Kernel: $(boot)/$@ is rea !! 146 bzlilo: vmlinux >> 147 @$(MAKEBOOT) BOOTIMAGE=bzImage zlilo 197 148 198 # the install target always installs KBUILD_IM !! 149 zdisk: vmlinux 199 # but keep the zinstall target for compatibili !! 150 @$(MAKEBOOT) BOOTIMAGE=zImage zdisk 200 install zinstall: << 201 $(call cmd,install) << 202 151 203 PHONY += rv32_randconfig !! 152 bzdisk: vmlinux 204 rv32_randconfig: !! 153 @$(MAKEBOOT) BOOTIMAGE=bzImage zdisk 205 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctre << 206 -f $(srctree)/Makefile randcon << 207 154 208 PHONY += rv64_randconfig !! 155 install: vmlinux 209 rv64_randconfig: !! 156 @$(MAKEBOOT) BOOTIMAGE=bzImage install 210 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctre << 211 -f $(srctree)/Makefile randcon << 212 157 213 PHONY += rv32_defconfig !! 158 archclean: 214 rv32_defconfig: !! 159 @$(MAKEBOOT) clean 215 $(Q)$(MAKE) -f $(srctree)/Makefile def << 216 160 217 PHONY += rv32_nommu_virt_defconfig !! 161 archmrproper: 218 rv32_nommu_virt_defconfig: << 219 $(Q)$(MAKE) -f $(srctree)/Makefile nom << 220 162 221 define archhelp !! 163 archdep: 222 echo ' Image - Uncompressed !! 164 @$(MAKEBOOT) dep 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.