diff mbox series

[1/2] kernel-fitimage: mangle slashes to underscores as late as possible

Message ID 20221026132219.3330056-1-a.fatoum@pengutronix.de
State Accepted, archived
Commit 8bea426ca59d17715a3b32f7e3caf3e4b6db5ce9
Headers show
Series [1/2] kernel-fitimage: mangle slashes to underscores as late as possible | expand

Commit Message

Ahmad Fatoum Oct. 26, 2022, 1:22 p.m. UTC
This introduces no functional change, but will come in handy in a later
commit where a file lookup will have us using the device tree name. If
we keep it like it's now, we will lose the information whether an
underscore is an original underscore or a mangled slash.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 meta/classes-recipe/kernel-fitimage.bbclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
index befdf2568cb1..6307e3c50a3f 100644
--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -392,6 +392,8 @@  fitimage_emit_section_config() {
 	setup_line=""
 	default_line=""
 
+	dtb_image=$(echo $dtb_image | tr '/' '_')
+
 	# conf node name is selected based on dtb ID if it is present,
 	# otherwise its selected based on kernel ID
 	if [ -n "$dtb_image" ]; then
@@ -550,12 +552,11 @@  fitimage_assemble() {
 				DTB_PATH="${KERNEL_OUTPUT_DIR}/$DTB"
 			fi
 
-			DTB=$(echo "$DTB" | tr '/' '_')
-
 			# Skip DTB if we've picked it up previously
 			echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue
 
 			DTBS="$DTBS $DTB"
+			DTB=$(echo $DTB | tr '/' '_')
 			fitimage_emit_section_dtb $1 $DTB $DTB_PATH
 		done
 	fi
@@ -563,12 +564,11 @@  fitimage_assemble() {
 	if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ]; then
 		dtbcount=1
 		for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" \( -name '*.dtb' -o -name '*.dtbo' \) -printf '%P\n' | sort); do
-			DTB=$(echo "$DTB" | tr '/' '_')
-
 			# Skip DTB if we've picked it up previously
 			echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue
 
 			DTBS="$DTBS $DTB"
+			DTB=$(echo $DTB | tr '/' '_')
 			fitimage_emit_section_dtb $1 $DTB "${EXTERNAL_KERNEL_DEVICETREE}/$DTB"
 		done
 	fi