From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7163980406052618240 X-Received: by 2002:a19:c501:0:b0:4b5:6aa3:b6d with SMTP id w1-20020a19c501000000b004b56aa30b6dmr8584195lfe.126.1671556173472; Tue, 20 Dec 2022 09:09:33 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:ac2:4e8a:0:b0:4c8:8384:83f3 with SMTP id o10-20020ac24e8a000000b004c8838483f3ls1738464lfr.3.-pod-prod-gmail; Tue, 20 Dec 2022 09:09:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Xr7Kys3k0Vddx+UZ5vfe3qIf0L0MPGjaTSmc7KsNKhmfZCKSsdrtTZ+8U2d7ZGaJ/lPTO X-Received: by 2002:a05:6512:2613:b0:4a4:68b7:e717 with SMTP id bt19-20020a056512261300b004a468b7e717mr16902321lfb.1.1671556172255; Tue, 20 Dec 2022 09:09:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671556172; cv=pass; d=google.com; s=arc-20160816; b=czC4oHkzbv97t1Xg/NSgSQurBOlbfhQxoseTsxUCJ3dQ5AorjyWsx0gC5JX24Bxkbl vBmmP78/MM6Hva6fuUTVeEDV+JIx1R7dQONkdKWDhu6FdScP77MToey/k0NtuXbpL1V+ 476kIGXc9ojTANhpUUKNPRvdrRy6dnlOL0k4ZF3ygdUjxb2duCF2MkzRdzuz4d59q/Ky LxR8brKVLsGxDZmNnD1vjd9PiOIIXUHc3pzE0AqbZ+cSPHkejN5cYZMwuvGg5UVwkrNW GykTStkA211ffZi+K/DO5VQwmENF4h2jZyinLbmGPlNzb9kri3ff0GjvWwdVbkcRPI05 s7uw== 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=hsxMf9GhamTXSPFuEV76aMbAz5NzgBGVdtuuusCJItA=; b=vSTI4dYXDgdtRrZtqnvZBHphgx4pXbgLVVM5+CdIONwFpHRjeIHJ3xzD2xSLEZ7zdP mLsIsGVOrAymzcSIHlnNlNlamLA5nHTH4/cOXYPwqSARbgrKXjyKCRZ20GicvjKSKi/D xxNVRQ/gYewVgHFmr8eAjmDOodPKl+CRxGKdD0Nj06gvE8pH6YXRJieikrC+GxbfQPJ9 LPiRDYGqvzA48XpIDoDtUJymkp2y20xk3OfEdQNRgChzNHaxW0ZOccdxKWzicZZZSeOB CTYizftV9FpK9QhggaEQuKS9+ZifJwXlQd/dOUCMZLqL8sF0xtEohgPxljVE3cEliPhR 30gQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=Q7DGHkP1; 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 40.107.21.77 as permitted sender) smtp.mailfrom=stefan-koch@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2077.outbound.protection.outlook.com. [40.107.21.77]) by gmr-mx.google.com with ESMTPS id c5-20020a056512324500b004b58f5274c1si546577lfr.1.2022.12.20.09.09.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2022 09:09:32 -0800 (PST) Received-SPF: pass (google.com: domain of stefan-koch@siemens.com designates 40.107.21.77 as permitted sender) client-ip=40.107.21.77; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=Q7DGHkP1; 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 40.107.21.77 as permitted sender) smtp.mailfrom=stefan-koch@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UMNIFvmz2zoqNw/5qPxPyWef5qb4o0kiJEaLLJMI8ZPT9tW/sdhQXv+fqPzVjKHlp71amZHTnex4ZDLG2kG4zI3PUSWD1HKXJBNJN8BIgYEbb9ws5yyq03aqnjii3S4/zef3+CLzyP19JoKJEdPnPvsdNzbSb2YpguRU9lzU1VfuUzWq9KrcSmHp9ITj0OnhSBYexWu6PTDjn/pJKEw5SQFieEShe7dngDRSW4gZ/beZpbtXjjcACxIN0/tWw5dB0gHzBskEwwO+N39mZZbK0oi2mDi74aq+4c/2m4+rztOJGXN7xan++gtp1SUmaNsMk6RFCvXbAh6dLLvYNRnoJA== 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=hsxMf9GhamTXSPFuEV76aMbAz5NzgBGVdtuuusCJItA=; b=h3ZxO6Upm8dxPMIwOz0XLSHOMCgM0ig5lQFgvW/UwlLU32OngYGLMXVjEFT05tDD6/iGN2yjd0vq7UDYUko0jbvxNDNmKsML/6ifP70325k2fZyQNvNxRRrYGY7GE4WPIM2LgmB+V32LFT8jtVHWrdqj13Ae5307IbnYKV2kuU+mWf0j0qDA8eE4qJ6Eaxb9rJr2UaWAeT80WULkTKxF+8wcmNR/DL+uR8ey90gOB7bszLgo9HQqYYhlyXJZ636rqvLeegW91O6+dtAC9CgyzqkNlrfKzHuSVAliPtjuIj7DZXeNh2qyqpSdc7HMQoQ6gMK/QAyvb7YMf4rwj0Ev7Q== 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=hsxMf9GhamTXSPFuEV76aMbAz5NzgBGVdtuuusCJItA=; b=Q7DGHkP1qUelMk4leHSvmEz4drwo9XayttMW3Np38aW2coaf/uquyKAssKzWtfZyVjs7JMcuoG1OQxg2fZ3IcCzywRYN8dsz34HhW/PRKPe3LrQzz6enEKu04Jv2eqiK3P3Vp57AhPx9jv3L18Gq8wLIyjgEY3eiNKHObcbs3zZIpBCoP3nX8ValzaqWgFiy2FZw1rzIRStTw8ZS5vFHdy4izjneGD7648tPtcfS59tnv9Z3OcRMjHjgCTr/E1pDEiFh5qruBVSEKodjy1Ao6KmGJkp8NkGAsFYD+lhYpWdMLfJOpgRk4rsP27DQ6k9sUtkQvMf9bhCGl9Ck6iOQ+Q== Received: from AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:41e::11) by GV1PR10MB6146.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:99::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 17:09:30 +0000 Received: from AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM ([fe80::3be:f097:9bbc:68f3]) by AM9PR10MB4959.EURPRD10.PROD.OUTLOOK.COM ([fe80::3be:f097:9bbc:68f3%3]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 17:09:30 +0000 From: "Koch, Stefan" To: "isar-users@googlegroups.com" CC: "Kiszka, Jan" , "ubely@ilbers.de" , "Storm, Christian" , "Adler, Michael" , "Sudler, Simon" , "Koch, Stefan" Subject: [PATCH v2 4/5] linux-custom: Provide host and target specific kernel kbuild packages Thread-Topic: [PATCH v2 4/5] linux-custom: Provide host and target specific kernel kbuild packages Thread-Index: AQHZFJXS6oya2RtHqUeJrb5PNoVWvw== Date: Tue, 20 Dec 2022 17:09:29 +0000 Message-ID: <20221220170921.1718503-5-stefan-koch@siemens.com> References: <20221220170921.1718503-1-stefan-koch@siemens.com> In-Reply-To: <20221220170921.1718503-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.30.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_|GV1PR10MB6146:EE_ x-ms-office365-filtering-correlation-id: e54d4ad0-6f08-458f-52dc-08dae2acf51d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xSlTU8ZOClxl3BRSK5ZxzWCLkyJUb+jTe+EV+XRr3tXiBAwbibRrAohBEx2KQO8G2jnhkdVnS2mWXM/1qPbVkPj2kKKZEikxGNDV+LtXOXndKA+kMXUiM7o+2ZiuLxNrL1rg/Gi4fWKLV+Mrpm3it0tV0+mcYuGVFK608xjFrsTO9YFrrBKSEGTUbAhwqmNXoWaM7qt7YgPgd8fie5iF1HPTGfFYJVqbf5nY0FcJQWE2kzYx7vjRdCLcebTphWbJ1/keO9wNYAuCOIZqn/602rssI+PdABM9PtZJd0XYTHUKOPifjvIJbxdP10UR/rBxDg67oo4rgIhQwBl5pd+MY7dXMxUJuw0eqKFC06HaqbfORoHSR/fTpvgpMtjzZuOtmKQ4/UZ0J7SJ8Rg2GGHirC1GmDYjD2faof8Jxi5377xvPhjs833b2v+y9FD9zL8o/cNrcnjYx81F4P6mBiPwdJlPX6Qoi0CvH5qjLIfsqIwREOeKedGwF1F2WuaUeuCvSEm52L0XZrui7l5zPrgQvD1B14SbE4McJ8XPejUqGmrnhEcKN6sk+FCWifcMH5rHCuD5NXdxUPWUbv698pVNJi2QTBf/newnslNKYda7lK/FBgsg1IZAHpRiVWxJprqxbrKjqCpOc4wx0lQvnVR4XhMI8Mc0p2A1JzG+TuCvkDXI4J69h+SqfkEhwvvCLKn6Lawne6HAkJyLHJ0D79Oyxy58iffE4WLSouEQQobzCJo= 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:(13230022)(4636009)(366004)(396003)(39860400002)(346002)(136003)(376002)(451199015)(1076003)(6512007)(186003)(26005)(966005)(478600001)(6506007)(8936002)(38070700005)(2616005)(2906002)(107886003)(71200400001)(38100700002)(82960400001)(122000001)(6486002)(36756003)(5660300002)(83380400001)(316002)(54906003)(6916009)(66476007)(66446008)(66946007)(66556008)(41300700001)(4326008)(76116006)(91956017)(64756008)(8676002)(30864003)(86362001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?iWT7ucTf2PuSS5oLP7voTOoN8U0z+fAsLruIgeyG0EC0O7SLP/+7DC9bSp?= =?iso-8859-1?Q?flNEF9Uj1iG5Te9EdTxuIJq3LvfqtoIoerZ9IL5T9V7wDftIy1BfZi1KZS?= =?iso-8859-1?Q?wm47Yel5WE5zvzRPTcdkSc252UfA6N6x06bCGaaSVglIPVW2x5CXFpRQy/?= =?iso-8859-1?Q?JkPK1EyeUuGVkFOv6VpVF1IWaM0lTRa5dGQ2oY4k+3bbX4UTQq+kQCbxpy?= =?iso-8859-1?Q?X4hk3O/ke2Tt9JYBQVuaNUl5ZDxo2Nbigm3X+yVLlb/eXsfOWr03yjfBe0?= =?iso-8859-1?Q?L8LRM6BWT5DAiEuEdsPzMH+nSBPxi2J6GlIb6Up8r2TErPFeQN/D1elT4o?= =?iso-8859-1?Q?T6vGa/rslRId2qLtJGPbQNJODBOncCwqnVvXKjq2k9emCS6ZaQAn1Yhi4s?= =?iso-8859-1?Q?sJ3QJvQJHd/bvQXcFrKrDbf7d8RiJH5S2AUkz/eMGWPqYHBaj+89MnDx+R?= =?iso-8859-1?Q?poB2MF0irmPJ/K1h4RXIsY54Fu0Cl+R26EOZpbzkPD02ZiSz2QTvcYgIeC?= =?iso-8859-1?Q?A7srsM3Vo+9Agsg0SGDrIWRDhGAy4NgTJ4MnIMVivfbag6PWihXTIcBYSu?= =?iso-8859-1?Q?VCzCJz8SSonvCnCqNkviB5bj2v8vWMeXcMzY23e225/rJ5yafnGEkRpNrF?= =?iso-8859-1?Q?CaKqFl35dGztG3EO8pNnSCFKvbE1ppwictsl0dmRMvfGl5rmhChQvmnSpU?= =?iso-8859-1?Q?j+aimqcPCSUayYXJXcr+d7BOdLhoXhgE9Eua9obEZI4f7dVNz1ufy16gu/?= =?iso-8859-1?Q?wESyIW4cFeke02PpI1qpw04suI2YfGUeH36iET3c1IH4jVDkHB238BYoHU?= =?iso-8859-1?Q?c1P1AyVXgF/Lg8RMe1txyC0qJ75kHDxS9S4Wfm+MBgzirZ7+3nJ/Dp8SU4?= =?iso-8859-1?Q?IlfFbIMX721XdwIE3SiT9BQ4BatdQewD33+oWyQ4sxYCXyoPf/8XGh12K0?= =?iso-8859-1?Q?AvI5mcUFzlbi1tzsEFuyfrYJ0jkqVfc42Q6Zpt4DV0zTtDD+VubCaQSr8H?= =?iso-8859-1?Q?ecyvJovfme4UMQfUenOGxvmPpSwksAeiaM/DLRxijA1Lj7Xzpqa7sT7Fi+?= =?iso-8859-1?Q?qsUiZEs/TbZSxXUR4+h6igCtbkEZ9oZhZKO626ejbDhuvwiodESiQajuAU?= =?iso-8859-1?Q?9yiI4Oo/yM4/v+mcVQyx+e0CkZI3SZ0nrfUJ9hsDbSWQQjPedSDW2/A+QS?= =?iso-8859-1?Q?fxgX36uhMpSSVKioxi8ZOeBONWmT74v5lXJRkElwoXBMe9GBdslVt4OokB?= =?iso-8859-1?Q?Ehv5RSJHUUDAXGndzV7tVJTV0R0BdjRAHFmavwcpCRnkCFBjsoitQHBvfU?= =?iso-8859-1?Q?LzbhsJOgruywp4zj0E8UkwrPqntTYtkHahQn0SUUbAmbe9M6K+AA0UnzvM?= =?iso-8859-1?Q?ti5dQWAPyFeba3H2E5Aktzoj5q4coaozdxFKeWRt6N/9+uPepjpmPMeY31?= =?iso-8859-1?Q?3tQ7eBWxKLD/OrLu/JH9fjymQS64X9Nrw+QpdxAbWSmKy2DgfozWkLstbx?= =?iso-8859-1?Q?qTH+K0YZbPlrZDTvSYUl8gDpGlCmFfyegDIKmZjx6Hvr5nLu0V0MhghdD4?= =?iso-8859-1?Q?XLjz0fFAfsLK6BVBcfLitaWx2kBkkdK9z262wyf7Sl4let0kSDoxl5QjfE?= =?iso-8859-1?Q?ljVgcJd1m4NydrUA3AyqIiYAsZKVvkVgjgGgnpcZ8AlEujBugkbDEHjg?= =?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: e54d4ad0-6f08-458f-52dc-08dae2acf51d X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2022 17:09:29.3740 (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: r28YGMforUDUT+YxkaCVOCg3GD6vj1KSI/m7pUNUClOPwU/nOPAiWP5aI1NmIThAEP2n2LvDsPvSUBG7y9dBKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR10MB6146 X-TUID: JwODg9iLn8N3 When using a cross build this patch does introduce optionally host and target specific kernel kbuild packages that ship the "scripts" and "tools" binaries. Appending ISAR_BUILDS with "target" will enable the build of a target specific kbuild package at cross builds. Appending ISAR_BUILDS with "host" will enable the build of a host specific kbuild package at cross builds. In this case no kbuild-cross package will be generated. 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 | 47 +++++++++++++++---- 7 files changed, 102 insertions(+), 27 deletions(-) diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/rec= ipes-kernel/linux/files/debian/control.tmpl index b19ca2c..c012048 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 94cfbe0..7e095ca 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}= " + 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}" scripts + if [ -d "tools/objtool" ]; then + ${MAKE} O=3D${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=3D"${= KCFLAGS}" tools/objtool + fi + if grep -q "CONFIG_MODULES=3Dy" ${KERNEL_BUILD_DIR}/.config; then + ${MAKE} O=3D${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=3D"${= KCFLAGS}" modules_prepare + fi + else # Build the Linux kernel + ${MAKE} O=3D${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=3D"${KCFL= AGS}" + 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 f4c0519..65fa1fa 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 389c9a8..900d5cd 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 236b67c..08b8a9a 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 8063c49..d176528 100755 --- a/meta/recipes-kernel/linux/files/debian/rules.tmpl +++ b/meta/recipes-kernel/linux/files/debian/rules.tmpl @@ -36,4 +36,4 @@ override_dh_auto_test: 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 dbda755..db2d7a3 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/recipes-kernel/linux/linux-custom.inc @@ -80,6 +80,7 @@ TEMPLATE_VARS +=3D " \ KERNEL_NAME_PROVIDED \ KERNEL_CONFIG_FRAGMENTS \ KCFLAGS \ + PP \ " =20 inherit dpkg @@ -91,28 +92,54 @@ KCFLAGS ?=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', True).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", True) - d.setVar('PROVIDES', 'linux-image-' + kernel_name + ' ' + \ - 'linux-headers-' + kernel_name) + distro_arch =3D d.getVar("DISTRO_ARCH", True) + host_arch =3D d.getVar("HOST_ARCH", True) headers_depends =3D "linux-kbuild-" + kernel_name =20 + # By appending ISAR_BUILDS with "target" and/or "host" it's possible + # to run additional target or host builds. + # There are no "target" and "host" builds enabled by default. + # When both build modes are enabled then for a cross build a kbuild pa= ckage + # for the target and a kbuild package for the host will be created. + # When "host" build is not enabled instead of the kbuild + # a kbuild-cross package for the host is generated. + if not "host" in d.getVar("ISAR_BUILDS", True) and d.getVar("ISAR_CROS= S_COMPILE", True) =3D=3D "1" and d.getVar("HOST_ARCH", True) !=3D d.getVar(= "DISTRO_ARCH", True): + d.appendVar('DEB_BUILD_PROFILES', ' crosskbuild') + + # For different distro and host archs + # - Add dependency for sbuild-chroot-target + # to allow building arch specific kbuild scripts and tools + # - Set correct kbuild package dependency + if distro_arch !=3D host_arch and d.getVar("ISAR_CROSS_COMPILE", True)= =3D=3D "1": + d.appendVar("SCHROOT_DEP", " sbuild-chroot-target:do_build") + headers_depends =3D headers_depends + "-cross | " + headers_depend= s + build_depends =3D "crossbuild-essential-" + distro_arch + " [" + h= ost_arch + "], " + d.prependVar("KBUILD_DEPENDS", build_depends) + else: + d.appendVar("DEB_BUILD_PROFILES", " defaultkbuild") + + # Make bitbake know we will be producing + # linux-image and linux-headers packages + 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"]: +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.30.2