public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [OE-core] [PATCH 0/2] Some kernel fitimage build fixes
@ 2022-03-28 14:15 liu.ming50
  2022-03-28 14:15 ` [OE-core] [PATCH 1/2] kernel-fitimage.bbclass: change 'echo' to 'bbnote' liu.ming50
  2022-03-28 14:15 ` [OE-core] [PATCH 2/2] kernel-fitimage.bbclass: introduce FIT_SUPPORTED_INITRAMFS_FSTYPES liu.ming50
  0 siblings, 2 replies; 3+ messages in thread
From: liu.ming50 @ 2022-03-28 14:15 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <liu.ming50@gmail.com>

Ming Liu (2):
  kernel-fitimage.bbclass: change 'echo' to 'bbnote'
  kernel-fitimage.bbclass: introduce FIT_SUPPORTED_INITRAMFS_FSTYPES

 meta/classes/kernel-fitimage.bbclass | 35 +++++++++++++++++-----------
 1 file changed, 21 insertions(+), 14 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [OE-core] [PATCH 1/2] kernel-fitimage.bbclass: change 'echo' to 'bbnote'
  2022-03-28 14:15 [OE-core] [PATCH 0/2] Some kernel fitimage build fixes liu.ming50
@ 2022-03-28 14:15 ` liu.ming50
  2022-03-28 14:15 ` [OE-core] [PATCH 2/2] kernel-fitimage.bbclass: introduce FIT_SUPPORTED_INITRAMFS_FSTYPES liu.ming50
  1 sibling, 0 replies; 3+ messages in thread
From: liu.ming50 @ 2022-03-28 14:15 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <liu.ming50@gmail.com>

Change 'echo' usages to 'bbnote' for better logging.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 meta/classes/kernel-fitimage.bbclass | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index df5de0427b..13af4daafc 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -568,13 +568,12 @@ fitimage_assemble() {
 		# Find and use the first initramfs image archive type we find
 		for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio; do
 			initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img"
-			echo -n "Searching for $initramfs_path..."
 			if [ -e "$initramfs_path" ]; then
-				echo "found"
+				bbnote "Found initramfs image: $initramfs_path"
 				fitimage_emit_section_ramdisk $1 "$ramdiskcount" "$initramfs_path"
 				break
 			else
-				echo "not found"
+				bbnote "Did not find initramfs image: $initramfs_path"
 			fi
 		done
 	fi
@@ -686,12 +685,12 @@ do_kernel_generate_rsa_keys() {
 			# make directory if it does not already exist
 			mkdir -p "${UBOOT_SIGN_KEYDIR}"
 
-			echo "Generating RSA private key for signing fitImage"
+			bbnote "Generating RSA private key for signing fitImage"
 			openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \
 				"${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \
 			"${FIT_SIGN_NUMBITS}"
 
-			echo "Generating certificate for signing fitImage"
+			bbnote "Generating certificate for signing fitImage"
 			openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \
 				-key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \
 				-out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt
@@ -704,12 +703,12 @@ do_kernel_generate_rsa_keys() {
 			# make directory if it does not already exist
 			mkdir -p "${UBOOT_SIGN_KEYDIR}"
 
-			echo "Generating RSA private key for signing fitImage"
+			bbnote "Generating RSA private key for signing fitImage"
 			openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \
 				"${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".key \
 			"${FIT_SIGN_NUMBITS}"
 
-			echo "Generating certificate for signing fitImage"
+			bbnote "Generating certificate for signing fitImage"
 			openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \
 				-key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".key \
 				-out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_IMG_KEYNAME}".crt
@@ -725,13 +724,13 @@ kernel_do_deploy:append() {
 	if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
 
 		if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
-			echo "Copying fit-image.its source file..."
+			bbnote "Copying fit-image.its source file..."
 			install -m 0644 ${B}/fit-image.its "$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its"
 			if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
 				ln -snf fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}"
 			fi
 
-			echo "Copying linux.bin file..."
+			bbnote "Copying linux.bin file..."
 			install -m 0644 ${B}/linux.bin $deployDir/fitImage-linux.bin-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT}
 			if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
 				ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT} "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}"
@@ -739,14 +738,14 @@ kernel_do_deploy:append() {
 		fi
 
 		if [ -n "${INITRAMFS_IMAGE}" ]; then
-			echo "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
+			bbnote "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
 			install -m 0644 ${B}/fit-image-${INITRAMFS_IMAGE}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its"
 			if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
 				ln -snf fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
 			fi
 
 			if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
-				echo "Copying fitImage-${INITRAMFS_IMAGE} file..."
+				bbnote "Copying fitImage-${INITRAMFS_IMAGE} file..."
 				install -m 0644 ${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT}"
 				if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
 					ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}${KERNEL_FIT_BIN_EXT} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
@@ -765,9 +764,9 @@ kernel_do_deploy:append() {
 		# If we're also creating and/or signing the uboot fit, now we need to
 		# deploy it, it's its file, as well as u-boot-spl.dtb
 		install -m 0644 ${B}/u-boot-spl-${MACHINE}*.dtb "$deployDir/"
-		echo "Copying u-boot-fitImage file..."
+		bbnote "Copying u-boot-fitImage file..."
 		install -m 0644 ${B}/u-boot-fitImage-* "$deployDir/"
-		echo "Copying u-boot-its file..."
+		bbnote "Copying u-boot-its file..."
 		install -m 0644 ${B}/u-boot-its-* "$deployDir/"
 	fi
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [OE-core] [PATCH 2/2] kernel-fitimage.bbclass: introduce FIT_SUPPORTED_INITRAMFS_FSTYPES
  2022-03-28 14:15 [OE-core] [PATCH 0/2] Some kernel fitimage build fixes liu.ming50
  2022-03-28 14:15 ` [OE-core] [PATCH 1/2] kernel-fitimage.bbclass: change 'echo' to 'bbnote' liu.ming50
@ 2022-03-28 14:15 ` liu.ming50
  1 sibling, 0 replies; 3+ messages in thread
From: liu.ming50 @ 2022-03-28 14:15 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

From: Ming Liu <liu.ming50@gmail.com>

It was found when a end user wants to build a squashfs type initramfs
into fitimage, it just fails without printing out any error or warning
messages, which is not right.

Introduce a FIT_SUPPORTED_INITRAMFS_FSTYPES variable to avoid
hard-coding the supported initramfs types, and it could be overridden
in config files. Also break the build when none of a supported
initramfs type is found.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 meta/classes/kernel-fitimage.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index 13af4daafc..f28c943860 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -65,6 +65,8 @@ FIT_SIGN_INDIVIDUAL ?= "0"
 FIT_CONF_PREFIX ?= "conf-"
 FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name"
 
+FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio"
+
 # Keys used to sign individually image nodes.
 # The keys to sign image nodes must be different from those used to sign
 # configuration nodes, otherwise the "required" property, from
@@ -566,16 +568,22 @@ fitimage_assemble() {
 	#
 	if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
 		# Find and use the first initramfs image archive type we find
-		for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio; do
+		found=
+		for img in ${FIT_SUPPORTED_INITRAMFS_FSTYPES}; do
 			initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img"
 			if [ -e "$initramfs_path" ]; then
 				bbnote "Found initramfs image: $initramfs_path"
+				found=true
 				fitimage_emit_section_ramdisk $1 "$ramdiskcount" "$initramfs_path"
 				break
 			else
 				bbnote "Did not find initramfs image: $initramfs_path"
 			fi
 		done
+
+		if [ -z "$found" ]; then
+			bbfatal "Could not find a valid initramfs type for ${INITRAMFS_IMAGE_NAME}, the supported types are: ${FIT_SUPPORTED_INITRAMFS_FSTYPES}"
+		fi
 	fi
 
 	fitimage_emit_section_maint $1 sectend
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-28 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-28 14:15 [OE-core] [PATCH 0/2] Some kernel fitimage build fixes liu.ming50
2022-03-28 14:15 ` [OE-core] [PATCH 1/2] kernel-fitimage.bbclass: change 'echo' to 'bbnote' liu.ming50
2022-03-28 14:15 ` [OE-core] [PATCH 2/2] kernel-fitimage.bbclass: introduce FIT_SUPPORTED_INITRAMFS_FSTYPES liu.ming50

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox