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-y := 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 # SRM bootable image. Copy to offset 512 of a partition. 19 targets := vmlinux.bin setup.bin setup !! 18 $(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh 20 targets += fdimage fdimage144 fdimage2 !! 19 ( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@ 21 subdir- := compressed !! 20 $(obj)/tools/mkbb $@ $(obj)/tools/lxboot 22 !! 21 @echo ' Bootimage $@ is ready' 23 setup-y += a20.o bioscall.o cmdline.o !! 22 24 setup-y += early_serial_console.o edd. !! 23 # BOOTP bootable image. Define INITRD during make to append initrd image. 25 setup-y += pm.o pmjump.o printf.o regs !! 24 $(obj)/bootpfile: $(obj)/tools/bootph $(obj)/vmlinux.nh 26 setup-y += video-mode.o version.o !! 25 cat $(obj)/tools/bootph $(obj)/vmlinux.nh > $@ 27 setup-$(CONFIG_X86_APM_BOOT) += apm.o !! 26 ifdef INITRD 28 !! 27 cat $(INITRD) >> $@ 29 # The link order of the video-*.o modules can !! 28 endif 30 # video-vga.o *must* be listed first, followed !! 29 31 # Hardware-specific drivers should follow in t !! 30 # Compressed kernel BOOTP bootable image. 32 # probed, and video-bios.o should typically be !! 31 # Define INITRD during make to append initrd image. 33 setup-y += video-vga.o !! 32 $(obj)/bootpzfile: $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz 34 setup-y += video-vesa.o !! 33 cat $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz > $@ 35 setup-y += video-bios.o !! 34 ifdef INITRD 36 !! 35 cat $(INITRD) >> $@ 37 targets += $(setup-y) !! 36 endif 38 hostprogs := tools/build !! 37 39 hostprogs += mkcpustr !! 38 # Compressed kernel image 40 !! 39 $(obj)/vmlinux.gz: $(obj)/vmlinux FORCE 41 HOST_EXTRACFLAGS += -I$(srctree)/tools/include !! 40 $(call if_changed,gzip) 42 -include include/generated !! 41 @echo ' Kernel $@ is ready' 43 -D__EXPORTED_HEADERS__ !! 42 44 !! 43 $(obj)/main.o: $(obj)/ksize.h 45 $(obj)/cpu.o: $(obj)/cpustr.h !! 44 $(obj)/bootp.o: $(obj)/ksize.h 46 !! 45 $(obj)/bootpz.o: $(obj)/kzsize.h 47 quiet_cmd_cpustr = CPUSTR $@ !! 46 48 cmd_cpustr = $(obj)/mkcpustr > $@ !! 47 $(obj)/ksize.h: $(obj)/vmlinux.nh FORCE 49 $(obj)/cpustr.h: $(obj)/mkcpustr FORCE !! 48 echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T 50 $(call if_changed,cpustr) !! 49 ifdef INITRD 51 targets += cpustr.h !! 50 [ -f $(INITRD) ] || exit 1 52 !! 51 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T 53 # -------------------------------------------- !! 52 endif 54 !! 53 cmp -s $@T $@ || mv -f $@T $@ 55 KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP !! 54 rm -f $@T 56 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMB !! 55 57 KBUILD_CFLAGS += $(call cc-option,-fmacro-pr !! 56 $(obj)/kzsize.h: $(obj)/vmlinux.nh.gz FORCE 58 KBUILD_CFLAGS += -fno-asynchronous-unwind-ta !! 57 echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T 59 KBUILD_CFLAGS += $(CONFIG_CC_IMPLICIT_FALLTH !! 58 echo "#define KERNEL_Z_SIZE `ls -l $(obj)/vmlinux.nh.gz | awk '{print $$5}'`" >> $@T 60 !! 59 ifdef INITRD 61 $(obj)/bzImage: asflags-y := $(SVGA_MODE) !! 60 [ -f $(INITRD) ] || exit 1 62 !! 61 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T 63 quiet_cmd_image = BUILD $@ !! 62 endif 64 silent_redirect_image = >/dev/null !! 63 cmp -s $@T $@ || mv -f $@T $@ 65 cmd_image = $(obj)/tools/build $(obj)/setup.bi !! 64 rm -f $@T 66 $(obj)/zoffset. !! 65 67 !! 66 quiet_cmd_strip = STRIP $@ 68 $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinu !! 67 cmd_strip = $(STRIP) -o $@ $< 69 $(call if_changed,image) !! 68 70 @$(kecho) 'Kernel: $@ is ready' ' (#'$ !! 69 $(obj)/vmlinux: vmlinux FORCE 71 !! 70 $(call if_changed,strip) 72 OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note !! 71 73 $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux !! 72 quiet_cmd_objstrip = OBJSTRIP $@ 74 $(call if_changed,objcopy) !! 73 cmd_objstrip = $(OBJSTRIP) $(OSFLAGS_$(@F)) $< $@ 75 !! 74 76 SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) !! 75 OSFLAGS_vmlinux.nh := -v 77 !! 76 OSFLAGS_lxboot := -p 78 sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z !! 77 OSFLAGS_bootlx := -vb 79 !! 78 OSFLAGS_bootph := -vb 80 quiet_cmd_zoffset = ZOFFSET $@ !! 79 OSFLAGS_bootpzh := -vb 81 cmd_zoffset = $(NM) $< | sed -n $(sed-zo !! 80 82 !! 81 $(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE 83 targets += zoffset.h !! 82 $(call if_changed,objstrip) 84 $(obj)/zoffset.h: $(obj)/compressed/vmlinux FO !! 83 85 $(call if_changed,zoffset) !! 84 $(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE >> 85 $(call if_changed,gzip) >> 86 >> 87 $(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE >> 88 $(call if_changed,objstrip) >> 89 >> 90 $(obj)/tools/bootlx: $(obj)/bootloader $(OBJSTRIP) FORCE >> 91 $(call if_changed,objstrip) >> 92 >> 93 $(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE >> 94 $(call if_changed,objstrip) >> 95 >> 96 $(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE >> 97 $(call if_changed,objstrip) >> 98 >> 99 LDFLAGS_bootloader := -static -uvsprintf -T #-N -relax >> 100 LDFLAGS_bootpheader := -static -uvsprintf -T #-N -relax >> 101 LDFLAGS_bootpzheader := -static -uvsprintf -T #-N -relax >> 102 >> 103 OBJ_bootlx := $(obj)/head.o $(obj)/main.o >> 104 OBJ_bootph := $(obj)/head.o $(obj)/bootp.o >> 105 OBJ_bootpzh := $(obj)/head.o $(obj)/bootpz.o $(obj)/misc.o 86 106 >> 107 $(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE >> 108 $(call if_changed,ld) 87 109 88 AFLAGS_header.o += -I$(objtree)/$(obj) !! 110 $(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE 89 $(obj)/header.o: $(obj)/zoffset.h !! 111 $(call if_changed,ld) 90 112 91 LDFLAGS_setup.elf := -m elf_i386 -z noex !! 113 $(obj)/bootpzheader: $(obj)/bootloader.lds $(OBJ_bootpzh) $(LIBS_Y) FORCE 92 $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS << 93 $(call if_changed,ld) 114 $(call if_changed,ld) 94 115 95 OBJCOPYFLAGS_setup.bin := -O binary !! 116 $(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.