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