Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. subdir- := wakeup
  10. always := realmode.bin
  11. realmode-y += header.o
  12. realmode-y += trampoline_$(BITS).o
  13. realmode-y += stack.o
  14. realmode-$(CONFIG_X86_32) += reboot_32.o
  15. realmode-$(CONFIG_ACPI_SLEEP) += wakeup/wakeup.o
  16. targets += $(realmode-y)
  17. $(obj)/wakeup/wakeup.o: FORCE
  18. $(Q)$(MAKE) $(build)=$(obj)/wakeup $@
  19. REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
  20. sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
  21. quiet_cmd_pasyms = PASYMS $@
  22. cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \
  23. sed $(sed-pasyms) | sort | uniq > $@
  24. $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
  25. $(call if_changed,pasyms)
  26. $(obj)/realmode.lds: $(obj)/pasyms.h
  27. LDFLAGS_realmode.elf := --emit-relocs -T
  28. CPPFLAGS_realmode.lds += -P -C -I$(obj)
  29. $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
  30. $(call if_changed,ld)
  31. OBJCOPYFLAGS_realmode.bin := -O binary
  32. $(obj)/realmode.bin: $(obj)/realmode.elf
  33. $(call if_changed,objcopy)
  34. quiet_cmd_relocs = RELOCS $@
  35. cmd_relocs = scripts/x86-relocs --realmode $< > $@
  36. $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
  37. $(call if_changed,relocs)
  38. # ---------------------------------------------------------------------------
  39. # How to compile the 16-bit code. Note we always compile for -march=i386,
  40. # that way we can complain to the user if the CPU is insufficient.
  41. KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ \
  42. -DDISABLE_BRANCH_PROFILING \
  43. -Wall -Wstrict-prototypes \
  44. -march=i386 -mregparm=3 \
  45. -include $(srctree)/$(src)/../../boot/code16gcc.h \
  46. -fno-strict-aliasing -fomit-frame-pointer \
  47. $(call cc-option, -ffreestanding) \
  48. $(call cc-option, -fno-toplevel-reorder,\
  49. $(call cc-option, -fno-unit-at-a-time)) \
  50. $(call cc-option, -fno-stack-protector) \
  51. $(call cc-option, -mpreferred-stack-boundary=2)
  52. KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
  53. GCOV_PROFILE := n