1 # 1 # 2 # arch/x86/boot/Makefile !! 2 # arch/alpha/boot/Makefile 3 # 3 # 4 # This file is subject to the terms and condit 4 # This file is subject to the terms and conditions of the GNU General Public 5 # License. See the file "COPYING" in the main 5 # License. See the file "COPYING" in the main directory of this archive 6 # for more details. 6 # for more details. 7 # 7 # 8 # Copyright (C) 1994 by Linus Torvalds 8 # Copyright (C) 1994 by Linus Torvalds 9 # Changed by many, many contributors over the << 10 # 9 # 11 10 12 # If you want to preset the SVGA mode, uncomme !! 11 hostprogs := tools/mkbb tools/objstrip 13 # set SVGA_MODE to whatever number you want. !! 12 targets := vmlinux.gz vmlinux \ 14 # Set it to -DSVGA_MODE=NORMAL_VGA if you just !! 13 vmlinux.nh tools/lxboot tools/bootlx tools/bootph \ 15 # The number is the same as you would ordinari !! 14 tools/bootpzh bootloader bootpheader bootpzheader 16 !! 15 OBJSTRIP := $(obj)/tools/objstrip 17 SVGA_MODE := -DSVGA_MODE=NORMAL_VGA !! 16 18 !! 17 KBUILD_HOSTCFLAGS := -Wall -I$(objtree)/usr/include 19 targets := vmlinux.bin setup.bin setup !! 18 BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) 20 targets += fdimage fdimage144 fdimage2 !! 19 21 subdir- := compressed !! 20 # SRM bootable image. Copy to offset 512 of a partition. 22 !! 21 $(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh 23 setup-y += a20.o bioscall.o cmdline.o !! 22 ( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@ 24 setup-y += early_serial_console.o edd. !! 23 $(obj)/tools/mkbb $@ $(obj)/tools/lxboot 25 setup-y += pm.o pmjump.o printf.o regs !! 24 @echo ' Bootimage $@ is ready' 26 setup-y += video-mode.o version.o !! 25 27 setup-$(CONFIG_X86_APM_BOOT) += apm.o !! 26 # BOOTP bootable image. Define INITRD during make to append initrd image. 28 !! 27 $(obj)/bootpfile: $(obj)/tools/bootph $(obj)/vmlinux.nh 29 # The link order of the video-*.o modules can !! 28 cat $(obj)/tools/bootph $(obj)/vmlinux.nh > $@ 30 # video-vga.o *must* be listed first, followed !! 29 ifdef INITRD 31 # Hardware-specific drivers should follow in t !! 30 cat $(INITRD) >> $@ 32 # probed, and video-bios.o should typically be !! 31 endif 33 setup-y += video-vga.o !! 32 34 setup-y += video-vesa.o !! 33 # Compressed kernel BOOTP bootable image. 35 setup-y += video-bios.o !! 34 # Define INITRD during make to append initrd image. 36 !! 35 $(obj)/bootpzfile: $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz 37 targets += $(setup-y) !! 36 cat $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz > $@ 38 hostprogs := tools/build !! 37 ifdef INITRD 39 hostprogs += mkcpustr !! 38 cat $(INITRD) >> $@ 40 !! 39 endif 41 HOST_EXTRACFLAGS += -I$(srctree)/tools/include !! 40 42 -include include/generated !! 41 # Compressed kernel image 43 -D__EXPORTED_HEADERS__ !! 42 $(obj)/vmlinux.gz: $(obj)/vmlinux FORCE 44 !! 43 $(call if_changed,gzip) 45 $(obj)/cpu.o: $(obj)/cpustr.h !! 44 @echo ' Kernel $@ is ready' 46 !! 45 47 quiet_cmd_cpustr = CPUSTR $@ !! 46 $(obj)/main.o: $(obj)/ksize.h 48 cmd_cpustr = $(obj)/mkcpustr > $@ !! 47 $(obj)/bootp.o: $(obj)/ksize.h 49 $(obj)/cpustr.h: $(obj)/mkcpustr FORCE !! 48 $(obj)/bootpz.o: $(obj)/kzsize.h 50 $(call if_changed,cpustr) !! 49 51 targets += cpustr.h !! 50 $(obj)/ksize.h: $(obj)/vmlinux.nh FORCE 52 !! 51 echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T 53 # -------------------------------------------- !! 52 ifdef INITRD 54 !! 53 [ -f $(INITRD) ] || exit 1 55 KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP !! 54 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T 56 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMB !! 55 endif 57 KBUILD_CFLAGS += $(call cc-option,-fmacro-pr !! 56 cmp -s $@T $@ || mv -f $@T $@ 58 KBUILD_CFLAGS += -fno-asynchronous-unwind-ta !! 57 rm -f $@T 59 KBUILD_CFLAGS += $(CONFIG_CC_IMPLICIT_FALLTH !! 58 60 !! 59 $(obj)/kzsize.h: $(obj)/vmlinux.nh.gz FORCE 61 $(obj)/bzImage: asflags-y := $(SVGA_MODE) !! 60 echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T 62 !! 61 echo "#define KERNEL_Z_SIZE `ls -l $(obj)/vmlinux.nh.gz | awk '{print $$5}'`" >> $@T 63 quiet_cmd_image = BUILD $@ !! 62 ifdef INITRD 64 silent_redirect_image = >/dev/null !! 63 [ -f $(INITRD) ] || exit 1 65 cmd_image = $(obj)/tools/build $(obj)/setup.bi !! 64 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T 66 $(obj)/zoffset. !! 65 endif 67 !! 66 cmp -s $@T $@ || mv -f $@T $@ 68 $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinu !! 67 rm -f $@T 69 $(call if_changed,image) !! 68 70 @$(kecho) 'Kernel: $@ is ready' ' (#'$ !! 69 quiet_cmd_strip = STRIP $@ 71 !! 70 cmd_strip = $(STRIP) -o $@ $< 72 OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note !! 71 73 $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux !! 72 $(obj)/vmlinux: vmlinux FORCE 74 $(call if_changed,objcopy) !! 73 $(call if_changed,strip) 75 !! 74 76 SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) !! 75 quiet_cmd_objstrip = OBJSTRIP $@ 77 !! 76 cmd_objstrip = $(OBJSTRIP) $(OSFLAGS_$(@F)) $< $@ 78 sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z !! 77 79 !! 78 OSFLAGS_vmlinux.nh := -v 80 quiet_cmd_zoffset = ZOFFSET $@ !! 79 OSFLAGS_lxboot := -p 81 cmd_zoffset = $(NM) $< | sed -n $(sed-zo !! 80 OSFLAGS_bootlx := -vb 82 !! 81 OSFLAGS_bootph := -vb 83 targets += zoffset.h !! 82 OSFLAGS_bootpzh := -vb 84 $(obj)/zoffset.h: $(obj)/compressed/vmlinux FO !! 83 85 $(call if_changed,zoffset) !! 84 $(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE >> 85 $(call if_changed,objstrip) >> 86 >> 87 $(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE >> 88 $(call if_changed,gzip) >> 89 >> 90 $(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE >> 91 $(call if_changed,objstrip) >> 92 >> 93 $(obj)/tools/bootlx: $(obj)/bootloader $(OBJSTRIP) FORCE >> 94 $(call if_changed,objstrip) >> 95 >> 96 $(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE >> 97 $(call if_changed,objstrip) >> 98 >> 99 $(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE >> 100 $(call if_changed,objstrip) >> 101 >> 102 LDFLAGS_bootloader := -static -T # -N -relax >> 103 LDFLAGS_bootloader := -static -T # -N -relax >> 104 LDFLAGS_bootpheader := -static -T # -N -relax >> 105 LDFLAGS_bootpzheader := -static -T # -N -relax >> 106 >> 107 OBJ_bootlx := $(obj)/head.o $(obj)/stdio.o $(obj)/main.o >> 108 OBJ_bootph := $(obj)/head.o $(obj)/stdio.o $(obj)/bootp.o >> 109 OBJ_bootpzh := $(obj)/head.o $(obj)/stdio.o $(obj)/bootpz.o $(obj)/misc.o 86 110 >> 111 $(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE >> 112 $(call if_changed,ld) 87 113 88 AFLAGS_header.o += -I$(objtree)/$(obj) !! 114 $(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE 89 $(obj)/header.o: $(obj)/zoffset.h !! 115 $(call if_changed,ld) 90 116 91 LDFLAGS_setup.elf := -m elf_i386 -z noex !! 117 $(obj)/bootpzheader: $(obj)/bootloader.lds $(OBJ_bootpzh) $(LIBS_Y) FORCE 92 $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS << 93 $(call if_changed,ld) 118 $(call if_changed,ld) 94 119 95 OBJCOPYFLAGS_setup.bin := -O binary !! 120 $(obj)/misc.o: lib/inflate.c 96 $(obj)/setup.bin: $(obj)/setup.elf FORCE << 97 $(call if_changed,objcopy) << 98 << 99 $(obj)/compressed/vmlinux: FORCE << 100 $(Q)$(MAKE) $(build)=$(obj)/compressed << 101 << 102 # Set this if you want to pass append argument << 103 # bzdisk/fdimage/hdimage/isoimage kernel << 104 FDARGS = << 105 # Set this if you want one or more initrds inc << 106 FDINITRD = << 107 << 108 imgdeps = $(obj)/bzImage $(obj)/mtools.conf $( << 109 << 110 $(obj)/mtools.conf: $(src)/mtools.conf.in << 111 sed -e 's|@OBJ@|$(obj)|g' < $< > $@ << 112 << 113 targets += mtools.conf << 114 << 115 # genimage.sh requires bash, but it also has a << 116 # external dependencies. << 117 quiet_cmd_genimage = GENIMAGE $3 << 118 cmd_genimage = $(BASH) $(src)/genimage.s << 119 $(obj)/mtools.conf '$(FDARGS)' << 120 << 121 PHONY += bzdisk fdimage fdimage144 fdimage288 << 122 << 123 # This requires write access to /dev/fd0 << 124 # All images require syslinux to be installed; << 125 # EDK2/OVMF if the kernel is compiled with the << 126 bzdisk: $(imgdeps) << 127 $(call cmd,genimage,bzdisk,/dev/fd0) << 128 << 129 fdimage fdimage144: $(imgdeps) << 130 $(call cmd,genimage,fdimage144,$(obj)/ << 131 @$(kecho) 'Kernel: $(obj)/fdimage is r << 132 << 133 fdimage288: $(imgdeps) << 134 $(call cmd,genimage,fdimage288,$(obj)/ << 135 @$(kecho) 'Kernel: $(obj)/fdimage is r << 136 << 137 hdimage: $(imgdeps) << 138 $(call cmd,genimage,hdimage,$(obj)/hdi << 139 @$(kecho) 'Kernel: $(obj)/hdimage is r << 140 << 141 isoimage: $(imgdeps) << 142 $(call cmd,genimage,isoimage,$(obj)/im << 143 @$(kecho) 'Kernel: $(obj)/image.iso is <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.