Makefile 2.5 KB

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