Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | # |
2 | # arch/i386/boot/Makefile | |
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 | ||
f4549448 DP |
28 | targets := vmlinux.bin bootsect bootsect.o \ |
29 | setup setup.o zImage bzImage | |
1da177e4 LT |
30 | subdir- := compressed |
31 | ||
32 | hostprogs-y := tools/build | |
33 | ||
34 | HOSTCFLAGS_build.o := $(LINUXINCLUDE) | |
35 | ||
36 | # --------------------------------------------------------------------------- | |
37 | ||
38 | $(obj)/zImage: IMAGE_OFFSET := 0x1000 | |
484ad393 | 39 | $(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) |
1da177e4 | 40 | $(obj)/bzImage: IMAGE_OFFSET := 0x100000 |
484ad393 | 41 | $(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__ |
1da177e4 LT |
42 | $(obj)/bzImage: BUILDFLAGS := -b |
43 | ||
44 | quiet_cmd_image = BUILD $@ | |
45 | cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \ | |
46 | $(obj)/vmlinux.bin $(ROOT_DEV) > $@ | |
47 | ||
48 | $(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \ | |
49 | $(obj)/vmlinux.bin $(obj)/tools/build FORCE | |
50 | $(call if_changed,image) | |
2894801d | 51 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
1da177e4 LT |
52 | |
53 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE | |
54 | $(call if_changed,objcopy) | |
55 | ||
56 | LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary | |
57 | LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext | |
58 | ||
59 | $(obj)/setup $(obj)/bootsect: %: %.o FORCE | |
60 | $(call if_changed,ld) | |
61 | ||
62 | $(obj)/compressed/vmlinux: FORCE | |
63 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ | |
64 | ||
841b8a46 | 65 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel |
1da177e4 | 66 | FDARGS = |
841b8a46 PA |
67 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel |
68 | FDINITRD = | |
69 | ||
70 | image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,) | |
1da177e4 LT |
71 | |
72 | $(obj)/mtools.conf: $(src)/mtools.conf.in | |
73 | sed -e 's|@OBJ@|$(obj)|g' < $< > $@ | |
74 | ||
75 | # This requires write access to /dev/fd0 | |
76 | zdisk: $(BOOTIMAGE) $(obj)/mtools.conf | |
77 | MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync | |
78 | syslinux /dev/fd0 ; sync | |
841b8a46 | 79 | echo '$(image_cmdline)' | \ |
1da177e4 | 80 | MTOOLSRC=$(src)/mtools.conf mcopy - a:syslinux.cfg |
841b8a46 PA |
81 | if [ -f '$(FDINITRD)' ] ; then \ |
82 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \ | |
83 | fi | |
1da177e4 LT |
84 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync |
85 | ||
86 | # These require being root or having syslinux 2.02 or higher installed | |
87 | fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf | |
88 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440 | |
89 | MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync | |
90 | syslinux $(obj)/fdimage ; sync | |
841b8a46 | 91 | echo '$(image_cmdline)' | \ |
1da177e4 | 92 | MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg |
841b8a46 PA |
93 | if [ -f '$(FDINITRD)' ] ; then \ |
94 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \ | |
95 | fi | |
1da177e4 LT |
96 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync |
97 | ||
98 | fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf | |
99 | dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880 | |
100 | MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync | |
101 | syslinux $(obj)/fdimage ; sync | |
841b8a46 | 102 | echo '$(image_cmdline)' | \ |
1da177e4 | 103 | MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg |
841b8a46 PA |
104 | if [ -f '$(FDINITRD)' ] ; then \ |
105 | MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \ | |
106 | fi | |
1da177e4 LT |
107 | MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync |
108 | ||
841b8a46 PA |
109 | isoimage: $(BOOTIMAGE) |
110 | -rm -rf $(obj)/isoimage | |
111 | mkdir $(obj)/isoimage | |
bf660254 AK |
112 | for i in lib lib64 share end ; do \ |
113 | if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \ | |
114 | cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \ | |
115 | break ; \ | |
116 | fi ; \ | |
117 | if [ $$i = end ] ; then exit 1 ; fi ; \ | |
118 | done | |
841b8a46 PA |
119 | cp $(BOOTIMAGE) $(obj)/isoimage/linux |
120 | echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg | |
121 | if [ -f '$(FDINITRD)' ] ; then \ | |
122 | cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \ | |
123 | fi | |
124 | mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \ | |
125 | -no-emul-boot -boot-load-size 4 -boot-info-table \ | |
126 | $(obj)/isoimage | |
127 | rm -rf $(obj)/isoimage | |
128 | ||
1da177e4 LT |
129 | zlilo: $(BOOTIMAGE) |
130 | if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi | |
131 | if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi | |
132 | cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz | |
133 | cp System.map $(INSTALL_PATH)/ | |
134 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | |
135 | ||
0d20babd | 136 | install: |
d274ba20 | 137 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" |