Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #
  2. # arch/x86/realmode/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. #
  9. always := realmode.bin realmode.relocs
  10. wakeup-objs := wakeup_asm.o wakemain.o video-mode.o
  11. wakeup-objs += copy.o bioscall.o regs.o
  12. # The link order of the video-*.o modules can matter. In particular,
  13. # video-vga.o *must* be listed first, followed by video-vesa.o.
  14. # Hardware-specific drivers should follow in the order they should be
  15. # probed, and video-bios.o should typically be last.
  16. wakeup-objs += video-vga.o
  17. wakeup-objs += video-vesa.o
  18. wakeup-objs += video-bios.o
  19. realmode-y += header.o
  20. realmode-y += trampoline_$(BITS).o
  21. realmode-y += stack.o
  22. realmode-y += reboot.o
  23. realmode-$(CONFIG_ACPI_SLEEP) += $(wakeup-objs)
  24. targets += $(realmode-y)
  25. REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
  26. sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
  27. quiet_cmd_pasyms = PASYMS $@
  28. cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \
  29. sed $(sed-pasyms) | sort | uniq > $@
  30. targets += pasyms.h
  31. $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
  32. $(call if_changed,pasyms)
  33. targets += realmode.lds
  34. $(obj)/realmode.lds: $(obj)/pasyms.h
  35. LDFLAGS_realmode.elf := --emit-relocs -T
  36. CPPFLAGS_realmode.lds += -P -C -I$(obj)
  37. targets += realmode.elf
  38. $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
  39. $(call if_changed,ld)
  40. OBJCOPYFLAGS_realmode.bin := -O binary
  41. targets += realmode.bin
  42. $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs
  43. $(call if_changed,objcopy)
  44. quiet_cmd_relocs = RELOCS $@
  45. cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
  46. targets += realmode.relocs
  47. $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
  48. $(call if_changed,relocs)
  49. # ---------------------------------------------------------------------------
  50. # How to compile the 16-bit code. Note we always compile for -march=i386,
  51. # that way we can complain to the user if the CPU is insufficient.
  52. KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ -D_WAKEUP \
  53. -I$(srctree)/arch/x86/boot \
  54. -DDISABLE_BRANCH_PROFILING \
  55. -Wall -Wstrict-prototypes \
  56. -march=i386 -mregparm=3 \
  57. -include $(srctree)/$(src)/../../boot/code16gcc.h \
  58. -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
  59. $(call cc-option, -ffreestanding) \
  60. $(call cc-option, -fno-toplevel-reorder,\
  61. $(call cc-option, -fno-unit-at-a-time)) \
  62. $(call cc-option, -fno-stack-protector) \
  63. $(call cc-option, -mpreferred-stack-boundary=2)
  64. KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
  65. GCOV_PROFILE := n