Makefile 2.1 KB

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