kernel-build.mk 2.2 KB

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