Makefile 4.8 KB

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