From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7262285697649737728 X-Received: by 2002:a05:6402:b2c:b0:522:2ce0:d80a with SMTP id bo12-20020a0564020b2c00b005222ce0d80amr1790172edb.35.1690882681994; Tue, 01 Aug 2023 02:38:01 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6402:14c6:b0:522:3ad4:9c9e with SMTP id f6-20020a05640214c600b005223ad49c9els286036edx.0.-pod-prod-00-eu; Tue, 01 Aug 2023 02:38:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlF721aaLPU5qdcpxoS519Fk1fAl2I2Rp9DhlEAubmfftgo21mf+YRoUmWm2GvifjpicNwKn X-Received: by 2002:a05:6402:520e:b0:51d:cf7b:c9f0 with SMTP id s14-20020a056402520e00b0051dcf7bc9f0mr2820693edd.12.1690882679989; Tue, 01 Aug 2023 02:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690882679; cv=none; d=google.com; s=arc-20160816; b=YFKlkDbr7G/UBCBAFvB7ad6FZPfQghArp4oBYj2eVP70wC/mIb/xwSYPszjdnYRqSv gFtOEQhRrST9EYz/TLFM5VsNGFhN7v81E0Bbi57wry7NHymoV9DWTxZLDJ1D+6/Jl/HG ctNKhHWbycOdgzbPZ2PWEm9YEaNr8cXCqEatBK5X47GNDEOWfhF94dZLzEHF7cauhNAS 4Wr9uATSM8i1Uz1sxuFt4qk2t6g5ThZQPYPe8h3MKDiM8YmNjFXhJvFQ4MtSMvXNeFYh m/9QmKBKdBbrVKxqhImpLFjfCAiJYPRCnM4qGxLf1n0XFzHn72Va1D2F7UsOoID59GeZ 6ypw== 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=OHnvd7j+7hL1A+tpY17J65lND4UpBuOixZp+gy5DwBo=; fh=Y8xmVxKsXeOwj5VJYPzj0QBUOe1XiBsygT7R+JGa07w=; b=UVdr9cStoDrDAN69fOlafFg9bi/+qyrRJah7HhGhda5sIQ2oS0zHFh3oI02oLfLzV3 NPs6U7ePJn/opGaeDN/aqjwdDJl+lJnnZ8+ujpy3uThkbngSGzal8BDThT6UQI+7Mzhq yIq9qc8UojgkPMAihiEfwvLBRvNqDAOyNP5cbCEVa+c1f6cE/uXF4Ciij9aXcjpvTbaE RdbHjp8gmApBdO5434USiol+2KpWkOTDVS8xLTRZONZf/+pX8cfaL0kmzXrVcqL4j4TE pxnuVRG3dfl6Fr5rxh24DwYKpxPIHqzELn+jDglPaTn+W5zLkXTnRDn8ZTss1ic9XHme oUBQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=SMXuLTsD; spf=pass (google.com: domain of fm-72506-20230801093759cce4b245ab7fc6711a-abnx9y@rts-flowmailer.siemens.com designates 185.136.65.226 as permitted sender) smtp.mailfrom=fm-72506-20230801093759cce4b245ab7fc6711a-ABNX9y@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net. [185.136.65.226]) by gmr-mx.google.com with ESMTPS id ez2-20020a056402450200b0052174fd486fsi769853edb.1.2023.08.01.02.37.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2023 02:37:59 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-72506-20230801093759cce4b245ab7fc6711a-abnx9y@rts-flowmailer.siemens.com designates 185.136.65.226 as permitted sender) client-ip=185.136.65.226; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=SMXuLTsD; spf=pass (google.com: domain of fm-72506-20230801093759cce4b245ab7fc6711a-abnx9y@rts-flowmailer.siemens.com designates 185.136.65.226 as permitted sender) smtp.mailfrom=fm-72506-20230801093759cce4b245ab7fc6711a-ABNX9y@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 20230801093759cce4b245ab7fc6711a for ; Tue, 01 Aug 2023 11:37:59 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=felix.moessbauer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=OHnvd7j+7hL1A+tpY17J65lND4UpBuOixZp+gy5DwBo=; b=SMXuLTsDFcLwIVdtfDr1p/gRGAMxsG3XqUt50qcgEQjtIxgylYw9H6vvVKluoDZ+gjiSiZ VbecdU5tEu07/44fjs8cIjyvNlSfJCL6WJOID0Z7d4fWHWhkl7S9/B75iE1msQTVQ5hhOXzd PS6tNnu71l7Fp5AOAPUlTb11cLg0Q=; From: Felix Moessbauer To: isar-users@googlegroups.com Cc: florian.bezdeka@siemens.com, jan.kiszka@siemens.com, Felix Moessbauer Subject: [PATCH 3/4] u-boot-script: add support to use builtin dt Date: Tue, 1 Aug 2023 09:37:05 +0000 Message-Id: <20230801093706.1347928-4-felix.moessbauer@siemens.com> In-Reply-To: <20230801093706.1347928-1-felix.moessbauer@siemens.com> References: <20230801093706.1347928-1-felix.moessbauer@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-72506:519-21489:flowmailer X-TUID: DLOprCPmyJUY This patch adds support to use the u-boot builtin device tree instead of the one from the rootfs / linux. This enables the use of dt overlays even if the corresponding device tree in the kernel is not compiled with symbol support (uboot builtin DTBs always have symbol information). To use the builtin dt, add the WKS sourceparam "builtin_dt=yes" to the rootfs-u-boot sourcer. Co-developed-by: Florian Bezdeka Signed-off-by: Felix Moessbauer --- .../u-boot-script/files/u-boot-script | 3 +++ .../u-boot-script/files/update-u-boot-script | 16 ++++++++++++---- .../lib/wic/plugins/source/rootfs-u-boot.py | 3 +++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/meta/recipes-bsp/u-boot-script/files/u-boot-script b/meta/recipes-bsp/u-boot-script/files/u-boot-script index d053d721..a11212c0 100644 --- a/meta/recipes-bsp/u-boot-script/files/u-boot-script +++ b/meta/recipes-bsp/u-boot-script/files/u-boot-script @@ -15,3 +15,6 @@ NO_INITRD="" # U-boot commands to prepend to boot script SCRIPT_PREPEND="" + +# use u-boot builtin device tree +BUILTIN_DT="no" diff --git a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script index 14a81563..f4e36ed2 100755 --- a/meta/recipes-bsp/u-boot-script/files/update-u-boot-script +++ b/meta/recipes-bsp/u-boot-script/files/update-u-boot-script @@ -33,10 +33,18 @@ echo "${SCRIPT_PREPEND}" >> ${BOOT_CMD} echo "setenv bootargs ${KERNEL_ARGS}" >> ${BOOT_CMD} -echo "echo Loading /usr/lib/linux-image-${KERNEL_VERSION}/\${fdtfile}..." \ - >> ${BOOT_CMD} -echo "load \${devtype} \${devnum}:${ROOT_PARTITION} \${fdt_addr_r}" \ - "/usr/lib/linux-image-${KERNEL_VERSION}/\${fdtfile}" >> ${BOOT_CMD} +if [ "${BUILTIN_DT}" = "yes" ]; then + echo "echo Loading builtin device tree..." \ + >> ${BOOT_CMD} + echo "fdt addr \${fdtcontroladdr}" >> ${BOOT_CMD} + echo "fdt move \${fdtcontroladdr} \${fdt_addr_r}" >> ${BOOT_CMD} +else + echo "echo Loading /usr/lib/linux-image-${KERNEL_VERSION}/\${fdtfile}..." \ + >> ${BOOT_CMD} + echo "load \${devtype} \${devnum}:${ROOT_PARTITION} \${fdt_addr_r}" \ + "/usr/lib/linux-image-${KERNEL_VERSION}/\${fdtfile}" >> ${BOOT_CMD} +fi + echo "echo Loading /boot/${KERNEL_FILE}-${KERNEL_VERSION}..." >> ${BOOT_CMD} echo "load \${devtype} \${devnum}:\${distro_bootpart} \${kernel_addr_r}" \ "/boot/${KERNEL_FILE}-${KERNEL_VERSION}" >> ${BOOT_CMD} diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py index 0b4f9eec..93600dc2 100644 --- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py +++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py @@ -10,6 +10,7 @@ # Recognized sourceparams: # - no_initrd=yes (disables initrd loading) # - overlays=file.dtbo ... (overlay files) +# - builtin_dt=no (use DT from uboot instead of kernel) # - script_prepend=cmd;... (prepends U-Boot command) import glob @@ -82,6 +83,8 @@ class RootfsUBootPlugin(RootfsPlugin): cfg.write('NO_INITRD="%s"\n' % no_initrd) overlays = source_params.get('overlays') or '' cfg.write('OVERLAYS="%s"\n' % overlays) + builtin_dt = source_params.get('builtin_dt') or '' + cfg.write('BUILTIN_DT="%s"\n' % builtin_dt) script_prepend = source_params.get('script_prepend') or '' # remove escapes from $\{var\} that are needed to avoid expansion by wic script_prepend = re.sub(r'\$\\{([^\\]+)\\}', r'${\1}', script_prepend) -- 2.34.1