From patchwork Sun Nov 30 09:27:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 4682 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Sun, 30 Nov 2025 10:28:12 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-wm1-f59.google.com (mail-wm1-f59.google.com [209.85.128.59]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 5AU9S9eP006283 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 30 Nov 2025 10:28:09 +0100 Received: by mail-wm1-f59.google.com with SMTP id 5b1f17b1804b1-47910af0c8bsf22696955e9.2 for ; Sun, 30 Nov 2025 01:28:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1764494873; cv=pass; d=google.com; s=arc-20240605; b=Jce5JTTMmL3zXDjcQ/44rGQcpkuCG+vnsV5z1+qiiq5sDEkd0GL/SzXMy+Lcq/de/V yBk1c4bce3j+IcSK4GOHMtj0BSkkyjUqFt8GkRGUxdlme2Y/0eaj8hWGH/y918Tj2jLl zBL0NoK2R2IRld24VoTUS0y5xFLHr74aw4MDIDH6H+IX5AFhCLtax723jKxTXvL5RfOU H13nPZ9LRVnIRi0rEPl+ZP6URTMrEsOmhWh/6XZ6ut1DMTGFrkuQjP9DO3CUaNTK/+U8 gDxXfy+bkUT5+5N/93GWAc8ccxbA/e8Lmv2OQ3QStHpZyDhPdf6k+GoWkGJmD6NYcf49 3cEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VzmqvIJSuCyn2u5Zrl4B7yTxydSHzu5giFVi0eze+Qs=; fh=KlIp7O6ok5MFhBMb7AH4zkuGTfEHNThV2okf1eD+stw=; b=U/86XyZOsgmhkW4xeIh2h3H5M9Ze/dJE4/rMvv9i0PeFOVxkhmRn2j2LHkkwlj0o2l ESHV6agCqtw1fVoSSVWYPN6fSsrqqA27KsOt/uzgieVPUk2E5KzXs9C8ha6exS+PH7vM U/NNXzRCuIhb4Zknf2n4DvIIwv+7XtXRfUoxxwBp9htvRjePIe/CXzWARzbuonS0wGA5 K9nMgMWMSuvGwAwZUfyLSQ+cxx+Qnp8FYg3E1UMU+5nHN8NB8NuyLG5NM3PKe4guvCh+ GBmSC6UJlhnUjIBqshWIDr90cCAdcYRUgCAczBHKW6oIFT1TulQxQ+NBo5mvVo8niaJY 9H+Q==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=DOYYwKDb; spf=pass (google.com: domain of fm-294854-2025113009274926117dcc4c00020796-t4b0cn@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-294854-2025113009274926117dcc4c00020796-t4B0Cn@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1764494873; x=1765099673; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=VzmqvIJSuCyn2u5Zrl4B7yTxydSHzu5giFVi0eze+Qs=; b=qsad4j6KXIE144zG5DgAoXcrzYHuOVmJLW/UM2HR/XRj/HFaiAG1CQMXSsDhaYCJlh P8YIFWm/g+AQVwgBbOn7iIIHPmhcPEi5/9GttzvbPyIyi/34zb5W/CT4D5evGzhalPQd jB2vNrfY0LGMInoiFrUcCp5pOGg4so8smWDYE8Y1jMxDxzcGGWrAMpFTm0g03e25ZUPF zZn06fE799hnp7jKL5BVvi0zKO5r5nKHtd/fK3XXgNWSTveIMmaG3HprzZdnR6me+VEv HKKglWYKn1Nf78sSsc22H2IoJ8y5LHJuLaa/ooSk0MhMkQp7Mi0MBiuPUBPwIHMW+cep sQVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764494873; x=1765099673; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VzmqvIJSuCyn2u5Zrl4B7yTxydSHzu5giFVi0eze+Qs=; b=rhImNtv/pdYAg0NdQH9Ccug+KnyrpQiKq3bt0R9HxYxdggsZNFXhSPxfwBb1ssYDh4 UdZrCXoHdasJ5XHsPyq2U9YzlfKOi84Dyqy2d61USVv4QdyaLof+VqOpgN2pND0CJDgq +vEMh9Vrgwk5HaNMxeRimhduRrdkw4PtZkytlVDWHbAGe9GqICebU5bM3wLWaJTFdniP oX9WeevXvlrn25R26CAx8BWONYrGFKEe12/G1h+BWSL264KbErb8KOulXwBeMuGzcY+k gtHo2fCsmiyyHIZ+/jv3QNppBp2/3bf35TadQaqCwlNzw5S4sDIpEysOtu94K/hILZLf bhyQ== X-Forwarded-Encrypted: i=2; AJvYcCV5m7mtG472vPA5VT1Ex11ajV31kngAebm3ujbnGSkLKPmMSU42dsjcTiDuNbPORgLeNprTyQM=@isar-build.org X-Gm-Message-State: AOJu0YxX8ZpvjhgsKDwqyOI/cAASOb5vqPReb2kpwZLdpWKqm7utAorq szGemeuxU/Yc9pgwPSmTt+2ApIX3dMXzQyaxtTkydOtHYvv6JZMLTLYR X-Google-Smtp-Source: AGHT+IF5r6xpA42R2Nt23W3IU2nmMYZ6ZobaGwBkz3y3bXY2f/CcAjd9wjUrr1ocGSz25n0JrXRuNA== X-Received: by 2002:a05:600c:3152:b0:465:a51d:d4 with SMTP id 5b1f17b1804b1-47904ace283mr208252135e9.6.1764494872763; Sun, 30 Nov 2025 01:27:52 -0800 (PST) X-BeenThere: isar-users@googlegroups.com; h="Ae8XA+buHh9QapXpduWTZo7jfCXIBchtv+MRWbPxaCE9X8PLjA==" Received: by 2002:a05:600c:1d02:b0:477:980b:baeb with SMTP id 5b1f17b1804b1-4790fd87637ls31469765e9.2.-pod-prod-09-eu; Sun, 30 Nov 2025 01:27:49 -0800 (PST) X-Received: by 2002:a05:600c:3587:b0:471:131f:85aa with SMTP id 5b1f17b1804b1-47904aecfd9mr217375885e9.13.1764494869677; Sun, 30 Nov 2025 01:27:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1764494869; cv=none; d=google.com; s=arc-20240605; b=Foin7798feVsTJHD+wcmV6voANscOtNl8yOd4ay1LFguDCxdQLXjMqd0Kv8+C+hC7O CUKdcUD9NIGP6O52yZTIYY9jMgmwhH2Nbiaos22uChMAXsM1wgfBVw1ch6YcnYpHhigi 9PrJeM3fauVJpofb2qbt13zCjEKV21i1PWj28lTcDsEBNXfdB8tbQwR8axjpbXrWe3v8 CtUIjYbMhTK5lV/ixX2kyzTLCzmhLDb9Eee+5K8XJxTelh5uE9C6b0thLwTUKLcxJ74Y 5MTGgjNIamreJt4o1VO5V5Jwy+rbWGHhCDTVaKz0JyuvbQ6o4nVpEnGdr38SIa5NYM+2 e0eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:to:from:dkim-signature; bh=YrRT9jZNG15bAVpz+4P1rO3dfa4jvrmrj+UDNtktLwc=; fh=hOBXq6nisExkIRIwN8IDOmOCLKwX8PM0ANlxQbNMEqA=; b=hUeE6NOOkG/r1l3fv5MJbssazMVPlY1Gew/U2RlFrGsFoLUxZglIh+zvonjEvaWFka Em233kNakQFyLFaSF7bomOCcGrrGbqRT+LQczUSViEJ2ADvhIKLirheRlhD76OjJhkRZ PRf5ai8J3LJ+BV8kFm7RtCi/zT/cdkYh0nhvLQeVFUUbwuS9KfKga44s7LfYE58/4Kli uAjCrKMX1yihHIQCYdsrkHQmmcc6MZcdf7ZXYf26V2BuDlpN5dbI1NxbGea4FJEbQrnP +rCuVcze5Gp/0S7gB6CT7ogP4JBujgRu6wGxxt+QUIV/JHr2oDHOMlzLAshqGfzGktM7 5VIw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=DOYYwKDb; spf=pass (google.com: domain of fm-294854-2025113009274926117dcc4c00020796-t4b0cn@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-294854-2025113009274926117dcc4c00020796-t4B0Cn@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net. [185.136.64.228]) by gmr-mx.google.com with ESMTPS id 5b1f17b1804b1-479052a86ffsi1184095e9.2.2025.11.30.01.27.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Nov 2025 01:27:49 -0800 (PST) Received-SPF: pass (google.com: domain of fm-294854-2025113009274926117dcc4c00020796-t4b0cn@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) client-ip=185.136.64.228; Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 2025113009274926117dcc4c00020796 for ; Sun, 30 Nov 2025 10:27:49 +0100 X-Patchwork-Original-From: "'Jan Kiszka' via isar-users" From: Jan Kiszka To: isar-users Subject: [PATCH v3 05/27] linux-custom: Migrate to a bbclass Date: Sun, 30 Nov 2025 10:27:25 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854:519-21489:flowmailer X-Original-Sender: jan.kiszka@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=DOYYwKDb; spf=pass (google.com: domain of fm-294854-2025113009274926117dcc4c00020796-t4b0cn@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-294854-2025113009274926117dcc4c00020796-t4B0Cn@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Jan Kiszka Reply-To: Jan Kiszka Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Jan Kiszka "inherit linux-kernel" is shorter and a more common pattern compared to OE/yocto. Keep the original .inc file as transitional helper, issuing a warning when it's used with a migration suggestion. Signed-off-by: Jan Kiszka --- .../linux-kernel.bbclass} | 2 +- meta/recipes-kernel/linux/linux-custom.inc | 330 +----------------- 2 files changed, 7 insertions(+), 325 deletions(-) copy meta/{recipes-kernel/linux/linux-custom.inc => classes-recipe/linux-kernel.bbclass} (99%) diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/classes-recipe/linux-kernel.bbclass similarity index 99% copy from meta/recipes-kernel/linux/linux-custom.inc copy to meta/classes-recipe/linux-kernel.bbclass index f73649a3..8f38a617 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/classes-recipe/linux-kernel.bbclass @@ -51,7 +51,7 @@ KERNEL_DEFCONFIG ??= "" HEADERS_INSTALL_EXTRA ??= "" # Add our template meta-data to the sources -FILESPATH:append := ":${FILE_DIRNAME}/files" +FILESPATH:append = ":${LAYERDIR_core}/recipes-kernel/linux/files" SRC_URI += "file://debian" # Variables and files that make our templates diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc index f73649a3..c372ec56 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/recipes-kernel/linux/linux-custom.inc @@ -1,331 +1,13 @@ -# Custom kernel build +# Transitional include for linux-kernel.bbclass # # This software is a part of ISAR. -# Copyright (c) Siemens AG, 2022 -# Copyright (c) Mentor Graphics, a Siemens business, 2022 +# Copyright (c) Siemens AG, 2025 # # SPDX-License-Identifier: MIT -# Settings that would typically be done from the custom kernel recipe -# ------------------------------------------------------------------- +inherit linux-kernel -CHANGELOG_V = "${PV}+${PR}" -DESCRIPTION ?= "Custom kernel" -MAINTAINER ?= "isar-users " -DISTRIBUTOR ?= "ISAR" - -# pinned due to known or possible issues with compat 12 -DEBIAN_COMPAT:buster = "10" - -KBUILD_DEPENDS ?= "build-essential:native, \ - libelf-dev:native, \ - libncurses-dev:native, \ - libssl-dev:native, \ - bc, \ - bison, \ - cpio, \ - dwarves, \ - flex, \ - git, \ - kmod, \ - linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} , \ - rsync," - -KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool | dracut, \ - kmod, \ - linux-base (>= 4.3~)," - -KERNEL_HEADERS_DEBIAN_DEPENDS ?= "" - -KERNEL_LIBC_DEV_ARCH_ALL = "0" -KERNEL_LIBC_DEV_ARCH_ALL:trixie = "1" -KERNEL_LIBC_DEV_DEPLOY ?= "0" - -# Settings that may be changed on a per distro, machine or layer basis -# -------------------------------------------------------------------- - -LINUX_VERSION_EXTENSION ?= "" - -KERNEL_DEFCONFIG ??= "" - -HEADERS_INSTALL_EXTRA ??= "" - -# Add our template meta-data to the sources -FILESPATH:append := ":${FILE_DIRNAME}/files" -SRC_URI += "file://debian" - -# Variables and files that make our templates -# ------------------------------------------- - -TEMPLATE_FILES += " \ - debian/control.tmpl \ - debian/isar/build.tmpl \ - debian/isar/clean.tmpl \ - debian/isar/common.tmpl \ - debian/isar/configure.tmpl \ - debian/isar/install.tmpl \ - debian/isar/version.cfg.tmpl \ - debian/linux-image.postinst.tmpl \ - debian/linux-image.postrm.tmpl \ - debian/linux-image.preinst.tmpl \ - debian/linux-image.prerm.tmpl \ - debian/rules.tmpl \ -" - -TEMPLATE_VARS += " \ - BPN \ - KBUILD_DEPENDS \ - KERNEL_ARCH \ - KERNEL_DEBIAN_DEPENDS \ - KERNEL_BUILD_DIR \ - KERNEL_FILE \ - KERNEL_HEADERS_DEBIAN_DEPENDS \ - KERNEL_LIBC_DEV_ARCH \ - LINUX_VERSION_EXTENSION \ - KERNEL_NAME_PROVIDED \ - KERNEL_CONFIG_FRAGMENTS \ - KCFLAGS \ - KAFLAGS \ - DISTRIBUTOR \ - KERNEL_EXTRA_BUILDARGS \ - HEADERS_INSTALL_EXTRA \ - ISAR_ENABLE_COMPAT_ARCH \ - COMPAT_DISTRO_ARCH \ - DEBIAN_COMPAT \ -" - -inherit dpkg -inherit kbuildtarget - -# Add custom cflags to the kernel build -KCFLAGS ?= "-fdebug-prefix-map=${CURDIR}=." -KAFLAGS ?= "-fdebug-prefix-map=${CURDIR}=." - -# Add extra arguments to the kernel build -KERNEL_EXTRA_BUILDARGS ??= "" - -# Derive name of the kernel packages from the name of this recipe -KERNEL_NAME_PROVIDED ?= "${@ d.getVar('BPN').partition('linux-')[2]}" - -# Determine cross-profile override -python() { - if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and bb.utils.to_boolean(d.getVar("ISAR_CROSS_COMPILE")): - if "class-native" not in d.getVar("OVERRIDES").split(":"): - # cross compiling - d.appendVar("OVERRIDES", ":cross-profile") - else: - # generating -cross packages (in HOST_ARCH) from a -native variant - d.appendVar("OVERRIDES", ":cross-pkgs") -} - -# Default profiles and provides -BUILD_PROFILES = "pkg.${BPN}.kernel pkg.${BPN}.kbuild" - -# We only offer the -kbuildtarget variant when actually cross compiling -BBCLASSEXTEND:append:cross-profile = " kbuildtarget" - -# When cross-profile is active: -# build only kernel (including config) with the default variant of the recipe -BUILD_PROFILES:cross-profile = "pkg.${BPN}.kernel" - -# -native: kbuild package for host -BUILD_PROFILES:class-native = "pkg.${BPN}.kbuild" -BUILD_PROFILES:append:cross-pkgs = " pkg.${BPN}.cross" -RECIPE_PROVIDES:class-native = " \ - linux-headers-${KERNEL_NAME_PROVIDED} \ - linux-kbuild-${KERNEL_NAME_PROVIDED}" -# Use pseudo target to pull in the base variant of the recipe. -# Will be auto-extended with -native by multiarch.bbclass. -# Using DEPENDS instead of RDEPENDS to ensure creation of kernel including -# pregenerated kernel config before host specific linux-kbuild package build -DEPENDS:class-native += "${BPN}-pseudo" - -# -kbuildtarget: kbuild package for target, enforcing non-cross-build -BUILD_PROFILES:class-kbuildtarget = "pkg.${BPN}.kbuild" -RECIPE_PROVIDES:class-kbuildtarget = " \ - linux-headers-${KERNEL_NAME_PROVIDED} \ - linux-kbuild-${KERNEL_NAME_PROVIDED}" -# Using DEPENDS instead of RDEPENDS to ensure creation of kernel including -# pregenerated kernel config before target specific linux-kbuild package build -DEPENDS:class-kbuildtarget = "${BPN}" -ISAR_CROSS_COMPILE:class-kbuildtarget = "0" - -# Make bitbake know we will be producing linux-image and linux-headers packages -# Also make it know about other packages from control -RECIPE_PROVIDES = " \ - linux-image-${KERNEL_NAME_PROVIDED} \ - linux-headers-${KERNEL_NAME_PROVIDED} \ - linux-image-${KERNEL_NAME_PROVIDED}-dbg \ - linux-kbuild-${KERNEL_NAME_PROVIDED} \ - ${BPN}-pseudo-native \ -" - -# Provide linux-libc-dev packages unless nolibcdev profile used -OVERRIDES:append = ":${@ bb.utils.contains('DEB_BUILD_PROFILES', 'pkg.{}.nolibcdev'.format(d.getVar('BPN')), 'nolibcdev', 'libcdev', d)}" - -RECIPE_PROVIDES:append:libcdev = " \ - linux-libc-dev \ - linux-libc-dev-${DISTRO_ARCH}-cross \ -" - -# When cross-profile is active: -# kbuild package is provided by -native or -kbuildtarget variant. Also headers -# provisioning moves over to ensure those variants are pulled, although the -# package itself is still built by the base recipe. -RECIPE_PROVIDES:remove:cross-profile = " \ - linux-headers-${KERNEL_NAME_PROVIDED} \ - linux-kbuild-${KERNEL_NAME_PROVIDED}" - -# As the multiarch class will not append -compat to -pseudo-native, we end up -# with two providers of it. Remove the wrong one. -RECIPE_PROVIDES:remove:class-compat = "${BPN}-pseudo-native" - -# Append headers depends -HEADERS_DEPENDS = ", linux-kbuild-${KERNEL_NAME_PROVIDED} | linux-kbuild-${KERNEL_NAME_PROVIDED}-${DISTRO_ARCH}-cross" -KERNEL_HEADERS_DEBIAN_DEPENDS:append = "${HEADERS_DEPENDS}" - -# Append provides -PROVIDES += "${RECIPE_PROVIDES}" - -# Append build profiles -DEB_BUILD_PROFILES += "${BUILD_PROFILES}" - -def get_kernel_arch(d): - distro_arch = d.getVar("DISTRO_ARCH") - if distro_arch in ["amd64", "i386"]: - kernel_arch = "x86" - elif distro_arch == "arm64": - kernel_arch = "arm64" - elif distro_arch == "armhf": - kernel_arch = "arm" - elif distro_arch == "mipsel": - kernel_arch = "mips" - elif distro_arch == "riscv64": - kernel_arch = "riscv" - else: - kernel_arch = "" - return kernel_arch - -KERNEL_ARCH ??= "${@get_kernel_arch(d)}" - -# set KERNEL_FILE without depending on package arch used in bitbake.conf -KERNEL_FILE:forcevariable = "${@ 'vmlinux' if d.getVar('KERNEL_ARCH') in ['mipsel', 'riscv', 'arm64'] else 'vmlinuz'}" - -def config_fragments(d): - fragments = [] - sources = d.getVar("SRC_URI").split() - for s in sources: - _, _, local, _, _, parm = bb.fetch.decodeurl(s) - apply = parm.get("apply") - if apply == "no": - continue - base, ext = os.path.splitext(os.path.basename(local)) - if ext and ext in (".cfg"): - fragments.append(local) - return fragments - -def get_additional_build_profiles(d): - profiles = d.getVar('BASE_DISTRO') - if not bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')): - profiles += ' pkg.{}.nolibcdev'.format(d.getVar('BPN')) - elif bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_ARCH_ALL')): - profiles += ' pkg.{}.libcdev-arch-all'.format(d.getVar('BPN')) - return profiles - -KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'pkg.{}.libcdev-arch-all'.format(d.getVar('BPN')), 'all\nMulti-Arch: foreign', 'any', d) }" -DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}" - -do_prepare_build:prepend() { - # copy meta-data over to source tree - rm -rf ${S}/debian - cp -r ${WORKDIR}/debian ${S}/ - - # remove templates from the source tree - find ${S}/debian -name *.tmpl | xargs rm -f - - # rename install/remove hooks to match user-specified name for our linux-image package - mv ${S}/debian/linux-image.postinst ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.postinst - mv ${S}/debian/linux-image.postrm ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.postrm - mv ${S}/debian/linux-image.preinst ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.preinst - mv ${S}/debian/linux-image.prerm ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.prerm - - # produce a changelog for our kernel build - deb_add_changelog - - # make sure user-specified directories do exist in ${S} - if [ -n "${HEADERS_INSTALL_EXTRA}" ]; then - for d in ${HEADERS_INSTALL_EXTRA}; do - [ -d ${S}/${d} ] || { - bbfatal "HEADERS_INSTALL_EXTRA: '${d}' not found in \${S}!" - } - done - fi -} - -# build directory for our "full" kernel build -KERNEL_BUILD_DIR = "build-full" - -def get_kernel_config_target(d): - kernel_defconfig = d.getVar('KERNEL_DEFCONFIG') - - config_target = kernel_defconfig - - if kernel_defconfig: - workdir=d.getVar('WORKDIR') - if os.path.isfile(workdir + "/" + kernel_defconfig): - config_target = "olddefconfig" - else: - config_target = "defconfig KBUILD_DEFCONFIG=" + kernel_defconfig - else: - config_target = "defconfig" - - return config_target - -def get_kernel_config_fragments(d): - src_frags = " ".join(config_fragments(d)) - out_frags = " ".join(map(lambda frag: 'debian/fragments/' + frag, config_fragments(d))) - - linux_version_extension = d.getVar('LINUX_VERSION_EXTENSION') - if linux_version_extension: - out_frags += " debian/isar/version.cfg" - - return out_frags - -KERNEL_CONFIG_FRAGMENTS = "${@get_kernel_config_fragments(d)}" - -dpkg_configure_kernel() { - grep -q "KERNEL_CONFIG_TARGET=" ${S}/debian/isar/configure || - cat << EOF | sed -i '/^do_configure() {/ r /dev/stdin' ${S}/debian/isar/configure - KERNEL_CONFIG_TARGET="${@get_kernel_config_target(d)}" -EOF - - rm -rf ${S}/${KERNEL_BUILD_DIR} && mkdir -p ${S}/${KERNEL_BUILD_DIR} - if [ -n "${KERNEL_DEFCONFIG}" ]; then - if [ -e "${WORKDIR}/${KERNEL_DEFCONFIG}" ]; then - cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${S}/${KERNEL_BUILD_DIR}/.config - fi - fi - - # copy config fragments over to the kernel tree - src_frags="${@ " ".join(config_fragments(d)) }" - rm -rf ${S}/debian/fragments - for frag in ${src_frags}; do - basedir=$(dirname ${frag}) - mkdir -p ${S}/debian/fragments/${basedir} - cp ${WORKDIR}/${frag} ${S}/debian/fragments/${basedir}/ - done -} - -get_localversion_auto() { - if grep -q "^CONFIG_LOCALVERSION_AUTO=y" ${S}/${KERNEL_BUILD_DIR}/.config; then - cd ${S} - if head=$(git rev-parse --verify --short HEAD 2>/dev/null); then - echo "-g${head}" >${S}/.scmversion - fi - fi -} - -do_dpkg_source:prepend() { - dpkg_configure_kernel - get_localversion_auto +do_warn_custom_inc() { + bbwarn "Please migrate from \"require recipes-kernel/linux/linux-custom.inc\" to \"inherit linux-kernel\"" } +addtask warn_custom_inc before do_unpack