]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | # |
96ae6ea0 | 2 | # arch/x86/boot/Makefile |
1da177e4 LT |
3 | # |
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 | |
6 | # for more details. | |
7 | # | |
8 | # Copyright (C) 1994 by Linus Torvalds | |
9 | # | |
10 | ||
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 | |
13 | # the default of FLOPPY is used by 'build'. | |
14 | ||
15 | ROOT_DEV := CURRENT | |
16 | ||
17 | # If you want to preset the SVGA mode, uncomment the next line and | |
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. | |
20 | # The number is the same as you would ordinarily press at bootup. | |
21 | ||
22 | SVGA_MODE := -DSVGA_MODE=NORMAL_VGA | |
23 | ||
24 | # If you want the RAM disk device, define this to be the size in blocks. | |
25 | ||
26 | #RAMDISK := -DRAMDISK=512 | |
27 | ||
4fd06960 | 28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage |
f0be6c6a | 29 | subdir- := compressed |
1da177e4 | 30 | |
a6b68076 | 31 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o |
4fd06960 | 32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o |
e44b7b75 | 33 | setup-y += printf.o string.o tty.o video.o video-mode.o version.o |
a6b68076 | 34 | setup-$(CONFIG_X86_APM_BOOT) += apm.o |
4fd06960 PA |
35 | |
36 | # The link order of the video-*.o modules can matter. In particular, | |
37 | # video-vga.o *must* be listed first, followed by video-vesa.o. | |
38 | # Hardware-specific drivers should follow in the order they should be | |
39 | # probed, and video-bios.o should typically be last. | |
40 | setup-y += video-vga.o | |
41 | setup-y += video-vesa.o | |
42 | setup-y += video-bios.o | |
30c82645 | 43 | |
3fbc5416 | 44 | targets += $(setup-y) |
f0be6c6a | 45 | hostprogs-y := mkcpustr tools/build |
1da177e4 | 46 | |
f0be6c6a PA |
47 | HOST_EXTRACFLAGS += $(LINUXINCLUDE) |
48 | ||
49 | $(obj)/cpu.o: $(obj)/cpustr.h | |
50 | ||
51 | quiet_cmd_cpustr = CPUSTR $@ | |
52 | cmd_cpustr = $(obj)/mkcpustr > $@ | |
53 | targets += cpustr.h | |
54 | $(obj)/cpustr.h: $(obj)/mkcpustr FORCE | |
55 | $(call if_changed,cpustr) | |
1da177e4 LT |
56 | |
57 | # --------------------------------------------------------------------------- | |
58 | ||
4fd06960 PA |
59 | # How to compile the 16-bit code. Note we always compile for -march=i386, |
60 | # that way we can complain to the user if the CPU is insufficient. | |
a0f97e06 | 61 | KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ |
4fd06960 PA |
62 | -Wall -Wstrict-prototypes \ |
63 | -march=i386 -mregparm=3 \ | |
64 | -include $(srctree)/$(src)/code16gcc.h \ | |
65 | -fno-strict-aliasing -fomit-frame-pointer \ | |
66 | $(call cc-option, -ffreestanding) \ | |
67 | $(call cc-option, -fno-toplevel-reorder,\ | |
68 | $(call cc-option, -fno-unit-at-a-time)) \ | |
69 | $(call cc-option, -fno-stack-protector) \ | |
70 | $(call cc-option, -mpreferred-stack-boundary=2) | |
4ba7e5cd | 71 | KBUILD_CFLAGS += $(call cc-option,-m32) |
222d394d | 72 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
4fd06960 | 73 | |
7eebb934 | 74 | $(obj)/zImage: asflags-y := $(SVGA_MODE) $(RAMDISK) |
7eebb934 SR |
75 | $(obj)/bzImage: ccflags-y := -D__BIG_KERNEL__ |
76 | $(obj)/bzImage: asflags-y := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ | |
1da177e4 LT |
77 | $(obj)/bzImage: BUILDFLAGS := -b |
78 | ||
79 | quiet_cmd_image = BUILD $@ | |
4fd06960 | 80 | cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \ |
1da177e4 LT |
81 | $(obj)/vmlinux.bin $(ROOT_DEV) > $@ |
82 | ||
4fd06960 | 83 | $(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ |
1da177e4 LT |
84 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE |
85 | $(call if_changed,image) | |
2894801d | 86 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
1da177e4 | 87 | |
1622ac23 | 88 | OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S |
1da177e4 LT |
89 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE |
90 | $(call if_changed,objcopy) | |
91 | ||
4fd06960 | 92 | SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) |
1da177e4 | 93 | |
099e1377 IC |
94 | sed-offsets := -e 's/^00*/0/' \ |
95 | -e 's/^\([0-9a-fA-F]*\) . \(input_data\|input_data_end\)$$/\#define \2 0x\1/p' | |
96 | ||
97 | quiet_cmd_offsets = OFFSETS $@ | |
98 | cmd_offsets = $(NM) $< | sed -n $(sed-offsets) > $@ | |
99 | ||
100 | $(obj)/offsets.h: $(obj)/compressed/vmlinux FORCE | |
101 | $(call if_changed,offsets) | |
102 | ||
103 | targets += offsets.h | |
104 | ||
105 | AFLAGS_header.o += -I$(obj) | |
106 | $(obj)/header.o: $(obj)/offsets.h | |
107 | ||
4fd06960 PA |
108 | LDFLAGS_setup.elf := -T |
109 | $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE | |
1da177e4 LT |
110 | $(call if_changed,ld) |
111 | ||
4fd06960 | 112 | OBJCOPYFLAGS_setup.bin := -O binary |
4fd06960 PA |
113 | $(obj)/setup.bin: $(obj)/setup.elf FORCE |
114 | $(call if_changed,objcopy) | |
115 | ||
1da177e4 | 116 | $(obj)/compressed/vmlinux: FORCE |
d960c9ce | 117 | $(Q)$(MAKE) $(build)=$(obj)/compressed $@ |
1da177e4 | 118 | |
841b8a46 | 119 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel |
f0be6c6a | 120 | FDARGS = |
841b8a46 PA |
121 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel |
122 | FDINITRD = | |
123 | ||
124 | image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) | |
1da177e4 LT |
125 | |
126 | $(obj)/mtools.conf: $(src)/mtools.conf.in | |
127 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ | |
128 | ||
129 | # This requires write access to /dev/fd0 | |
130 | zdisk: $(BOOTIMAGE) $(obj)/mtools.conf | |
131 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync | |
132 | syslinux /dev/fd0 ; sync | |
841b8a46 | 133 | echo '$(image_cmdline)' | \ |
1da177e4 | 134 | MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg |
841b8a46 PA |
135 | if [ -f '$(FDINITRD)' ] ; then \ |
136 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ | |
137 | fi | |
1da177e4 LT |
138 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync |
139 | ||
140 | # These require being root or having syslinux 2.02 or higher installed | |
141 | fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf | |
142 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 | |
143 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync | |
144 | syslinux $(obj)/fdimage ; sync | |
841b8a46 | 145 | echo '$(image_cmdline)' | \ |
1da177e4 | 146 | MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg |
841b8a46 PA |
147 | if [ -f '$(FDINITRD)' ] ; then \ |
148 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ | |
149 | fi | |
1da177e4 LT |
150 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync |
151 | ||
152 | fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf | |
153 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 | |
154 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync | |
155 | syslinux $(obj)/fdimage ; sync | |
841b8a46 | 156 | echo '$(image_cmdline)' | \ |
1da177e4 | 157 | MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg |
841b8a46 PA |
158 | if [ -f '$(FDINITRD)' ] ; then \ |
159 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ | |
160 | fi | |
1da177e4 LT |
161 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync |
162 | ||
841b8a46 PA |
163 | isoimage: $(BOOTIMAGE) |
164 | -rm -rf $(obj)/isoimage | |
165 | mkdir $(obj)/isoimage | |
bf660254 AK |
166 | for i in lib lib64 share end ; do \ |
167 | if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \ | |
168 | cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \ | |
169 | break ; \ | |
170 | fi ; \ | |
171 | if [ $$i = end ] ; then exit 1 ; fi ; \ | |
172 | done | |
841b8a46 PA |
173 | cp $(BOOTIMAGE) $(obj)/isoimage/linux |
174 | echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg | |
175 | if [ -f '$(FDINITRD)' ] ; then \ | |
176 | cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ | |
177 | fi | |
178 | mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \ | |
179 | -no-emul-boot -boot-load-size 4 -boot-info-table \ | |
180 | $(obj)/isoimage | |
d2f37384 | 181 | isohybrid $(obj)/image.iso 2>/dev/null || true |
841b8a46 PA |
182 | rm -rf $(obj)/isoimage |
183 | ||
1da177e4 LT |
184 | zlilo: $(BOOTIMAGE) |
185 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi | |
186 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi | |
187 | cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz | |
188 | cp System.map $(INSTALL_PATH)/ | |
189 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | |
190 | ||
0d20babd | 191 | install: |
d274ba20 | 192 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" |