From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7057120643105423360 X-Received: by 2002:a2e:b954:0:b0:239:2768:cf0b with SMTP id 20-20020a2eb954000000b002392768cf0bmr2103100ljs.245.1645714163087; Thu, 24 Feb 2022 06:49:23 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:651c:1a13:b0:246:6680:f7ba with SMTP id by19-20020a05651c1a1300b002466680f7bals504592ljb.10.gmail; Thu, 24 Feb 2022 06:49:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhpB9I7Lq7oek2vgIc1Fa2X1UVT6Wpv2A73ptJx3jfxD8tDprWa7Aq4b2nOnWSBgtcHB+X X-Received: by 2002:a2e:a607:0:b0:245:f6e5:ad63 with SMTP id v7-20020a2ea607000000b00245f6e5ad63mr2166471ljp.89.1645714161924; Thu, 24 Feb 2022 06:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645714161; cv=none; d=google.com; s=arc-20160816; b=RA8/vji5Q3YgouWQYAM5fsJOhOjKnN6iv3ClIkE/ocVqoUtQp/6Qc1n8klE5zh/QES +l+i7VIbyCLnIfIg+b3zVa30bHhM7UF/DzcwML15kZdw+LdZ91IfJprXj8hM/N4nDtZy t2PO8wx4XQb4yRrKAOPpEOtgxj/8I3oXHRYqyfYZWiVsm4oSa63wowkrvBs29GeCCY0E yrO0hMmOUAf+0sSLxELo0x8c3tlvFU9LjLGAiZCdQo2RHuPoDqG1+FZGetFfiCCJhBR/ 7+lEAri/4/yCKzgHQcXOQJrOgcwZ7QqytFhjslwmjdrLCJk1YqWflKKFoaVaxLb55UB9 9yrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=hIq+LIMdxragALU9Jh5r9gHP9vG58OLErPD7QHX1fdc=; b=FYDp+wgRWNqxl5A5bZr2bwZsVtzo/oBhQmEP2GHFlItW5v1mc7EkVt4xcMmjWu0vUM RgxQLS3VHG8r0XnnLgBt34zgSxOpM8cf/pJuQ2E3dh7NG1rVyB73XT2dUx7paBS08db1 6gL3AfXBUZLE2tyKrx+GM132LpL1zEOQDrMSy56O4k+hqFHTYGC/O6XWBa3BRcfwmGb4 535ndJHdfLjwPrGyFFGd6nadirE0acVtPViTiGxl90s07cXjGOwJwAynclj0C2yYU5GZ hDTTeBMDfBNcTD+cfwNXO8TFUm9t8c0tv4jEoS/OQDX/+anRnx++CHywZx5hjxa2lPOJ 0cug== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id n5si106850lfq.6.2022.02.24.06.49.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Feb 2022 06:49:21 -0800 (PST) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from home.localnet (44-208-124-178-static.mgts.by [178.124.208.44] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 21OEnKn7031111 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Feb 2022 15:49:20 +0100 From: Uladzimir Bely To: Henning Schild Cc: isar-users@googlegroups.com Subject: Re: [PATCH v5 9/9] linux-custom: Move cfg fragments applying to debian/rules Date: Thu, 24 Feb 2022 17:49:17 +0300 Message-ID: <2535027.fDdHjke4Dd@home> In-Reply-To: <20220224133657.66e1fc24@md1za8fc.ad001.siemens.net> References: <20220213074111.23232-1-ubely@ilbers.de> <20834726.4csPzL39Zc@home> <20220224133657.66e1fc24@md1za8fc.ad001.siemens.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED 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-TUID: +iWL8IRo8vWL In the email from Thursday, 24 February 2022 15:36:57 +03 user Henning Schild wrote: > Am Thu, 24 Feb 2022 12:09:00 +0300 > > schrieb Uladzimir Bely : > > In the email from Wednesday, 23 February 2022 16:53:03 +03 user > > > > Henning Schild wrote: > > > I just ran into an issue with that not actually finding my config in > > > WORKDIR and now trying to go the KBUILD_DEFCONFIG way > > > > > > Am Sun, 13 Feb 2022 08:41:11 +0100 > > > > > > schrieb Uladzimir Bely : > > > > Prepare linux fragments applying in Debian way. > > > > > > > > This allows to avoid pre-build chroot call used for merging > > > > kernel config file and custom config fragments. Also, shell > > > > exports are not used anymore in favor of template files. > > > > > > > > Signed-off-by: Uladzimir Bely > > > > --- > > > > > > > > .../linux/files/debian/isar/configure.tmpl | 19 +++++++ > > > > .../linux/files/debian/rules.tmpl | 3 ++ > > > > meta/recipes-kernel/linux/linux-custom.inc | 53 > > > > > > > > ++++++++++++------- 3 files changed, 55 insertions(+), 20 > > > > deletions(-) > > > > > > > > create mode 100644 > > > > > > > > meta/recipes-kernel/linux/files/debian/isar/configure.tmpl > > > > > > > > diff --git > > > > a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl > > > > b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl new > > > > file mode 100644 index 00000000..83871baa --- /dev/null > > > > +++ b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl > > > > @@ -0,0 +1,19 @@ > > > > +#!/bin/bash > > > > +# Copyright (c) Mentor Graphics, a Siemens business, 2019 > > > > +# SPDX-License-Identifier: MIT > > > > + > > > > +# Load common stuff > > > > +. ${S}/debian/isar/common || exit ${?} > > > > + > > > > +do_configure() { > > > > + > > > > + # Process kernel config target and fragments > > > > + ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET} || exit > > > > ${?} > > > > + ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \ > > > > + ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS} > > > > + > > > > + # Stop tracing > > > > + set +x > > > > +} > > > > + > > > > +main configure ${*} > > > > diff --git a/meta/recipes-kernel/linux/files/debian/rules.tmpl > > > > b/meta/recipes-kernel/linux/files/debian/rules.tmpl index > > > > 05a26fe2..a1166287 100755 --- > > > > a/meta/recipes-kernel/linux/files/debian/rules.tmpl +++ > > > > b/meta/recipes-kernel/linux/files/debian/rules.tmpl @@ -22,6 > > > > +22,9 @@ > > > > > > > > isar_env=$(strip \ override_dh_auto_clean: > > > > $(isar_env) && bash $(deb_top_dir)/isar/clean > > > > > > > > +override_dh_auto_configure: > > > > + $(isar_env) && bash $(deb_top_dir)/isar/configure > > > > + > > > > > > > > override_dh_auto_build: > > > > $(isar_env) && bash $(deb_top_dir)/isar/build > > > > > > > > diff --git a/meta/recipes-kernel/linux/linux-custom.inc > > > > b/meta/recipes-kernel/linux/linux-custom.inc index > > > > 59d42c84..ea1abf76 100644 --- > > > > a/meta/recipes-kernel/linux/linux-custom.inc +++ > > > > b/meta/recipes-kernel/linux/linux-custom.inc @@ -52,6 +52,7 @@ > > > > TEMPLATE_FILES += " \ > > > > > > > > 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 \ > > > > > > > > @@ -71,6 +72,8 @@ TEMPLATE_VARS += " \ > > > > > > > > KERNEL_HEADERS_DEBIAN_DEPENDS \ > > > > LINUX_VERSION_EXTENSION \ > > > > KERNEL_NAME_PROVIDED \ > > > > > > > > + KERNEL_CONFIG_TARGET \ > > > > + KERNEL_CONFIG_FRAGMENTS \ > > > > > > > > " > > > > > > > > inherit dpkg > > > > > > > > @@ -146,41 +149,51 @@ do_prepare_build_prepend() { > > > > > > > > # build directory for our "full" kernel build > > > > KERNEL_BUILD_DIR = "build-full" > > > > > > > > +def get_kernel_config_target(d): > > > > + kernel_defconfig = d.getVar('KERNEL_DEFCONFIG', True) > > > > + > > > > + config_target = kernel_defconfig > > > > + > > > > + if kernel_defconfig: > > > > + workdir=d.getVar('WORKDIR', True) > > > > > > > + if os.path.isfile(workdir + "/" + kernel_defconfig): > > > Doing that at parse-time when assigning the variable > > > KERNEL_CONFIG_TARGET can not work. Some task in the task chain might > > > need to create that file first ... fetch/unpack/fiddle-with > > > > > > Checking if the file exists at parse time seems very wrong. I guess > > > this patch needs to be reverted and rewritten and i guess the test > > > suite does not properly cover kernels custom defconfig > > > > Yes, you are right, this moment is wrong. > > > > I guess, it can be fixed by passing KERNEL_CONFIG_TARGET to > > 'debian/*' by direct appending from the recipe task (instead of > > template way). > > > > I'll try prepare a solution soon. > > Cool, > > i would even suggest a revert because that breaks kernel builds in > layers. I reverted just that one and my layer worked again. > > I will look into writing a patch to the testsuite, covering the > olddefconfig path. > > Henning > Please look at "linux-custom: Set KERNEL_CONFIG_TARGET at build time" patch that should solve the issue you've described. While we have custom configs only for amd64 machines, but we have no in Isar amd64 machine with linux-mainline (or linux-cip) that define some custom config file in workdir, I just tested it on bullseye-amd64 with separate buildi linux-mainline by bitbake. It seems now it works and properly detects and uses x86_64_defconfig in workdir, while the stuff is moved to dpkg_configure_kernel() which technically is a part of dpkg_runbuild. > > > This is how one can rebuild a debian kernel > > > > > > KBUILD_DEPENDS += ",linux-config-${PV}" > > > > > > KERNEL_DEFCONFIG="${P}.conf" > > > > > > do_take_debian_config() { > > > > > > xzcat > > > > > > ${BUILDCHROOT_DIR}/usr/src/linux-config-${PV}/config.${DISTRO_ARCH}_none > > > _${ > > > DISTRO_ARCH}.xz > ${S}/${KERNEL_DEFCONFIG} } > > > > > > addtask take_debian_config after do_install_builddeps before > > > do_dpkg_build > > > > > > Maybe that could be used for writing a kernel test recipe actually > > > going the "olddefconfig" way in case we do not yet have one. > > > > > > Henning > > > > > > > + config_target = "olddefconfig" > > > > + else: > > > > + config_target = "defconfig KBUILD_DEFCONFIG=" + > > > > kernel_defconfig > > > > + else: > > > > + config_target = "defconfig" > > > > + > > > > + return config_target > > > > + > > > > +KERNEL_CONFIG_TARGET = "${@get_kernel_config_target(d)}" > > > > + > > > > +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', > > > > True) > > > > + if linux_version_extension: > > > > + out_frags += " debian/isar/version.cfg" > > > > + > > > > + return out_frags > > > > + > > > > +KERNEL_CONFIG_FRAGMENTS = "${@get_kernel_config_fragments(d)}" > > > > + > > > > > > > > dpkg_configure_kernel() { > > > > > > > > - config_target="${KERNEL_DEFCONFIG}" > > > > > > > > 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 > > > > - config_target="olddefconfig" > > > > - else > > > > - config_target="defconfig > > > > KBUILD_DEFCONFIG=${KERNEL_DEFCONFIG}" fi > > > > - else > > > > - config_target="defconfig" > > > > > > > > fi > > > > > > > > # copy config fragments over to the kernel tree > > > > src_frags="${@ " ".join(config_fragments(d)) }" > > > > > > > > - out_frags="${@ " ".join(map(lambda frag: > > > > 'debian/fragments/' > > > > + frag, config_fragments(d))) }" > > > > - if [ -n "${LINUX_VERSION_EXTENSION}" ]; then > > > > - out_frags="${out_frags} debian/isar/version.cfg" > > > > - fi > > > > > > > > rm -rf ${S}/debian/fragments > > > > if [ -n "${src_frags}" ]; then > > > > > > > > mkdir -p ${S}/debian/fragments > > > > (cd ${WORKDIR} && cp ${src_frags} > > > > > > > > ${S}/debian/fragments/) fi > > > > - > > > > - sudo -E chroot --userspec=$(id -u):$(id -g) > > > > ${BUILDCHROOT_DIR} sh -c " \ > > > > - export ARCH=${KERNEL_ARCH} && > > > > > > > > \ > > > > > > > > - cd ${PP}/${PPS} && > > > > > > > > \ > > > > > > > > - make O=${KERNEL_BUILD_DIR} ${config_target} && > > > > > > > > \ > > > > > > > > - ./scripts/kconfig/merge_config.sh > > > > > > > > \ > > > > > > > > - -O ${KERNEL_BUILD_DIR}/ > > > > > > > > \ > > > > > > > > - ${KERNEL_BUILD_DIR}/.config > > > > > > > > \ > > > > > > > > - ${out_frags} > > > > > > > > \ > > > > > > > > - " > > > > > > > > } > > > > > > > > dpkg_runbuild_prepend() { -- Uladzimir Bely