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
/$(ADK_TARGET_OS
)-ver.mk
6 include $(ADK_TOPDIR
)/mk
/$(ADK_TARGET_OS
).mk
7 include $(ADK_TOPDIR
)/mk
/kernel-vars.mk
9 ifeq ($(ADK_TARGET_OS_LINUX
),y
)
10 KERNEL_MODULES_USED
:=$(shell grep ^ADK_LINUX_KERNEL
$(ADK_TOPDIR
)/.config|grep
=m
)
12 ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_CUSTOMCONFIG
),y
)
13 KERNEL_MODULES_USED
:=$(shell grep
-s
=m
$(ADK_TOPDIR
)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH
))
16 KERNEL_FILE
:=$(ADK_TARGET_KERNEL
)
17 KERNEL_TARGET
:=$(ADK_TARGET_KERNEL
)
18 ifeq ($(ADK_TARGET_KERNEL_LINUXBIN
),y
)
21 ifeq ($(ADK_TARGET_KERNEL_ZIMAGE
),y
)
24 ifeq ($(ADK_TARGET_KERNEL_VMLINUX_EFI
),y
)
25 KERNEL_FILE
:=vmlinux.efi
28 ifeq ($(ADK_TARGET_KERNEL_VMLINUX_GZ
),y
)
32 ifeq ($(ADK_TARGET_KERNEL_BZIMAGE
),y
)
36 ifeq ($(ADK_TARGET_KERNEL_IMAGE
),y
)
39 ifeq ($(ADK_TARGET_KERNEL_SIMPLEIMAGE
),y
)
40 KERNEL_FILE
:=vmlinux.bin
41 KERNEL_TARGET
:=simpleImage.milkymist_one
44 ifneq ($(KERNEL_MODULES_USED
),)
45 KERNEL_TARGET
+=modules
48 ifeq ($(ADK_RUNTIME_DEV_UDEV
),y
)
49 ADK_DEPMOD
:=$(STAGING_HOST_DIR
)/usr
/bin
/depmod
54 $(LINUX_DIR
)/.prepared
: $(TOOLCHAIN_BUILD_DIR
)/w-
$(PKG_NAME
)-$(PKG_VERSION
)-$(PKG_RELEASE
)/$(ADK_TARGET_OS
)-$(KERNEL_FILE_VER
)/.patched
55 ln
-sf
$(TOOLCHAIN_BUILD_DIR
)/w-
$(PKG_NAME
)-$(PKG_VERSION
)-$(PKG_RELEASE
)/$(ADK_TARGET_OS
)-$(KERNEL_FILE_VER
) $(LINUX_DIR
)
56 mkdir
-p
$(LINUX_BUILD_DIR
)/kmod-control
59 ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_MINICONFIG
),y
)
60 $(LINUX_DIR
)/.config
: $(BUILD_DIR
)/.kernelconfig
63 ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_CUSTOMCONFIG
),y
)
64 $(ADK_TOPDIR
)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH
):
65 $(LINUX_DIR
)/.config
: $(ADK_TOPDIR
)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH
)
68 $(LINUX_DIR
)/.config
: $(LINUX_DIR
)/.prepared
69 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-kernel-configure.. "
70 echo
"-${KERNEL_RELEASE}" >${LINUX_DIR}/localversion
71 ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_DEFCONFIG
),y
)
72 ${KERNEL_MAKE} $(ADK_TARGET_LINUX_KERNEL_DEFCONFIG
) $(MAKE_TRACE
)
73 else ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_CUSTOMCONFIG
),y
)
74 @if
[ ! -f
$(ADK_TOPDIR
)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH
) ];then \
75 echo
"no kernel configuration found in $(ADK_TOPDIR)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH)"; \
78 ${KERNEL_MAKE} KCONFIG_ALLCONFIG
=$(ADK_TOPDIR
)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH
) allnoconfig
$(MAKE_TRACE
)
80 $(CP
) $(BUILD_DIR
)/.kernelconfig
$(LINUX_DIR
)/mini.config
81 ${KERNEL_MAKE} KCONFIG_ALLCONFIG
=mini.config allnoconfig
$(MAKE_TRACE
)
86 $(LINUX_DIR
)/$(KERNEL_FILE
): $(LINUX_DIR
)/.config
87 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-kernel-compile.. "
88 ifneq ($(ADK_TARGET_KERNEL_APPEND_DTB
),)
89 ${KERNEL_MAKE} zImage dtbs
$(MAKE_TRACE
)
90 (cd
$(LINUX_DIR
)/arch
/$(ADK_TARGET_ARCH
)/boot
&& \
91 cat dts
/${ADK_TARGET_KERNEL_APPEND_DTB}.dtb
>> zImage
)
93 ${KERNEL_MAKE} $(KERNEL_TARGET
) $(MAKE_TRACE
)
98 compile
: $(LINUX_DIR
)/$(KERNEL_FILE
)
100 ifneq ($(KERNEL_MODULES_USED
),)
101 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-kernel-modules-install.. "
102 rm -rf
$(LINUX_BUILD_DIR
)/modules
103 ${KERNEL_MAKE} DEPMOD
=$(ADK_DEPMOD
) \
104 INSTALL_MOD_PATH
=$(LINUX_BUILD_DIR
)/modules \
105 modules_install
$(MAKE_TRACE
)
108 $(START_TRACE
) "target/$(ADK_TARGET_ARCH)-kernel-modules-create-packages.. "
109 rm -f
${PACKAGE_DIR}/kmod-
*
110 PATH
='${HOST_PATH}' ${BASH} ${SCRIPT_DIR}/make-module-ipkgs.sh \
111 "${ADK_TARGET_CPU_ARCH}" \
112 "${KERNEL_VERSION}" \
113 "${LINUX_BUILD_DIR}" \
118 $(START_TRACE
) "target/${ADK_TARGET_ARCH}-kernel-modules-install-packages.. "
119 -for pkg in
$(PACKAGE_DIR
)/kmod-
*; do \
120 [[ -e
"$$pkg" ]] && $(PKG_INSTALL
) $$pkg; \
124 $(CP
) $(LINUX_BUILD_DIR
)/modules
/lib
/modules
/$(KERNEL_VERSION
)/modules.
{order
,builtin
} \
125 $(TARGET_DIR
)/lib
/modules
/$(KERNEL_VERSION
)/
129 rm -rf
$(LINUX_BUILD_DIR
)
130 rm -f
$(wildcard ${PACKAGE_DIR}/kmod-
*) $(wildcard ${PACKAGE_DIR}/kernel_
*)