From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7057120643105423360 X-Received: by 2002:a17:906:564c:: with SMTP id v12mr5144257ejr.255.1644475402393; Wed, 09 Feb 2022 22:43:22 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:907:8d09:: with SMTP id tc9ls1364873ejc.7.gmail; Wed, 09 Feb 2022 22:43:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMFz9kgpvVjnuGx/b9AP12ttkBfrLXMLI8tIXGpo5aPyg63NsEV5CCfg12lckkPr1PxVFh X-Received: by 2002:a17:907:7f09:: with SMTP id qf9mr5119763ejc.110.1644475401425; Wed, 09 Feb 2022 22:43:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644475401; cv=none; d=google.com; s=arc-20160816; b=eQaKZHDRGlu3pkQO9NBxjH4FUBM1s7dpH/XoKZk0JB77EydLHEQL9PTSXC0Egv40Jg bn+8GyedsnqcM/Rjg710hZcyufdQNwbtb5bzLmJ60N34LoMeyNMUajQ+XsFWyxn9hsZT 6h2pJoyDWag4FRMxX4kJ5BxjWamiYgOImQMI+nOmumZwCoZD0jzjcLVGDjsZl9SEZ8RI eoQHTJRUDSI12PlqlY42WJECCW7leRTyyQleBAxl4C2KcS2S/nogHGaTBJ4+AGuAlVXQ ZwrnBiyHG27oBbyjOkTRQtX/L+0CQqHJKfqgXQitlUlrB/YniE1I1Y1iWl3gL8q7wldF fjrw== 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:to:from; bh=/AF0FfFi/ftbm6zdyMRIpHjYyCbjjkMFBQPHqQUSRyc=; b=v/7mEk29mDhHNX6eyY/6F8u8XzeISBtfUjM+n4rynNBpf/CzKnhlKEXQs1VIaVcaXe gha29ox2kS3Ng7zllOaAXJl4BT7P1kh70nAE0RZrHQ24+Nt/ZeNiPvuqdUF1kmF+ZeSC wE3DvCsukdO5ORFYQo/U2tIW3OXo4wEpZR3zN3Jy47iGtKvX/9xCl216Ilrew0P27pZg OTU/xnmwBCfdOSnhogPdZFDDeDry9nfi/Gb/lgg5mM0YdwN4MrIfKG0FVEU4fVprzZ1d BNNvCT6LS7/S6Bk4lvuvyIEWQu6nuh54aSJZPGAgkimFKKmEgdMrwbqeFu+hU/2jkjJJ kRew== 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 s26si332009edr.0.2022.02.09.22.43.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 Feb 2022 22:43: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 baighyz.m.ilbers.de (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 21A6hHmr027943 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 10 Feb 2022 07:43:20 +0100 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH v4 9/9] linux-custom: Move cfg fragments applying to debian/rules Date: Thu, 10 Feb 2022 07:43:17 +0100 Message-Id: <20220210064317.3712-10-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220210064317.3712-1-ubely@ilbers.de> References: <20220210064317.3712-1-ubely@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 0RqQOQR+n1ao 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): + 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() { -- 2.20.1