Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. # ROOT_DEV specifies the default root-device when making the image.
  11. # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
  12. # the default of FLOPPY is used by 'build'.
  13. ROOT_DEV := CURRENT
  14. # If you want to preset the SVGA mode, uncomment the next line and
  15. # set SVGA_MODE to whatever number you want.
  16. # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
  17. # The number is the same as you would ordinarily press at bootup.
  18. SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
  19. # If you want the RAM disk device, define this to be the size in blocks.
  20. #RAMDISK := -DRAMDISK=512
  21. targets := vmlinux.bin bootsect bootsect.o \
  22. setup setup.o bzImage mtools.conf
  23. EXTRA_CFLAGS := -m32
  24. hostprogs-y := tools/build
  25. HOST_EXTRACFLAGS += $(LINUXINCLUDE)
  26. subdir- := compressed/ #Let make clean descend in compressed/
  27. # ---------------------------------------------------------------------------
  28. $(obj)/bzImage: IMAGE_OFFSET := 0x100000
  29. $(obj)/bzImage: EXTRA_AFLAGS := -traditional $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
  30. $(obj)/bzImage: BUILDFLAGS := -b
  31. quiet_cmd_image = BUILD $@
  32. cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
  33. $(obj)/vmlinux.bin $(ROOT_DEV) > $@
  34. $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
  35. $(obj)/vmlinux.bin $(obj)/tools/build FORCE
  36. $(call if_changed,image)
  37. @echo 'Kernel: $@ is ready'
  38. $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
  39. $(call if_changed,objcopy)
  40. LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
  41. LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
  42. $(obj)/setup $(obj)/bootsect: %: %.o FORCE
  43. $(call if_changed,ld)
  44. $(obj)/compressed/vmlinux: FORCE
  45. $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
  46. # Set this if you want to pass append arguments to the zdisk/fdimage kernel
  47. FDARGS =
  48. $(obj)/mtools.conf: $(src)/mtools.conf.in
  49. sed -e 's|@OBJ@|$(obj)|g' < $< > $@
  50. # This requires write access to /dev/fd0
  51. zdisk: $(BOOTIMAGE) $(obj)/mtools.conf
  52. MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync
  53. syslinux /dev/fd0 ; sync
  54. echo 'default linux $(FDARGS)' | \
  55. MTOOLSRC=$(obj)/mtools.conf mcopy - a:syslinux.cfg
  56. MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync
  57. # These require being root or having syslinux 2.02 or higher installed
  58. fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf
  59. dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
  60. MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync
  61. syslinux $(obj)/fdimage ; sync
  62. echo 'default linux $(FDARGS)' | \
  63. MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg
  64. MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync
  65. fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf
  66. dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880
  67. MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync
  68. syslinux $(obj)/fdimage ; sync
  69. echo 'default linux $(FDARGS)' | \
  70. MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg
  71. MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync
  72. zlilo: $(BOOTIMAGE)
  73. if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
  74. if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
  75. cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz
  76. cp System.map $(INSTALL_PATH)/
  77. if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
  78. install: $(BOOTIMAGE)
  79. sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"