kernel-build.mk 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 | ${KERNEL_MAKE_ENV} $(MAKE) ${KERNEL_MAKE_OPTS} oldconfig $(MAKE_TRACE)
  21. ${KERNEL_MAKE_ENV} $(MAKE) ${KERNEL_MAKE_OPTS} prepare scripts $(MAKE_TRACE)
  22. touch -c $(LINUX_DIR)/.config
  23. $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.config
  24. -rm $(LINUX_DIR)/vmlinux
  25. $(TRACE) target/$(ADK_TARGET_ARCH)-kernel-compile
  26. ${KERNEL_MAKE_ENV} $(MAKE) ${KERNEL_MAKE_OPTS} -j${ADK_MAKE_JOBS} LOCALVERSION="" $(MAKE_TRACE)
  27. $(TRACE) target/$(ADK_TARGET_ARCH)-kernel-modules-install
  28. rm -rf $(LINUX_BUILD_DIR)/modules
  29. ${KERNEL_MAKE_ENV} $(MAKE) ${KERNEL_MAKE_OPTS} DEPMOD=true \
  30. INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules \
  31. LOCALVERSION="" \
  32. modules_install $(MAKE_TRACE)
  33. $(TRACE) target/$(ADK_TARGET_ARCH)-create-packages
  34. ifneq ($(strip $(TARGETS)),)
  35. $(MAKE) $(TARGETS)
  36. endif
  37. touch -c $(LINUX_DIR)/vmlinux
  38. prepare:
  39. compile: $(LINUX_DIR)/vmlinux
  40. install: compile
  41. ifneq ($(strip $(INSTALL_TARGETS)),)
  42. $(TRACE) target/${ADK_TARGET_ARCH}-modules-install
  43. ifeq ($(ADK_TARGET_PACKAGE_IPKG),y)
  44. $(PKG_INSTALL) $(INSTALL_TARGETS) $(MAKE_TRACE)
  45. else
  46. $(foreach pkg,$(INSTALL_TARGETS),$(shell $(PKG_INSTALL) $(pkg)))
  47. endif
  48. endif
  49. clean:
  50. rm -rf $(LINUX_BUILD_DIR)
  51. rm -f $(TARGETS)