From patchwork Tue Aug 13 11:55:20 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: 3746 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Tue, 13 Aug 2024 13:56:36 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-lj1-f185.google.com (mail-lj1-f185.google.com [209.85.208.185]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 47DBuZKo015856 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 13 Aug 2024 13:56:35 +0200 Received: by mail-lj1-f185.google.com with SMTP id 38308e7fff4ca-2f16a786316sf37128511fa.1 for ; Tue, 13 Aug 2024 04:56:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1723550189; cv=pass; d=google.com; s=arc-20160816; b=RQDYgFlZcVEjp4cMdPbyxCqxkaB+KNdSCX+ynAWOxjTTWZCGGoXp5Gc0Wxe+WfZjHU pxcbEA+LwNnBfPHoYioeX4j+s1GKgO7hoMTi5JBdy2k2N/xm77K/JD4UHyIFqTtfyO1L AI6MYugilkrvGh/VZj++Q4Y1g0DyymSiWB/ku5OXEwgTC6ddJ2gbQrxmd5yDijv7w7nI U11yU+3Bqb9ouAOVq6kW0g7enaMJaBa5+E3kbsWokFoifr3BoMwjXry87Phq9hVp6qfE yVW/yO2j/DbiNCWwcMD9uXaZukCjFv8pLUfIUZJ955oEAv6KV1ZgkSi+EyPDWUXFSbD5 B5WA== 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=zY6lH3TPjseLCeyP/6lV1dQr98SJ4j04FtRoG+6C6Lw=; fh=JdejG8jylSBXcv/6y+N9F3hFLBGk27gSVFuzzVHH+iI=; b=weEzqw28lBdrCrwHegijfEmIhN5gqy1OWN76E0ZpHv2SvP8IdLs4F4Hu5yOrCR6zTq NdtOsjHYYdfjOmSSuqpdjYbQEVFuT5cyfsxdXkQaPuK0Ge9QwDpRPY1S/fVABC9LhOPH xgd/dteeIGnCun8zamSC/Qd2caafGIMYIVkv1ic/zNWC4HHiq20Zh4oB8u+aAD4G9xxN hP33lfrTEnhB2tDp3+e6h4/2K2pmy8rJswyRGpYPOfy+d86ATJPDdhQ444EJXNmL3piv VWa1pWT4SMsWF8A8Ne7Epefw7O/pjKSs1+qSaPlArckIzNGkceLy+wejR/6/BNHsDnQT bk5A==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=fjCAmlTE; spf=pass (google.com: domain of fm-1327153-202408131156253b26fe288a19371416-dp9npq@rts-flowmailer.siemens.com designates 185.136.65.227 as permitted sender) smtp.mailfrom=fm-1327153-202408131156253b26fe288a19371416-dp9NPQ@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=1723550189; x=1724154989; 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=zY6lH3TPjseLCeyP/6lV1dQr98SJ4j04FtRoG+6C6Lw=; b=Oim97irQk63cpE5hc76NliLDpwVk3zReLqgluuccnkF7TBr6N3hOQ6o4/N1rlqd03t c5A4QqVNHfCQINtM0XtvcxaT4LaxSZVCluW5DGIveXjNqEU52YE9YdCCCCMAKXkcbe4n 3Zs9yh1lKLUkMX6G41dRKtpcT6xutbxaAxNLwNz3QUUOGcpu7rpceu66AxHxa1sHs15a 7Dnp9tU6N/zmUwe7ae1wYMSf7QtCwvS1tdrHiTNca3jU//kLiRQq5lMmXolstmBa4W6q 8IVQ36KM6JCpvD58y+VD56aZsr3RKXz6b0MHn1uoFXSYjlNn4W1LVCkUWlgwaFb4clL5 D7IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723550189; x=1724154989; 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=zY6lH3TPjseLCeyP/6lV1dQr98SJ4j04FtRoG+6C6Lw=; b=hkn+ib16Z3t8zebSKVDzQl1B4gSTBYz49TYzD2LOcdHe3Q/Q6epXkrTOS0qdJVkw4R ps2h0ChpVWvLP7SgeRsDiyyJwlUgBSIGKpL3AdsnyDrOpvkX0v0HN+pADFsduOx1AuVO AUEgDV/qFWaIJM8rS8RIsu2c6Ja/NLIC4fuYPQ0lUW9wtY9VdxKFyIC8dnXHUMiDiX5S d1zZIGiNoPUxnFT888FEsjL+hTv1FP/5vBEDp++jV06SJhJzW+eOuhycVhwSakeT2VBQ 3uD5jQKu44Rtxy7xB6ioqx2B/qQ8mDdLJR1SC/HT16L+VKCAVE4IKU3zzIkVyO37BH0e 14og== X-Forwarded-Encrypted: i=2; AJvYcCUgxE3E5qIy6snoTCvKfsI8Di7S1Pi6rae/tb+0xPeg545gdh+sQxV8DVlsFbiaecPRai4rrFZb6QyM3XR0L9TJvF+rAwo= X-Gm-Message-State: AOJu0YwAtuTbTbisMYxKJKri2vLp8hShbLWg4ZfNVjIPIFRDfbJ9SdYj OOWOsQho0z5HQAz4I5RWEEAWH4HjSoIIT6vcqqwlHYsuZfkXYttc X-Google-Smtp-Source: AGHT+IEDz+n1Q7DJdkZidPlPyyr/0W1JUQpayL2rq2hxOv2hr+GtmL69M9OrZc/ryxTySFiCrwEfEg== X-Received: by 2002:a2e:b891:0:b0:2f0:1d1d:f2ce with SMTP id 38308e7fff4ca-2f2b8f3f8bdmr9049731fa.26.1723550188556; Tue, 13 Aug 2024 04:56:28 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:2a41:0:b0:2f0:1e8f:d12e with SMTP id 38308e7fff4ca-2f19bc6242fls8700911fa.1.-pod-prod-00-eu; Tue, 13 Aug 2024 04:56:26 -0700 (PDT) X-Received: by 2002:a05:6512:2207:b0:52e:f9f1:c132 with SMTP id 2adb3069b0e04-53213d977a9mr776030e87.4.1723550186224; Tue, 13 Aug 2024 04:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723550186; cv=none; d=google.com; s=arc-20160816; b=Cz1hYH4312l/SZudZYTU6Nr7sPdp322SkvF6cG6+SgpuSzhXqBvm6ijbibU6MH1tWt qg5oPyzT/u5nRODr5/uDJyTLUAQyZN4bZp30H1PdH7SB+BbwDdV3pAur+j/soYCkRr3C BjTlNX6L1jXdKG7dfbD5otWVbKuNm100TB1AGCldcMT6J+Jr1pU6+CCHJ7a17T0/jrfE +E9SSqeHMV5m/sx1f2kcjBlcaTJ8GINpR0ysIaJ/CKPZiAvnY02RWtIBid0eAlDTDN6U 41YM52sUmLN9yz3g9nCJzbctzMaYMk9JIktJe6QgrzRto1demcMrXwYgi2wBMLEHT/Om Djag== 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=XU15djdN5hfKpXPsTMiLkMgCmlnklFthZK1yc8PzVrY=; fh=uEpizMaC9FZ5RjhWZ8Q38YHTDXG+3EPxv68QQHJHPnI=; b=oPDQeLZpK/GjtU5uSiqZBMK6AUgEOj4wW3YVORWyKEbvV3aLCPleyN74+LbcyUlEXm LCFMgwzY/3LyLTEHYXAca9xlU8sHXp3gB0V0sYVrKjd7hAIsR04sLJq/uzRH7Cw1YMEr qkOUgdWNsIPVxtrFpVHxNK0pDtYABZmtISNyaGyKfIgcc6eYs/4nw9t8cQO+uYCsf3NE NtXzfMPLCJtXqbtxMrtcRzfUuX+t2XetlzCh1QAsO4xJs/jyZVgxUNKIdfDKO66OsScQ 78tZACgNfyfhf/PWYResRV8Xjf1hQ+ceHdBUAZPx0dHgrV3gMAOmtzvlQzSJitG/ZoKY BiOw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=fjCAmlTE; spf=pass (google.com: domain of fm-1327153-202408131156253b26fe288a19371416-dp9npq@rts-flowmailer.siemens.com designates 185.136.65.227 as permitted sender) smtp.mailfrom=fm-1327153-202408131156253b26fe288a19371416-dp9NPQ@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net. [185.136.65.227]) by gmr-mx.google.com with ESMTPS id 2adb3069b0e04-53200ea4d92si158493e87.5.2024.08.13.04.56.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Aug 2024 04:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-1327153-202408131156253b26fe288a19371416-dp9npq@rts-flowmailer.siemens.com designates 185.136.65.227 as permitted sender) client-ip=185.136.65.227; Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 202408131156253b26fe288a19371416 for ; Tue, 13 Aug 2024 13:56:25 +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 those specified dtbs Date: Tue, 13 Aug 2024 14:55:20 +0300 Message-Id: <20240813115521.381481-2-nicusor.huhulea@siemens.com> In-Reply-To: <20240813115521.381481-1-nicusor.huhulea@siemens.com> References: <20240802114105.1767411-1-nicusor.huhulea@siemens.com> <20240813115521.381481-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=fjCAmlTE; spf=pass (google.com: domain of fm-1327153-202408131156253b26fe288a19371416-dp9npq@rts-flowmailer.siemens.com designates 185.136.65.227 as permitted sender) smtp.mailfrom=fm-1327153-202408131156253b26fe288a19371416-dp9NPQ@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..15201686 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 <