From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7057120643105423360 X-Received: by 2002:a05:6402:90b:b0:412:e7f8:6de6 with SMTP id g11-20020a056402090b00b00412e7f86de6mr1377161edz.182.1645693745715; Thu, 24 Feb 2022 01:09:05 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:906:a94a:b0:6d0:76e0:adbd with SMTP id hh10-20020a170906a94a00b006d076e0adbdls422684ejb.9.gmail; Thu, 24 Feb 2022 01:09:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8BZWFVRwHVn6B7OLqjP3GdlBukq+LTNG59XitpChTZ+zZ+ghZnEce8VMtxCmPXyk5mbBi X-Received: by 2002:a17:906:1948:b0:6b5:1ca3:a34f with SMTP id b8-20020a170906194800b006b51ca3a34fmr1439389eje.451.1645693744659; Thu, 24 Feb 2022 01:09:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645693744; cv=none; d=google.com; s=arc-20160816; b=DB12jIRCnbFKSmNpfE2IrYLm/YkyCKtYVoIkx8AfcUVz9QwhIHlSFkhJyKbrcQw5pB 6e1bdNFo4XlvsZpnmswPu9N4qHO0HlLRZZ1kHP5clw+xgUcAFhbpQkIIPWKnudWGNnSb igO72fa0IH16ElfKqiy1v+sqAjUwakKVdVoevtJDYcWoZMtq6QG5HA8OGjfnWXEuMss6 03FbtwjAIWTGHNK+LInwgvglSxy038StS3DqqVCTOAgYWhRoHnz+qhoki6YIWXSFowTu s8h2ymmtkSbqtXkkRAxSX53OZFw5uZU2429MB85w8v9YjtqbQoexpqH+5aH8WyJjRBxU J44A== 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=k3bmq0VFnflm1/luYFM8Tsr1Cmcid9syS5gA8oRXSo4=; b=DPZxUj6eNz+mqntDAl2aD/pFWl7HZmuf28tlbFr4Y7yWMntQL/y7aNOHSrCQmQG/WP q16rFLj3rClIky2X3T7KmshPB4Gnfh6Quy1rldyQJ/o2bA8YQHCiiCwU0rzgxoyWXcvT xDpSrODmacjOuO/Lle8It/eULfohr/gni7uE78XsNPEzpcFffAQoJsNRHjB8WrWImnn3 zgmsP0Yiil60yqk4kzpgO0q2wLD593yFXp0ws6zplmcahsVLMe2DUwUQP6pOsVKNvK+E NsvojvucSgM4X0CfaNogsIkZl5MmkyX1ro1wB5QHUf5VxoZfkhw7SHqgEZVCPS8p8QbV YCmg== 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 j22si88143eda.1.2022.02.24.01.09.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Feb 2022 01:09:04 -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 21O9933c030121 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Feb 2022 10:09:03 +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 12:09:00 +0300 Message-ID: <20834726.4csPzL39Zc@home> In-Reply-To: <20220223145303.13459269@md1za8fc.ad001.siemens.net> References: <20220213074111.23232-1-ubely@ilbers.de> <20220213074111.23232-10-ubely@ilbers.de> <20220223145303.13459269@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: yPPYIoquncGK 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. > 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