Commit 3fbc54165d7217abf62b871c0dd074e76ce0eb31
Committed by
H. Peter Anvin
1 parent
8c027ae2dc
[PATCH] x86: do not recompile boot for each build
Keep the arch/i386/boot directory from being rebuilt every time. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Showing 1 changed file with 1 additions and 1 deletions Inline Diff
arch/i386/boot/Makefile
1 | # | 1 | # |
2 | # arch/i386/boot/Makefile | 2 | # arch/i386/boot/Makefile |
3 | # | 3 | # |
4 | # This file is subject to the terms and conditions of the GNU General Public | 4 | # This file is subject to the terms and conditions of the GNU General Public |
5 | # License. See the file "COPYING" in the main directory of this archive | 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 | # | 9 | # |
10 | 10 | ||
11 | # ROOT_DEV specifies the default root-device when making the image. | 11 | # ROOT_DEV specifies the default root-device when making the image. |
12 | # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case | 12 | # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case |
13 | # the default of FLOPPY is used by 'build'. | 13 | # the default of FLOPPY is used by 'build'. |
14 | 14 | ||
15 | ROOT_DEV := CURRENT | 15 | ROOT_DEV := CURRENT |
16 | 16 | ||
17 | # If you want to preset the SVGA mode, uncomment the next line and | 17 | # If you want to preset the SVGA mode, uncomment the next line and |
18 | # set SVGA_MODE to whatever number you want. | 18 | # set SVGA_MODE to whatever number you want. |
19 | # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. | 19 | # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. |
20 | # The number is the same as you would ordinarily press at bootup. | 20 | # The number is the same as you would ordinarily press at bootup. |
21 | 21 | ||
22 | SVGA_MODE := -DSVGA_MODE=NORMAL_VGA | 22 | SVGA_MODE := -DSVGA_MODE=NORMAL_VGA |
23 | 23 | ||
24 | # If you want the RAM disk device, define this to be the size in blocks. | 24 | # If you want the RAM disk device, define this to be the size in blocks. |
25 | 25 | ||
26 | #RAMDISK := -DRAMDISK=512 | 26 | #RAMDISK := -DRAMDISK=512 |
27 | 27 | ||
28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage | 28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage |
29 | subdir- := compressed | 29 | subdir- := compressed |
30 | 30 | ||
31 | setup-y += a20.o apm.o cmdline.o copy.o cpu.o cpucheck.o edd.o | 31 | setup-y += a20.o apm.o cmdline.o copy.o cpu.o cpucheck.o edd.o |
32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o | 32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o |
33 | setup-y += printf.o string.o tty.o video.o version.o voyager.o | 33 | setup-y += printf.o string.o tty.o video.o version.o voyager.o |
34 | 34 | ||
35 | # The link order of the video-*.o modules can matter. In particular, | 35 | # The link order of the video-*.o modules can matter. In particular, |
36 | # video-vga.o *must* be listed first, followed by video-vesa.o. | 36 | # video-vga.o *must* be listed first, followed by video-vesa.o. |
37 | # Hardware-specific drivers should follow in the order they should be | 37 | # Hardware-specific drivers should follow in the order they should be |
38 | # probed, and video-bios.o should typically be last. | 38 | # probed, and video-bios.o should typically be last. |
39 | setup-y += video-vga.o | 39 | setup-y += video-vga.o |
40 | setup-y += video-vesa.o | 40 | setup-y += video-vesa.o |
41 | setup-y += video-bios.o | 41 | setup-y += video-bios.o |
42 | 42 | targets += $(setup-y) | |
43 | hostprogs-y := tools/build | 43 | hostprogs-y := tools/build |
44 | 44 | ||
45 | HOSTCFLAGS_build.o := $(LINUXINCLUDE) | 45 | HOSTCFLAGS_build.o := $(LINUXINCLUDE) |
46 | 46 | ||
47 | # --------------------------------------------------------------------------- | 47 | # --------------------------------------------------------------------------- |
48 | 48 | ||
49 | # How to compile the 16-bit code. Note we always compile for -march=i386, | 49 | # How to compile the 16-bit code. Note we always compile for -march=i386, |
50 | # that way we can complain to the user if the CPU is insufficient. | 50 | # that way we can complain to the user if the CPU is insufficient. |
51 | cflags-i386 := | 51 | cflags-i386 := |
52 | cflags-x86_64 := -m32 | 52 | cflags-x86_64 := -m32 |
53 | CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ | 53 | CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ |
54 | $(cflags-$(ARCH)) \ | 54 | $(cflags-$(ARCH)) \ |
55 | -Wall -Wstrict-prototypes \ | 55 | -Wall -Wstrict-prototypes \ |
56 | -march=i386 -mregparm=3 \ | 56 | -march=i386 -mregparm=3 \ |
57 | -include $(srctree)/$(src)/code16gcc.h \ | 57 | -include $(srctree)/$(src)/code16gcc.h \ |
58 | -fno-strict-aliasing -fomit-frame-pointer \ | 58 | -fno-strict-aliasing -fomit-frame-pointer \ |
59 | $(call cc-option, -ffreestanding) \ | 59 | $(call cc-option, -ffreestanding) \ |
60 | $(call cc-option, -fno-toplevel-reorder,\ | 60 | $(call cc-option, -fno-toplevel-reorder,\ |
61 | $(call cc-option, -fno-unit-at-a-time)) \ | 61 | $(call cc-option, -fno-unit-at-a-time)) \ |
62 | $(call cc-option, -fno-stack-protector) \ | 62 | $(call cc-option, -fno-stack-protector) \ |
63 | $(call cc-option, -mpreferred-stack-boundary=2) | 63 | $(call cc-option, -mpreferred-stack-boundary=2) |
64 | AFLAGS := $(CFLAGS) -D__ASSEMBLY__ | 64 | AFLAGS := $(CFLAGS) -D__ASSEMBLY__ |
65 | 65 | ||
66 | $(obj)/zImage: IMAGE_OFFSET := 0x1000 | 66 | $(obj)/zImage: IMAGE_OFFSET := 0x1000 |
67 | $(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) | 67 | $(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) |
68 | $(obj)/bzImage: IMAGE_OFFSET := 0x100000 | 68 | $(obj)/bzImage: IMAGE_OFFSET := 0x100000 |
69 | $(obj)/bzImage: EXTRA_CFLAGS := -D__BIG_KERNEL__ | 69 | $(obj)/bzImage: EXTRA_CFLAGS := -D__BIG_KERNEL__ |
70 | $(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ | 70 | $(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ |
71 | $(obj)/bzImage: BUILDFLAGS := -b | 71 | $(obj)/bzImage: BUILDFLAGS := -b |
72 | 72 | ||
73 | quiet_cmd_image = BUILD $@ | 73 | quiet_cmd_image = BUILD $@ |
74 | cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \ | 74 | cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \ |
75 | $(obj)/vmlinux.bin $(ROOT_DEV) > $@ | 75 | $(obj)/vmlinux.bin $(ROOT_DEV) > $@ |
76 | 76 | ||
77 | $(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ | 77 | $(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ |
78 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE | 78 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE |
79 | $(call if_changed,image) | 79 | $(call if_changed,image) |
80 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' | 80 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
81 | 81 | ||
82 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE | 82 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE |
83 | $(call if_changed,objcopy) | 83 | $(call if_changed,objcopy) |
84 | 84 | ||
85 | SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) | 85 | SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) |
86 | 86 | ||
87 | LDFLAGS_setup.elf := -T | 87 | LDFLAGS_setup.elf := -T |
88 | $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE | 88 | $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE |
89 | $(call if_changed,ld) | 89 | $(call if_changed,ld) |
90 | 90 | ||
91 | OBJCOPYFLAGS_setup.bin := -O binary | 91 | OBJCOPYFLAGS_setup.bin := -O binary |
92 | 92 | ||
93 | $(obj)/setup.bin: $(obj)/setup.elf FORCE | 93 | $(obj)/setup.bin: $(obj)/setup.elf FORCE |
94 | $(call if_changed,objcopy) | 94 | $(call if_changed,objcopy) |
95 | 95 | ||
96 | $(obj)/compressed/vmlinux: FORCE | 96 | $(obj)/compressed/vmlinux: FORCE |
97 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ | 97 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ |
98 | 98 | ||
99 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel | 99 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel |
100 | FDARGS = | 100 | FDARGS = |
101 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel | 101 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel |
102 | FDINITRD = | 102 | FDINITRD = |
103 | 103 | ||
104 | image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) | 104 | image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) |
105 | 105 | ||
106 | $(obj)/mtools.conf: $(src)/mtools.conf.in | 106 | $(obj)/mtools.conf: $(src)/mtools.conf.in |
107 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ | 107 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ |
108 | 108 | ||
109 | # This requires write access to /dev/fd0 | 109 | # This requires write access to /dev/fd0 |
110 | zdisk: $(BOOTIMAGE) $(obj)/mtools.conf | 110 | zdisk: $(BOOTIMAGE) $(obj)/mtools.conf |
111 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync | 111 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync |
112 | syslinux /dev/fd0 ; sync | 112 | syslinux /dev/fd0 ; sync |
113 | echo '$(image_cmdline)' | \ | 113 | echo '$(image_cmdline)' | \ |
114 | MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg | 114 | MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg |
115 | if [ -f '$(FDINITRD)' ] ; then \ | 115 | if [ -f '$(FDINITRD)' ] ; then \ |
116 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ | 116 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ |
117 | fi | 117 | fi |
118 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync | 118 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync |
119 | 119 | ||
120 | # These require being root or having syslinux 2.02 or higher installed | 120 | # These require being root or having syslinux 2.02 or higher installed |
121 | fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf | 121 | fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf |
122 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 | 122 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 |
123 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync | 123 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync |
124 | syslinux $(obj)/fdimage ; sync | 124 | syslinux $(obj)/fdimage ; sync |
125 | echo '$(image_cmdline)' | \ | 125 | echo '$(image_cmdline)' | \ |
126 | MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg | 126 | MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg |
127 | if [ -f '$(FDINITRD)' ] ; then \ | 127 | if [ -f '$(FDINITRD)' ] ; then \ |
128 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ | 128 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ |
129 | fi | 129 | fi |
130 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync | 130 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync |
131 | 131 | ||
132 | fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf | 132 | fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf |
133 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 | 133 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 |
134 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync | 134 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync |
135 | syslinux $(obj)/fdimage ; sync | 135 | syslinux $(obj)/fdimage ; sync |
136 | echo '$(image_cmdline)' | \ | 136 | echo '$(image_cmdline)' | \ |
137 | MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg | 137 | MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg |
138 | if [ -f '$(FDINITRD)' ] ; then \ | 138 | if [ -f '$(FDINITRD)' ] ; then \ |
139 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ | 139 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ |
140 | fi | 140 | fi |
141 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync | 141 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync |
142 | 142 | ||
143 | isoimage: $(BOOTIMAGE) | 143 | isoimage: $(BOOTIMAGE) |
144 | -rm -rf $(obj)/isoimage | 144 | -rm -rf $(obj)/isoimage |
145 | mkdir $(obj)/isoimage | 145 | mkdir $(obj)/isoimage |
146 | for i in lib lib64 share end ; do \ | 146 | for i in lib lib64 share end ; do \ |
147 | if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \ | 147 | if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \ |
148 | cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \ | 148 | cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \ |
149 | break ; \ | 149 | break ; \ |
150 | fi ; \ | 150 | fi ; \ |
151 | if [ $$i = end ] ; then exit 1 ; fi ; \ | 151 | if [ $$i = end ] ; then exit 1 ; fi ; \ |
152 | done | 152 | done |
153 | cp $(BOOTIMAGE) $(obj)/isoimage/linux | 153 | cp $(BOOTIMAGE) $(obj)/isoimage/linux |
154 | echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg | 154 | echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg |
155 | if [ -f '$(FDINITRD)' ] ; then \ | 155 | if [ -f '$(FDINITRD)' ] ; then \ |
156 | cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ | 156 | cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ |
157 | fi | 157 | fi |
158 | mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \ | 158 | mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \ |
159 | -no-emul-boot -boot-load-size 4 -boot-info-table \ | 159 | -no-emul-boot -boot-load-size 4 -boot-info-table \ |
160 | $(obj)/isoimage | 160 | $(obj)/isoimage |
161 | rm -rf $(obj)/isoimage | 161 | rm -rf $(obj)/isoimage |
162 | 162 | ||
163 | zlilo: $(BOOTIMAGE) | 163 | zlilo: $(BOOTIMAGE) |
164 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi | 164 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi |
165 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi | 165 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi |
166 | cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz | 166 | cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz |
167 | cp System.map $(INSTALL_PATH)/ | 167 | cp System.map $(INSTALL_PATH)/ |
168 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | 168 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi |
169 | 169 | ||
170 | install: | 170 | install: |
171 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" | 171 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" |
172 | 172 |