Skip to contentSkip to conversation

kernel-fitimage.bbclass: Handle bundled initramfs case correctly.

PATCH New Leon Woestenberg 1 participant 2 messages Sep 6, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 kernel-fitimage.bbclass: Handle bundled initramfs case correctly.

From: Walter Goossens <[email protected]>

If INITRAMFS_IMAGE was set, but also INITRAMFS_BUNDLE = 1, then the kernel image already has the initramfs bundled inside. In that case do not pack the initramfs inside the FIT (again).

(The fitImage name does keep the suffix INITRAMFS_IMAGE for all initramfs cases.)

---
 meta/classes/kernel-fitimage.bbclass | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
meta/classes/kernel-fitimage.bbclass +15 -1
index 88d8022..8bda644 100644
@@ -475,7 +475,9 @@ addtask assemble_fitimage before do_install after do_compile
 
 do_assemble_fitimage_initramfs() {
 	if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
-		test -n "${INITRAMFS_IMAGE}" ; then
+		test -n "${INITRAMFS_IMAGE}" && \
+		test ! -n "${INITRAMFS_IMAGE_BUNDLE}"; then
+
 		cd ${B}
 		fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
 	fi
@@ -483,6 +485,18 @@ do_assemble_fitimage_initramfs() {
 
 addtask assemble_fitimage_initramfs before do_deploy after do_install
 
+do_assemble_fitimage_bundled_initramfs() {
+	if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
+		test -n "${INITRAMFS_IMAGE}" && \
+		test -n "${INITRAMFS_IMAGE_BUNDLE}"; then
+
+		cd ${B}
+		fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE}
+	fi
+}
+
+addtask assemble_fitimage_bundled_initramfs before do_deploy after do_bundle_initramfs
+
 
 kernel_do_deploy[vardepsexclude] = "DATETIME"
 kernel_do_deploy_append() {
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/2 kernel-fitimage.bbclass: Create a "fitImage" symlink to resulting FIT image.

From: Walter Goossens <[email protected]>

If an initramfs was used, the fitImage link will point to the FIT containing the initramfs. Otherwise it will link to the FIT without initramfs.

This ensures the user can depend on "fitImage" to point to the desired FIT image.

---
 meta/classes/kernel-fitimage.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes/kernel-fitimage.bbclass +5 -0
index 8bda644..17addab 100644
@@ -519,5 +519,10 @@ kernel_do_deploy_append() {
 			install -m 0644 ${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} ${DEPLOYDIR}/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin
 			ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin ${DEPLOYDIR}/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}
 		fi
+		if [ -n "${INITRAMFS_IMAGE}" ]; then
+			ln -sf fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its fitImage
+		else
+			ln -sf fitImage-linux.bin-${KERNEL_FIT_NAME}.bin fitImage
+		fi
 	fi
 }
Signature · 1 line
2.7.4