Back to home page

OSCL-LXR

 
 

    


0001 #
0002 # arch/x86/boot/Makefile
0003 #
0004 # This file is subject to the terms and conditions of the GNU General Public
0005 # License.  See the file "COPYING" in the main directory of this archive
0006 # for more details.
0007 #
0008 # Copyright (C) 1994 by Linus Torvalds
0009 # Changed by many, many contributors over the years.
0010 #
0011 
0012 # Sanitizer runtimes are unavailable and cannot be linked for early boot code.
0013 KASAN_SANITIZE                  := n
0014 KCSAN_SANITIZE                  := n
0015 OBJECT_FILES_NON_STANDARD       := y
0016 
0017 # Kernel does not boot with kcov instrumentation here.
0018 # One of the problems observed was insertion of __sanitizer_cov_trace_pc()
0019 # callback into middle of per-cpu data enabling code. Thus the callback observed
0020 # inconsistent state and crashed. We are interested mostly in syscall coverage,
0021 # so boot code is not interesting anyway.
0022 KCOV_INSTRUMENT         := n
0023 
0024 # If you want to preset the SVGA mode, uncomment the next line and
0025 # set SVGA_MODE to whatever number you want.
0026 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
0027 # The number is the same as you would ordinarily press at bootup.
0028 
0029 SVGA_MODE       := -DSVGA_MODE=NORMAL_VGA
0030 
0031 targets         := vmlinux.bin setup.bin setup.elf bzImage
0032 targets         += fdimage fdimage144 fdimage288 image.iso hdimage
0033 subdir-         := compressed
0034 
0035 setup-y         += a20.o bioscall.o cmdline.o copy.o cpu.o cpuflags.o cpucheck.o
0036 setup-y         += early_serial_console.o edd.o header.o main.o memory.o
0037 setup-y         += pm.o pmjump.o printf.o regs.o string.o tty.o video.o
0038 setup-y         += video-mode.o version.o
0039 setup-$(CONFIG_X86_APM_BOOT) += apm.o
0040 
0041 # The link order of the video-*.o modules can matter.  In particular,
0042 # video-vga.o *must* be listed first, followed by video-vesa.o.
0043 # Hardware-specific drivers should follow in the order they should be
0044 # probed, and video-bios.o should typically be last.
0045 setup-y         += video-vga.o
0046 setup-y         += video-vesa.o
0047 setup-y         += video-bios.o
0048 
0049 targets         += $(setup-y)
0050 hostprogs       := tools/build
0051 hostprogs       += mkcpustr
0052 
0053 HOST_EXTRACFLAGS += -I$(srctree)/tools/include \
0054                     -include include/generated/autoconf.h \ 
0055                     -D__EXPORTED_HEADERS__
0056 
0057 ifdef CONFIG_X86_FEATURE_NAMES
0058 $(obj)/cpu.o: $(obj)/cpustr.h
0059 
0060 quiet_cmd_cpustr = CPUSTR  $@
0061       cmd_cpustr = $(obj)/mkcpustr > $@
0062 $(obj)/cpustr.h: $(obj)/mkcpustr FORCE
0063         $(call if_changed,cpustr)
0064 endif
0065 targets += cpustr.h
0066 
0067 # ---------------------------------------------------------------------------
0068 
0069 KBUILD_CFLAGS   := $(REALMODE_CFLAGS) -D_SETUP
0070 KBUILD_AFLAGS   := $(KBUILD_CFLAGS) -D__ASSEMBLY__
0071 KBUILD_CFLAGS   += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
0072 KBUILD_CFLAGS   += -fno-asynchronous-unwind-tables
0073 GCOV_PROFILE := n
0074 UBSAN_SANITIZE := n
0075 
0076 $(obj)/bzImage: asflags-y  := $(SVGA_MODE)
0077 
0078 quiet_cmd_image = BUILD   $@
0079 silent_redirect_image = >/dev/null
0080 cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
0081                                $(obj)/zoffset.h $@ $($(quiet)redirect_image)
0082 
0083 $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
0084         $(call if_changed,image)
0085         @$(kecho) 'Kernel: $@ is ready' ' (#'`cat .version`')'
0086 
0087 OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S
0088 $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
0089         $(call if_changed,objcopy)
0090 
0091 SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
0092 
0093 sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|efi32_pe_entry\|input_data\|kernel_info\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p'
0094 
0095 quiet_cmd_zoffset = ZOFFSET $@
0096       cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
0097 
0098 targets += zoffset.h
0099 $(obj)/zoffset.h: $(obj)/compressed/vmlinux FORCE
0100         $(call if_changed,zoffset)
0101 
0102 
0103 AFLAGS_header.o += -I$(objtree)/$(obj)
0104 $(obj)/header.o: $(obj)/zoffset.h
0105 
0106 LDFLAGS_setup.elf       := -m elf_i386 -z noexecstack -T
0107 $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE
0108         $(call if_changed,ld)
0109 
0110 OBJCOPYFLAGS_setup.bin  := -O binary
0111 $(obj)/setup.bin: $(obj)/setup.elf FORCE
0112         $(call if_changed,objcopy)
0113 
0114 $(obj)/compressed/vmlinux: FORCE
0115         $(Q)$(MAKE) $(build)=$(obj)/compressed $@
0116 
0117 # Set this if you want to pass append arguments to the
0118 # bzdisk/fdimage/hdimage/isoimage kernel
0119 FDARGS =
0120 # Set this if you want one or more initrds included in the image
0121 FDINITRD =
0122 
0123 imgdeps = $(obj)/bzImage $(obj)/mtools.conf $(src)/genimage.sh
0124 
0125 $(obj)/mtools.conf: $(src)/mtools.conf.in
0126         sed -e 's|@OBJ@|$(obj)|g' < $< > $@
0127 
0128 targets += mtools.conf
0129 
0130 # genimage.sh requires bash, but it also has a bunch of other
0131 # external dependencies.
0132 quiet_cmd_genimage = GENIMAGE $3
0133 cmd_genimage = $(BASH) $(srctree)/$(src)/genimage.sh $2 $3 $(obj)/bzImage \
0134                 $(obj)/mtools.conf '$(FDARGS)' $(FDINITRD)
0135 
0136 PHONY += bzdisk fdimage fdimage144 fdimage288 hdimage isoimage
0137 
0138 # This requires write access to /dev/fd0
0139 # All images require syslinux to be installed; hdimage also requires
0140 # EDK2/OVMF if the kernel is compiled with the EFI stub.
0141 bzdisk: $(imgdeps)
0142         $(call cmd,genimage,bzdisk,/dev/fd0)
0143 
0144 fdimage fdimage144: $(imgdeps)
0145         $(call cmd,genimage,fdimage144,$(obj)/fdimage)
0146         @$(kecho) 'Kernel: $(obj)/fdimage is ready'
0147 
0148 fdimage288: $(imgdeps)
0149         $(call cmd,genimage,fdimage288,$(obj)/fdimage)
0150         @$(kecho) 'Kernel: $(obj)/fdimage is ready'
0151 
0152 hdimage: $(imgdeps)
0153         $(call cmd,genimage,hdimage,$(obj)/hdimage)
0154         @$(kecho) 'Kernel: $(obj)/hdimage is ready'
0155 
0156 isoimage: $(imgdeps)
0157         $(call cmd,genimage,isoimage,$(obj)/image.iso)
0158         @$(kecho) 'Kernel: $(obj)/image.iso is ready'