1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 274b469f2SSam Ravnborg# Unified Makefile for i386 and x86_64 374b469f2SSam Ravnborg 42266cfd5SSam Ravnborg# select defconfig based on actual architecture 5d746d647SSam Ravnborgifeq ($(ARCH),x86) 6ffee0de4SDavid Woodhouse ifeq ($(shell uname -m),x86_64) 7ffee0de4SDavid Woodhouse KBUILD_DEFCONFIG := x86_64_defconfig 8ffee0de4SDavid Woodhouse else 9d746d647SSam Ravnborg KBUILD_DEFCONFIG := i386_defconfig 10ffee0de4SDavid Woodhouse endif 11d746d647SSam Ravnborgelse 122266cfd5SSam Ravnborg KBUILD_DEFCONFIG := $(ARCH)_defconfig 13d746d647SSam Ravnborgendif 142266cfd5SSam Ravnborg 15d77698dfSMatthias Kaehlcke# For gcc stack alignment is specified with -mpreferred-stack-boundary, 16d77698dfSMatthias Kaehlcke# clang has the option -mstack-alignment for that purpose. 17d77698dfSMatthias Kaehlckeifneq ($(call cc-option, -mpreferred-stack-boundary=4),) 188f918697SMatthias Kaehlcke cc_stack_align4 := -mpreferred-stack-boundary=2 198f918697SMatthias Kaehlcke cc_stack_align8 := -mpreferred-stack-boundary=3 208f918697SMatthias Kaehlckeelse ifneq ($(call cc-option, -mstack-alignment=16),) 218f918697SMatthias Kaehlcke cc_stack_align4 := -mstack-alignment=4 228f918697SMatthias Kaehlcke cc_stack_align8 := -mstack-alignment=8 23d77698dfSMatthias Kaehlckeendif 24d77698dfSMatthias Kaehlcke 251c678da3SDavid Woodhouse# How to compile the 16-bit code. Note we always compile for -march=i386; 261c678da3SDavid Woodhouse# that way we can complain to the user if the CPU is insufficient. 27de3accdaSDavid Woodhouse# 28de3accdaSDavid Woodhouse# The -m16 option is supported by GCC >= 4.9 and clang >= 3.5. For 29a9cfcceeSH. Peter Anvin# older versions of GCC, include an *assembly* header to make sure that 30a9cfcceeSH. Peter Anvin# gcc doesn't play any games behind our back. 31a9cfcceeSH. Peter AnvinCODE16GCC_CFLAGS := -m32 -Wa,$(srctree)/arch/x86/boot/code16gcc.h 32de3accdaSDavid WoodhouseM16_CFLAGS := $(call cc-option, -m16, $(CODE16GCC_CFLAGS)) 33de3accdaSDavid Woodhouse 34*d6289f36SCao jinREALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING \ 351c678da3SDavid Woodhouse -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ 361c678da3SDavid Woodhouse -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ 37032a2c4fSMatthias Kaehlcke -mno-mmx -mno-sse 38032a2c4fSMatthias Kaehlcke 39032a2c4fSMatthias KaehlckeREALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding) 40032a2c4fSMatthias KaehlckeREALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -fno-stack-protector) 419e8730b1SMatthias KaehlckeREALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align4)) 421c678da3SDavid Woodhouseexport REALMODE_CFLAGS 431c678da3SDavid Woodhouse 440a6ef376SSam Ravnborg# BITS is used as extension for files which are available in a 32 bit 450a6ef376SSam Ravnborg# and a 64 bit version to simplify shared Makefiles. 460a6ef376SSam Ravnborg# e.g.: obj-y += foo_$(BITS).o 470a6ef376SSam Ravnborgexport BITS 4874b469f2SSam Ravnborg 49a0215061SKees Cookifdef CONFIG_X86_NEED_RELOCS 50a0215061SKees Cook LDFLAGS_vmlinux := --emit-relocs 51a0215061SKees Cookendif 52a0215061SKees Cook 53b2c51106SAndy Lutomirski# 54b2c51106SAndy Lutomirski# Prevent GCC from generating any FP code by mistake. 55b2c51106SAndy Lutomirski# 56b2c51106SAndy Lutomirski# This must happen before we try the -mpreferred-stack-boundary, see: 57b2c51106SAndy Lutomirski# 58b2c51106SAndy Lutomirski# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 59b2c51106SAndy Lutomirski# 60b2c51106SAndy LutomirskiKBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow 61b2c51106SAndy LutomirskiKBUILD_CFLAGS += $(call cc-option,-mno-avx,) 62b2c51106SAndy Lutomirski 63d746d647SSam Ravnborgifeq ($(CONFIG_X86_32),y) 640a6ef376SSam Ravnborg BITS := 32 658c6531f7SAndreas Herrmann UTS_MACHINE := i386 664ba7e5cdSSam Ravnborg CHECKFLAGS += -D__i386__ 670a6ef376SSam Ravnborg 684ba7e5cdSSam Ravnborg biarch := $(call cc-option,-m32) 694ba7e5cdSSam Ravnborg KBUILD_AFLAGS += $(biarch) 704ba7e5cdSSam Ravnborg KBUILD_CFLAGS += $(biarch) 710a6ef376SSam Ravnborg 720a6ef376SSam Ravnborg KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return 730a6ef376SSam Ravnborg 74484d90eeSAndrew Boie # Never want PIC in a 32-bit kernel, prevent breakage with GCC built 75484d90eeSAndrew Boie # with nonstandard options 76484d90eeSAndrew Boie KBUILD_CFLAGS += -fno-pic 77484d90eeSAndrew Boie 78d77698dfSMatthias Kaehlcke # Align the stack to the register width instead of using the default 79d77698dfSMatthias Kaehlcke # alignment of 16 bytes. This reduces stack usage and the number of 80d77698dfSMatthias Kaehlcke # alignment instructions. 819e8730b1SMatthias Kaehlcke KBUILD_CFLAGS += $(call cc-option,$(cc_stack_align4)) 820a6ef376SSam Ravnborg 830a6ef376SSam Ravnborg # Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use 840a6ef376SSam Ravnborg # a lot more stack due to the lack of sharing of stacklots: 85c7bd0414SFrans Pop KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0400, \ 86c7bd0414SFrans Pop $(call cc-option,-fno-unit-at-a-time)) 870a6ef376SSam Ravnborg 880a6ef376SSam Ravnborg # CPU-specific tuning. Anything which can be shared with UML should go here. 89a436bb7bSMasahiro Yamada include arch/x86/Makefile_32.cpu 900a6ef376SSam Ravnborg KBUILD_CFLAGS += $(cflags-y) 910a6ef376SSam Ravnborg 920a6ef376SSam Ravnborg # temporary until string.h is fixed 930a6ef376SSam Ravnborg KBUILD_CFLAGS += -ffreestanding 940a6ef376SSam Ravnborgelse 950a6ef376SSam Ravnborg BITS := 64 960a6ef376SSam Ravnborg UTS_MACHINE := x86_64 970a6ef376SSam Ravnborg CHECKFLAGS += -D__x86_64__ -m64 980a6ef376SSam Ravnborg 9914262d67SGeorge Spelvin biarch := -m64 1000a6ef376SSam Ravnborg KBUILD_AFLAGS += -m64 1010a6ef376SSam Ravnborg KBUILD_CFLAGS += -m64 1020a6ef376SSam Ravnborg 103be6cb027SIngo Molnar # Align jump targets to 1 byte, not the default 16 bytes: 1042c4fd1acSMatthias Kaehlcke KBUILD_CFLAGS += $(call cc-option,-falign-jumps=1) 105be6cb027SIngo Molnar 10652648e83SIngo Molnar # Pack loops tightly as well: 1072c4fd1acSMatthias Kaehlcke KBUILD_CFLAGS += $(call cc-option,-falign-loops=1) 10852648e83SIngo Molnar 1095c630089SRasmus Villemoes # Don't autogenerate traditional x87 instructions 1108f2dd677SBehan Webster KBUILD_CFLAGS += $(call cc-option,-mno-80387) 1118f2dd677SBehan Webster KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387) 1125551a34eSH. Peter Anvin 113d77698dfSMatthias Kaehlcke # By default gcc and clang use a stack alignment of 16 bytes for x86. 114d77698dfSMatthias Kaehlcke # However the standard kernel entry on x86-64 leaves the stack on an 115d77698dfSMatthias Kaehlcke # 8-byte boundary. If the compiler isn't informed about the actual 116d77698dfSMatthias Kaehlcke # alignment it will generate extra alignment instructions for the 117d77698dfSMatthias Kaehlcke # default alignment which keep the stack *mis*aligned. 118d77698dfSMatthias Kaehlcke # Furthermore an alignment to the register width reduces stack usage 119d77698dfSMatthias Kaehlcke # and the number of alignment instructions. 1209e8730b1SMatthias Kaehlcke KBUILD_CFLAGS += $(call cc-option,$(cc_stack_align8)) 121d9b0cde9SH.J. Lu 122d9ee948dSH.J. Lu # Use -mskip-rax-setup if supported. 123d9ee948dSH.J. Lu KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup) 124d9ee948dSH.J. Lu 1250a6ef376SSam Ravnborg # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) 1260a6ef376SSam Ravnborg cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8) 1270a6ef376SSam Ravnborg cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) 1280a6ef376SSam Ravnborg 1290a6ef376SSam Ravnborg cflags-$(CONFIG_MCORE2) += \ 1300a6ef376SSam Ravnborg $(call cc-option,-march=core2,$(call cc-option,-mtune=generic)) 131366d19e1STobias Doerffel cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom) \ 132366d19e1STobias Doerffel $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic)) 1330a6ef376SSam Ravnborg cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic) 1340a6ef376SSam Ravnborg KBUILD_CFLAGS += $(cflags-y) 1350a6ef376SSam Ravnborg 1360a6ef376SSam Ravnborg KBUILD_CFLAGS += -mno-red-zone 1370a6ef376SSam Ravnborg KBUILD_CFLAGS += -mcmodel=kernel 1380a6ef376SSam Ravnborg 1390a6ef376SSam Ravnborg # -funit-at-a-time shrinks the kernel .text considerably 1400a6ef376SSam Ravnborg # unfortunately it makes reading oopses harder. 1410a6ef376SSam Ravnborg KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) 1425d707e9cSTejun Heoendif 1430a6ef376SSam Ravnborg 1440bf62763SH. Peter Anvinifdef CONFIG_X86_X32 1450bf62763SH. Peter Anvin x32_ld_ok := $(call try-run,\ 1460bf62763SH. Peter Anvin /bin/echo -e '1: .quad 1b' | \ 1470bf62763SH. Peter Anvin $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ 1480bf62763SH. Peter Anvin $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ 1490bf62763SH. Peter Anvin $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) 1500bf62763SH. Peter Anvin ifeq ($(x32_ld_ok),y) 1510bf62763SH. Peter Anvin CONFIG_X86_X32_ABI := y 1520bf62763SH. Peter Anvin KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI 1530bf62763SH. Peter Anvin KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI 1540bf62763SH. Peter Anvin else 1550bf62763SH. Peter Anvin $(warning CONFIG_X86_X32 enabled but no binutils support) 1560bf62763SH. Peter Anvin endif 1570bf62763SH. Peter Anvinendif 1580bf62763SH. Peter Anvinexport CONFIG_X86_X32_ABI 1590bf62763SH. Peter Anvin 1603f135e57SJosh Poimboeuf# 1613f135e57SJosh Poimboeuf# If the function graph tracer is used with mcount instead of fentry, 1623f135e57SJosh Poimboeuf# '-maccumulate-outgoing-args' is needed to prevent a GCC bug 1633f135e57SJosh Poimboeuf# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42109) 1643f135e57SJosh Poimboeuf# 1653f135e57SJosh Poimboeufifdef CONFIG_FUNCTION_GRAPH_TRACER 1663f135e57SJosh Poimboeuf ifndef CONFIG_HAVE_FENTRY 1673f135e57SJosh Poimboeuf ACCUMULATE_OUTGOING_ARGS := 1 1683f135e57SJosh Poimboeuf else 1693f135e57SJosh Poimboeuf ifeq ($(call cc-option-yn, -mfentry), n) 1703f135e57SJosh Poimboeuf ACCUMULATE_OUTGOING_ARGS := 1 171a5859c6dSJosh Poimboeuf 172a5859c6dSJosh Poimboeuf # GCC ignores '-maccumulate-outgoing-args' when used with '-Os'. 173a5859c6dSJosh Poimboeuf # If '-Os' is enabled, disable it and print a warning. 174a5859c6dSJosh Poimboeuf ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 175a5859c6dSJosh Poimboeuf undefine CONFIG_CC_OPTIMIZE_FOR_SIZE 176a5859c6dSJosh Poimboeuf $(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE. Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.) 177a5859c6dSJosh Poimboeuf endif 178a5859c6dSJosh Poimboeuf 1793f135e57SJosh Poimboeuf endif 1803f135e57SJosh Poimboeuf endif 1813f135e57SJosh Poimboeufendif 1823f135e57SJosh Poimboeuf 183e501ce95SPeter Zijlstraifndef CC_HAVE_ASM_GOTO 184e501ce95SPeter Zijlstra $(error Compiler lacks asm-goto support.) 185e501ce95SPeter Zijlstraendif 186e501ce95SPeter Zijlstra 1873f135e57SJosh Poimboeuf# 1883f135e57SJosh Poimboeuf# Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a 1893f135e57SJosh Poimboeuf# GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226). There's no way 1903f135e57SJosh Poimboeuf# to test for this bug at compile-time because the test case needs to execute, 1913f135e57SJosh Poimboeuf# which is a no-go for cross compilers. So check the GCC version instead. 1923f135e57SJosh Poimboeuf# 1933f135e57SJosh Poimboeufifdef CONFIG_JUMP_LABEL 1943f135e57SJosh Poimboeuf ifneq ($(ACCUMULATE_OUTGOING_ARGS), 1) 1953f135e57SJosh Poimboeuf ACCUMULATE_OUTGOING_ARGS = $(call cc-if-fullversion, -lt, 040502, 1) 1963f135e57SJosh Poimboeuf endif 1973f135e57SJosh Poimboeufendif 1983f135e57SJosh Poimboeuf 1993f135e57SJosh Poimboeufifeq ($(ACCUMULATE_OUTGOING_ARGS), 1) 2004a1bec46SNick Desaulniers # This compiler flag is not supported by Clang: 2014a1bec46SNick Desaulniers KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args,) 2023f135e57SJosh Poimboeufendif 2033f135e57SJosh Poimboeuf 2040a6ef376SSam Ravnborg# Stackpointer is addressed different for 32 bit and 64 bit x86 2050a6ef376SSam Ravnborgsp-$(CONFIG_X86_32) := esp 2060a6ef376SSam Ravnborgsp-$(CONFIG_X86_64) := rsp 2070a6ef376SSam Ravnborg 2087b956f03SAndy Lutomirski# do binutils support CFI? 2097b956f03SAndy Lutomirskicfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset $(sp-y)$(comma)0\n.cfi_endproc,-DCONFIG_AS_CFI=1) 2107b956f03SAndy Lutomirski# is .cfi_signal_frame supported too? 2117b956f03SAndy Lutomirskicfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1) 2127b956f03SAndy Lutomirskicfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTIONS=1) 2137b956f03SAndy Lutomirski 214d7acb92fSH. Peter Anvin# does binutils support specific instructions? 215d7acb92fSH. Peter Anvinasinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1) 21675aaf4c3SJan Beulichasinstr += $(call as-instr,pshufb %xmm0$(comma)%xmm0,-DCONFIG_AS_SSSE3=1) 21706325190SJan Beulichasinstr += $(call as-instr,crc32l %eax$(comma)%eax,-DCONFIG_AS_CRC32=1) 218ea4d26aeSJim Kukunasavx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1) 2197056741fSJim Kukunasavx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) 220e0a491c1SGayatri Kammelaavx512_instr :=$(call as-instr,vpmovm2b %k1$(comma)%zmm5,-DCONFIG_AS_AVX512=1) 221e38b6b7fStimsha1_ni_instr :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA1_NI=1) 222e38b6b7fStimsha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA256_NI=1) 223d7acb92fSH. Peter Anvin 224e0a491c1SGayatri KammelaKBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) 225e0a491c1SGayatri KammelaKBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) 2260a6ef376SSam Ravnborg 2270a6ef376SSam RavnborgLDFLAGS := -m elf_$(UTS_MACHINE) 22825dfeeb7SSam Ravnborg 22925dfeeb7SSam Ravnborg# Speed up the build 2300a6ef376SSam RavnborgKBUILD_CFLAGS += -pipe 23125dfeeb7SSam Ravnborg# Workaround for a gcc prelease that unfortunately was shipped in a suse release 23225dfeeb7SSam RavnborgKBUILD_CFLAGS += -Wno-sign-compare 23325dfeeb7SSam Ravnborg# 23425dfeeb7SSam RavnborgKBUILD_CFLAGS += -fno-asynchronous-unwind-tables 2350a6ef376SSam Ravnborg 23676b04384SDavid Woodhouse# Avoid indirect branches in kernel to deal with Spectre 23776b04384SDavid Woodhouseifdef CONFIG_RETPOLINE 23876b04384SDavid Woodhouseifneq ($(RETPOLINE_CFLAGS),) 23976b04384SDavid Woodhouse KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE 24076b04384SDavid Woodhouseendif 24176b04384SDavid Woodhouseendif 24276b04384SDavid Woodhouse 2433ce9e53eSMichal Marekarchscripts: scripts_basic 2446520fe55SH. Peter Anvin $(Q)$(MAKE) $(build)=arch/x86/tools relocs 2456520fe55SH. Peter Anvin 2460a6ef376SSam Ravnborg### 247303395acSH. Peter Anvin# Syscall table generation 248303395acSH. Peter Anvin 249303395acSH. Peter Anvinarchheaders: 2501f57d5d8SIngo Molnar $(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all 251303395acSH. Peter Anvin 2528fc5b4d4SVivek Goyalarchprepare: 25374ca317cSVivek Goyalifeq ($(CONFIG_KEXEC_FILE),y) 2548fc5b4d4SVivek Goyal $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c 2558fc5b4d4SVivek Goyalendif 2568fc5b4d4SVivek Goyal 257303395acSH. Peter Anvin### 2580a6ef376SSam Ravnborg# Kernel objects 2590a6ef376SSam Ravnborg 2600a6ef376SSam Ravnborghead-y := arch/x86/kernel/head_$(BITS).o 261700efc1bSEric W. Biedermanhead-y += arch/x86/kernel/head$(BITS).o 262f2d85299SLuis R. Rodriguezhead-y += arch/x86/kernel/ebda.o 2638d152e7aSLuis R. Rodriguezhead-y += arch/x86/kernel/platform-quirks.o 2640a6ef376SSam Ravnborg 2650a6ef376SSam Ravnborglibs-y += arch/x86/lib/ 2660a6ef376SSam Ravnborg 267d1f0ae5eSSam Ravnborg# See arch/x86/Kbuild for content of core part of the kernel 268d1f0ae5eSSam Ravnborgcore-y += arch/x86/ 2690a6ef376SSam Ravnborg 2700a6ef376SSam Ravnborg# drivers-y are linked after core-y 2710a6ef376SSam Ravnborgdrivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/ 2720a6ef376SSam Ravnborgdrivers-$(CONFIG_PCI) += arch/x86/pci/ 2730a6ef376SSam Ravnborg 2740a6ef376SSam Ravnborg# must be linked after kernel/ 2750a6ef376SSam Ravnborgdrivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/ 2760a6ef376SSam Ravnborg 277cf7700feSRafael J. Wysocki# suspend and hibernation support 2780a6ef376SSam Ravnborgdrivers-$(CONFIG_PM) += arch/x86/power/ 279cf7700feSRafael J. Wysocki 2800a6ef376SSam Ravnborgdrivers-$(CONFIG_FB) += arch/x86/video/ 2810a6ef376SSam Ravnborg 2820a6ef376SSam Ravnborg#### 2830a6ef376SSam Ravnborg# boot loader support. Several targets are kept for legacy purposes 2840a6ef376SSam Ravnborg 2850a6ef376SSam Ravnborgboot := arch/x86/boot 2860a6ef376SSam Ravnborg 2871648e4f8SH. Peter AnvinBOOT_TARGETS = bzlilo bzdisk fdimage fdimage144 fdimage288 isoimage 288f9c5107cSH. Peter Anvin 289f9c5107cSH. Peter AnvinPHONY += bzImage $(BOOT_TARGETS) 2900a6ef376SSam Ravnborg 2910a6ef376SSam Ravnborg# Default kernel to build 2920a6ef376SSam Ravnborgall: bzImage 2930a6ef376SSam Ravnborg 2940a6ef376SSam Ravnborg# KBUILD_IMAGE specify target image being built 2950a6ef376SSam RavnborgKBUILD_IMAGE := $(boot)/bzImage 2960a6ef376SSam Ravnborg 297f9c5107cSH. Peter AnvinbzImage: vmlinux 298ca0e9badSMasami Hiramatsuifeq ($(CONFIG_X86_DECODER_SELFTEST),y) 299ca0e9badSMasami Hiramatsu $(Q)$(MAKE) $(build)=arch/x86/tools posttest 300ca0e9badSMasami Hiramatsuendif 3010a6ef376SSam Ravnborg $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) 3020a6ef376SSam Ravnborg $(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot 30341b3eae6SJan Beulich $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/$@ 3040a6ef376SSam Ravnborg 305f9c5107cSH. Peter Anvin$(BOOT_TARGETS): vmlinux 306f9c5107cSH. Peter Anvin $(Q)$(MAKE) $(build)=$(boot) $@ 3070a6ef376SSam Ravnborg 3081648e4f8SH. Peter AnvinPHONY += install 3091648e4f8SH. Peter Anvininstall: 3101648e4f8SH. Peter Anvin $(Q)$(MAKE) $(build)=$(boot) $@ 3111648e4f8SH. Peter Anvin 3120a6ef376SSam RavnborgPHONY += vdso_install 3130a6ef376SSam Ravnborgvdso_install: 314d603c8e1SIngo Molnar $(Q)$(MAKE) $(build)=arch/x86/entry/vdso $@ 3150a6ef376SSam Ravnborg 3160a6ef376SSam Ravnborgarchclean: 3170a6ef376SSam Ravnborg $(Q)rm -rf $(objtree)/arch/i386 3180a6ef376SSam Ravnborg $(Q)rm -rf $(objtree)/arch/x86_64 3190a6ef376SSam Ravnborg $(Q)$(MAKE) $(clean)=$(boot) 320b2d668daSJarkko Sakkinen $(Q)$(MAKE) $(clean)=arch/x86/tools 321b0108f9eSMichael Welling $(Q)$(MAKE) $(clean)=arch/x86/purgatory 3220a6ef376SSam Ravnborg 3230a6ef376SSam Ravnborgdefine archhelp 3240a6ef376SSam Ravnborg echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' 3250a6ef376SSam Ravnborg echo ' install - Install kernel using' 326caa27b66SSam Ravnborg echo ' (your) ~/bin/$(INSTALLKERNEL) or' 327caa27b66SSam Ravnborg echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 3280a6ef376SSam Ravnborg echo ' install to $$(INSTALL_PATH) and run lilo' 32937f30e21SAndi Kleen echo ' fdimage - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)' 33037f30e21SAndi Kleen echo ' fdimage144 - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)' 33137f30e21SAndi Kleen echo ' fdimage288 - Create 2.8MB boot floppy image (arch/x86/boot/fdimage)' 33237f30e21SAndi Kleen echo ' isoimage - Create a boot CD-ROM image (arch/x86/boot/image.iso)' 33337f30e21SAndi Kleen echo ' bzdisk/fdimage*/isoimage also accept:' 33437f30e21SAndi Kleen echo ' FDARGS="..." arguments for the booted kernel' 33537f30e21SAndi Kleen echo ' FDINITRD=file initrd for the booted kernel' 3360a6ef376SSam Ravnborgendef 337