From patchwork Fri Aug 9 10:59:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "nicusor.huhulea@siemens.com" X-Patchwork-Id: 3741 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Fri, 09 Aug 2024 13:01:16 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-lj1-f186.google.com (mail-lj1-f186.google.com [209.85.208.186]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 479B1G4J025824 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 9 Aug 2024 13:01:16 +0200 Received: by mail-lj1-f186.google.com with SMTP id 38308e7fff4ca-2ef23d3650fsf20009081fa.2 for ; Fri, 09 Aug 2024 04:01:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1723201271; cv=pass; d=google.com; s=arc-20160816; b=B7lZ+NMrAscxiXikO2bWWnit4EWRjM+EstQenXdq8bscu4HEdgEVmPlMkG+8AY0A+Z bey7rrznHvjnIFrCNpshXrN+E9oHIXnQYodvIY25QVJo9Lyinx/5Vjgmth18RU5twqsK AHol++e3NbJ4ZjY3D+YOEZb9vWv/hdJdMba0GqRfhZf2AZezKlexBbO76KpFKlH6z40x JOyuDPiEvBbpY29ZzesdvdGC3I/KNjOvxXzTi4549KA8F4/dt85B08nBsWH/QRwb4Kk+ 1MVq7iOXYDS2bMjAW2aIR0MrKIoViCNk2TjEjTL0+/z4O6y+h3SqNWEIRMUtMRvvtrPA Zj/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vJ3hX4UOHBLMGIyJml7Df2nDlC0YkFlPu7Owme02O3o=; fh=25I+UcXbrjTrgBkGTdKuD17MCn7FkvjSPFR39iEGaBA=; b=HCu62Ed0x8qSiKk3w9RpFAaz+8D3Yki5nWt8uVvxVt9Y+y8mCJhlaEtGTx7AEXDKTF fyKpyVtgshvucCNv7dCuvCQP598a2dbjFXAo8Gij6pIa+LHTTcYjpgIeBYow+kCY8hXj vgtaLUWvpWo5fKZHS4PE4eZQzLwF+8MczkgRfcAVRS0Z83b/umHgmZCGvMKHsKaJIcDG g8dMKGppRzZ4q4G10vHnJTPIz7PrRDg/D9wnmbWa9fzOtICAzXB/xehw+sad1rq2yuyO SsGBzHkFvnKMMakt1+UXXUf87XRDvUaDg7Yr38xSzJ1I1xE5LfsUK8LhlHjX/JEWZgfH oNMQ==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=CLqcJ57Y; spf=pass (google.com: domain of fm-1327153-20240809110106f9d27c9a091c370707-o6irfq@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-1327153-20240809110106f9d27c9a091c370707-O6IrFQ@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1723201271; x=1723806071; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=vJ3hX4UOHBLMGIyJml7Df2nDlC0YkFlPu7Owme02O3o=; b=bjXHzS1Kn+k11gi812HVZ94lk3BVInnVgmkueS8nl/agg+OG94Ym/68t15WVyOL9RK vUhi3lGBbIVWqvqzTtHhQhtRij8oOTHvdktdo9zU1pa/ctSZ6MjK2qRgui1P5b5yTtly htjIhaID0IndHF0DmOpUeeg2Big1cAovVTrhl4zkBT9yVa/goIrFcf9GqWC6d0HQcQno /bF0XXAxgKB7Bp9+piJdVOEvT1V5+xNgI2AfLWzOsucqhSbwreuekIUJO75IoNbdEEp1 wz7R3bBrK0a5qtffcMqbJ8fRAzGUpc/fOoVtoHTD8X8wsLXHBMnZW0etP2rQCJRlN9TK gYWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723201271; x=1723806071; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vJ3hX4UOHBLMGIyJml7Df2nDlC0YkFlPu7Owme02O3o=; b=fEDgDTzVKBr6S7OWP0ZQfNzj5tW4jdvHtbIzRVPrUJLxnyxQv31gmdX1niryuis5S9 MyEJXQC6jp+ewbwesK5Bz04huyaeRBo32X8amKeo/uwjY01BaflRzLOPnYIHWhOJ/X2E 0pemYNSNhw+F30dDiO+ztL42nw7GcNmSvfI0UrHwI1v2T2DJi3bD6gj7OJj7xA90I5qz n+Ad7FMfPuv5jUMoIdjo4aeCsfPzMaQnjbDWWO5ivxOeJ7FefveYBrP9qtQrRSkkCwZX kUEMEkCNpPX23P1aiyzJE3srGQ612Ph0KbQ5spXkOqN/OZo7tgg7iazo0LPhD2l8UXVZ o0/g== X-Forwarded-Encrypted: i=2; AJvYcCWU6es/sUZCxXOYCz+HuD1zisGPsOhMHulXiw9TIjhTNnaj3FD9TEbOzFZ9XgTD3U89fq4nOrZPt4Iqw6PSiXYDLdRhmfI= X-Gm-Message-State: AOJu0Yw1L3GqkIjC7y3dowaiKZULnA76R6jvMuM3lkP4CB7LS0pwgECC 9kyHNf1LMGao3g+1OVKx9Frh01kkHz05DmpOVxndu4sKmWcD14Vg X-Google-Smtp-Source: AGHT+IGIgb1EnBcPAaEgKqEAtaUn9SpBdOVqTC9T4Rw+mIBdtqrVIq9FWY7t4/8U/YpBoV3UdK0Jaw== X-Received: by 2002:a2e:a549:0:b0:2ef:2608:2e47 with SMTP id 38308e7fff4ca-2f1a6d0c730mr10862741fa.13.1723201269616; Fri, 09 Aug 2024 04:01:09 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:2243:0:b0:2f0:1cb8:9ec5 with SMTP id 38308e7fff4ca-2f19bb21448ls6026771fa.0.-pod-prod-09-eu; Fri, 09 Aug 2024 04:01:07 -0700 (PDT) X-Received: by 2002:a2e:d12:0:b0:2ef:2c20:e061 with SMTP id 38308e7fff4ca-2f1a6d1a9d7mr8825391fa.22.1723201267365; Fri, 09 Aug 2024 04:01:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723201267; cv=none; d=google.com; s=arc-20160816; b=Q++O2H40SfoUuMd2Y99489uyWBHny+Vt9892GvlqKDKUKc3+My7rkaq8Rv0kNJ0m5g lwPGZc+3JE/l8EltdLec66lur/+DfuNZ2MuXmiMnfYUsHoIirAzu/5BXoPVpNAUZresc 0p23I9n1dhBblTNIK0QJ6LJU2OYG38WTfMWQCvAn5By8/ofBpknGxRCIT3f4tssFfVnV aCQsFysk25bakzEQKSs48MRwvYyd3VyVZpESKw0uLFIZSPFxb7UfxLo8K3MiCAW3AUSl 0ka8tSgTkT+PzilDKjjWVHSTLW5zUWx2KS+OfPHIdhRbSGPXC8dnvrTk7WN3rOcWebQH e3rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=AswVfFsQjnBXeys0SpoXP+Lnfrwer/afRSnA33C/94Q=; fh=uEpizMaC9FZ5RjhWZ8Q38YHTDXG+3EPxv68QQHJHPnI=; b=R5YLhS0QRewzPLLeVN3cAt8H4JFxoxeD2SPFP4cAuHX+3CoFJN3bD6u/MJQyYpV+Nr PfSnxsKH1cmm5Lfd4rLrZQ4zuOUdj1PCLZEg+uZ8SRjXAYZ987SAGJOwFE781REgaldd lMSTKST64qU+BX3lYYqW344wWjvsdMTFbx0nJvmr5DfSP2uYUHQSDEKjFd1FBg1U1FLN WJyXJlHxf2U2nNay977qcajvVvvRDJ8WRPjdEtzQev3rXH1tB7x4cx8g3rVEX5L5erw1 FJunDJsaNdsDnkFmOSpM1woMpx6BTwsvY+oaygKuzDHnVe+6c2EBuHovzZ+1PcYE2fBZ I65Q==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=CLqcJ57Y; spf=pass (google.com: domain of fm-1327153-20240809110106f9d27c9a091c370707-o6irfq@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-1327153-20240809110106f9d27c9a091c370707-O6IrFQ@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net. [185.136.64.225]) by gmr-mx.google.com with ESMTPS id ffacd0b85a97d-36d27382337si70536f8f.8.2024.08.09.04.01.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Aug 2024 04:01:07 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-1327153-20240809110106f9d27c9a091c370707-o6irfq@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) client-ip=185.136.64.225; Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 20240809110106f9d27c9a091c370707 for ; Fri, 09 Aug 2024 13:01:06 +0200 X-Patchwork-Original-From: "'Nicusor Huhulea' via isar-users" From: "nicusor.huhulea@siemens.com" To: isar-users@googlegroups.com Cc: Nicusor Huhulea Subject: [PATCH] linux-custom: compile only those specified dtbs Date: Fri, 9 Aug 2024 13:59:33 +0300 Message-Id: <20240809105933.3040701-2-nicusor.huhulea@siemens.com> In-Reply-To: <20240809105933.3040701-1-nicusor.huhulea@siemens.com> References: <20240802114105.1767411-1-nicusor.huhulea@siemens.com> <20240809105933.3040701-1-nicusor.huhulea@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1327153:519-21489:flowmailer X-Original-Sender: nicusor.huhulea@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=CLqcJ57Y; spf=pass (google.com: domain of fm-1327153-20240809110106f9d27c9a091c370707-o6irfq@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-1327153-20240809110106f9d27c9a091c370707-O6IrFQ@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Nicusor Huhulea Reply-To: Nicusor Huhulea Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= The current implementation makes a full kernel build and that means it will compile all dtbs specified by the bsp makefile e.g arch/arm64/boot/dts/ti/Makefile Currently the required dtbs are given by the DTB_FILES. These changes are checking if the DTB_FILES is specified, compile only those and avoids compiling all the dtbs from the bsp directory. Otherwise build all dtbs specified by the kernel source. Preventing the automatic dtb builds is made by using target specific build commands e.g KERNEL_IMAGETYPE The compilation of the dtbs accepts the following formats e.g: Kernel Post 6.x: a) full path from the architecture directory: arch/${ARCH}/boot/dts/bsp_dir/test.dts arch/${ARCH}/boot/dts/bsp_dir/test.dtb b) relative path from the dts directory: bsp_dir/test.dts c) device tree blob file: bsp_dir/test.dtb Kernel Pre 6.x: The same as on Kernel Post 6.x but without the bsp_dir The differences when building a full build and when using a specific target build are:(tests were made on the machine phyboard-mira on 6.x and 4.x versions) specific target: Build needed 00:02:08, 2219688k disk space linux-phy 6.x full build: Build needed 00:02:14, 2271528k disk space linux-phy 6.x The time difference: the full build took 6s longer than the specific target build The disk space difference: the full build used 50.6MB more disk space than the specific target build. In conclusion the specific target build is slightly faster and uses less disk space. For now the DTB_FILES variable should accept only Device Tree Blobs(.dtb) because some areas still depends on it e.g: do_copy_boot_files, plugins Signed-off-by: Nicusor Huhulea --- meta-isar/conf/machine/imx6-sabrelite.conf | 2 + meta-isar/conf/machine/phyboard-mira.conf | 2 + .../linux/files/debian/isar/build.tmpl | 63 +++++++++++++++++-- .../linux/files/debian/isar/install.tmpl | 12 +++- meta/recipes-kernel/linux/linux-custom.inc | 6 ++ 5 files changed, 79 insertions(+), 6 deletions(-) diff --git a/meta-isar/conf/machine/imx6-sabrelite.conf b/meta-isar/conf/machine/imx6-sabrelite.conf index e48823d6..bffebdc1 100644 --- a/meta-isar/conf/machine/imx6-sabrelite.conf +++ b/meta-isar/conf/machine/imx6-sabrelite.conf @@ -15,4 +15,6 @@ MKUBIFS_ARGS := "-m 0x1000 -e 0x3e000 -c 1500" UBINIZE_ARGS = "-vv -m 0x1000 -p 0x40000" IMAGE_FSTYPES ?= "ubi-ubifs" +KERNEL_IMAGETYPE = "zImage" + DTB_FILES = "imx6q-sabrelite.dtb" diff --git a/meta-isar/conf/machine/phyboard-mira.conf b/meta-isar/conf/machine/phyboard-mira.conf index feec4e54..1d2b3e1c 100644 --- a/meta-isar/conf/machine/phyboard-mira.conf +++ b/meta-isar/conf/machine/phyboard-mira.conf @@ -20,6 +20,8 @@ DTB_FILES = "imx6q-phytec-mira-rdk-nand.dtb" IMAGE_INSTALL += "barebox" +KERNEL_IMAGETYPE = "zImage" + BAREBOX_CONFIG = "imx_v7_defconfig" BAREBOX_ENV = "phytec-mira-env" BAREBOX_BASE_BIN = "barebox-phytec-phycore-imx6q-som-nand-1gib" diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl index bafc5ca4..90222adc 100644 --- a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl +++ b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl @@ -21,15 +21,21 @@ do_build() { KR=$(${MAKE} O=${KERNEL_BUILD_DIR} -s --no-print-directory kernelrelease) sed -i "s/@KR@/${KR}/g" ${S}/debian/control ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.* - if echo "${DEB_BUILD_PROFILES}" | grep -q "kernel"; then # Build kernel scripts and tools - ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} ${KERNEL_EXTRA_BUILDARGS} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" + MAKE_COMMON_ARGS="O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} ${KERNEL_EXTRA_BUILDARGS} KCFLAGS=${KCFLAGS} KAFLAGS=${KAFLAGS}" + if echo "${DEB_BUILD_PROFILES}" | grep -q "kernel"; then + if [ -n "${KERNEL_IMAGETYPE}" ]; then # Override the default compilation + ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_IMAGETYPE} modules + compile_dtbs + else # Full build + ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_EXTRA_BUILDARGS} + fi elif echo "${DEB_BUILD_PROFILES}" | grep -q "kbuild"; then # Build kernel scripts and tools - ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} ${KERNEL_EXTRA_BUILDARGS} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" scripts + ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_EXTRA_BUILDARGS} scripts if grep -q -E "CONFIG_STACK_VALIDATION=y|CONFIG_HAVE_OBJTOOL=y" ${KERNEL_BUILD_DIR}/.config && [ -d "tools/objtool" ]; then - ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" tools/objtool || true + ${MAKE} ${MAKE_COMMON_ARGS} tools/objtool || true fi if grep -q "CONFIG_MODULES=y" ${KERNEL_BUILD_DIR}/.config; then - ${MAKE} O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" modules_prepare + ${MAKE} ${MAKE_COMMON_ARGS} modules_prepare fi fi @@ -37,6 +43,53 @@ do_build() { set +x } +compile_dtbs() { + local prefix="arch/${ARCH}/boot/dts/" + + for dtb in ${DTB_FILES}; do + # Handle the case where a standalone(with no path .dtb/.dts) file may reside within + # a specific BSP directory or not(kernel pre-6.x) + if [[ ("${dtb}" == *.dtb || "${dtb}" == *.dts) && "${dtb}" != */* ]]; then + bsp_dir="" + dts_path="" + if [[ "${dtb}" == *.dtb ]]; then + dts="${dtb%.dtb}.dts" + else + dts="${dtb}" + fi + + # recursively search for the dts file in all possible BSP directories + while IFS= read -r dts_path; do + if [ -n "${dts_path}" ]; then + # Eliminate the prefix and dts to get only the bsp_dir + bsp_dir="${dts_path#${prefix}}" + bsp_dir="${bsp_dir%${dts}}" + + relative_dtb_path="${bsp_dir}${dtb}" + else + relative_dtb_path="${prefix}${dtb}" + fi + done < <(find "${prefix}" -type f -name "${dts}") + + # Check if the path is relative (starts with arch/${ARCH}/) + # and if it does then extract the relative path from the architecture specific path + elif [[ "${dtb}" == "${prefix}"* ]]; then + relative_dtb_path="${dtb#${prefix}}" + else + # directly use the given dtb + relative_dtb_path="${dtb}" + fi + + # Check if it's a .dts file + if [[ "${relative_dtb_path}" == *.dts ]]; then + # Change .dts to .dtb + relative_dtb_path="${relative_dtb_path%.dts}.dtb" + fi + + ${MAKE} ${MAKE_COMMON_ARGS} ${relative_dtb_path} + done +} + print_settings() { cat <