Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCHv3 1/4] kernel-devicetree.bbclass: Use lowercase names for shell variables
Date: Wed,  4 Jul 2018 07:59:21 +0000	[thread overview]
Message-ID: <20180704075924.24065-1-Martin.Jansa@gmail.com> (raw)
In-Reply-To: <CA+chaQd9otpzozM5DrifBUVdODogBsVdy2U8czAAd+Ys_6TBtA@mail.gmail.com>

* just to make it more clear what is local shell variable and what is
  replaced by bitbake from the metadata and also to prevent the variable
  to be incorrectly expanded by bitbake if someone happens to define
  e.g. DTB_BASE_NAME

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes/kernel-devicetree.bbclass | 80 +++++++++++++-------------
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass
index 9866d844ab..5d38d3760d 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -10,21 +10,21 @@ FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-
 KERNEL_DEVICETREE_BUNDLE ?= "0"
 
 normalize_dtb () {
-	DTB="$1"
-	if echo ${DTB} | grep -q '/dts/'; then
-		bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
+	dtb="$1"
+	if echo $dtb | grep -q '/dts/'; then
+		bbwarn "$dtb contains the full path to the the dts file, but only the dtb name should be used."
 	fi
-	DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
-	echo "${DTB}"
+	dtb=`basename $dtb | sed 's,\.dts$,.dtb,g'`
+	echo "$dtb"
 }
 
 get_real_dtb_path_in_kernel () {
-	DTB="$1"
-	DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
-	if [ ! -e "${DTB_PATH}" ]; then
-		DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
+	dtb="$1"
+	dtb_path="${B}/arch/${ARCH}/boot/dts/$dtb"
+	if [ ! -e "$dtb_path" ]; then
+		dtb_path="${B}/arch/${ARCH}/boot/$dtb"
 	fi
-	echo "${DTB_PATH}"
+	echo "$dtb_path"
 }
 
 do_configure_append() {
@@ -50,61 +50,61 @@ do_configure_append() {
 }
 
 do_compile_append() {
-	for DTB in ${KERNEL_DEVICETREE}; do
-		DTB=`normalize_dtb "${DTB}"`
-		oe_runmake ${DTB}
+	for dtbf in ${KERNEL_DEVICETREE}; do
+		dtb=`normalize_dtb "$dtbf"`
+		oe_runmake $dtb
 	done
 }
 
 do_install_append() {
-	for DTB in ${KERNEL_DEVICETREE}; do
-		DTB=`normalize_dtb "${DTB}"`
-		DTB_EXT=${DTB##*.}
-		DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
-		DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
-		install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT}
+	for dtbf in ${KERNEL_DEVICETREE}; do
+		dtb=`normalize_dtb "$dtbf"`
+		dtb_ext=${dtb##*.}
+		dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
+		dtb_base_name=`basename $dtb ."$dtb_ext"`
+		install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext
 		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
 			symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
-			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			ln -sf ${DTB_BASE_NAME}.${DTB_EXT} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.${DTB_EXT}
+			dtb_symlink_name=`echo ${symlink_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
+			ln -sf $dtb_base_name.$dtb_ext ${D}/${KERNEL_IMAGEDEST}/devicetree-$dtb_symlink_name.$dtb_ext
 
 			if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
 				cat ${D}/${KERNEL_IMAGEDEST}/$type \
-					${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} \
-					> ${D}/${KERNEL_IMAGEDEST}/$type-${DTB_BASE_NAME}.${DTB_EXT}.bin
+					${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext \
+					> ${D}/${KERNEL_IMAGEDEST}/$type-$dtb_base_name.$dtb_ext.bin
 			fi
 		done
 	done
 }
 
 do_deploy_append() {
-	for DTB in ${KERNEL_DEVICETREE}; do
-		DTB=`normalize_dtb "${DTB}"`
-		DTB_EXT=${DTB##*.}
-		DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"`
+	for dtbf in ${KERNEL_DEVICETREE}; do
+		dtb=`normalize_dtb "$dtbf"`
+		dtb_ext=${dtb##*.}
+		dtb_base_name=`basename $dtb ."$dtb_ext"`
 		for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
 			base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME}
 			symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
-			DTB_NAME=`echo ${base_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-			DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
+			dtb_name=`echo ${base_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
+			dtb_symlink_name=`echo ${symlink_name} | sed "s/${MACHINE}/$dtb_base_name/g"`
+			dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
 			install -d ${DEPLOYDIR}
-			install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}
-			ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.${DTB_EXT}
-			ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_BASE_NAME}.${DTB_EXT}
+			install -m 0644 $dtb_path ${DEPLOYDIR}/$dtb_name.$dtb_ext
+			ln -sf $dtb_name.$dtb_ext ${DEPLOYDIR}/$dtb_symlink_name.$dtb_ext
+			ln -sf $dtb_name.$dtb_ext ${DEPLOYDIR}/$dtb_base_name.$dtb_ext
 
 			if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
 				cat ${DEPLOYDIR}/$type \
-					${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT} \
-					> ${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT}.bin
-				ln -sf ${DTB_NAME}.${DTB_EXT}.bin ${DEPLOYDIR}/$type-${DTB_BASE_NAME}.${DTB_EXT}.bin
+					${DEPLOYDIR}/$dtb_name.$dtb_ext \
+					> ${DEPLOYDIR}/$dtb_name.$dtb_ext.bin
+				ln -sf $dtb_name.$dtb_ext.bin ${DEPLOYDIR}/$type-$dtb_base_name.$dtb_ext.bin
 
 				if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
 					cat ${KERNEL_OUTPUT_DIR}/${type}.initramfs \
-						${DEPLOYDIR}/${DTB_NAME}.${DTB_EXT} \
-						> ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-${DTB_BASE_NAME}.${DTB_EXT}.bin
-					ln -sf ${type}-${INITRAMFS_BASE_NAME}-${DTB_BASE_NAME}.${DTB_EXT}.bin \
-					       ${DEPLOYDIR}/${type}-initramfs-${DTB_BASE_NAME}.${DTB_EXT}-${MACHINE}.bin
+						${DEPLOYDIR}/$dtb_name.$dtb_ext \
+						> ${DEPLOYDIR}/${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name.$dtb_ext.bin
+					ln -sf ${type}-${INITRAMFS_BASE_NAME}-$dtb_base_name.$dtb_ext.bin \
+					       ${DEPLOYDIR}/${type}-initramfs-$dtb_base_name.$dtb_ext-${MACHINE}.bin
 				fi
 			fi
 		done
-- 
2.17.1



  parent reply	other threads:[~2018-07-04  7:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 20:11 [RFC][PATCH 0/5] Kernel artifacts naming changes Martin Jansa
2017-11-20 20:11 ` [RFC][PATCH 1/5] kernel-devicetree.bbclass: Use lowercase names for shell variables Martin Jansa
2017-11-20 20:11 ` [RFC][PATCH 2/5] kernel-devicetree.bbclass: Fix and simplify instalation of DTB files Martin Jansa
2017-11-20 20:11 ` [RFC][PATCH 3/5] kernel-devicetree.bbclass: build DTBs with make dtbs Martin Jansa
2017-11-20 20:11 ` [RFC][PATCH 4/5] kernel.bbclass: use the consistent naming schema for initramfs Martin Jansa
2017-11-20 20:11 ` [RFC][PATCH 5/5] kernel.bbclass: move variables for kernel artifacts names to separate bbclass Martin Jansa
2017-11-21 11:58 ` [RFC][PATCH 0/5] Kernel artifacts naming changes Otavio Salvador
2018-07-02 14:16   ` Martin Jansa
2018-07-02 16:56     ` Otavio Salvador
2018-07-02 22:07     ` [PATCHv2 1/4] kernel-devicetree.bbclass: Use lowercase names for shell variables Martin Jansa
2018-07-02 22:07       ` [PATCHv2 2/4] kernel-devicetree.bbclass: Fix and simplify instalation of DTB files Martin Jansa
2018-07-02 22:07       ` [PATCHv2 3/4] kernel.bbclass: use the consistent naming schema for initramfs Martin Jansa
2018-07-02 22:07       ` [PATCHv2 4/4] kernel.bbclass: move variables for kernel artifacts names to separate bbclass Martin Jansa
2018-07-04  7:59     ` Martin Jansa [this message]
2018-07-04  7:59       ` [PATCHv3 2/4] kernel-devicetree.bbclass: Fix and simplify instalation of DTB files Martin Jansa
2018-07-04  8:54         ` Paulo Neves
2018-07-04  9:18           ` Martin Jansa
2018-07-04  7:59       ` [PATCHv3 3/4] kernel.bbclass: use the consistent naming schema for initramfs Martin Jansa
2018-07-04  7:59       ` [PATCHv3 4/4] kernel.bbclass: move variables for kernel artifacts names to separate bbclass Martin Jansa
2018-07-05  8:21       ` [PATCHv3 1/4] kernel-devicetree.bbclass: Use lowercase names for shell variables Richard Purdie
2018-07-09 15:04         ` Martin Jansa
2018-07-09 15:04           ` [PATCHv4 " Martin Jansa
2018-07-09 15:04             ` [PATCHv4 2/4] kernel-devicetree.bbclass: Fix and simplify instalation of DTB files Martin Jansa
2018-07-09 15:04             ` [PATCHv4 3/4] kernel.bbclass: use the consistent naming schema for initramfs Martin Jansa
2018-07-09 15:05             ` [PATCHv4 4/4] kernel.bbclass: move variables for kernel artifacts names to separate bbclass Martin Jansa
2018-07-04 20:06     ` [PATCH] Revert "kernel-devicetree: Corrected normalize_dtb" Martin Jansa
2018-07-05  7:15       ` Nicolas Dechesne
2018-07-05  8:23         ` Richard Purdie
2018-07-05  8:38           ` Martin Jansa
2018-07-05 10:37             ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180704075924.24065-1-Martin.Jansa@gmail.com \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox