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 |
1da177e4 LT |
29 | subdir- := compressed |
30 | ||
4fd06960 PA |
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 | |
33 | setup-y += printf.o string.o tty.o video.o version.o voyager.o | |
34 | ||
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. | |
37 | # Hardware-specific drivers should follow in the order they should be | |
38 | # probed, and video-bios.o should typically be last. | |
39 | setup-y += video-vga.o | |
40 | setup-y += video-vesa.o | |
41 | setup-y += video-bios.o | |
30c82645 | 42 | |
3fbc5416 | 43 | targets += $(setup-y) |
1da177e4 LT |
44 | hostprogs-y := tools/build |
45 | ||
46 | HOSTCFLAGS_build.o := $(LINUXINCLUDE) | |
47 | ||
48 | # --------------------------------------------------------------------------- | |
49 | ||
4fd06960 PA |
50 | # How to compile the 16-bit code. Note we always compile for -march=i386, |
51 | # that way we can complain to the user if the CPU is insufficient. | |
a0f97e06 | 52 | KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ |
4fd06960 PA |
53 | -Wall -Wstrict-prototypes \ |
54 | -march=i386 -mregparm=3 \ | |
55 | -include $(srctree)/$(src)/code16gcc.h \ | |
56 | -fno-strict-aliasing -fomit-frame-pointer \ | |
57 | $(call cc-option, -ffreestanding) \ | |
58 | $(call cc-option, -fno-toplevel-reorder,\ | |
59 | $(call cc-option, -fno-unit-at-a-time)) \ | |
60 | $(call cc-option, -fno-stack-protector) \ | |
61 | $(call cc-option, -mpreferred-stack-boundary=2) | |
4ba7e5cd | 62 | KBUILD_CFLAGS += $(call cc-option,-m32) |
222d394d | 63 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
4fd06960 | 64 | |
1da177e4 | 65 | $(obj)/zImage: IMAGE_OFFSET := 0x1000 |
7eebb934 | 66 | $(obj)/zImage: asflags-y := $(SVGA_MODE) $(RAMDISK) |
1da177e4 | 67 | $(obj)/bzImage: IMAGE_OFFSET := 0x100000 |
7eebb934 SR |
68 | $(obj)/bzImage: ccflags-y := -D__BIG_KERNEL__ |
69 | $(obj)/bzImage: asflags-y := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ | |
1da177e4 LT |
70 | $(obj)/bzImage: BUILDFLAGS := -b |
71 | ||
72 | quiet_cmd_image = BUILD $@ | |
4fd06960 | 73 | cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \ |
1da177e4 LT |
74 | $(obj)/vmlinux.bin $(ROOT_DEV) > $@ |
75 | ||
4fd06960 | 76 | $(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ |
1da177e4 LT |
77 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE |
78 | $(call if_changed,image) | |
2894801d | 79 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
1da177e4 LT |
80 | |
81 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE | |
82 | $(call if_changed,objcopy) | |
83 | ||
4fd06960 | 84 | SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) |
1da177e4 | 85 | |
4fd06960 PA |
86 | LDFLAGS_setup.elf := -T |
87 | $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE | |
1da177e4 LT |
88 | $(call if_changed,ld) |
89 | ||
4fd06960 PA |
90 | OBJCOPYFLAGS_setup.bin := -O binary |
91 | ||
92 | $(obj)/setup.bin: $(obj)/setup.elf FORCE | |
93 | $(call if_changed,objcopy) | |
94 | ||
1da177e4 LT |
95 | $(obj)/compressed/vmlinux: FORCE |
96 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ | |
97 | ||
841b8a46 | 98 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel |
1da177e4 | 99 | FDARGS = |
841b8a46 PA |
100 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel |
101 | FDINITRD = | |
102 | ||
103 | image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) | |
1da177e4 LT |
104 | |
105 | $(obj)/mtools.conf: $(src)/mtools.conf.in | |
106 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ | |
107 | ||
108 | # This requires write access to /dev/fd0 | |
109 | zdisk: $(BOOTIMAGE) $(obj)/mtools.conf | |
110 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync | |
111 | syslinux /dev/fd0 ; sync | |
841b8a46 | 112 | echo '$(image_cmdline)' | \ |
1da177e4 | 113 | MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg |
841b8a46 PA |
114 | if [ -f '$(FDINITRD)' ] ; then \ |
115 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ | |
116 | fi | |
1da177e4 LT |
117 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync |
118 | ||
119 | # These require being root or having syslinux 2.02 or higher installed | |
120 | fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf | |
121 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 | |
122 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync | |
123 | syslinux $(obj)/fdimage ; sync | |
841b8a46 | 124 | echo '$(image_cmdline)' | \ |
1da177e4 | 125 | MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg |
841b8a46 PA |
126 | if [ -f '$(FDINITRD)' ] ; then \ |
127 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ | |
128 | fi | |
1da177e4 LT |
129 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync |
130 | ||
131 | fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf | |
132 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 | |
133 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync | |
134 | syslinux $(obj)/fdimage ; sync | |
841b8a46 | 135 | echo '$(image_cmdline)' | \ |
1da177e4 | 136 | MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg |
841b8a46 PA |
137 | if [ -f '$(FDINITRD)' ] ; then \ |
138 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ | |
139 | fi | |
1da177e4 LT |
140 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync |
141 | ||
841b8a46 PA |
142 | isoimage: $(BOOTIMAGE) |
143 | -rm -rf $(obj)/isoimage | |
144 | mkdir $(obj)/isoimage | |
bf660254 AK |
145 | for i in lib lib64 share end ; do \ |
146 | if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \ | |
147 | cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \ | |
148 | break ; \ | |
149 | fi ; \ | |
150 | if [ $$i = end ] ; then exit 1 ; fi ; \ | |
151 | done | |
841b8a46 PA |
152 | cp $(BOOTIMAGE) $(obj)/isoimage/linux |
153 | echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg | |
154 | if [ -f '$(FDINITRD)' ] ; then \ | |
155 | cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ | |
156 | fi | |
157 | mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \ | |
158 | -no-emul-boot -boot-load-size 4 -boot-info-table \ | |
159 | $(obj)/isoimage | |
160 | rm -rf $(obj)/isoimage | |
161 | ||
1da177e4 LT |
162 | zlilo: $(BOOTIMAGE) |
163 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi | |
164 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi | |
165 | cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz | |
166 | cp System.map $(INSTALL_PATH)/ | |
167 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | |
168 | ||
0d20babd | 169 | install: |
d274ba20 | 170 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" |