blob: a8c7f651449364a4e849229907e4266eeb7a14c9 [file] [log] [blame]
xf.li3dd53742024-09-27 00:06:23 -07001SUMMARY = "zxic Linux kernel"
2SECTION = "kernel"
3PV = "${LINUX_VERSION}"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM ?= "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
6LINUX_VERSION ?= "5.10.156"
7BSPDIR = "${TOPDIR}/../upstream"
8#pub include
9include ${TOPDIR}/layers/meta-zxic/conf/pub_esdk.inc
10
11DEPENDS += "kern-tools-native"
12DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES','dm-verity','zstd-native','',d)}"
13inherit kernel siteinfo
14
15EXTRA_OEMAKE_append = " LOADADDR=${KERNEL_LOADADDR} EXTRA_CFLAGS='${ZXIC_EXTRA_CFLAGS}' "
16FILESEXTRAPATHS_prepend :="${TOPDIR}/../upstream:"
17# PR_CONFIG_cpe = "linux-5_10-cpe-${BOOT_CTL}-defconfig"
18# PR_CONFIG_v2x = "linux-5_10-v2x-${BOOT_CTL}-defconfig"
19PR_CONFIG_vehicle_dc = "linux-5_10-vehicle_dc-${BOOT_CTL}-defconfig"
20PR_CONFIG_vehicle_dc_4Gb = "linux-5_10-vehicle_dc_4Gb-${BOOT_CTL}-defconfig"
21S = "${WORKDIR}/linux-5.10"
22
23do_install[nostamp] = "1"
24
25SRC_URI = "\
26 file://linux-5.10 \
27 file://${MACHINE}/${LINUX_BASE_CONFIG} \
28 "
29
30# returns all the elements from the src uri that are .cfg files
31def find_cfgs(d):
32 sources=src_patches(d, True)
33 sources_list=[]
34 for s in sources:
35 if s.endswith('.cfg'):
36 sources_list.append(s)
37
38 return sources_list
39
40kernel_do_configure() {
41 # fixes extra + in /lib/modules/2.6.37+
42 # $ scripts/setlocalversion . => +
43 # $ make kernelversion => 2.6.37
44 # $ make kernelrelease => 2.6.37+
45 touch ${B}/.scmversion ${S}/.scmversion
46
47 cp ${WORKDIR}/${MACHINE}/${LINUX_BASE_CONFIG} ${WORKDIR}/defconfig
48 if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then
49 mv "${S}/.config" "${B}/.config"
50 fi
51
52 # Copy defconfig to .config if .config does not exist. This allows
53 # recipes to manage the .config themselves in do_configure_prepend().
54 if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
55 cp "${WORKDIR}/defconfig" "${B}/.config"
56 fi
57
58 merge_config.sh -m ${WORKDIR}/defconfig ${@" ".join(find_cfgs(d))}
59 ${KERNEL_CONFIG_COMMAND}
60}
61
62fakeroot do_cpio () {
63 if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
64 cp -v ${BSPDIR}/../esdk/sources/meta-zxic-custom/conf/distro/dm-verity/${KERNEL_INITRAMFS_CPIO} ${B}/
65 fi
66}
67
68do_install_append () {
69 #install elfs
70 install -d ${ELFS-PATH}/
71 install -d ${BINS-PATH}/
72 install -m 0755 ${WORKDIR}/image/boot/uImage ${ELFS-PATH}/uImage
73 install -m 0755 ${WORKDIR}/image/boot/${MACHINE}-${DISTRO}.dtb ${BINS-PATH}/ap_cpucap.dtb
74 install -m 0755 ${WORKDIR}/image/boot/${MACHINE}-${DISTRO}.dtb ${ELFS-PATH}/
75
76 install -m 0755 ${B}/vmlinux ${ELFS-PATH}/vmlinux
77 install -m 0755 ${B}/System.map ${ELFS-PATH}/System.map
78 if [ -d ${WORKDIR}/image/lib/modules ]; then
79 cp -rf ${WORKDIR}/image/lib/modules ${ELFS-PATH}/${PN}/
80 fi
81}
82
83do_cleanlibs () {
84 rm -fr ${ELFS-PATH}/uImage
85 rm -fr ${ELFS-PATH}/${MACHINE}-${DISTRO}.dtb
86 rm -fr ${ELFS-PATH}/vmlinux
87 rm -fr ${ELFS-PATH}/System.map
88 rm -fr ${ELFS-PATH}/${PN}/modules
89}
90addtask cleanlibs after do_clean before do_cleansstate
91addtask do_cpio after do_configure before do_compile
92
93COMPATIBLE_MACHINE = "^zxic$"