All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] support initramfs/devicetree bundle for uImage
@ 2018-05-15  6:11 liu.ming50
  2018-05-15  6:11 ` [PATCH 1/4] kernel-uimage.bbclass: use boolean to check KEEPUIMAGE liu.ming50
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: liu.ming50 @ 2018-05-15  6:11 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

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

Ming Liu (4):
  kernel-uimage.bbclass: use boolean to check KEEPUIMAGE
  kernel.bbclass: make bundle_initramfs to be more flexible
  kernel-uimage.bbclass: support initramfs bundle
  kernel-uimage.bbclass: support devicetree bundle

 meta/classes/kernel-devicetree-common.bbclass | 21 ++++++++
 meta/classes/kernel-devicetree.bbclass        | 29 +++-------
 meta/classes/kernel-uimage.bbclass            | 78 +++++++++++++++++++++++----
 meta/classes/kernel.bbclass                   | 74 ++++++++++++++-----------
 4 files changed, 138 insertions(+), 64 deletions(-)
 create mode 100644 meta/classes/kernel-devicetree-common.bbclass

-- 
2.7.4



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

* [PATCH 1/4] kernel-uimage.bbclass: use boolean to check KEEPUIMAGE
  2018-05-15  6:11 [PATCH 0/4] support initramfs/devicetree bundle for uImage liu.ming50
@ 2018-05-15  6:11 ` liu.ming50
  2018-05-15  6:11 ` [PATCH 2/4] kernel.bbclass: make bundle_initramfs to be more flexible liu.ming50
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: liu.ming50 @ 2018-05-15  6:11 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

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

It now accepts yes/on/true/1 as positive values.

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

diff --git a/meta/classes/kernel-uimage.bbclass b/meta/classes/kernel-uimage.bbclass
index 1d8656e..d3d9d77 100644
--- a/meta/classes/kernel-uimage.bbclass
+++ b/meta/classes/kernel-uimage.bbclass
@@ -9,9 +9,9 @@ python __anonymous () {
         # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
         # to kernel.bbclass . We override the variable here, since we need
         # to build uImage using the kernel build system if and only if
-        # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
-        # the uImage .
-        if d.getVar("KEEPUIMAGE") != 'yes':
+        # KEEPUIMAGE == yes|1|true|on. Otherwise, we pack compressed vmlinux
+        # into the uImage .
+        if not oe.types.boolean(d.getVar("KEEPUIMAGE")):
             typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
             if "uImage" in typeformake.split():
                 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux'))
-- 
2.7.4



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

* [PATCH 2/4] kernel.bbclass: make bundle_initramfs to be more flexible
  2018-05-15  6:11 [PATCH 0/4] support initramfs/devicetree bundle for uImage liu.ming50
  2018-05-15  6:11 ` [PATCH 1/4] kernel-uimage.bbclass: use boolean to check KEEPUIMAGE liu.ming50
@ 2018-05-15  6:11 ` liu.ming50
  2018-05-15  6:11 ` [PATCH 3/4] kernel-uimage.bbclass: support initramfs bundle liu.ming50
  2018-05-15  6:11 ` [PATCH 4/4] kernel-uimage.bbclass: support devicetree bundle liu.ming50
  3 siblings, 0 replies; 5+ messages in thread
From: liu.ming50 @ 2018-05-15  6:11 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

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

Introduce three new variables:
- INITRAMFS_IMAGE_BUNDLE_PREPROCESS_COMMANDS: the command list to be
  executed before re-compiling kernel with initramfs.
- INITRAMFS_IMAGE_BUNDLE_POSTPROCESS_COMMANDS: the command list to be
  executed after re-compiling kernel with initramfs.
- KERNEL_IMAGETYPE_BACKUP_UIMAGE: the backup uimage that need to be
stored before re-compiling kernel with initramfs.

The main purpose for introducing the above variables is to make
bundle_initramfs to be able to be extended by other bbclasses, there is
no functional changes.

For instance, while KEEPUIMAGE is set to 'no', currently there is no
way to bundle initramfs to kernel for uImage. With this change, we can
achieve that by setting INITRAMFS_IMAGE_BUNDLE_POSTPROCESS_COMMANDS and
KERNEL_IMAGETYPE_BACKUP_UIMAGE in kernel-uimage.bbclass.

Signen-nff-by: Ming Liu <liu.ming50@gmail.com>
---
 meta/classes/kernel.bbclass | 74 +++++++++++++++++++++++++++------------------
 1 file changed, 44 insertions(+), 30 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 6595a04..6a2f033 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -184,8 +184,14 @@ KERNEL_EXTRA_ARGS ?= ""
 EXTRA_OEMAKE = " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}""
 KERNEL_ALT_IMAGETYPE ??= ""
 
+INITRAMFS_BASE_NAME ?= "initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}"
+INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME"
+
+INITRAMFS_IMAGE_BUNDLE_PREPROCESS_COMMANDS ?= "copy_initramfs; backup_kernel_images;"
+INITRAMFS_IMAGE_BUNDLE_POSTPROCESS_COMMANDS ?= "restore_kernel_images;"
+
 copy_initramfs() {
-	echo "Copying initramfs into ./usr ..."
+	echo "Creating a kernel image with a bundled initramfs by copying initramfs into ./usr ..."
 	# In case the directory is not created yet from the first pass compile:
 	mkdir -p ${B}/usr
 	# Find and use the first initramfs image archive type we find
@@ -225,42 +231,50 @@ copy_initramfs() {
 	echo "Finished copy of initramfs into ./usr"
 }
 
+backup_kernel_images() {
+	# Backing up kernel image relies on its type(regular file or symbolic link)
+	tmp_path=""
+	for type in ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_IMAGETYPE_BACKUP_UIMAGE}; do
+		if [ -h ${KERNEL_OUTPUT_DIR}/$type ] ; then
+			linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$type`
+			realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$type`
+			mv -f $realpath $realpath.bak
+			tmp_path=$tmp_path" "$type"#"$linkpath"#"$realpath
+		elif [ -f ${KERNEL_OUTPUT_DIR}/$type ]; then
+			mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.bak
+			tmp_path=$tmp_path" "$type"##"
+		fi
+	done
+}
+
+restore_kernel_images() {
+	# Restoring kernel image
+	for tp in $tmp_path ; do
+		type=`echo $tp|cut -d "#" -f 1`
+		linkpath=`echo $tp|cut -d "#" -f 2`
+		realpath=`echo $tp|cut -d "#" -f 3`
+		if [ -n "$realpath" ]; then
+			mv -f $realpath $realpath.initramfs
+			mv -f $realpath.bak $realpath
+			ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs
+		else
+			mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.initramfs
+			mv -f ${KERNEL_OUTPUT_DIR}/$type.bak ${KERNEL_OUTPUT_DIR}/$type
+		fi
+	done
+}
+
 INITRAMFS_BASE_NAME ?= "initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}"
 INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME"
 do_bundle_initramfs () {
+	${INITRAMFS_IMAGE_BUNDLE_PREPROCESS_COMMANDS}
+
 	if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
-		echo "Creating a kernel image with a bundled initramfs..."
-		copy_initramfs
-		# Backing up kernel image relies on its type(regular file or symbolic link)
-		tmp_path=""
-		for type in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
-			if [ -h ${KERNEL_OUTPUT_DIR}/$type ] ; then
-				linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$type`
-				realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$type`
-				mv -f $realpath $realpath.bak
-				tmp_path=$tmp_path" "$type"#"$linkpath"#"$realpath
-			elif [ -f ${KERNEL_OUTPUT_DIR}/$type ]; then
-				mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.bak
-				tmp_path=$tmp_path" "$type"##"
-			fi
-		done
 		use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
 		kernel_do_compile
-		# Restoring kernel image
-		for tp in $tmp_path ; do
-			type=`echo $tp|cut -d "#" -f 1`
-			linkpath=`echo $tp|cut -d "#" -f 2`
-			realpath=`echo $tp|cut -d "#" -f 3`
-			if [ -n "$realpath" ]; then
-				mv -f $realpath $realpath.initramfs
-				mv -f $realpath.bak $realpath
-				ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs
-			else
-				mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.initramfs
-				mv -f ${KERNEL_OUTPUT_DIR}/$type.bak ${KERNEL_OUTPUT_DIR}/$type
-			fi
-		done
 	fi
+
+	${INITRAMFS_IMAGE_BUNDLE_POSTPROCESS_COMMANDS}
 }
 do_bundle_initramfs[dirs] = "${B}"
 
-- 
2.7.4



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

* [PATCH 3/4] kernel-uimage.bbclass: support initramfs bundle
  2018-05-15  6:11 [PATCH 0/4] support initramfs/devicetree bundle for uImage liu.ming50
  2018-05-15  6:11 ` [PATCH 1/4] kernel-uimage.bbclass: use boolean to check KEEPUIMAGE liu.ming50
  2018-05-15  6:11 ` [PATCH 2/4] kernel.bbclass: make bundle_initramfs to be more flexible liu.ming50
@ 2018-05-15  6:11 ` liu.ming50
  2018-05-15  6:11 ` [PATCH 4/4] kernel-uimage.bbclass: support devicetree bundle liu.ming50
  3 siblings, 0 replies; 5+ messages in thread
From: liu.ming50 @ 2018-05-15  6:11 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

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

Add do_uboot_mkimage to INITRAMFS_IMAGE_BUNDLE_POSTPROCESS_COMMANDS,
and add uImage to KERNEL_IMAGETYPE_BACKUP_UIMAGE to support initramfs
bundle when KEEPUIMAGE is set negative.

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

diff --git a/meta/classes/kernel-uimage.bbclass b/meta/classes/kernel-uimage.bbclass
index d3d9d77..4bd6c7b 100644
--- a/meta/classes/kernel-uimage.bbclass
+++ b/meta/classes/kernel-uimage.bbclass
@@ -18,6 +18,10 @@ python __anonymous () {
 
             # Enable building of uImage with mkimage
             bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d)
+
+            # Handle uImage initramfs bundle
+            d.prependVar('INITRAMFS_IMAGE_BUNDLE_POSTPROCESS_COMMANDS', 'do_uboot_mkimage; ')
+            d.setVar('KERNEL_IMAGETYPE_BACKUP_UIMAGE', 'uImage')
 }
 
 do_uboot_mkimage[dirs] += "${B}"
-- 
2.7.4



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

* [PATCH 4/4] kernel-uimage.bbclass: support devicetree bundle
  2018-05-15  6:11 [PATCH 0/4] support initramfs/devicetree bundle for uImage liu.ming50
                   ` (2 preceding siblings ...)
  2018-05-15  6:11 ` [PATCH 3/4] kernel-uimage.bbclass: support initramfs bundle liu.ming50
@ 2018-05-15  6:11 ` liu.ming50
  3 siblings, 0 replies; 5+ messages in thread
From: liu.ming50 @ 2018-05-15  6:11 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ming Liu

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

This patch mainly aims to support devicetree bundle for uImage, when
KEEPUIMAGE is set negative, by appending some code to kernel_do_install
and kernel_do_deploy to check KERNEL_DEVICETREE_BUNDLE and call
uboot-mkimage to regenerate the devicetree bundled image if it's set.

Some common code is moved to kernel-devicetree-common.bbclass as well
since they are being referred now in both kernel-devicetree.bbclass and
kernel-uimage.bbclass.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 meta/classes/kernel-devicetree-common.bbclass | 21 +++++++++
 meta/classes/kernel-devicetree.bbclass        | 29 +++---------
 meta/classes/kernel-uimage.bbclass            | 68 +++++++++++++++++++++++----
 3 files changed, 87 insertions(+), 31 deletions(-)
 create mode 100644 meta/classes/kernel-devicetree-common.bbclass

diff --git a/meta/classes/kernel-devicetree-common.bbclass b/meta/classes/kernel-devicetree-common.bbclass
new file mode 100644
index 0000000..2216533
--- /dev/null
+++ b/meta/classes/kernel-devicetree-common.bbclass
@@ -0,0 +1,21 @@
+
+# Generate kernel+devicetree bundle
+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=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
+	fi
+	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}"
+	fi
+	echo "${DTB_PATH}"
+}
diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass
index 4f80cc6..00c6210 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -1,31 +1,14 @@
 # Support for device tree generation
+inherit kernel-devicetree-common
+
 PACKAGES_append = " \
     ${KERNEL_PACKAGE_NAME}-devicetree \
     ${@[d.getVar('KERNEL_PACKAGE_NAME') + '-image-zimage-bundle', ''][d.getVar('KERNEL_DEVICETREE_BUNDLE') != '1']} \
+    ${@[d.getVar('KERNEL_PACKAGE_NAME') + '-image-uimage-bundle', ''][d.getVar('KERNEL_DEVICETREE_BUNDLE') != '1']} \
 "
 FILES_${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
 FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
-
-# Generate kernel+devicetree bundle
-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=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
-	fi
-	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}"
-	fi
-	echo "${DTB_PATH}"
-}
+FILES_${KERNEL_PACKAGE_NAME}-image-uimage-bundle = "/${KERNEL_IMAGEDEST}/uImage-*.dtb.bin"
 
 do_configure_append() {
 	if [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
@@ -69,7 +52,7 @@ do_install_append() {
 			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 \
+				cat ${KERNEL_OUTPUT_DIR}/$type \
 					${D}/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.${DTB_EXT} \
 					> ${D}/${KERNEL_IMAGEDEST}/$type-${DTB_BASE_NAME}.${DTB_EXT}.bin
 			fi
@@ -94,7 +77,7 @@ do_deploy_append() {
 			ln -sf ${DTB_NAME}.${DTB_EXT} ${DEPLOYDIR}/${DTB_BASE_NAME}.${DTB_EXT}
 
 			if [ "$type" = "zImage" ] && [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then
-				cat ${DEPLOYDIR}/$type \
+				cat ${KERNEL_OUTPUT_DIR}/$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
diff --git a/meta/classes/kernel-uimage.bbclass b/meta/classes/kernel-uimage.bbclass
index 4bd6c7b..103c779 100644
--- a/meta/classes/kernel-uimage.bbclass
+++ b/meta/classes/kernel-uimage.bbclass
@@ -1,4 +1,4 @@
-inherit kernel-uboot
+inherit kernel-uboot kernel-devicetree-common
 
 python __anonymous () {
     if "uImage" in (d.getVar('KERNEL_IMAGETYPES') or "").split():
@@ -14,7 +14,8 @@ python __anonymous () {
         if not oe.types.boolean(d.getVar("KEEPUIMAGE")):
             typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
             if "uImage" in typeformake.split():
-                d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', 'vmlinux'))
+                replace_image = 'zImage' if oe.types.boolean(d.getVar('KERNEL_DEVICETREE_BUNDLE')) else 'vmlinux'
+                d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('uImage', replace_image))
 
             # Enable building of uImage with mkimage
             bb.build.addtask('do_uboot_mkimage', 'do_install', 'do_kernel_link_images', d)
@@ -24,16 +25,67 @@ python __anonymous () {
             d.setVar('KERNEL_IMAGETYPE_BACKUP_UIMAGE', 'uImage')
 }
 
+normalize_entrypoint() {
+	local entrypoint=${UBOOT_ENTRYPOINT}
+	if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
+		entrypoint=`${HOST_PREFIX}nm ${B}/vmlinux | \
+			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
+	fi
+	echo $entrypoint
+}
+
 do_uboot_mkimage[dirs] += "${B}"
 do_uboot_mkimage() {
 	uboot_prep_kimage
 
-	ENTRYPOINT=${UBOOT_ENTRYPOINT}
-	if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
-		ENTRYPOINT=`${HOST_PREFIX}nm ${B}/vmlinux | \
-			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
+	uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} \
+		-e `normalize_entrypoint` -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage
+	rm -f linux.bin
+}
+
+kernel_do_install_append() {
+	if [ "${KERNEL_IMAGETYPE_BACKUP_UIMAGE}" != "uImage" ] || [ "${KERNEL_DEVICETREE_BUNDLE}" != "1" ]; then
+		return
 	fi
 
-	uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage
-	rm -f linux.bin
+	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}"`
+		cat ${B}/${KERNEL_OUTPUT_DIR}/zImage ${DTB_PATH} \
+			> linux-${DTB_BASE_NAME}.${DTB_EXT}.bin
+		uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} \
+			-e `normalize_entrypoint` -n "${DISTRO_NAME}/${PV}/${MACHINE}" \
+			-d  linux-${DTB_BASE_NAME}.${DTB_EXT}.bin \
+			${D}/${KERNEL_IMAGEDEST}/uImage-${DTB_BASE_NAME}.${DTB_EXT}.bin
+		rm -f linux-${DTB_BASE_NAME}.${DTB_EXT}.bin
+	done
+}
+
+kernel_do_deploy_append() {
+	if [ "${KERNEL_IMAGETYPE_BACKUP_UIMAGE}" != "uImage" ] || [ "${KERNEL_DEVICETREE_BUNDLE}" != "1" ]; then
+		return
+	fi
+
+	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 0755 ${D}/${KERNEL_IMAGEDEST}/uImage-${DTB_BASE_NAME}.${DTB_EXT}.bin \
+			${DEPLOYDIR}/uImage-${DTB_NAME}.${DTB_EXT}.bin
+		ln -sf uImage-${DTB_NAME}.${DTB_EXT}.bin ${DEPLOYDIR}/uImage-${DTB_BASE_NAME}.${DTB_EXT}.bin
+		if [ -e "${B}/${KERNEL_OUTPUT_DIR}/zImage.initramfs" ]; then
+			cat ${B}/${KERNEL_OUTPUT_DIR}/zImage.initramfs ${DTB_PATH} \
+				> linux-initramfs-${DTB_BASE_NAME}.${DTB_EXT}.bin
+			uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} \
+				-e `normalize_entrypoint` -n "${DISTRO_NAME}/${PV}/${MACHINE}" \
+				-d linux-initramfs-${DTB_BASE_NAME}.${DTB_EXT}.bin \
+				${DEPLOYDIR}/uImage-${INITRAMFS_BASE_NAME}-${DTB_BASE_NAME}.${DTB_EXT}.bin
+			ln -sf uImage-${INITRAMFS_BASE_NAME}-${DTB_BASE_NAME}.${DTB_EXT}.bin \
+				${DEPLOYDIR}/uImage-initramfs-${DTB_BASE_NAME}.${DTB_EXT}-${MACHINE}.bin
+			rm -f linux-initramfs-${DTB_BASE_NAME}.${DTB_EXT}.bin
+		fi
+	done
 }
-- 
2.7.4



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

end of thread, other threads:[~2018-05-15  6:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15  6:11 [PATCH 0/4] support initramfs/devicetree bundle for uImage liu.ming50
2018-05-15  6:11 ` [PATCH 1/4] kernel-uimage.bbclass: use boolean to check KEEPUIMAGE liu.ming50
2018-05-15  6:11 ` [PATCH 2/4] kernel.bbclass: make bundle_initramfs to be more flexible liu.ming50
2018-05-15  6:11 ` [PATCH 3/4] kernel-uimage.bbclass: support initramfs bundle liu.ming50
2018-05-15  6:11 ` [PATCH 4/4] kernel-uimage.bbclass: support devicetree bundle liu.ming50

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.