1
0

Makefile 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(ADK_TOPDIR)/rules.mk
  4. include $(ADK_TOPDIR)/mk/rootfs.mk
  5. all: install
  6. ### Kernel .config Creation
  7. # The following target combines all kernel-related variables and
  8. # config files into a single one to be used as the final kernel
  9. # configuration when building. This is how it's done:
  10. # 1) fetch all enabled ADK_KERNEL_* vars into
  11. # .kernelconfig.kernel
  12. # 2) get the global and device-specific static kernel config and place it into
  13. # .kernelconfig.board
  14. # 3) append ${FS_CMDLINE} to the kernel commandline inside .kernelconfig.board
  15. # 4) merge both together into .kernelconfig.tmp
  16. # 5) check if .kernelconfig.tmp differs from the current one
  17. # (.kernelconfig) at all, overwriting the current one
  18. # only if it does (so the timestamp stays intact)
  19. # 6) remove the temporary .kernelconfig.tmp
  20. ###
  21. ADK_PACKAGE_CRYPTINIT_ROOT:=$(strip $(subst ",, $(ADK_PACKAGE_CRYPTINIT_ROOT)))
  22. ADK_PACKAGE_CRYPTINIT_SWAP:=$(strip $(subst ",, $(ADK_PACKAGE_CRYPTINIT_SWAP)))
  23. ADK_PACKAGE_CMDLINE:=root=$(ADK_PACKAGE_CRYPTINIT_ROOT) swap=$(ADK_PACKAGE_CRYPTINIT_SWAP) resume=/dev/mapper/swapcrypt
  24. ifeq (${ADK_TARGET_KERNEL_CUSTOMISING},y)
  25. config-prepare: $(ADK_TOPDIR)/.config
  26. @sed -n '/^ADK_KERNEL/s//CONFIG/p' ${ADK_TOPDIR}/.config \
  27. >${BUILD_DIR}/.kernelconfig.kernel
  28. @if [ -f ${ADK_TARGET_ARCH}/kernel/${ADK_TARGET_KERNEL_MINICONFIG} ];then \
  29. cat ${ADK_TOPDIR}/target/linux/kernel.config \
  30. ${ADK_TARGET_ARCH}/kernel/${ADK_TARGET_KERNEL_MINICONFIG} > ${BUILD_DIR}/.kernelconfig.board; \
  31. else \
  32. echo "no miniconfig found for target system"; \
  33. exit 1; \
  34. fi
  35. ifeq ($(ADK_TARGET_ROOTFS_NFSROOT),)
  36. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ro"#' \
  37. ${BUILD_DIR}/.kernelconfig.board
  38. endif
  39. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ${FS_CMDLINE}"#' \
  40. ${BUILD_DIR}/.kernelconfig.board
  41. ifneq ($(ADK_TARGET_CMDLINE),)
  42. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ${ADK_TARGET_CMDLINE}"#' \
  43. ${BUILD_DIR}/.kernelconfig.board
  44. endif
  45. ifeq ($(ADK_TARGET_QEMU_WITH_GRAPHIC),y)
  46. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 console=tty0"#' \
  47. ${BUILD_DIR}/.kernelconfig.board
  48. endif
  49. ifneq ($(ADK_PACKAGE_CRYPTINIT_ROOT),)
  50. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 ${ADK_PACKAGE_CMDLINE}"#' \
  51. ${BUILD_DIR}/.kernelconfig.board
  52. endif
  53. ifeq ($(ADK_RUNTIME_QUIET_INIT),y)
  54. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 rcquiet=1"#' \
  55. ${BUILD_DIR}/.kernelconfig.board
  56. endif
  57. ifeq ($(ADK_QUIET_KERNEL),y)
  58. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 quiet loglevel=2 vt.global_cursor_default=0"#' \
  59. ${BUILD_DIR}/.kernelconfig.board
  60. endif
  61. ifeq ($(ADK_KERNEL_DEBUG_WITH_KGDB),y)
  62. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 kgdbwait kgdboc=ttyS0,115200"#' \
  63. ${BUILD_DIR}/.kernelconfig.board
  64. endif
  65. ifeq ($(ADK_KERNEL_NETCONSOLE),y)
  66. @sed -i -e 's#^\(CONFIG_.*CMDLINE="\)\(.*\)"#\1\2 netconsole=@$(ADK_PARAMETER_NETCONSOLE_SRC_IP)/,@$(ADK_PARAMETER_NETCONSOLE_DST_IP)/"#' \
  67. ${BUILD_DIR}/.kernelconfig.board
  68. endif
  69. @cd ${BUILD_DIR} && cat .kernelconfig.board .kernelconfig.kernel \
  70. >.kernelconfig.tmp
  71. @cd ${BUILD_DIR} && cmp -s .kernelconfig.tmp .kernelconfig || \
  72. cp .kernelconfig.tmp .kernelconfig
  73. @-rm -f ${BUILD_DIR}/.kernelconfig.tmp
  74. else
  75. config-prepare: $(ADK_TOPDIR)/.config
  76. @if [ -f ${ADK_TARGET_ARCH}/kernel/${ADK_TARGET_KERNEL_MINICONFIG} ];then \
  77. cat ${ADK_TOPDIR}/target/linux/kernel.config \
  78. ${ADK_TARGET_ARCH}/kernel/${ADK_TARGET_KERNEL_MINICONFIG} > ${BUILD_DIR}/.kernelconfig.board; \
  79. else \
  80. echo "no miniconfig found for target system"; \
  81. exit 1; \
  82. fi
  83. endif
  84. prepare: $(ADK_TARGET_ARCH)-prepare
  85. compile: $(ADK_TARGET_ARCH)-compile
  86. image: $(ADK_TARGET_ARCH)-imageclean $(ADK_TARGET_ARCH)-imageinstall
  87. targethelp: $(ADK_TARGET_ARCH)-targethelp
  88. install: $(ADK_TARGET_ARCH)-imageclean $(ADK_TARGET_ARCH)-install $(ADK_TARGET_ARCH)-imageinstall
  89. clean: $(ADK_TARGET_ARCH)-clean $(ADK_TARGET_ARCH)-imageclean
  90. %-clean:
  91. $(TRACE) target/$(patsubst %-clean,%,$@)-clean
  92. $(MAKE) -C $(patsubst %-clean,%,$@) clean
  93. %-imageclean:
  94. $(TRACE) target/$(patsubst %-imageclean,%,$@)-imageclean
  95. $(MAKE) -C $(patsubst %-imageclean,%,$@) imageclean
  96. %-prepare:
  97. $(TRACE) target/$(patsubst %-prepare,%,$@)-prepare
  98. $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
  99. %-imageprepare:
  100. $(TRACE) target/$(patsubst %-imageprepare,%,$@)-imageprepare
  101. $(MAKE) -C $(patsubst %-imageprepare,%,$@) imageprepare
  102. %-compile: %-prepare
  103. $(TRACE) target/$(patsubst %-compile,%,$@)-compile
  104. $(MAKE) -C $(patsubst %-compile,%,$@) compile
  105. %-install: %-compile
  106. $(TRACE) target/$(patsubst %-install,%,$@)-install
  107. $(MAKE) -C $(patsubst %-install,%,$@) install
  108. %-targethelp:
  109. $(MAKE) -C $(patsubst %-targethelp,%,$@) targethelp
  110. %-imageinstall: %-imageprepare
  111. $(TRACE) target/$(patsubst %-imageinstall,%,$@)-imageinstall
  112. $(MAKE) -C $(patsubst %-imageinstall,%,$@) imageinstall
  113. @echo 'Login as user root with password ${ADK_RUNTIME_PASSWORD} via ssh or console.'