kernel-build.mk 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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/kernel-patch
  8. $(PATCH) $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION) \
  9. ../linux/patches/$(KERNEL_VERSION) *.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/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 $(TOPDIR)/mk/modules.mk
  17. $(TRACE) target/$(ADK_TARGET_ARCH)-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_ARCH)-kernel-compile
  25. $(MAKE) ${KERNEL_MAKE_OPTS} -j${ADK_MAKE_JOBS} LOCALVERSION="" $(MAKE_TRACE)
  26. $(TRACE) target/$(ADK_TARGET_ARCH)-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. LOCALVERSION="" \
  31. modules_install $(MAKE_TRACE)
  32. $(TRACE) target/$(ADK_TARGET_ARCH)-create-packages
  33. ifneq ($(strip $(TARGETS)),)
  34. $(MAKE) $(TARGETS)
  35. endif
  36. touch -c $(LINUX_DIR)/vmlinux
  37. prepare:
  38. compile: $(LINUX_DIR)/vmlinux
  39. install: compile
  40. ifneq ($(strip $(INSTALL_TARGETS)),)
  41. $(TRACE) target/${ADK_TARGET_ARCH}-modules-install
  42. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  43. $(PKG_INSTALL) $(INSTALL_TARGETS) $(MAKE_TRACE)
  44. else
  45. $(foreach pkg,$(INSTALL_TARGETS),$(shell $(PKG_INSTALL) $(pkg)))
  46. endif
  47. endif
  48. clean:
  49. rm -rf $(LINUX_BUILD_DIR)
  50. rm -f $(TARGETS)