Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #
  2. # arch/alpha/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. hostprogs-y := tools/mkbb tools/objstrip
  11. targets := vmlinux.gz vmlinux \
  12. vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
  13. tools/bootpzh bootloader bootpheader bootpzheader
  14. OBJSTRIP := $(obj)/tools/objstrip
  15. HOSTCFLAGS := -Wall -I$(objtree)/usr/include
  16. BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj)
  17. # SRM bootable image. Copy to offset 512 of a partition.
  18. $(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh
  19. ( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@
  20. $(obj)/tools/mkbb $@ $(obj)/tools/lxboot
  21. @echo ' Bootimage $@ is ready'
  22. # BOOTP bootable image. Define INITRD during make to append initrd image.
  23. $(obj)/bootpfile: $(obj)/tools/bootph $(obj)/vmlinux.nh
  24. cat $(obj)/tools/bootph $(obj)/vmlinux.nh > $@
  25. ifdef INITRD
  26. cat $(INITRD) >> $@
  27. endif
  28. # Compressed kernel BOOTP bootable image.
  29. # Define INITRD during make to append initrd image.
  30. $(obj)/bootpzfile: $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz
  31. cat $(obj)/tools/bootpzh $(obj)/vmlinux.nh.gz > $@
  32. ifdef INITRD
  33. cat $(INITRD) >> $@
  34. endif
  35. # Compressed kernel image
  36. $(obj)/vmlinux.gz: $(obj)/vmlinux FORCE
  37. $(call if_changed,gzip)
  38. @echo ' Kernel $@ is ready'
  39. $(obj)/main.o: $(obj)/ksize.h
  40. $(obj)/bootp.o: $(obj)/ksize.h
  41. $(obj)/bootpz.o: $(obj)/kzsize.h
  42. $(obj)/ksize.h: $(obj)/vmlinux.nh FORCE
  43. echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
  44. ifdef INITRD
  45. [ -f $(INITRD) ] || exit 1
  46. echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
  47. endif
  48. cmp -s $@T $@ || mv -f $@T $@
  49. rm -f $@T
  50. $(obj)/kzsize.h: $(obj)/vmlinux.nh.gz FORCE
  51. echo "#define KERNEL_SIZE `ls -l $(obj)/vmlinux.nh | awk '{print $$5}'`" > $@T
  52. echo "#define KERNEL_Z_SIZE `ls -l $(obj)/vmlinux.nh.gz | awk '{print $$5}'`" >> $@T
  53. ifdef INITRD
  54. [ -f $(INITRD) ] || exit 1
  55. echo "#define INITRD_IMAGE_SIZE `ls -l $(INITRD) | awk '{print $$5}'`" >> $@T
  56. endif
  57. cmp -s $@T $@ || mv -f $@T $@
  58. rm -f $@T
  59. quiet_cmd_strip = STRIP $@
  60. cmd_strip = $(STRIP) -o $@ $<
  61. $(obj)/vmlinux: vmlinux FORCE
  62. $(call if_changed,strip)
  63. quiet_cmd_objstrip = OBJSTRIP $@
  64. cmd_objstrip = $(OBJSTRIP) $(OSFLAGS_$(@F)) $< $@
  65. OSFLAGS_vmlinux.nh := -v
  66. OSFLAGS_lxboot := -p
  67. OSFLAGS_bootlx := -vb
  68. OSFLAGS_bootph := -vb
  69. OSFLAGS_bootpzh := -vb
  70. $(obj)/vmlinux.nh: vmlinux $(OBJSTRIP) FORCE
  71. $(call if_changed,objstrip)
  72. $(obj)/vmlinux.nh.gz: $(obj)/vmlinux.nh FORCE
  73. $(call if_changed,gzip)
  74. $(obj)/tools/lxboot: $(obj)/bootloader $(OBJSTRIP) FORCE
  75. $(call if_changed,objstrip)
  76. $(obj)/tools/bootlx: $(obj)/bootloader $(OBJSTRIP) FORCE
  77. $(call if_changed,objstrip)
  78. $(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE
  79. $(call if_changed,objstrip)
  80. $(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE
  81. $(call if_changed,objstrip)
  82. LDFLAGS_bootloader := -static -T # -N -relax
  83. LDFLAGS_bootloader := -static -T # -N -relax
  84. LDFLAGS_bootpheader := -static -T # -N -relax
  85. LDFLAGS_bootpzheader := -static -T # -N -relax
  86. OBJ_bootlx := $(obj)/head.o $(obj)/stdio.o $(obj)/main.o
  87. OBJ_bootph := $(obj)/head.o $(obj)/stdio.o $(obj)/bootp.o
  88. OBJ_bootpzh := $(obj)/head.o $(obj)/stdio.o $(obj)/bootpz.o $(obj)/misc.o
  89. $(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE
  90. $(call if_changed,ld)
  91. $(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE
  92. $(call if_changed,ld)
  93. $(obj)/bootpzheader: $(obj)/bootloader.lds $(OBJ_bootpzh) $(LIBS_Y) FORCE
  94. $(call if_changed,ld)
  95. $(obj)/misc.o: lib/inflate.c