From patchwork Wed Aug 14 17:35:23 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: 3752 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Wed, 14 Aug 2024 19:36:48 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-lf1-f58.google.com (mail-lf1-f58.google.com [209.85.167.58]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 47EHal07022863 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 14 Aug 2024 19:36:48 +0200 Received: by mail-lf1-f58.google.com with SMTP id 2adb3069b0e04-52eff769963sf15724e87.2 for ; Wed, 14 Aug 2024 10:36:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1723657002; cv=pass; d=google.com; s=arc-20240605; b=HOemfyg+QrscBPQKrvgYOhExTHv1HUSyifl42SYd+4zSzcYKALj3aNfYvxnKmfN7aA zPiBBAzFyBp54lbdDv1OgR5wos4z1ZupDeh0KFVOXrm8+SIY9w9f+/hLR9oRvocpPPhk NIs9r6q1YEkYZQ17ayFO3+ktepAsQ4xvsjuiDKTimACaMpocsLSqzYU8Ei+2PsgzjdSA O07J3/k6yhSkGbXLpN38qyQDOm231bNLDpTbfR2k//qoc0aoHi7nfO/SiLpPORIcAxbn 0v3b9I1eAWucQsXY8CYXgHfc/CLzeIpE85YXAF7/GAFM+PB3XYfrViujxhS28lm8RBnD h/4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=FojB1YyvNmE0ob8+wAGMpfZ0qoOlq9Qek28GMGFU4EQ=; fh=H7dAakuCMhVoiBDL6KAG3IGpVURwsUK0Sn6ctea4bho=; b=isbLq9J6jdsa2JuJehHJW9XZLoD258f1onCFhk6BJ1trVt9qe0nAnFMjygb2k7e4q0 6TR+HpuIofW7qfW/iK7jjXUZU2te7jMl5UQoz4K0ivRpjKjCKc9M4kz02Y19QmX42arK WLT8augNDlvpUXSJ3bg9S9PWRu0VV8mj6j6Qz3cDMr8YNx9wfOS4c9MgE8BgZ4s1xqd7 OyMMPpCknkIAwKxgwpxpUxvkRExLrF6poeLOdvTKUAM8+RvzxP+lRSr8C+v1MNnC9niy npwbICX30bA1mVIyPUEvHVDNTIM6WBiyQOzE01vckD3Yzyvwc9XRX1gYMSqP5GFZVm0b +oQA==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=N3FpvHJj; spf=pass (google.com: domain of fm-1327153-2024081417363916cda24803cb9175c6-vjdz8k@rts-flowmailer.siemens.com designates 185.136.64.226 as permitted sender) smtp.mailfrom=fm-1327153-2024081417363916cda24803cb9175c6-vJdz8k@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=1723657002; x=1724261802; 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=FojB1YyvNmE0ob8+wAGMpfZ0qoOlq9Qek28GMGFU4EQ=; b=DR0Tudy0ikrTdEFrPfXFnhcTH3Lh+2vPwZec392bok8LDsik6Br1kUQ89ubLiFWdVR m4OG0JF2HANfHkbd8IR252Se3ltsFMvE4Kh+FyHk04BLpqCcWr1KB9kUk9Z1oSRYTlmH WxlhkY8ORsMPChe1n7FZfYvFvcQpf8FVOOKZOMETZ0iq1rQRnRhi8rPGHZSCClRw4Fcs qAhrbQmdtNyLipBpixD0prW6K8c4h/Qfx4U4+W5FkJhBQpF/7iVyndtOMG4ODNt/+Rhi LysXEJCiFlBOnLtHTpXWfmv35lSAgfMOGaWkwfXNNHu38RPY7BQT9hgMLzZtMrWELXTx nlwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723657002; x=1724261802; 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=FojB1YyvNmE0ob8+wAGMpfZ0qoOlq9Qek28GMGFU4EQ=; b=DyM5xC8xcvMRxvwpveY7YL0TwaHIf9ISOE9/g5TTBXDE7LDWR97RkTYe2MUgmDaZsO +pwv0WXdPqmvbvO8kMDJcCIoy6tZAQJrZtuyIyNUY3QRydte5LCgIXQc07QOBRc6uIdn T8frRfooQwze3mpmgUrJWm4y6zJG/oKR7EVCQx4EOZwwv/8wko1Xg1YzeQOak0PyOLOU joWqxVMwyI4YIfbe9fFaE+hXqCVIVR1Ww5ZYd0J9XWXpzxzAOh7mjEi0TSsYn+DMc+AL tbjRzZPYlXDsqVxFEfuEk58fu2EZnJyQkiYDzVbEOLdf9mVxVeAsomyt87w2Uv5quZ+D UN+Q== X-Forwarded-Encrypted: i=2; AJvYcCV6iCR+xA7CP6+ELTUythPG3YWQzuSFqRC4R3O1Imdwvb+vJ+oc2m5NH4Lj8WLLKb4va57zmiQ=@isar-build.org X-Gm-Message-State: AOJu0YyByNUsoxXsr0/92eCrQq+7X07S52XJcevPX82wRcgwNsK73Htp zlvC86DQVrGh9VDFUdS/eT5N0dX0dy4TTl04V82NGV6f6x506o/q X-Google-Smtp-Source: AGHT+IH2Isx7q3Scro/rNbzv4IlimpGFywr/oaHzRsEA3naMLOQDFSLIZYoK6lYUqTDM73K8KDCNHA== X-Received: by 2002:a2e:be11:0:b0:2f1:5ae3:7141 with SMTP id 38308e7fff4ca-2f3aa1a52edmr13637261fa.3.1723657001540; Wed, 14 Aug 2024 10:36:41 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:f2c9:0:b0:368:4489:3f45 with SMTP id ffacd0b85a97d-37186a8fbb7ls28795f8f.2.-pod-prod-01-eu; Wed, 14 Aug 2024 10:36:40 -0700 (PDT) X-Received: by 2002:a5d:598a:0:b0:368:4bc0:9210 with SMTP id ffacd0b85a97d-37177796363mr2829452f8f.25.1723656999702; Wed, 14 Aug 2024 10:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723656999; cv=none; d=google.com; s=arc-20160816; b=XoRmFczTmNk77/KmYmAp8n5ZVDXl42euvFV+aqXXc7aSd4NRR/6wUbm5HwFUrtAGVU rzT3pVkSBgRPrqCNyeozzYQP3D9ZCfwnM1tnQcteM9haW9LKWtXbrL7xLlm32oUklxks JEazLZ5ZjceJutZU8w1j3dX7D6raMw5aA59Ulp0dOI/79lzErOVJgYMEw6myNloNPzUV yHMUlHbmWGhpQL7XYWWh+Ni/OCpwHn1W1+74kxmbUPc5CutONIN+NPIIJbVjXzraVp5r Ulzfxj8U2RiaEaf2jHAo84xW/p99+xWS7IEnA8ZvKUOzcN3CV25SW25k5B9GumPeUwW7 PSQA== 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=ES882WFj81yPqTJMoUgscUi4D3c/VlR0p2YsjBTLots=; fh=uEpizMaC9FZ5RjhWZ8Q38YHTDXG+3EPxv68QQHJHPnI=; b=WLMgNAQmSroaDLDwaQ7mVKbGU8/PZrIc+U61UTq0IpLmU560ik5jcCIag9tfKzNhTU 7tTOquxfllUEHGT3RCRL5eFKSxGo6w/UbT3A2kgdyPrGosfYBhwL0SCYrg8nDcPZ3hDk zpvnmCIoIiE+gY9645tVqgCz0cQBHtUbOPeToeeRzfY1XBB17hNbvMTySgOCFV9yRpu4 WdSoKwXeBP86Coc+AQyfjgyve9xX26xfzftSPMwP6y3qt6Y+Vd6FuUp5ErZeyH4zoGuj soi0ONeuEu/x9AUuqWN8hTZPIpx9yVnpjzLHQH8iezpJD11+06fPQ9ewbpqUKbNlbpnD nYDw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=N3FpvHJj; spf=pass (google.com: domain of fm-1327153-2024081417363916cda24803cb9175c6-vjdz8k@rts-flowmailer.siemens.com designates 185.136.64.226 as permitted sender) smtp.mailfrom=fm-1327153-2024081417363916cda24803cb9175c6-vJdz8k@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net. [185.136.64.226]) by gmr-mx.google.com with ESMTPS id ffacd0b85a97d-36e4bbb15e6si174023f8f.2.2024.08.14.10.36.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Aug 2024 10:36:39 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-1327153-2024081417363916cda24803cb9175c6-vjdz8k@rts-flowmailer.siemens.com designates 185.136.64.226 as permitted sender) client-ip=185.136.64.226; Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 2024081417363916cda24803cb9175c6 for ; Wed, 14 Aug 2024 19:36:39 +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 2/3] linux-custom: compile only the specified dtbs by using specific target build Date: Wed, 14 Aug 2024 20:35:23 +0300 Message-Id: <20240814173524.383600-3-nicusor.huhulea@siemens.com> In-Reply-To: <20240814173524.383600-1-nicusor.huhulea@siemens.com> References: <20240814173524.383600-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=N3FpvHJj; spf=pass (google.com: domain of fm-1327153-2024081417363916cda24803cb9175c6-vjdz8k@rts-flowmailer.siemens.com designates 185.136.64.226 as permitted sender) smtp.mailfrom=fm-1327153-2024081417363916cda24803cb9175c6-vJdz8k@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 --- .../linux/files/debian/isar/build.tmpl | 56 ++++++++++++++++++- .../linux/files/debian/isar/install.tmpl | 12 +++- meta/recipes-kernel/linux/linux-custom.inc | 6 ++ 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl index 1fd6f948..6f186e02 100644 --- a/meta/recipes-kernel/linux/files/debian/isar/build.tmpl +++ b/meta/recipes-kernel/linux/files/debian/isar/build.tmpl @@ -22,8 +22,13 @@ do_build() { sed -i "s/@KR@/${KR}/g" ${S}/debian/control ${S}/debian/linux-image-${KERNEL_NAME_PROVIDED}.* MAKE_COMMON_ARGS="O=${KERNEL_BUILD_DIR} ${PARALLEL_MAKE} KCFLAGS=${KCFLAGS} KAFLAGS=${KAFLAGS}" - if echo "${DEB_BUILD_PROFILES}" | grep -q "kernel"; then # Full build - ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_EXTRA_BUILDARGS} + if echo "${DEB_BUILD_PROFILES}" | grep -q "kernel"; then + if [ -n "${KERNEL_IMAGETYPE}" ]; then # Override the default compilation + ${MAKE} ${MAKE_COMMON_ARGS} ${KERNEL_EXTRA_BUILDARGS} ${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} ${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 @@ -38,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 <