Skip to contentSkip to conversation

meta: introduce UBOOT_MKIMAGE_KERNEL_TYPE

PATCH Superseded [email protected] 2 participants 4 messages Jul 6, 2022 – Jul 7, 2022

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meta: introduce UBOOT_MKIMAGE_KERNEL_TYPE

From: Ming Liu <[email protected]>

Sometimes an end user might want to choose another kernel type argument for uboot-mkimage other than "kernel", for instance: "kernel_noload".

Let's introduce a variable UBOOT_MKIMAGE_KERNEL_TYPE to support that, and it could be used by BSP layers as well.

---
 meta/classes/kernel-fitimage.bbclass     | 2 +-
 meta/classes/kernel-uboot.bbclass        | 3 +++
 meta/classes/kernel-uimage.bbclass       | 2 +-
 meta/lib/oeqa/selftest/cases/fitimage.py | 3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)
meta/classes/kernel-fitimage.bbclass +1 -1
index 7e09b075ff..2112ae4cfa 100644
@@ -148,7 +148,7 @@ fitimage_emit_section_kernel() {
                 kernel-$2 {
                         description = "Linux kernel";
                         data = /incbin/("$3");
-                        type = "kernel";
+                        type = "${UBOOT_MKIMAGE_KERNEL_TYPE}";
                         arch = "${UBOOT_ARCH}";
                         os = "linux";
                         compression = "$4";
meta/classes/kernel-uboot.bbclass +3 -0
index 2facade818..1bc98e042d 100644
@@ -2,6 +2,9 @@
 FIT_KERNEL_COMP_ALG ?= "gzip"
 FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
 
+# Kernel image type passed to mkimage (i.e. kernel kernel_noload...)
+UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
+
 uboot_prep_kimage() {
 	if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then
 		vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
meta/classes/kernel-uimage.bbclass +1 -1
index cedb4fa070..e116bf0265 100644
@@ -30,6 +30,6 @@ do_uboot_mkimage() {
 			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
 	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
+	uboot-mkimage -A ${UBOOT_ARCH} -O ${UBOOT_MKIMAGE_KERNEL_TYPE} -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
 }
meta/lib/oeqa/selftest/cases/fitimage.py +2 -1
index e6bfd1257e..7e6479c9ca 100644
@@ -763,6 +763,7 @@ FIT_HASH_ALG = "sha256"
 
         kernel_load = str(get_bb_var('UBOOT_LOADADDRESS'))
         kernel_entry = str(get_bb_var('UBOOT_ENTRYPOINT'))
+        kernel_type = str(get_bb_var('UBOOT_MKIMAGE_KERNEL_TYPE'))
         kernel_compression = str(get_bb_var('FIT_KERNEL_COMP_ALG'))
         uboot_arch = str(get_bb_var('UBOOT_ARCH'))
         fit_hash_alg = str(get_bb_var('FIT_HASH_ALG'))
@@ -775,7 +776,7 @@ FIT_HASH_ALG = "sha256"
             'kernel-1 {',
             'description = "Linux kernel";',
             'data = /incbin/("linux.bin");',
-            'type = "kernel";',
+            'type = "' + kernel_type + '";',
             'arch = "' + uboot_arch + '";',
             'os = "linux";',
             'compression = "' + kernel_compression + '";',
Signature · 1 line
2.25.1
#1 lore raw

Hello,

Quoted 48 lines · Ming Liu

From: Ming Liu <[email protected]>

Sometimes an end user might want to choose another kernel type argument for uboot-mkimage other than "kernel", for instance: "kernel_noload".

Let's introduce a variable UBOOT_MKIMAGE_KERNEL_TYPE to support that, and it could be used by BSP layers as well.

---
 meta/classes/kernel-fitimage.bbclass     | 2 +-
 meta/classes/kernel-uboot.bbclass        | 3 +++
 meta/classes/kernel-uimage.bbclass       | 2 +-
 meta/lib/oeqa/selftest/cases/fitimage.py | 3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)
meta/classes/kernel-fitimage.bbclass +1 -1
index 7e09b075ff..2112ae4cfa 100644
@@ -148,7 +148,7 @@ fitimage_emit_section_kernel() {
                 kernel-$2 {
                         description = "Linux kernel";
                         data = /incbin/("$3");
-                        type = "kernel";
+                        type = "${UBOOT_MKIMAGE_KERNEL_TYPE}";
                         arch = "${UBOOT_ARCH}";
                         os = "linux";
                         compression = "$4";
meta/classes/kernel-uboot.bbclass +3 -0
index 2facade818..1bc98e042d 100644
@@ -2,6 +2,9 @@
 FIT_KERNEL_COMP_ALG ?= "gzip"
 FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
 
+# Kernel image type passed to mkimage (i.e. kernel kernel_noload...)
+UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
+
 uboot_prep_kimage() {
 	if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then
 		vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
meta/classes/kernel-uimage.bbclass +0 -0
index cedb4fa070..e116bf0265 100644

meta/classes/kernel-uimage.bbclass do_uboot_mkimage() { · line 33

Quoted 5 lines
meta/classes/kernel-uimage.bbclass +1 -1
@@ -30,6 +30,6 @@ do_uboot_mkimage() {
 			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
 	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
+	uboot-mkimage -A ${UBOOT_ARCH} -O ${UBOOT_MKIMAGE_KERNEL_TYPE} -T kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage

I feel like you replace the wrong argument here.

Quoted 36 lines
meta/classes/kernel-uimage.bbclass +0 -0
 	rm -f linux.bin
 }
meta/lib/oeqa/selftest/cases/fitimage.py +2 -1
index e6bfd1257e..7e6479c9ca 100644
@@ -763,6 +763,7 @@ FIT_HASH_ALG = "sha256"
 
         kernel_load = str(get_bb_var('UBOOT_LOADADDRESS'))
         kernel_entry = str(get_bb_var('UBOOT_ENTRYPOINT'))
+        kernel_type = str(get_bb_var('UBOOT_MKIMAGE_KERNEL_TYPE'))
         kernel_compression = str(get_bb_var('FIT_KERNEL_COMP_ALG'))
         uboot_arch = str(get_bb_var('UBOOT_ARCH'))
         fit_hash_alg = str(get_bb_var('FIT_HASH_ALG'))
@@ -775,7 +776,7 @@ FIT_HASH_ALG = "sha256"
             'kernel-1 {',
             'description = "Linux kernel";',
             'data = /incbin/("linux.bin");',
-            'type = "kernel";',
+            'type = "' + kernel_type + '";',
             'arch = "' + uboot_arch + '";',
             'os = "linux";',
             'compression = "' + kernel_compression + '";',
Signature · 11 lines
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#167719): https://lists.openembedded.org/g/openembedded-core/message/167719
Mute This Topic: https://lists.openembedded.org/mt/92204115/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#2 lore raw

Hi, Alexandre:

Thanks for the review, I did not quite follow you, you meant the 'type' argument being replaced wrongly? I dont see how. Could you share some details about your comment?

//Ming Liu

Alexandre Belloni <[email protected]> 於 2022年7月6日 週三 下午4:06寫道:

Quoted 113 lines

Hello,

Quoted 9 lines · Ming Liu

From: Ming Liu <[email protected]>

Sometimes an end user might want to choose another kernel type argument for uboot-mkimage other than "kernel", for instance: "kernel_noload".

Let's introduce a variable UBOOT_MKIMAGE_KERNEL_TYPE to support that, and it could be used by BSP layers as well.

Review

Quoted 8 lines
---
 meta/classes/kernel-fitimage.bbclass     | 2 +-
 meta/classes/kernel-uboot.bbclass        | 3 +++
 meta/classes/kernel-uimage.bbclass       | 2 +-
 meta/lib/oeqa/selftest/cases/fitimage.py | 3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/meta/classes/kernel-fitimage.bbclass

Review

Quoted 13 lines

index 7e09b075ff..2112ae4cfa 100644

meta/classes/kernel-fitimage.bbclass +1 -1
@@ -148,7 +148,7 @@ fitimage_emit_section_kernel() {
                 kernel-$2 {
                         description = "Linux kernel";
                         data = /incbin/("$3");
-                        type = "kernel";
+                        type = "${UBOOT_MKIMAGE_KERNEL_TYPE}";
                         arch = "${UBOOT_ARCH}";
                         os = "linux";
                         compression = "$4";
(quoted diff) +0 -0

b/meta/classes/kernel-uboot.bbclass

Review

Quoted 14 lines

index 2facade818..1bc98e042d 100644

meta/classes/kernel-uboot.bbclass +3 -0
@@ -2,6 +2,9 @@
 FIT_KERNEL_COMP_ALG ?= "gzip"
 FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
 
+# Kernel image type passed to mkimage (i.e. kernel kernel_noload...)
+UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
+
 uboot_prep_kimage() {
      if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then
              vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
(quoted diff) +0 -0

b/meta/classes/kernel-uimage.bbclass

meta/classes/kernel-uimage.bbclass do_uboot_mkimage() { · line 30

Quoted 5 lines

index cedb4fa070..e116bf0265 100644

meta/classes/kernel-uimage.bbclass +0 -0
@@ -30,6 +30,6 @@ do_uboot_mkimage() {
                      awk '$3=="${UBOOT_ENTRYSYMBOL}" {print

"0x"$1;exit}'`

meta/classes/kernel-uimage.bbclass do_uboot_mkimage() { · line 33

Quoted 3 lines
meta/classes/kernel-uimage.bbclass +0 -1
      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

meta/classes/kernel-uimage.bbclass do_uboot_mkimage() { · line 33

Quoted 1 line
meta/classes/kernel-uimage.bbclass +1 -0
+     uboot-mkimage -A ${UBOOT_ARCH} -O ${UBOOT_MKIMAGE_KERNEL_TYPE} -T

kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage

I feel like you replace the wrong argument here.

Review

Quoted 3 lines
meta/classes/kernel-uimage.bbclass +0 -0
      rm -f linux.bin
 }
(quoted diff) +0 -0

b/meta/lib/oeqa/selftest/cases/fitimage.py

Quoted 25 lines

index e6bfd1257e..7e6479c9ca 100644

meta/lib/oeqa/selftest/cases/fitimage.py +2 -2
@@ -763,6 +763,7 @@ FIT_HASH_ALG = "sha256"
 
         kernel_load = str(get_bb_var('UBOOT_LOADADDRESS'))
         kernel_entry = str(get_bb_var('UBOOT_ENTRYPOINT'))
+        kernel_type = str(get_bb_var('UBOOT_MKIMAGE_KERNEL_TYPE'))
         kernel_compression = str(get_bb_var('FIT_KERNEL_COMP_ALG'))
         uboot_arch = str(get_bb_var('UBOOT_ARCH'))
         fit_hash_alg = str(get_bb_var('FIT_HASH_ALG'))
@@ -775,7 +776,7 @@ FIT_HASH_ALG = "sha256"
             'kernel-1 {',
             'description = "Linux kernel";',
             'data = /incbin/("linux.bin");',
-            'type = "kernel";',
+            'type = "' + kernel_type + '";',
             'arch = "' + uboot_arch + '";',
             'os = "linux";',
             'compression = "' + kernel_compression + '";',
--

2.25.1

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#167719):

https://lists.openembedded.org/g/openembedded-core/message/167719

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/92204115/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#3 lore raw
Quoted 6 lines · Ming Liu

Hi, Alexandre:

Thanks for the review, I did not quite follow you, you meant the 'type' argument being replaced wrongly? I dont see how. Could you share some details about your comment?

See below...

Quoted 70 lines

//Ming Liu

Alexandre Belloni <[email protected]> 於 2022年7月6日 週三 下午4:06寫道:

Quoted 66 lines

Hello,

Quoted 9 lines · Ming Liu

From: Ming Liu <[email protected]>

Sometimes an end user might want to choose another kernel type argument for uboot-mkimage other than "kernel", for instance: "kernel_noload".

Let's introduce a variable UBOOT_MKIMAGE_KERNEL_TYPE to support that, and it could be used by BSP layers as well.

Review

Quoted 8 lines
---
 meta/classes/kernel-fitimage.bbclass     | 2 +-
 meta/classes/kernel-uboot.bbclass        | 3 +++
 meta/classes/kernel-uimage.bbclass       | 2 +-
 meta/lib/oeqa/selftest/cases/fitimage.py | 3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/meta/classes/kernel-fitimage.bbclass

Review

Quoted 13 lines

index 7e09b075ff..2112ae4cfa 100644

meta/classes/kernel-fitimage.bbclass +1 -1
@@ -148,7 +148,7 @@ fitimage_emit_section_kernel() {
                 kernel-$2 {
                         description = "Linux kernel";
                         data = /incbin/("$3");
-                        type = "kernel";
+                        type = "${UBOOT_MKIMAGE_KERNEL_TYPE}";
                         arch = "${UBOOT_ARCH}";
                         os = "linux";
                         compression = "$4";
(quoted diff) +0 -0

b/meta/classes/kernel-uboot.bbclass

Review

Quoted 14 lines

index 2facade818..1bc98e042d 100644

meta/classes/kernel-uboot.bbclass +3 -0
@@ -2,6 +2,9 @@
 FIT_KERNEL_COMP_ALG ?= "gzip"
 FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
 
+# Kernel image type passed to mkimage (i.e. kernel kernel_noload...)
+UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
+
 uboot_prep_kimage() {
      if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then
              vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
(quoted diff) +0 -0

b/meta/classes/kernel-uimage.bbclass

meta/classes/kernel-uimage.bbclass do_uboot_mkimage() { · line 30

Quoted 5 lines

index cedb4fa070..e116bf0265 100644

meta/classes/kernel-uimage.bbclass +0 -0
@@ -30,6 +30,6 @@ do_uboot_mkimage() {
                      awk '$3=="${UBOOT_ENTRYSYMBOL}" {print

"0x"$1;exit}'`

meta/classes/kernel-uimage.bbclass do_uboot_mkimage() { · line 33

Quoted 3 lines
meta/classes/kernel-uimage.bbclass +0 -1
      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

meta/classes/kernel-uimage.bbclass do_uboot_mkimage() { · line 33

Quoted 1 line
meta/classes/kernel-uimage.bbclass +1 -0
+     uboot-mkimage -A ${UBOOT_ARCH} -O ${UBOOT_MKIMAGE_KERNEL_TYPE} -T

kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin ${B}/arch/${ARCH}/boot/uImage

I feel like you replace the wrong argument here.

You replace 6O linux by -O ${UBOOT_MKIMAGE_KERNEL_TYPE} while your commit message suggests you want to replace -T kernel.

Quoted 39 lines
Quoted 39 lines

Review

Quoted 4 lines
meta/classes/kernel-uimage.bbclass +0 -0
      rm -f linux.bin
 }
(quoted diff) +0 -0

b/meta/lib/oeqa/selftest/cases/fitimage.py

Quoted 21 lines

index e6bfd1257e..7e6479c9ca 100644

meta/lib/oeqa/selftest/cases/fitimage.py +2 -2
@@ -763,6 +763,7 @@ FIT_HASH_ALG = "sha256"
 
         kernel_load = str(get_bb_var('UBOOT_LOADADDRESS'))
         kernel_entry = str(get_bb_var('UBOOT_ENTRYPOINT'))
+        kernel_type = str(get_bb_var('UBOOT_MKIMAGE_KERNEL_TYPE'))
         kernel_compression = str(get_bb_var('FIT_KERNEL_COMP_ALG'))
         uboot_arch = str(get_bb_var('UBOOT_ARCH'))
         fit_hash_alg = str(get_bb_var('FIT_HASH_ALG'))
@@ -775,7 +776,7 @@ FIT_HASH_ALG = "sha256"
             'kernel-1 {',
             'description = "Linux kernel";',
             'data = /incbin/("linux.bin");',
-            'type = "kernel";',
+            'type = "' + kernel_type + '";',
             'arch = "' + uboot_arch + '";',
             'os = "linux";',
             'compression = "' + kernel_compression + '";',
--
Quoted 6 lines

2.25.1

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com