Makefile 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # $Id: Makefile 400 2009-05-01 20:13:27Z wbx $
  2. #-
  3. # This file is part of the OpenADK project. OpenADK is copyrighted
  4. # material, please see the LICENCE file in the top-level directory.
  5. include $(TOPDIR)/rules.mk
  6. include $(TOPDIR)/mk/rootfs.mk
  7. all: install
  8. ### Kernel .config Creation
  9. # The following target combines all kernel-related variables and
  10. # config files into a single one to be used as the final kernel
  11. # configuration when building. This is how it's done:
  12. # 1) fetch all ADK_KPACKAGE_KMOD_* vars into
  13. # .kernelconfig.modules and set them to "m"
  14. # 2) fetch all enabled ADK_KERNEL_* vars into
  15. # .kernelconfig.kernel (no conversion, as they are booleans)
  16. # 3) repeat 2) for the disabled ones and save them into
  17. # .kernelconfig.nokernel (to overwrite defaults)
  18. # 4) get the device-specific static kernel config and place it into
  19. # .kernelconfig.board
  20. # 5) prepare for merging:
  21. # * if a variable is disabled in .kernelconfig.board and
  22. # enabled in either of .kernelconfig.{modules,kernel},
  23. # remove it from .kernelconfig.board
  24. # * append ${FS_CMDLINE} to the kernel commandline inside
  25. # .kernelconfig.board
  26. # 6) merge (cat) it all together into .kernelconfig.tmp
  27. # 7) check if .kernelconfig.tmp differs from the current one
  28. # (.kernelconfig) at all, overwriting the current one
  29. # only if it does (so the timestamp stays intact)
  30. # 8) remove the temporary .kernelconfig.tmp
  31. ###
  32. config-prepare: $(TOPDIR)/.config
  33. sed -n '/^ADK_KPACKAGE_KMOD/s//CONFIG/p' ${TOPDIR}/.config | \
  34. sed 's/=y/=m/' >${BUILD_DIR}/.kernelconfig.modules
  35. sed -n '/^ADK_KERNEL/s//CONFIG/p' ${TOPDIR}/.config \
  36. >${BUILD_DIR}/.kernelconfig.kernel
  37. sed -n '/^ADK_MOD_KERNEL/s//CONFIG/p' ${TOPDIR}/.config | \
  38. sed 's/=y/=m/' >${BUILD_DIR}/.kernelconfig.modkernel
  39. sed -n '/^# ADK_KERNEL/s//# CONFIG/p' ${TOPDIR}/.config \
  40. >${BUILD_DIR}/.kernelconfig.nokernel
  41. cp ${DEVICE}/kernel.config ${BUILD_DIR}/.kernelconfig.board
  42. (cat ${BUILD_DIR}/.kernelconfig.{modules,kernel} | \
  43. while IFS='=' read symbol value; do \
  44. sed -i -e "/^# $$symbol/d" ${BUILD_DIR}/.kernelconfig.board; \
  45. done;)
  46. sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ${FS_CMDLINE}"#' \
  47. ${BUILD_DIR}/.kernelconfig.board
  48. ifeq ($(ADK_KERNEL_DEBUG_WITH_KGDB),y)
  49. sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 kgdbwait kgdboc=ttyS0,115200"#' \
  50. ${BUILD_DIR}/.kernelconfig.board
  51. endif
  52. cd ${BUILD_DIR} && cat .kernelconfig.board .kernelconfig.nokernel \
  53. .kernelconfig.kernel .kernelconfig.modkernel .kernelconfig.modules \
  54. >.kernelconfig.tmp
  55. cd ${BUILD_DIR} && cmp -s .kernelconfig.tmp .kernelconfig || \
  56. cp .kernelconfig.tmp .kernelconfig
  57. -rm -f ${BUILD_DIR}/.kernelconfig.tmp
  58. prepare: $(DEVICE)-prepare
  59. compile: $(DEVICE)-compile
  60. image: $(DEVICE)-imageclean $(DEVICE)-imageinstall
  61. install: $(DEVICE)-imageclean $(DEVICE)-install $(DEVICE)-imageinstall
  62. clean: $(DEVICE)-clean $(DEVICE)-imageclean
  63. %-clean:
  64. $(TRACE) target/$(patsubst %-clean,%,$@)-clean
  65. $(MAKE) -C $(patsubst %-clean,%,$@) clean
  66. %-imageclean:
  67. $(TRACE) target/$(patsubst %-imageclean,%,$@)-imageclean
  68. $(MAKE) -C $(patsubst %-imageclean,%,$@) imageclean
  69. %-prepare:
  70. $(TRACE) target/$(patsubst %-prepare,%,$@)-prepare
  71. $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
  72. %-imageprepare:
  73. $(TRACE) target/$(patsubst %-imageprepare,%,$@)-imageprepare
  74. $(MAKE) -C $(patsubst %-imageprepare,%,$@) imageprepare
  75. %-compile: %-prepare
  76. $(TRACE) target/$(patsubst %-compile,%,$@)-compile
  77. $(MAKE) -C $(patsubst %-compile,%,$@) compile
  78. %-install: %-compile
  79. $(TRACE) target/$(patsubst %-install,%,$@)-install
  80. $(MAKE) -C $(patsubst %-install,%,$@) install
  81. %-imageinstall: %-imageprepare
  82. $(TRACE) target/$(patsubst %-imageinstall,%,$@)-imageinstall
  83. $(MAKE) -C $(patsubst %-imageinstall,%,$@) imageinstall