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