From 17fae35e5ea230aa23033ef0b5e28db77f8339e6 Mon Sep 17 00:00:00 2001 From: Alexandre Bard Date: Thu, 14 Oct 2021 09:53:32 +0200 Subject: [PATCH] linux-kernel: Build only one kernel per platform With this change we are building the same kernel config for all hardwares belonging to the same platform. The configs only differ from one or two drivers which are enabled or not and they are anyway not loaded as long as the devicetree is not matching. But having only one config for several hardwares is reducing maintenance (like enabling or disabling kernel security features) and also reducing build time when building for different machines. BugzID: 75223 --- conf/machine/am335x-hw25.conf | 2 +- conf/machine/am335x-hw26.conf | 2 +- conf/machine/am335x-nmhw21.conf | 6 +----- conf/machine/am335x-nmhw24.conf | 6 +----- conf/machine/am335x-nrhw16.conf | 9 +-------- conf/machine/am335x-nrhw20.conf | 5 +---- conf/machine/include/ti33x.inc | 22 +++++++++++++++++++++ recipes-kernel/linux/linux-netmodule_git.bb | 3 +++ recipes-kernel/linux/netmodule-fitimage.bb | 2 ++ 9 files changed, 33 insertions(+), 24 deletions(-) diff --git a/conf/machine/am335x-hw25.conf b/conf/machine/am335x-hw25.conf index 008eb76..3891d53 100644 --- a/conf/machine/am335x-hw25.conf +++ b/conf/machine/am335x-hw25.conf @@ -7,7 +7,7 @@ MACHINEOVERRIDES .= ":am335x-nmhw24" UBOOT_MACHINE = "am335x_hw25_defconfig" -KERNEL_DEVICETREE = "am335x-hw25.dtb " +KERNEL_DEVICETREE_TO_USE = "${HW25_DT}" SERIAL_CONSOLES = "115200;ttyS0" DEFAULT_ETH = "lan0" diff --git a/conf/machine/am335x-hw26.conf b/conf/machine/am335x-hw26.conf index 8bb9afa..86fc745 100644 --- a/conf/machine/am335x-hw26.conf +++ b/conf/machine/am335x-hw26.conf @@ -4,7 +4,7 @@ #require conf/machine/include/ti33x.inc require am335x-nmhw21.conf -KERNEL_DEVICETREE = "am335x-hw26.dtb " +KERNEL_DEVICETREE_TO_USE = "${HW26_DT}" MACHINEOVERRIDES .= ":am335x-nmhw21" MACHINE_FEATURES += "pps" MACHINE_FEATURES_remove = "user-module" diff --git a/conf/machine/am335x-nmhw21.conf b/conf/machine/am335x-nmhw21.conf index e2f0f0f..5c79c79 100644 --- a/conf/machine/am335x-nmhw21.conf +++ b/conf/machine/am335x-nmhw21.conf @@ -6,11 +6,7 @@ require conf/machine/include/ti33x.inc MACHINE_EXTRA_RRECOMMENDS = " kernel-modules kernel-devicetree" -KERNEL_DEFCONFIG ??= "am335x-nmhw21_defconfig" -KERNEL_DEVICETREE = "am335x-nmhw21-prod1.dtb \ - " - -KERNEL_IMAGETYPE = "zImage" +KERNEL_DEVICETREE_TO_USE = "${HW21_DT}" PREFERRED_PROVIDER_virtual/bootloader = "u-boot-ti33x" UBOOT_MACHINE = "am335x_nmhw21_defconfig" diff --git a/conf/machine/am335x-nmhw24.conf b/conf/machine/am335x-nmhw24.conf index 6f894e7..8d2c630 100644 --- a/conf/machine/am335x-nmhw24.conf +++ b/conf/machine/am335x-nmhw24.conf @@ -6,11 +6,7 @@ require conf/machine/include/ti33x.inc MACHINE_EXTRA_RRECOMMENDS = " kernel-modules kernel-devicetree" -KERNEL_DEFCONFIG ??= "am335x-nmhw24_defconfig" -KERNEL_DEVICETREE = "am335x-nmhw24-prod1.dtb \ - " - -KERNEL_IMAGETYPE = "zImage" +KERNEL_DEVICETREE_TO_USE = "${HW24_DT}" PREFERRED_PROVIDER_virtual/bootloader = "u-boot-ti33x" UBOOT_MACHINE = "am335x_nrhw24_defconfig" diff --git a/conf/machine/am335x-nrhw16.conf b/conf/machine/am335x-nrhw16.conf index f03c750..ba7d630 100644 --- a/conf/machine/am335x-nrhw16.conf +++ b/conf/machine/am335x-nrhw16.conf @@ -6,14 +6,7 @@ require conf/machine/include/ti33x.inc MACHINE_EXTRA_RRECOMMENDS = " kernel-modules kernel-devicetree" -KERNEL_DEFCONFIG ??= "am335x-nrhw16_defconfig" -KERNEL_DEVICETREE = "am335x-nrhw16.dtb \ - am335x-nrhw16-prod2.dtb \ - am335x-nrhw16-prod3.dtb \ - am335x-nrhw16-prod4.dtb \ - am335x-nrhw16-prod5.dtb \ - " -KERNEL_IMAGETYPE = "zImage" +KERNEL_DEVICETREE_TO_USE = "${HW16_DT}" PREFERRED_PROVIDER_virtual/bootloader = "u-boot-ti33x" UBOOT_MACHINE = "am335x_nbhw16_v2_defconfig" diff --git a/conf/machine/am335x-nrhw20.conf b/conf/machine/am335x-nrhw20.conf index 1d0fb68..8c2864b 100644 --- a/conf/machine/am335x-nrhw20.conf +++ b/conf/machine/am335x-nrhw20.conf @@ -6,10 +6,7 @@ require conf/machine/include/ti33x.inc MACHINE_EXTRA_RRECOMMENDS = " kernel-modules kernel-devicetree" -KERNEL_DEFCONFIG ??= "am335x-nrhw20_defconfig" -KERNEL_DEVICETREE = "am335x-nrhw20-prod1.dtb \ - " -KERNEL_IMAGETYPE = "zImage" +KERNEL_DEVICETREE_TO_USE = "${HW20_DT}" PREFERRED_PROVIDER_virtual/bootloader = "u-boot-ti33x" UBOOT_MACHINE = "am335x_nrhw20_defconfig" diff --git a/conf/machine/include/ti33x.inc b/conf/machine/include/ti33x.inc index 409e69e..dad248a 100644 --- a/conf/machine/include/ti33x.inc +++ b/conf/machine/include/ti33x.inc @@ -45,3 +45,25 @@ MACHINE_FEATURES = "kernel26 apm usbgadget usbhost pci vfat ext2 screen alsa eth NM_TARGET = "netbird" NM_ARCH = "arm" MACHINEOVERRIDES =. "${NM_TARGET}:" + + +# We have one kernel for all TI machines +KERNEL_IMAGETYPE = "zImage" +KERNEL_DEFCONFIG = "am335x-netmodule_defconfig" +STAGING_KERNEL_DIR = "${TMPDIR}/work-shared/${TUNE_PKGARCH}/kernel-source" +STAGING_KERNEL_BUILDDIR = "${TMPDIR}/work-shared/${TUNE_PKGARCH}/kernel-build-artifacts" + +# We need to specify all devicetrees here in order to build them with the kernel +HW16_DT = "am335x-nrhw16.dtb \ + am335x-nrhw16-prod2.dtb \ + am335x-nrhw16-prod3.dtb \ + am335x-nrhw16-prod4.dtb \ + am335x-nrhw16-prod5.dtb \ + " +HW20_DT = "am335x-nrhw20-prod1.dtb" +HW21_DT = "am335x-nmhw21-prod1.dtb" +HW24_DT = "am335x-nmhw24-prod1.dtb" +HW25_DT = "am335x-hw25.dtb" +HW26_DT = "am335x-hw26.dtb" + +KERNEL_DEVICETREE = "${HW16_DT} ${HW20_DT} ${HW21_DT} ${HW24_DT} ${HW25_DT} ${HW26_DT}" diff --git a/recipes-kernel/linux/linux-netmodule_git.bb b/recipes-kernel/linux/linux-netmodule_git.bb index b84ee86..35b5c0c 100644 --- a/recipes-kernel/linux/linux-netmodule_git.bb +++ b/recipes-kernel/linux/linux-netmodule_git.bb @@ -18,6 +18,9 @@ SRC_URI_append_netbird = " file://wlan.cfg" SRCREV ?= "${AUTOREV}" +# We are building one kernel for all machines with the same architecture +PACKAGE_ARCH = "${TUNE_PKGARCH}" + # HW23 is using a different source SRC_URI_imx8-nmhw23 = "git://git.netmodule.intranet/yoctoproject/linux-netmodule.git;protocol=ssh;user=gitea;branch=4.14/nxp/nmhw23" LIC_FILES_CHKSUM_imx8-nmhw23 = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" diff --git a/recipes-kernel/linux/netmodule-fitimage.bb b/recipes-kernel/linux/netmodule-fitimage.bb index 1d12cdd..78ca513 100644 --- a/recipes-kernel/linux/netmodule-fitimage.bb +++ b/recipes-kernel/linux/netmodule-fitimage.bb @@ -26,6 +26,8 @@ INITRAMFS_IMAGE_NAME ?= "${INITRAMFS_IMAGE}-${MACHINE}" UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" +KERNEL_DEVICETREE = "${KERNEL_DEVICETREE_TO_USE}" + do_configure_prepend () { install -d ${S}/arch/${ARCH}/boot/ for DTB in ${KERNEL_DEVICETREE}; do