1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 include $(ADK_TOPDIR
)/rules.mk
5 include $(ADK_TOPDIR
)/mk
/kernel-ver.mk
6 include $(ADK_TOPDIR
)/mk
/linux.mk
7 include $(ADK_TOPDIR
)/mk
/kernel-vars.mk
9 ifeq ($(ADK_TARGET_KERNEL_USE_CUSTOMCONFIG
),y
)
10 KERNEL_MODULES_USED
:=$(shell grep
-s
=m
$(ADK_TOPDIR
)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH
))
12 KERNEL_MODULES_USED
:=$(shell grep ^ADK_KERNEL
$(ADK_TOPDIR
)/.config|grep
=m
)
15 KERNEL_FILE
:=$(ADK_TARGET_KERNEL
)
16 KERNEL_TARGET
:=$(ADK_TARGET_KERNEL
)
17 ifeq ($(ADK_TARGET_KERNEL_LINUXBIN
),y
)
19 KERNEL_TARGET
:=$(ADK_TARGET_KERNEL
)
21 ifeq ($(ADK_TARGET_KERNEL_ZIMAGE
),y
)
23 KERNEL_TARGET
:=$(ADK_TARGET_KERNEL
)
25 ifeq ($(ADK_TARGET_KERNEL_BZIMAGE
),y
)
29 ifeq ($(ADK_TARGET_KERNEL_IMAGE
),y
)
31 KERNEL_TARGET
:=$(ADK_TARGET_KERNEL
)
34 ifeq ($(ADK_RUNTIME_DEV_UDEV
),y
)
35 ADK_DEPMOD
:=$(STAGING_HOST_DIR
)/usr
/bin
/depmod
40 $(LINUX_DIR
)/.prepared
: $(TOOLCHAIN_BUILD_DIR
)/w-
$(PKG_NAME
)-$(PKG_VERSION
)-$(PKG_RELEASE
)/linux-
$(KERNEL_FILE_VER
)/.patched
41 ln
-sf
$(TOOLCHAIN_BUILD_DIR
)/w-
$(PKG_NAME
)-$(PKG_VERSION
)-$(PKG_RELEASE
)/linux-
$(KERNEL_FILE_VER
) $(LINUX_DIR
)
42 mkdir
-p
$(LINUX_BUILD_DIR
)/kmod-control
45 ifeq ($(ADK_TARGET_KERNEL_USE_MINICONFIG
),y
)
46 $(LINUX_DIR
)/.config
: $(BUILD_DIR
)/.kernelconfig
49 ifeq ($(ADK_TARGET_KERNEL_USE_CUSTOMCONFIG
),y
)
50 $(ADK_TOPDIR
)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH
):
51 $(LINUX_DIR
)/.config
: $(ADK_TOPDIR
)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH
)
54 $(LINUX_DIR
)/.config
: $(LINUX_DIR
)/.prepared
55 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-kernel-configure.. "
56 -for f in
$(TARGETS
);do if
[ -f
$$f ];then
rm $$f;fi
;done
57 echo
"-${KERNEL_RELEASE}" >${LINUX_DIR}/localversion
58 ifeq ($(ADK_TARGET_KERNEL_USE_DEFCONFIG
),y
)
59 ${KERNEL_MAKE_ENV} $(MAKE
) -C
"${LINUX_DIR}" ${KERNEL_MAKE_OPTS} $(ADK_TARGET_KERNEL_DEFCONFIG
) $(MAKE_TRACE
)
60 else ifeq ($(ADK_TARGET_KERNEL_USE_CUSTOMCONFIG
),y
)
61 @if
[ ! -f
$(ADK_TOPDIR
)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH
) ];then \
62 echo
"no kernel configuration found in $(ADK_TOPDIR)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH)"; \
65 ${KERNEL_MAKE_ENV} $(MAKE
) -C
"${LINUX_DIR}" ${KERNEL_MAKE_OPTS} KCONFIG_ALLCONFIG
=$(ADK_TOPDIR
)/$(ADK_TARGET_KERNEL_CUSTOMCONFIG_PATH
) allnoconfig
$(MAKE_TRACE
)
67 $(CP
) $(BUILD_DIR
)/.kernelconfig
$(LINUX_DIR
)/mini.config
68 ${KERNEL_MAKE_ENV} $(MAKE
) -C
"${LINUX_DIR}" ${KERNEL_MAKE_OPTS} KCONFIG_ALLCONFIG
=mini.config allnoconfig
$(MAKE_TRACE
)
70 touch
-c
$(LINUX_DIR
)/.config
74 $(LINUX_DIR
)/$(KERNEL_FILE
): $(LINUX_DIR
)/.config
75 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-kernel-compile.. "
76 ${KERNEL_MAKE_ENV} $(MAKE
) -C
"${LINUX_DIR}" ${KERNEL_MAKE_OPTS} -j
${ADK_MAKE_JOBS} $(KERNEL_TARGET
) $(MAKE_TRACE
)
77 touch
-c
$(LINUX_DIR
)/$(KERNEL_FILE
)
81 $(LINUX_BUILD_DIR
)/modules
: $(LINUX_DIR
)/$(KERNEL_FILE
)
82 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-kernel-modules-compile.. "
83 ${KERNEL_MAKE_ENV} $(MAKE
) -C
"${LINUX_DIR}" ${KERNEL_MAKE_OPTS} -j
${ADK_MAKE_JOBS} modules
$(MAKE_TRACE
)
86 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-kernel-modules-install.. "
87 rm -rf
$(LINUX_BUILD_DIR
)/modules
88 ${KERNEL_MAKE_ENV} $(MAKE
) -C
"${LINUX_DIR}" ${KERNEL_MAKE_OPTS} \
89 DEPMOD
=$(ADK_DEPMOD
) \
90 INSTALL_MOD_PATH
=$(LINUX_BUILD_DIR
)/modules \
91 modules_install
$(MAKE_TRACE
)
94 ifneq ($(ADK_RUNTIME_DEV_UDEV
),y
)
95 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-create-packages.. "
96 @mkdir
-p
${PACKAGE_DIR}
97 PATH
='${HOST_PATH}' ${BASH} ${SCRIPT_DIR}/make-module-ipkgs.sh \
98 "${ADK_TARGET_CPU_ARCH}" \
100 "${LINUX_BUILD_DIR}" \
108 ifneq ($(KERNEL_MODULES_USED
),)
109 compile
: $(LINUX_BUILD_DIR
)/modules
111 compile
: $(LINUX_DIR
)/$(KERNEL_FILE
)
114 ifneq ($(KERNEL_MODULES_USED
),)
115 $(START_TRACE
) "target/${ADK_TARGET_ARCH}-modules-install.. "
116 ifeq ($(ADK_TARGET_PACKAGE_IPKG
)$(ADK_TARGET_PACKAGE_OPKG
),y
)
117 $(PKG_INSTALL
) $(wildcard ${PACKAGE_DIR}/kmod-
*) $(MAKE_TRACE
)
119 $(foreach pkg
,$(wildcard ${PACKAGE_DIR}/kmod-
*),$(shell $(PKG_INSTALL
) $(pkg
)))
126 rm -rf
$(LINUX_BUILD_DIR
)
127 rm -f
$(wildcard ${PACKAGE_DIR}/kmod-
*) $(wildcard ${PACKAGE_DIR}/kernel_
*)