Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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' ' (#'`cat .version`')'
  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/isoimage kernel
  47. FDARGS =
  48. # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel
  49. FDINITRD =
  50. image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,)
  51. $(obj)/mtools.conf: $(src)/mtools.conf.in
  52. sed -e 's|@OBJ@|$(obj)|g' < $< > $@
  53. # This requires write access to /dev/fd0
  54. zdisk: $(BOOTIMAGE) $(obj)/mtools.conf
  55. MTOOLSRC=$(obj)/mtools.conf mformat a: ; sync
  56. syslinux /dev/fd0 ; sync
  57. echo '$(image_cmdline)' | \
  58. MTOOLSRC=$(obj)/mtools.conf mcopy - a:syslinux.cfg
  59. if [ -f '$(FDINITRD)' ] ; then \
  60. MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' a:initrd.img ; \
  61. fi
  62. MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) a:linux ; sync
  63. # These require being root or having syslinux 2.02 or higher installed
  64. fdimage fdimage144: $(BOOTIMAGE) $(obj)/mtools.conf
  65. dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=1440
  66. MTOOLSRC=$(obj)/mtools.conf mformat v: ; sync
  67. syslinux $(obj)/fdimage ; sync
  68. echo '$(image_cmdline)' | \
  69. MTOOLSRC=$(obj)/mtools.conf mcopy - v:syslinux.cfg
  70. if [ -f '$(FDINITRD)' ] ; then \
  71. MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' v:initrd.img ; \
  72. fi
  73. MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) v:linux ; sync
  74. fdimage288: $(BOOTIMAGE) $(obj)/mtools.conf
  75. dd if=/dev/zero of=$(obj)/fdimage bs=1024 count=2880
  76. MTOOLSRC=$(obj)/mtools.conf mformat w: ; sync
  77. syslinux $(obj)/fdimage ; sync
  78. echo '$(image_cmdline)' | \
  79. MTOOLSRC=$(obj)/mtools.conf mcopy - w:syslinux.cfg
  80. if [ -f '$(FDINITRD)' ] ; then \
  81. MTOOLSRC=$(obj)/mtools.conf mcopy '$(FDINITRD)' w:initrd.img ; \
  82. fi
  83. MTOOLSRC=$(obj)/mtools.conf mcopy $(BOOTIMAGE) w:linux ; sync
  84. isoimage: $(BOOTIMAGE)
  85. -rm -rf $(obj)/isoimage
  86. mkdir $(obj)/isoimage
  87. for i in lib lib64 share end ; do \
  88. if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \
  89. cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \
  90. break ; \
  91. fi ; \
  92. if [ $$i = end ] ; then exit 1 ; fi ; \
  93. done
  94. cp $(BOOTIMAGE) $(obj)/isoimage/linux
  95. echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg
  96. if [ -f '$(FDINITRD)' ] ; then \
  97. cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \
  98. fi
  99. mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \
  100. -no-emul-boot -boot-load-size 4 -boot-info-table \
  101. $(obj)/isoimage
  102. rm -rf $(obj)/isoimage
  103. zlilo: $(BOOTIMAGE)
  104. if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi
  105. if [ -f $(INSTALL_PATH)/System.map ]; then mv $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
  106. cat $(BOOTIMAGE) > $(INSTALL_PATH)/vmlinuz
  107. cp System.map $(INSTALL_PATH)/
  108. if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
  109. install:
  110. sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"