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 # >> 10 # Creating a compressed kernel image (arch/alpha/boot/vmlinux.gz) >> 11 # is done via: >> 12 # >> 13 # make boot >> 14 # >> 15 # Creating a BOOTP image (arch/alpha/boot/bootpfile or bootpzfile) >> 16 # is done via: >> 17 # >> 18 # make bootpfile # using an uncompressed kernel >> 19 # make bootpzfile # using a compressed kernel >> 20 # >> 21 # Adding an INITRD image to a BOOTP file (arch/alpha/boot/bootpzfile) >> 22 # can be done, e.g, via: >> 23 # >> 24 # INITRD=`pwd`/initrd.img make bootpzfile 11 25 12 # If you want to preset the SVGA mode, uncomme !! 26 LINKFLAGS = -static -T bootloader.lds #-N -relax 13 # set SVGA_MODE to whatever number you want. << 14 # Set it to -DSVGA_MODE=NORMAL_VGA if you just << 15 # The number is the same as you would ordinari << 16 << 17 SVGA_MODE := -DSVGA_MODE=NORMAL_VGA << 18 << 19 targets := vmlinux.bin setup.bin setup << 20 targets += fdimage fdimage144 fdimage2 << 21 subdir- := compressed << 22 27 23 setup-y += a20.o bioscall.o cmdline.o !! 28 .S.s: 24 setup-y += early_serial_console.o edd. !! 29 $(CPP) $(AFLAGS) -traditional -o $*.o $< 25 setup-y += pm.o pmjump.o printf.o regs !! 30 .S.o: 26 setup-y += video-mode.o version.o !! 31 $(CC) $(AFLAGS) -traditional -c -o $*.o $< 27 setup-$(CONFIG_X86_APM_BOOT) += apm.o << 28 32 29 # The link order of the video-*.o modules can !! 33 OBJECTS = head.o main.o 30 # video-vga.o *must* be listed first, followed !! 34 BPOBJECTS = head.o bootp.o 31 # Hardware-specific drivers should follow in t !! 35 BPZOBJECTS = head.o bootpz.o misc.o 32 # probed, and video-bios.o should typically be !! 36 TARGETS = vmlinux.gz tools/objstrip # also needed by aboot & milo 33 setup-y += video-vga.o !! 37 VMLINUX = $(TOPDIR)/vmlinux 34 setup-y += video-vesa.o !! 38 OBJSTRIP = tools/objstrip 35 setup-y += video-bios.o << 36 39 37 targets += $(setup-y) !! 40 all: $(TARGETS) 38 hostprogs := tools/build !! 41 @echo Ready to install kernel in $(shell pwd)/vmlinux.gz 39 hostprogs += mkcpustr << 40 42 41 HOST_EXTRACFLAGS += -I$(srctree)/tools/include !! 43 # normally no need to build these: 42 -include include/generated !! 44 rawboot: vmlinux.nh tools/lxboot tools/bootlx 43 -D__EXPORTED_HEADERS__ << 44 45 45 $(obj)/cpu.o: $(obj)/cpustr.h !! 46 msb: tools/lxboot tools/bootlx vmlinux.nh >> 47 ( cat tools/lxboot tools/bootlx vmlinux.nh ) > /dev/rz0a >> 48 disklabel -rw rz0 'linux' tools/lxboot tools/bootlx 46 49 47 quiet_cmd_cpustr = CPUSTR $@ !! 50 bootimage: tools/mkbb tools/lxboot tools/bootlx vmlinux.nh 48 cmd_cpustr = $(obj)/mkcpustr > $@ !! 51 ( cat tools/lxboot tools/bootlx vmlinux.nh ) > bootimage 49 $(obj)/cpustr.h: $(obj)/mkcpustr FORCE !! 52 tools/mkbb bootimage tools/lxboot 50 $(call if_changed,cpustr) << 51 targets += cpustr.h << 52 53 53 # -------------------------------------------- !! 54 bootpfile: tools/bootph vmlinux.nh >> 55 cat tools/bootph vmlinux.nh > bootpfile >> 56 ifdef INITRD >> 57 cat $(INITRD) >> bootpfile >> 58 endif 54 59 55 KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP !! 60 bootpzfile: tools/bootpzh vmlinux.nh.gz 56 KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMB !! 61 cat tools/bootpzh vmlinux.nh.gz > bootpzfile 57 KBUILD_CFLAGS += $(call cc-option,-fmacro-pr !! 62 ifdef INITRD 58 KBUILD_CFLAGS += -fno-asynchronous-unwind-ta !! 63 cat $(INITRD) >> bootpzfile 59 KBUILD_CFLAGS += $(CONFIG_CC_IMPLICIT_FALLTH !! 64 endif 60 65 61 $(obj)/bzImage: asflags-y := $(SVGA_MODE) !! 66 srmboot: bootdevice bootimage >> 67 dd if=bootimage of=$(BOOTDEV) bs=512 seek=1 skip=1 >> 68 tools/mkbb $(BOOTDEV) tools/lxboot 62 69 63 quiet_cmd_image = BUILD $@ !! 70 bootdevice: 64 silent_redirect_image = >/dev/null !! 71 @test "$(BOOTDEV)" != "" || (echo You must specify BOOTDEV ; exit -1) 65 cmd_image = $(obj)/tools/build $(obj)/setup.bi << 66 $(obj)/zoffset. << 67 72 68 $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinu !! 73 vmlinux.gz: $(TOPDIR)/vmlinux 69 $(call if_changed,image) !! 74 gzip -fv9c $(TOPDIR)/vmlinux > vmlinux.gz 70 @$(kecho) 'Kernel: $@ is ready' ' (#'$ << 71 75 72 OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note !! 76 vmlinux.nh.gz: vmlinux.nh 73 $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux !! 77 gzip -fv9c vmlinux.nh > vmlinux.nh.gz 74 $(call if_changed,objcopy) << 75 78 76 SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) !! 79 main.o: ksize.h 77 80 78 sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z !! 81 bootp.o: ksize.h 79 82 80 quiet_cmd_zoffset = ZOFFSET $@ !! 83 bootpz.o: kzsize.h 81 cmd_zoffset = $(NM) $< | sed -n $(sed-zo << 82 84 83 targets += zoffset.h !! 85 ksize.h: vmlinux.nh dummy 84 $(obj)/zoffset.h: $(obj)/compressed/vmlinux FO !! 86 echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'`" > $@T 85 $(call if_changed,zoffset) !! 87 ifdef INITRD >> 88 [ ! \( -f $(INITRD) \) ] || exit 1 >> 89 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T >> 90 endif >> 91 cmp -s $@T $@ || mv -f $@T $@ >> 92 rm -f $@T 86 93 >> 94 kzsize.h: vmlinux.nh.gz dummy >> 95 echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'`" > $@T >> 96 echo "#define KERNEL_Z_SIZE `ls -l vmlinux.nh.gz | awk '{print $$5}'`" >> $@T >> 97 ifdef INITRD >> 98 [ -f $(INITRD) ] || exit 1 >> 99 echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T >> 100 endif >> 101 cmp -s $@T $@ || mv -f $@T $@ >> 102 rm -f $@T 87 103 88 AFLAGS_header.o += -I$(objtree)/$(obj) !! 104 vmlinux.nh: $(VMLINUX) $(OBJSTRIP) 89 $(obj)/header.o: $(obj)/zoffset.h !! 105 $(OBJSTRIP) -v $(VMLINUX) vmlinux.nh 90 106 91 LDFLAGS_setup.elf := -m elf_i386 -z noex !! 107 vmlinux: $(VMLINUX) 92 $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS !! 108 $(STRIP) -o vmlinux $(VMLINUX) 93 $(call if_changed,ld) << 94 109 95 OBJCOPYFLAGS_setup.bin := -O binary !! 110 tools/lxboot: $(OBJSTRIP) bootloader 96 $(obj)/setup.bin: $(obj)/setup.elf FORCE !! 111 $(OBJSTRIP) -p bootloader tools/lxboot 97 $(call if_changed,objcopy) << 98 112 99 $(obj)/compressed/vmlinux: FORCE !! 113 tools/bootlx: bootloader $(OBJSTRIP) 100 $(Q)$(MAKE) $(build)=$(obj)/compressed !! 114 $(OBJSTRIP) -vb bootloader tools/bootlx 101 115 102 # Set this if you want to pass append argument !! 116 tools/bootph: bootpheader $(OBJSTRIP) 103 # bzdisk/fdimage/hdimage/isoimage kernel !! 117 $(OBJSTRIP) -vb bootpheader tools/bootph 104 FDARGS = << 105 # Set this if you want one or more initrds inc << 106 FDINITRD = << 107 118 108 imgdeps = $(obj)/bzImage $(obj)/mtools.conf $( !! 119 tools/bootpzh: bootpzheader $(OBJSTRIP) >> 120 $(OBJSTRIP) -vb bootpzheader tools/bootpzh 109 121 110 $(obj)/mtools.conf: $(src)/mtools.conf.in !! 122 $(OBJSTRIP): $(OBJSTRIP).c 111 sed -e 's|@OBJ@|$(obj)|g' < $< > $@ !! 123 $(HOSTCC) $(HOSTCFLAGS) -I$(HPATH) $(OBJSTRIP).c -o $(OBJSTRIP) 112 124 113 targets += mtools.conf !! 125 tools/mkbb: tools/mkbb.c >> 126 $(HOSTCC) tools/mkbb.c -o tools/mkbb 114 127 115 # genimage.sh requires bash, but it also has a !! 128 bootloader: $(OBJECTS) 116 # external dependencies. !! 129 $(LD) $(LINKFLAGS) $(OBJECTS) $(LIBS) -o bootloader 117 quiet_cmd_genimage = GENIMAGE $3 << 118 cmd_genimage = $(BASH) $(src)/genimage.s << 119 $(obj)/mtools.conf '$(FDARGS)' << 120 130 121 PHONY += bzdisk fdimage fdimage144 fdimage288 !! 131 bootpheader: $(BPOBJECTS) >> 132 $(LD) $(LINKFLAGS) $(BPOBJECTS) $(LIBS) -o bootpheader 122 133 123 # This requires write access to /dev/fd0 !! 134 bootpzheader: $(BPZOBJECTS) 124 # All images require syslinux to be installed; !! 135 $(LD) $(LINKFLAGS) $(BPZOBJECTS) $(LIBS) -o bootpzheader 125 # EDK2/OVMF if the kernel is compiled with the << 126 bzdisk: $(imgdeps) << 127 $(call cmd,genimage,bzdisk,/dev/fd0) << 128 136 129 fdimage fdimage144: $(imgdeps) !! 137 misc.o: misc.c $(TOPDIR)/lib/inflate.c 130 $(call cmd,genimage,fdimage144,$(obj)/ << 131 @$(kecho) 'Kernel: $(obj)/fdimage is r << 132 138 133 fdimage288: $(imgdeps) !! 139 clean: 134 $(call cmd,genimage,fdimage288,$(obj)/ !! 140 rm -f $(TARGETS) bootloader bootimage bootpfile bootpheader 135 @$(kecho) 'Kernel: $(obj)/fdimage is r !! 141 rm -f tools/mkbb tools/bootlx tools/lxboot tools/bootph >> 142 rm -f vmlinux.nh ksize.h 136 143 137 hdimage: $(imgdeps) !! 144 dep: 138 $(call cmd,genimage,hdimage,$(obj)/hdi << 139 @$(kecho) 'Kernel: $(obj)/hdimage is r << 140 145 141 isoimage: $(imgdeps) !! 146 dummy: 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.