From e5531e2c0fd376409fd04c28a294edf04d903042 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Wed, 26 Jul 2023 13:18:26 +0800 Subject: [PATCH] Add device tree overlay support --- conf/machine/igkboard-6ull.conf | 20 ++++++++++++++++++++ recipes-kernel/linux/linux-imx_5.15.bbappend | 20 +++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletions(-) diff --git a/conf/machine/igkboard-6ull.conf b/conf/machine/igkboard-6ull.conf index 482835f..56aadf3 100644 --- a/conf/machine/igkboard-6ull.conf +++ b/conf/machine/igkboard-6ull.conf @@ -12,6 +12,25 @@ # Device tree file generated during kernel compilation KERNEL_DEVICETREE = "${MACHINE}.dtb" +# Device tree overlay files generated during kernel compilation +KERNEL_DTOVERLAY = " \ + ${MACHINE}/adc.dtbo \ + ${MACHINE}/cam.dtbo \ + ${MACHINE}/can1.dtbo \ + ${MACHINE}/can2.dtbo \ + ${MACHINE}/i2c1.dtbo \ + ${MACHINE}/lcd.dtbo \ + ${MACHINE}/nbiot-4g.dtbo \ + ${MACHINE}/pwm7.dtbo \ + ${MACHINE}/pwm8.dtbo \ + ${MACHINE}/spi1.dtbo \ + ${MACHINE}/uart2.dtbo \ + ${MACHINE}/uart3.dtbo \ + ${MACHINE}/uart4.dtbo \ + ${MACHINE}/uart7.dtbo \ + ${MACHINE}/w1.dtbo \ +" + # Uboot comfiguration UBOOT_CONFIG ??= "sd" UBOOT_CONFIG[sd] = "${MACHINE}_defconfig,sdcard" @@ -20,6 +39,7 @@ IMAGE_BOOT_FILES = " \ ${KERNEL_IMAGETYPE} \ ${KERNEL_DEVICETREE} \ + overlays/*;overlays/ \ " # Remove unused optee bcm4339 bcm43455 MACHINE_FEATURES += "wifi bluetooth" diff --git a/recipes-kernel/linux/linux-imx_5.15.bbappend b/recipes-kernel/linux/linux-imx_5.15.bbappend index 25961c4..b95f68c 100644 --- a/recipes-kernel/linux/linux-imx_5.15.bbappend +++ b/recipes-kernel/linux/linux-imx_5.15.bbappend @@ -4,9 +4,27 @@ SRC_URI += " file://linux-imx-lf-5.15.71-2.2.0.patch " PATCHTOOL = "patch" +KERNEL_DANGLING_FEATURES_WARN_ONLY="1" +KERNEL_DTC_FLAGS = "-@" +KERNEL_DTOVERLAY ?= "" + do_copy_defconfig:append() { cp ${S}/arch/arm/configs/${MACHINE}_defconfig ${WORKDIR}/defconfig cp ${S}/arch/arm/configs/${MACHINE}_defconfig ${B}/.config } -KERNEL_DANGLING_FEATURES_WARN_ONLY="1" +do_compile:append() { + if [ -n "${KERNEL_DTC_FLAGS}" ]; then + export DTC_FLAGS="${KERNEL_DTC_FLAGS}" + fi + + for dtbf in ${KERNEL_DTOVERLAY}; do + dtb=`normalize_dtb "$dtbf"` + oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} + done +} + +do_deploy:append(){ + install -d ${DEPLOYDIR}/overlays + cp ${B}/arch/arm/boot/dts/${MACHINE}/*.dtbo ${DEPLOYDIR}/overlays +} -- Gitblit v1.9.1