From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7163980406052618240 X-Received: by 2002:a2e:88d2:0:b0:2b9:e40f:ea93 with SMTP id a18-20020a2e88d2000000b002b9e40fea93mr1274841ljk.47.1692188091659; Wed, 16 Aug 2023 05:14:51 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:a7c3:0:b0:2b9:722f:8f69 with SMTP id x3-20020a2ea7c3000000b002b9722f8f69ls186927ljp.1.-pod-prod-03-eu; Wed, 16 Aug 2023 05:14:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOPqlrQk6cSoDPoq6yc30IlFpUfEIK8mfsqM4DvjOuiU9Q9DStXT40OYxNYQ87ljzJTVgZ X-Received: by 2002:a2e:9e52:0:b0:2ba:5ca7:2311 with SMTP id g18-20020a2e9e52000000b002ba5ca72311mr1325606ljk.41.1692188089788; Wed, 16 Aug 2023 05:14:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1692188089; cv=pass; d=google.com; s=arc-20160816; b=ZLWjZJ4zTtu282WRaUboTCOWpHN8bPpK/ZDpHRK/OAhcfFPbMTsCmc9E/9enRzLHx6 NZ3HW2pNF0AdUVdkMU/UCOM8Qe/d/v0fa7zdCf0xMEgzWeatTxsKyW/4juWGDPHuOe9M wChwaghXcRkRybKxqKc2UeMDE7G22/XanrXJf9WE6fWE6XAiwmITflzgw0GTcMjRb0Ne fGI+rHvrYiezs3mFhgkIc/xUy0LR2rVsmgQBQ7WNMzWUlWzkwqnEq7i/T5wXpQSTkkFL Vq/5J137u9LPQaqZxsvcDetQGXwAdx3vEEFBQJBlCcseSCqGPcSZmgNwxZggMyeQIqzf OW4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=e7dopBBA+7EUDdZwZi2P/eiC/6XWzGY55UaLGWWrgiU=; fh=P0iuKgidmAaYvPfY6P+WWv+5AQ1KAqwDcu5amwfnCeI=; b=YAWiPb4W9UPOGiAE6gQp3+CdVDtDwIPRiHH4zbpp2nqC21gqF14GOGofjjA5FUs1aY moJScYsZVMyEJ29OMvDUH+hNRU8XZv++v3If/Q/hPm0hQUDvU9/FnshUBeOHQBQmtd9p enZ+Rcs9I1i/yEO11sNDiweESOy5oJ9FhccIj3PbrkF0NphDRM3s4CSpCK4HSc5fDpkz YiuRbLG8a5E4w67PBTcfif8ARmeqljlJ/MS5nmBFgbj9EK5t5qe4PeUJF3HOrMOJ1pLp uPoS7qEFmvnd1o9A100tIoTMWCNez4ZOY6WqqpVEFcNtsN8JMV63r5HdY8WwLdyP9+0k OPLA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=gwjUmQgo; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of stefan-koch@siemens.com designates 2a01:111:f400:fe0e::618 as permitted sender) smtp.mailfrom=stefan-koch@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on0618.outbound.protection.outlook.com. [2a01:111:f400:fe0e::618]) by gmr-mx.google.com with ESMTPS id p3-20020a2e8043000000b002ba0a533736si1226397ljg.3.2023.08.16.05.14.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Aug 2023 05:14:49 -0700 (PDT) Received-SPF: pass (google.com: domain of stefan-koch@siemens.com designates 2a01:111:f400:fe0e::618 as permitted sender) client-ip=2a01:111:f400:fe0e::618; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=gwjUmQgo; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of stefan-koch@siemens.com designates 2a01:111:f400:fe0e::618 as permitted sender) smtp.mailfrom=stefan-koch@siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y/Zgzl6TRxZx3+YEguvOWisWeiomSQaDiX5OqmK/El3wygz0Cgapr0tsMZ5dyh/WvnzWg2CsyHazDcl8iYprllBKKKfRhGGqVH1i/EBx/Ko6LM7v/kJMVdnjWY8bpBfcYQdtyFmnmHqT1yTCHKQH+RBT0/yUdZAF5cSBWsoOuxp/X5ej03JZpeFIAL09slh9/ZMNd5H5Tqybul+LWyGpZ11BoHlFDQWrjIqKjwyGoIQHIUaPvVtFEStUBi6A9/o/NATFHYhd4iArG5HxvBWf/bR304OgzOft58U+QOz/HQYJMc8gRIDZM4oDAZzYOTUwcOYsyoxT/0MbRNTHP6wBUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e7dopBBA+7EUDdZwZi2P/eiC/6XWzGY55UaLGWWrgiU=; b=I7gnvTh+2u8Da/YCpOfAxqx4RqNMbOMDypI3vb8ykCabEpjewZqMo3YMx79qr95wG7d5V8wtQUea5gnMYItixGPwcByc6TIiV4nbkhPEaTSYiDERhOp8oTmig85HnzO/M3eCG4Spaf/6Kz/M8bRuI8zbhyZ+7cBzkOZkT3V+mZ8VnxcZs5t3mrP2Vzn806S7p/YxY22jmmYs3px7ccnmQZq4CQ5xzM6O/XYf5+7jN/Yrrh9r+v/b9IGhUgW9O0jbizT846FdtcXzQZrUn0017LULvSk/p2HaTpWXtintJ1Uzf6zR2LphPeLqa4neA7Iu0Pfxd/XFdzbaTcCQTliv0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siemens.com; dmarc=pass action=none header.from=siemens.com; dkim=pass header.d=siemens.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e7dopBBA+7EUDdZwZi2P/eiC/6XWzGY55UaLGWWrgiU=; b=gwjUmQgoMEJYUAw0Oy24KQJm+ux5Cxd421s9elooM3jGjXwUENI6cwFZuqDkYXI86P4anueDuYptAyLKzE68nQ72IxHQwcCuHuv2KYNLyIoYDBfn9zox/IE6iQ0dJimrhtNJ6EB4dIKuQbpRfzrTD0xC+VU596YAIUoUPffJHuwoupRC+FHIrUmLXybJNtWEM6AYMca5VWR/JBALa8O6swmUZ3SuV4/6h7CIyO/ragcOs9IbhQ68X48rXH/flblBL9ZilMoHJeHfhnUd1JKyJO+DfJPsjy11KcxElgAOVoO7CSyOUF6forhCQOcZtSAswWs2+PJ658ccO7StybBLmA== Received: from AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:41e::11) by AM7PR10MB3480.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:132::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.29; Wed, 16 Aug 2023 12:14:47 +0000 Received: from AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM ([fe80::c9da:178c:455b:211e]) by AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM ([fe80::c9da:178c:455b:211e%4]) with mapi id 15.20.6678.029; Wed, 16 Aug 2023 12:14:47 +0000 From: "Koch, Stefan" To: "isar-users@googlegroups.com" CC: "Koch, Stefan" , "Kiszka, Jan" , "Storm, Christian" , "Adler, Michael" , "Sudler, Simon" , "cedric.hombourger@siemens.com" , "Schmidt, Adriaan" , "MOESSBAUER, FELIX JONATHAN" , "ubely@ilbers.de" Subject: [PATCH v3 4/5] linux-custom: Provide host and target specific kernel kbuild packages Thread-Topic: [PATCH v3 4/5] linux-custom: Provide host and target specific kernel kbuild packages Thread-Index: AQHZ0Ds/UV4kclqQF0C9V6zQm5P2NA== Date: Wed, 16 Aug 2023 12:14:47 +0000 Message-ID: <20230816121423.3956608-5-stefan-koch@siemens.com> References: <20230816121423.3956608-1-stefan-koch@siemens.com> In-Reply-To: <20230816121423.3956608-1-stefan-koch@siemens.com> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.39.2 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siemens.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM9PR10MB4959:EE_|AM7PR10MB3480:EE_ x-ms-office365-filtering-correlation-id: 0521f90c-46bc-4f93-2560-08db9e52625e x-ld-processed: 38ae3bcd-9579-4fd4-adda-b42e1495d55a,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 36p+1iu5KclGfyOpZOgKOK+NW7VopWi7dx+7NW0SdBrfMvV83vwvvQNIP6UdzTvdcTcc/XEL9tJiY85cFcM3euSgIAuZC6c3/hwzThL0njkq+PYeOchmPPVbQOMCMJPMj2bCz/VsB/ZOBZHWzyGqw5XTnw52MLvCK0pyDaHBgD1duBl/jacqjF1Uwx/LtpFbFuXmOhJO7cxz2EjymGvY2NA4oYdVcCH7Kf/ELflDB60hm3FOwrJcDHZkVQTQSxiNMWep8fAojp2aAvm3vGWbSPzxMkAIaq0kMZzV97nNQogOslBh1nll0vM2tXONuOneD5KSUQFclOtPmPyYkhtJnQA4Yo/5gNIuhoqwSJa8uX3dJbcydhGdbSb4P5Pi7SV397ILdSrqKjaL9qAJjlZ3CjhNOWVHO0MF8BZlfjGVrrIGYMTs4FJKi2gszqhdU+JvmrkZLhEmOggDntiMIxHrGXSoVLKTLFCzLCQnILJd9ynyTKVmE11NGP8zf3OlXI7E3gqtb1LSNLvnVppTna4OW6iYBlGn0++ddDNLhN6WCOWFYOmsBvZwTzw6OZSjuQam76wXtWMVBNDtxS9tBypVkGNP7aCigdYsgyjWTN1bk0o= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(136003)(366004)(346002)(376002)(1800799009)(451199024)(186009)(316002)(54906003)(76116006)(6916009)(66946007)(91956017)(64756008)(66446008)(66476007)(66556008)(122000001)(966005)(41300700001)(5660300002)(38070700005)(38100700002)(8676002)(4326008)(8936002)(82960400001)(30864003)(2906002)(83380400001)(26005)(478600001)(86362001)(6512007)(6506007)(36756003)(71200400001)(1076003)(2616005)(6486002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?qaIY2Tgf398JHwcUy+KoCksDbsfCmNfmFit0RsiQdNWgmkYsW3Y9hYbVGq?= =?iso-8859-1?Q?F2HLrtT10EgxTUTvxmu7CuYRIsLuzancd4Dl5ngJCoy7WPCCMgILJaLrXE?= =?iso-8859-1?Q?OBgHvnsTuUbcw19h29qUTIDz8hSTFkrABJZu9rIF8CFTZZiRNvG+JYY4rP?= =?iso-8859-1?Q?MRwUjRReBV/Q0U+T97e10Pnq+FrksmopwOp8M9hInYDn0D1YGA8qMq6Xc9?= =?iso-8859-1?Q?RXEeTG4wZKcodwfS8NIFZ5RvVhkANVmMvoPHW+jWSJNR7wv8ISzCo7ngHn?= =?iso-8859-1?Q?qwquHGzIDK9hnqF+XuwbW+H6bzjcg+y+jXDhcI4JiXDvD1XzNVYbOvX7D8?= =?iso-8859-1?Q?N3WhShHDHgv2A5dVdl+f0IHTDxC6sYuiwoRUojU2r05Plsgjm8ZZI7vgHe?= =?iso-8859-1?Q?ZiraeT+4B0l0i+Z3Nhr1mDxG2W05UXHP+YSyg3t9mjIZsyQ/c8CQ0AjWJw?= =?iso-8859-1?Q?5tw3uzRlmoP27mgaHlZXT00JaredYElHhRA56ajDKbMvxeVxN6u2+2nyB8?= =?iso-8859-1?Q?HiDtXHWSv525o5kbFPYKFACLsqyJ8XbA5v/+sKuFL6lkXXRDbB2E+1QTrf?= =?iso-8859-1?Q?i0nl31RtYFnxBWgAmswTxAS3WnjYDgq8Dlvg7SPiV8+sutArlLgNh92Eba?= =?iso-8859-1?Q?+/ZP023YxOTznJjN/zkAXrxiRNMtwHJLp7E+r4QaTZvo3I6G/K/naP2C+0?= =?iso-8859-1?Q?dW6jKpjhaQVi/CDcJP7JvQ5vvfDBnhLlKR0Dn5FRG7/DcKjBWWpc47kW8k?= =?iso-8859-1?Q?WwQh5fVE4TkgwGxLirlwkxDKrmaYu2ZVI2mumsv4qHX9CoJE+YcvgJN7zy?= =?iso-8859-1?Q?Pu8liSFThANUQv4J5JglvLUqXuV2M0UNstGxmDLtImdm7rJv4K8sRHu55X?= =?iso-8859-1?Q?eIrGWwgO4ri4lQvrqvs+OVhvyeZh7HOhQjcIk+1h0haD9W3hzfsOPvJ9gt?= =?iso-8859-1?Q?vZAT0rqUQe5qIMWlPXn0Ozv2qvTT9KKpCGUZ+6SCfusRl/osKEL7zP9Toc?= =?iso-8859-1?Q?IF/4fHpZjoi91aWMZRAN1oz6AG6xPkzO6mgyD3o4NMS0RTyGPwCCR+jYYC?= =?iso-8859-1?Q?jeABvnSPoZC/zOK6vZIUJeeJWR2vjH2BAUe8O9kRia/WY0iQ6Ot0kHgj7+?= =?iso-8859-1?Q?Cwrhh8Ffl4pBurU06ozcswaKLyGodR21iZ4iO1GdiXET8EYsLMZfdVRHo8?= =?iso-8859-1?Q?npIc4570Dh8xlOEOL7lFRfhXQfiBKXzJBdrWye3JjaNfkpn+Z8OJWGdi0E?= =?iso-8859-1?Q?7VuMfIY0ys+Gse5LwTo5Y8aZpEeQOXjJI4ucVqaj3IpSCnvtmtmOCOot2q?= =?iso-8859-1?Q?JI42EOwJCg7vCrPya1Wp6Hb7ik1JWh8pfnQYGJA59S+3pND01oKKvcaM5/?= =?iso-8859-1?Q?UJv6MVEV3Ju6TV8zxQxhXWtvQHaC6V9OCeCprpf813oGFScgG798dHY0uq?= =?iso-8859-1?Q?BHO+gk3mKVdW39KtseQrW1GzribAWtOWw5cEcrn69kZeM1KUgYN52Oc+6f?= =?iso-8859-1?Q?uOzxrCMMKKsyHeqgKDFf8fyiXRVGQI4iTe75UdjQ+sH5MaAWLEQdYIX7AC?= =?iso-8859-1?Q?pEDfO8+H3YRTKj5walfCasZKtOXCLSXGHGVIIvxKou7Za+qmyh+0CGTr2H?= =?iso-8859-1?Q?iUK8Vkrggrk75atn7T37I3WGPoUHTD40A1rXAEMleE30fjzJBEMVEvRQ?= =?iso-8859-1?Q?=3D=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 0521f90c-46bc-4f93-2560-08db9e52625e X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Aug 2023 12:14:47.7763 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Q+gPouExRaFGtJuOkEi2JkmAAKg67SO4nsL+6GntBsffWxa+ffiP/YXXC7X+Z2Mdkik/giI1yyZPwXjDpDp2/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR10MB3480 X-TUID: 6+IrT2sIbc5z When using a cross build this patch does introduce optionally host and target specific kernel kbuild packages that ship the "scripts" and "tools" binaries. By default at cross builds a kbuild-cross package will be generated that provides the host specific kbuild package. When setting EXTENDED_KBUILD_MODE to "1" the "-compat" and "-native" multiarch bitbake targets are useable to run additional target or host specific builds for kbuild scripts and tools. Using the "-compat" bitbake target enables the build of a target specific kbuild package at cross builds. Using the "-native" bitbake target enables the build of a host specific kbuild package at cross builds. This solves this from doc/custom_kernel.inc: - The kernel headers package has not supported both native and cross compilation of kernel modules when itself was cross built - Future roadmap: Generate kernel headers package for both host and target when using a cross build Signed-off-by: Stefan Koch --- .../linux/files/debian/control.tmpl | 16 ++++- .../linux/files/debian/isar/build.tmpl | 13 +++- .../linux/files/debian/isar/common.tmpl | 12 +++- .../linux/files/debian/isar/configure.tmpl | 13 +++- .../linux/files/debian/isar/install.tmpl | 26 ++++--- .../linux/files/debian/rules.tmpl | 2 +- meta/recipes-kernel/linux/linux-custom.inc | 71 +++++++++++++++---- 7 files changed, 123 insertions(+), 30 deletions(-) diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/rec= ipes-kernel/linux/files/debian/control.tmpl index b19ca2c9..c012048b 100644 --- a/meta/recipes-kernel/linux/files/debian/control.tmpl +++ b/meta/recipes-kernel/linux/files/debian/control.tmpl @@ -6,6 +6,7 @@ Build-Depends: bc, kmod, cpio, ${KBUILD_DEPENDS} Homepage: http://www.kernel.org/ =20 Package: linux-image-${KERNEL_NAME_PROVIDED} +Build-Profiles: Architecture: any Depends: ${KERNEL_DEBIAN_DEPENDS} Description: ${KERNEL_NAME_PROVIDED} Linux kernel, version @KR@ @@ -13,6 +14,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel, versio= n @KR@ files, version: @KR@. =20 Package: linux-headers-${KERNEL_NAME_PROVIDED} +Build-Profiles: Architecture: any Depends: ${KERNEL_HEADERS_DEBIAN_DEPENDS}, ${perl:Depends}, ${shlib:Depend= s} Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers for @KR@ @@ -21,7 +23,7 @@ Description: ${KERNEL_NAME_PROVIDED} Linux kernel headers= for @KR@ This is useful for people who need to build external modules =20 Package: linux-libc-dev -Build-Profiles: +Build-Profiles: Section: devel Provides: linux-kernel-headers Architecture: any @@ -30,6 +32,7 @@ Description: Linux support headers for userspace developm= ent are used by the installed headers for GNU glibc and other system librarie= s. =20 Package: linux-image-${KERNEL_NAME_PROVIDED}-dbg +Build-Profiles: Section: debug Architecture: any Description: Linux kernel debugging symbols for @KR@ @@ -37,8 +40,19 @@ Description: Linux kernel debugging symbols for @KR@ all the necessary debug symbols for the kernel and its modules. =20 Package: linux-kbuild-${KERNEL_NAME_PROVIDED} +Build-Profiles: Architecture: any Depends: ${perl:Depends}, ${shlib:Depends} Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @K= R@ This package provides kernel kbuild scripts and tools for @KR@ This is useful for people who need to build external modules + +Package: linux-kbuild-${KERNEL_NAME_PROVIDED}-cross +Build-Profiles: +Architecture: any +Depends: ${KERNEL_HEADERS_DEBIAN_DEPENDS}, ${perl:Depends}, ${shlib:Depend= s} +Description: ${KERNEL_NAME_PROVIDED} Linux kbuild scripts and tools for @K= R@ + This package provides kernel kbuild scripts and tools + as ${HOST_ARCH} cross binaries for @KR@ + This is useful for those who need to cross build + external modules using ISAR's sbuild-chroot-host diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl b/meta/= recipes-kernel/linux/files/debian/isar/build.tmpl index 906dc580..7e7cab00 100644 --- a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl +++ b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl @@ -22,7 +22,18 @@ do_build() { sed -i "s/@KR@/${KR}/g" ${S}/debian/control ${S}/debian/linux-image-${= KERNEL_NAME_PROVIDED}.* =20 # Build the Linux kernel - ${MAKE} O=3D${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=3D"${KCFLAGS}= " KAFLAGS=3D"${KAFLAGS}" + if echo "${DEB_BUILD_PROFILES}" | grep -q -e "targetbuild" -e "hostbui= ld"; then # Build kernel scripts and tools + cat ${KERNEL_BUILD_DIR}/.config | grep RECORDM + ${MAKE} O=3D${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=3D"${KCFL= AGS}" KAFLAGS=3D"${KAFLAGS}" scripts + if [ -d "tools/objtool" ]; then + ${MAKE} O=3D${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=3D"${= KCFLAGS}" KAFLAGS=3D"${KAFLAGS}" tools/objtool || true + fi + if grep -q "CONFIG_MODULES=3Dy" ${KERNEL_BUILD_DIR}/.config; then + ${MAKE} O=3D${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=3D"${= KCFLAGS}" KAFLAGS=3D"${KAFLAGS}" modules_prepare + fi + else # Build the Linux kernel + ${MAKE} O=3D${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=3D"${KCFL= AGS}" KAFLAGS=3D"${KAFLAGS}" + fi =20 # Stop tracing set +x diff --git a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl b/meta= /recipes-kernel/linux/files/debian/isar/common.tmpl index f4c0519f..65fa1fa4 100644 --- a/meta/recipes-kernel/linux/files/debian/isar/common.tmpl +++ b/meta/recipes-kernel/linux/files/debian/isar/common.tmpl @@ -5,12 +5,22 @@ set -e =20 # Isar settings -ARCH=3D${KERNEL_ARCH} KERNEL_PKG_IMAGE=3Dlinux-image-${KERNEL_NAME_PROVIDED} KERNEL_PKG_KERN_HEADERS=3Dlinux-headers-${KERNEL_NAME_PROVIDED} KERNEL_PKG_LIBC_HEADERS=3Dlinux-libc-dev KERNEL_PKG_KERN_KBUILD=3Dlinux-kbuild-${KERNEL_NAME_PROVIDED} =20 +if echo "${DEB_BUILD_PROFILES}" | grep -q "hostbuild"; then + # Force creating kernel kbuild debian package with valid host arch + # Use a cross build to comply with arch specific kernel defconfigs + # scripts and tools are always created in host arch + ARCH=3D${KERNEL_ARCH} + eval $(dpkg-architecture -f -A ${DISTRO_ARCH}) + CROSS_COMPILE=3D${DEB_TARGET_GNU_TYPE}- +else + ARCH=3D${KERNEL_ARCH} +fi + # Constants KCONF=3D.config =20 diff --git a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl b/m= eta/recipes-kernel/linux/files/debian/isar/configure.tmpl index 389c9a85..900d5cd8 100644 --- a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl +++ b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl @@ -11,9 +11,16 @@ do_configure() { set -x =20 # Process kernel config target and fragments - ${MAKE} O=3D${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET} - ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \ - ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS} + if [ -e ${PP}/kernelconfig ]; then + mkdir -p ${KERNEL_BUILD_DIR} + cp ${PP}/kernelconfig ${KERNEL_BUILD_DIR}/.config + ${MAKE} O=3D${KERNEL_BUILD_DIR} olddefconfig + else + ${MAKE} O=3D${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET} + ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \ + ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS} + cp ${KERNEL_BUILD_DIR}/.config ${PP}/kernelconfig + fi =20 # Stop tracing set +x diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/met= a/recipes-kernel/linux/files/debian/isar/install.tmpl index 236b67c4..08b8a9a5 100644 --- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl +++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl @@ -34,18 +34,24 @@ do_install() { set -x =20 # Run the install steps - install_image - if [ "${ARCH}" !=3D "um" ]; then - install_config - install_map + if ! echo "${DEB_BUILD_PROFILES}" | grep -q -e "targetbuild" -e "hostb= uild"; then + install_image + if [ "${ARCH}" !=3D "um" ]; then + install_config + install_map + fi + install_hooks + install_dtbs + install_kmods + install_headers fi - install_hooks - install_dtbs - install_kmods - install_headers =20 - # Cleanup and install kernel scripts and tools - rm -rf ${deb_kern_kbuild_dir} + if ! echo "${DEB_BUILD_PROFILES}" | grep -q -e "targetbuild" -e "hostb= uild" && echo "${DEB_BUILD_PROFILES}" | grep -q "crosskbuild"; then + # Install cross kernel scripts and tools + install_kbuild ${deb_kern_kbuild_dir}-cross + fi + + # Install kernel scripts and tools install_kbuild ${deb_kern_kbuild_dir} =20 # Stop tracing diff --git a/meta/recipes-kernel/linux/files/debian/rules.tmpl b/meta/recip= es-kernel/linux/files/debian/rules.tmpl index e8ae3daa..1f838a41 100755 --- a/meta/recipes-kernel/linux/files/debian/rules.tmpl +++ b/meta/recipes-kernel/linux/files/debian/rules.tmpl @@ -48,4 +48,4 @@ override_dh_strip_nondeterminism: true =20 override_dh_strip: - unset DEB_HOST_GNU_TYPE && dh_strip -Xvmlinu --no-automatic-dbgsym + dh_strip -Xvmlinu -Xlinux-kbuild-${KERNEL_NAME_PROVIDED}-cross --no-autom= atic-dbgsym diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kern= el/linux/linux-custom.inc index 94ed84a2..71f195fb 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/recipes-kernel/linux/linux-custom.inc @@ -83,11 +83,9 @@ TEMPLATE_VARS +=3D " \ KCFLAGS \ KAFLAGS \ DISTRIBUTOR \ + PP \ " =20 -inherit dpkg -inherit template - # Add custom cflags to the kernel build KCFLAGS ?=3D "-fdebug-prefix-map=3D${CURDIR}=3D." KAFLAGS ?=3D "-fdebug-prefix-map=3D${CURDIR}=3D." @@ -95,28 +93,75 @@ KAFLAGS ?=3D "-fdebug-prefix-map=3D${CURDIR}=3D." # Derive name of the kernel packages from the name of this recipe KERNEL_NAME_PROVIDED ?=3D "${@ d.getVar('PN').partition('linux-')[2]}" =20 -# Make bitbake know we will be producing linux-image and linux-headers pac= kages python() { kernel_name =3D d.getVar("KERNEL_NAME_PROVIDED") - d.setVar('PROVIDES', 'linux-image-' + kernel_name + ' ' + \ - 'linux-headers-' + kernel_name) + distro_arch =3D d.getVar("DISTRO_ARCH") + host_arch =3D d.getVar("HOST_ARCH") headers_depends =3D "linux-kbuild-" + kernel_name =20 + # Determine creation of a kbuild-cross or (standard) kbuild package fo= r the host + is_cross_profile =3D distro_arch !=3D host_arch and d.getVar("ISAR_CRO= SS_COMPILE", True) =3D=3D "1" + if is_cross_profile: + d.appendVar('DEB_BUILD_PROFILES', ' crosskbuild') + headers_depends =3D headers_depends + "-cross | " + headers_depend= s + else: + d.appendVar("DEB_BUILD_PROFILES", " defaultkbuild") + + # By setting EXTENDED_KBUILD_MODE to "1" the "-compat" and "-native" + # multiarch bitbake targets are used to run additional + # target or host specific builds for kbuild scripts and tools. + # In this case the "-compat" bitbake target requests a "target" build + # and the "-native" bitbake target requests a "host" build. + # + # For different distro and host archs + # - Add dependency for sbuild-chroot-target + # to allow building arch specific kbuild scripts and tools + # - Set correct variable overrides + is_compat =3D "compat" in d.getVar("PN", True) + is_native =3D "native" in d.getVar("PN", True) + if d.getVar("EXTENDED_KBUILD_MODE", True) and is_cross_profile: + build_depends =3D "crossbuild-essential-" + distro_arch + " [" + h= ost_arch + "], " + d.prependVar("KBUILD_DEPENDS", build_depends) + d.appendVarFlag("do_prepare_build", "depends", " sbuild-chroot-tar= get:do_build") + d.setVar("ISAR_ENABLE_COMPAT_ARCH", "1") + d.setVar("COMPAT_DISTRO_ARCH", distro_arch) + + if is_compat: + d.appendVar("DEB_BUILD_PROFILES", " targetbuild") + d.setVar("ISAR_SKIP_CROSS_PROFILE", "1") + d.setVar("SCHROOT_DIR_OVERRIDE", d.getVar("SCHROOT_TARGET_DIR"= , True)) + d.setVar("SBUILD_BUILD_OVERRIDE", d.getVar("PACKAGE_ARCH", Tru= e)) + d.setVar("SBUILD_HOST_OVERRIDE", d.getVar("PACKAGE_ARCH", True= )) + elif is_native: + d.appendVar("DEB_BUILD_PROFILES", " hostbuild") + d.setVar("SCHROOT_DIR_OVERRIDE", d.getVar("SCHROOT_HOST_DIR", = True)) + d.setVar("SBUILD_BUILD_OVERRIDE", d.getVar("HOST_ARCH", True)) + d.setVar("SBUILD_HOST_OVERRIDE", d.getVar("HOST_ARCH", True)) + + # Make bitbake know we will be producing + # linux-image and linux-headers packages + if not is_compat and not is_native: + d.setVar("PROVIDES", "linux-image-" + kernel_name + " " + \ + "linux-headers-" + kernel_name) + # Set dependency for kernel headers d.appendVar("KERNEL_HEADERS_DEBIAN_DEPENDS", headers_depends) } =20 -def get_kernel_arch(d): - distro_arch =3D d.getVar("DISTRO_ARCH") - if distro_arch in ["amd64", "i386"]: +inherit dpkg +inherit template + +def get_kernel_arch(d, arch=3D"DISTRO_ARCH"): + arch =3D d.getVar(arch) + if arch in ["amd64", "i386"]: kernel_arch =3D "x86" - elif distro_arch =3D=3D "arm64": + elif arch =3D=3D "arm64": kernel_arch =3D "arm64" - elif distro_arch =3D=3D "armhf": + elif arch =3D=3D "armhf": kernel_arch =3D "arm" - elif distro_arch =3D=3D "mipsel": + elif arch =3D=3D "mipsel": kernel_arch =3D "mips" - elif distro_arch =3D=3D "riscv64": + elif arch =3D=3D "riscv64": kernel_arch =3D "riscv" else: kernel_arch =3D "" --=20 2.39.2