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