kernel-build.mk 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 $(TOPDIR)/rules.mk
  4. include $(TOPDIR)/mk/linux.mk
  5. include ${TOPDIR}/mk/kernel-vars.mk
  6. $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION)/.patched:
  7. $(TRACE) target/$(ADK_TARGET)-kernel-patch
  8. $(PATCH) $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION) ../linux/patches/$(KERNEL_VERSION) *.patch $(MAKE_TRACE)
  9. $(PATCH) $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION) ../$(ADK_TARGET)/patches *.patch $(MAKE_TRACE)
  10. ifeq ($(ADK_NATIVE),y)
  11. if [ -f /etc/adktarget ];then \
  12. target=$$(cat /etc/adktarget); \
  13. $(PATCH) $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION) ../$$target/patches *.patch $(MAKE_TRACE); \
  14. fi
  15. endif
  16. touch $@
  17. $(LINUX_DIR)/.prepared: $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION)/.patched
  18. $(TRACE) target/$(ADK_TARGET)-kernel-prepare
  19. ln -sf $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION) $(LINUX_DIR)
  20. mkdir -p $(LINUX_BUILD_DIR)/kmod-control
  21. touch $@
  22. $(LINUX_DIR)/.config: $(LINUX_DIR)/.prepared $(BUILD_DIR)/.kernelconfig $(TOPDIR)/mk/modules.mk
  23. $(TRACE) target/$(ADK_TARGET)-kernel-configure
  24. for f in $(TARGETS);do if [ -f $$f ];then rm $$f;fi;done $(MAKE_TRACE)
  25. $(CP) $(BUILD_DIR)/.kernelconfig $(LINUX_DIR)/.config
  26. echo N | $(MAKE) ${KERNEL_MAKE_OPTS} oldconfig $(MAKE_TRACE)
  27. $(MAKE) ${KERNEL_MAKE_OPTS} prepare scripts $(MAKE_TRACE)
  28. touch -c $(LINUX_DIR)/.config
  29. $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.config
  30. $(TRACE) target/$(ADK_TARGET)-kernel-compile
  31. $(MAKE) ${KERNEL_MAKE_OPTS} -j${ADK_MAKE_JOBS} LOCALVERSION="" $(MAKE_TRACE)
  32. $(TRACE) target/$(ADK_TARGET)-kernel-modules-install
  33. rm -rf $(LINUX_BUILD_DIR)/modules
  34. $(MAKE) ${KERNEL_MAKE_OPTS} DEPMOD=true \
  35. INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules \
  36. LOCALVERSION="" \
  37. modules_install $(MAKE_TRACE)
  38. $(TRACE) target/$(ADK_TARGET)-create-packages
  39. ifneq ($(strip $(TARGETS)),)
  40. $(MAKE) $(TARGETS)
  41. endif
  42. touch -c $(LINUX_DIR)/vmlinux
  43. prepare:
  44. compile: $(LINUX_DIR)/vmlinux
  45. install: compile
  46. ifneq ($(strip $(INSTALL_TARGETS)),)
  47. $(TRACE) target/${ADK_TARGET}-modules-install
  48. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  49. $(PKG_INSTALL) $(INSTALL_TARGETS) $(MAKE_TRACE)
  50. else
  51. $(foreach pkg,$(INSTALL_TARGETS),$(shell $(PKG_INSTALL) $(pkg)))
  52. endif
  53. endif
  54. clean:
  55. rm -rf $(LINUX_BUILD_DIR)
  56. rm -f $(TARGETS)