From mboxrd@z Thu Jan 1 00:00:00 1970 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-f188.google.com (mail-lj1-f188.google.com [209.85.208.188]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 479B1GcX025823 (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-f188.google.com with SMTP id 38308e7fff4ca-2ef3133ca88sf18877381fa.3 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=r8UxenVoVgkzTjU+aQEulg4ou0bnfnNScLj7tQPeou+t3/iR6MhZIYQb3UNyGups0N QsReTqgjrbTXXLd7LgFAFDLfVvcqFuKjpTIU1OjbZcfeucSgXejTJbh32c7WJ6QQW7hd SaG+2U96Jk2Rvod6bzOPM9rbMgjcNEmlpixj2ojxjH3OxQqBJfOj7Zdj987kDdVw7Xzn smaNRmsKRnloZdUnBRJ/CJQdt8V2vhosoUGJcwMtZ0TzIL/Tcdxnf18VA2/E78k/ng9v u2YRqhFBw7FjhrHeisRUHQkf7vApzUWmk0GePQxcoL2uUO66CM1JQHjR0qmwMdyaHkmg p9UA== 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=SQj3NA1ZyicLOtmp4tGQXp0k1FEd3Hd/lsTesA5fzMA=; b=HMhVD9ciEydbevm6LQJOdz3qtnf/JJilv4CQ3GfsHIArC7cGHAImSLnIGAMfBsE93y Of+5usMCr8WmeHwaTmuxKJEb6Ro8NMd4OrwWg4mFxDpaa+gt/oaGhsM3aeqqRosd2dWf m54At3zBBOkUb0QXPP0+wuS09WmZyj0G6UkgPRL9fOryAmW7nl6QUCNFt47XzvoYSQeE +4RcHaHbHqJbectQJE+ADFbLlsewlC/FqYB9iCWiccdGEzozpYMFUz9fou48RdIbxZyQ BoCitVH9nqct4WFUDfZqY7hjbJCXXEED8oiBuQc8dsUzN3C6VhkGMUotSWa9Y4qtqKJP FQsQ==; 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=1723201270; x=1723806070; 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=of6AmygXr9jYZ4MTPEoeG9oyAgHndr9uaF/MtLbieCJ9I5UeAhpWtLTIrwZ7YYgZ06 WqgAgMhcabn7m3noJfBNihvk5huA8TJVpiM2iqUBwvDrrhk9pG5nWmbPH+ztqmbIOZ+1 QNyd6mNWs1JvSIvc/ka62vYXmRpOGjWS1ZCjUkst2NCE93nDs9i4D/8fH7XAvYED/gwl SoJSqBtJH0KvZleVTNsMebPQOlJafMh/fffZSwfrRLds/t0YfjqRZvz+Xfaq+ypN9AZ9 43qU0s8EoCMAXAY3vVXGPUnA8rzxLE1NpSCkGevMTgeWh5/6FJk8z4XMGmrqUL7Re0pn Msrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723201270; x=1723806070; 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=vsjxf55Dwgd6+vot4fgXk4lePdT9ZvZ7KZirGLxnluZLpMvzv99seM/R+5AHLvwMwr Gn3pxZd9pnOTsa+KH+6Ispc7csuKp9JKvRz9PQcPh5E2H2spcY/I/XUsNb7gpCW0MvuT /hQS85Zo4nMc0cDSeQPByHIZyTyYchFUNDbA73Nt1+/ASzLMBkMAi5/Hn1zNW1tqqYBu llGO8NLHb6/Ij1sU1AMNrSTw2JA/AZzbzj7jnE2Sud63f9IsabKyoyd3FUOoXJcuLPR/ 04Qml+lKhhUwybVIaNJmvint9BRCXldTFbmXr7nZkAxINeke0PNLQeayxGBbUHAOcwTZ u+3w== X-Forwarded-Encrypted: i=2; AJvYcCUZoSbjczHclaGy+Dn/Wa3ZEbazf4I0ulQOg8XLaQJrT5cgLBB3QF/iqGONSDG7yrc8YdptFVtvdTrDBSQ2WggxLzI= X-Gm-Message-State: AOJu0YyRFyVv4jWCfhxZmmG073LlQuhMkV1NlnR1cgB8iHvpdHPQkRNQ oLMAAVcaUPs0iffabZmTbXoiIF3LPeR+n+Oem6JtdC5qqiXzX45E 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 From: "'Nicusor Huhulea' via isar-users" 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 Content-Type: text/plain; charset="UTF-8" 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-TUID: YN6LMQ2aGjnT 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 <