Skip to contentSkip to conversation

Allow KERNEL_IMAGETYPE override v2

PATCH In review [email protected] 2 participants 6 messages Sep 26, 2023 Arm Rockchip

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow KERNEL_IMAGETYPE override v2

From: Anthony Davies <[email protected]>

Apologies, this is the correct patch

Updated inc files to allow overriding KERNEL_IMAGETYPE in local.conf

Fixed bug where dtb couldnt be found when generating KERNEL_IMAGETYPE other then fitImage image due to KERNEL_DEVICETREE containing the dtb directory which is not available in the DEPLOY_DIR_IMAGE directory

---
 conf/machine/include/px30.inc         | 2 +-
 conf/machine/include/rk3066.inc       | 2 +-
 conf/machine/include/rk3188.inc       | 2 +-
 conf/machine/include/rk3288.inc       | 2 +-
 conf/machine/include/rk3328.inc       | 2 +-
 conf/machine/include/rk3399.inc       | 2 +-
 conf/machine/include/rockchip-wic.inc | 5 ++++-
 7 files changed, 10 insertions(+), 7 deletions(-)
conf/machine/include/px30.inc +1 -1
index a3727fb..badcbcd 100644
@@ -12,7 +12,7 @@ require conf/machine/include/rockchip-wic.inc
 
 KBUILD_DEFCONFIG ?= "defconfig"
 KERNEL_CLASSES = "kernel-fitimage"
-KERNEL_IMAGETYPE = "fitImage"
+KERNEL_IMAGETYPE ?= "fitImage"
 
 TFA_PLATFORM = "px30"
 TFA_BUILD_TARGET = "bl31"
conf/machine/include/rk3066.inc +1 -1
index fa97906..3510df2 100644
@@ -11,4 +11,4 @@ SERIAL_CONSOLES = "115200;ttyS2"
 
 KBUILD_DEFCONFIG = "multi_v7_defconfig"
 KERNEL_FEATURES:append:rk3066 = " bsp/rockchip/remove-non-rockchip-arch-arm.scc"
-KERNEL_IMAGETYPE = "zImage"
+KERNEL_IMAGETYPE ?= "zImage"
conf/machine/include/rk3188.inc +1 -1
index bc96a0c..830f908 100644
@@ -11,4 +11,4 @@ SERIAL_CONSOLES = "115200;ttyFIQ0"
 
 KBUILD_DEFCONFIG = "multi_v7_defconfig"
 KERNEL_FEATURES:append:rk3188 = " bsp/rockchip/remove-non-rockchip-arch-arm.scc"
-KERNEL_IMAGETYPE = "zImage"
+KERNEL_IMAGETYPE ?= "zImage"
conf/machine/include/rk3288.inc +1 -1
index b4c559d..e682c0b 100644
@@ -11,6 +11,6 @@ SERIAL_CONSOLES = "115200;ttyS2"
 
 KBUILD_DEFCONFIG ?= "multi_v7_defconfig"
 KERNEL_FEATURES:append:rk3288 = " bsp/rockchip/remove-non-rockchip-arch-arm.scc"
-KERNEL_IMAGETYPE = "zImage"
+KERNEL_IMAGETYPE ?= "zImage"
 
 UBOOT_SUFFIX ?= "bin"
conf/machine/include/rk3328.inc +1 -1
index f9f8792..6be777c 100644
@@ -13,7 +13,7 @@ require conf/machine/include/rockchip-wic.inc
 KBUILD_DEFCONFIG ?= "defconfig"
 KERNEL_FEATURES:append:rk3328 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
 KERNEL_CLASSES = "kernel-fitimage"
-KERNEL_IMAGETYPE = "fitImage"
+KERNEL_IMAGETYPE ?= "fitImage"
 
 TFA_PLATFORM = "rk3328"
 TFA_BUILD_TARGET = "bl31"
conf/machine/include/rk3399.inc +1 -1
index 88c87af..5a3f439 100644
@@ -13,7 +13,7 @@ require conf/machine/include/rockchip-wic.inc
 KBUILD_DEFCONFIG ?= "defconfig"
 KERNEL_FEATURES:append:rk3399 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
 KERNEL_CLASSES = "kernel-fitimage"
-KERNEL_IMAGETYPE = "fitImage"
+KERNEL_IMAGETYPE ?= "fitImage"
 
 TFA_PLATFORM = "rk3399"
 TFA_BUILD_TARGET = "bl31"
conf/machine/include/rockchip-wic.inc +4 -1
index 635288c..8ff6066 100644
@@ -11,9 +11,12 @@ WKS_FILE_DEPENDS ?= " \
 	virtual/bootloader \
 	virtual/kernel \
 	"
+ 
+KERNEL_DEVICETREE_BASENAME = "${@os.path.basename('${KERNEL_DEVICETREE}')}"
+
 IMAGE_BOOT_FILES = " \
 	${KERNEL_IMAGETYPE} \
-	${@bb.utils.contains('KERNEL_IMAGETYPE', 'fitImage', '', '${KERNEL_DEVICETREE}', d)} \
+	${@bb.utils.contains('KERNEL_IMAGETYPE', 'fitImage', '', '${KERNEL_DEVICETREE_BASENAME}', d)} \
 	"
 
 # use the first-defined <baud>;<device> pair in SERIAL_CONSOLES
Signature · 1 line
2.34.1
#1 lore raw

Hi Anthony,

Thanks for the patch!

Quoted 11 lines · Anthony Davies via lists.yoctoproject.org

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

From: Anthony Davies <[email protected]>

Apologies, this is the correct patch

Updated inc files to allow overriding KERNEL_IMAGETYPE in local.conf

Fixed bug where dtb couldnt be found when generating KERNEL_IMAGETYPE other then fitImage image due to KERNEL_DEVICETREE containing the dtb directory which is not available in the DEPLOY_DIR_IMAGE directory

Here we are missing your Signed-off-by.

I would highly suggest to split this into two separate commits, one for allowing to override the KERNEL_IMAGETYPE through local.conf and another one for the device tree thing.

On another topic, I really feel like this is more of an issue with the class handling KERNEL_DEVICETREE when we're not using a fitImage don't you think? Otherwise all layers will have to fix this one up and I don't think that's the right way to go.

Cheers,
Quentin

#2 lore raw

Hi Quentin

Happy to contribute but not all that familiar with emailing patches, sorry.

I lumped them together because if you modify the KERNEL_IMAGETYPE you trigger the bug.

I agree moving it out of the include file would be the best way to go but if you dont have the directory in the KERNEL_DEVICETREE it will fail to compile, quickly searching other layers are handling it similar to how I have, probably just in a more robust way.

Regards,

Tony

Quoted 31 lines · Quentin Schulz

Hi Anthony,

Thanks for the patch!

Quoted 11 lines · Anthony Davies via lists.yoctoproject.org

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

From: Anthony Davies <[email protected]>

Apologies, this is the correct patch

Updated inc files to allow overriding KERNEL_IMAGETYPE in local.conf

Fixed bug where dtb couldnt be found when generating KERNEL_IMAGETYPE other then fitImage image due to KERNEL_DEVICETREE containing the dtb directory which is not available in the DEPLOY_DIR_IMAGE directory

Here we are missing your Signed-off-by.

I would highly suggest to split this into two separate commits, one for allowing to override the KERNEL_IMAGETYPE through local.conf and another one for the device tree thing.

On another topic, I really feel like this is more of an issue with the class handling KERNEL_DEVICETREE when we're not using a fitImage don't you think? Otherwise all layers will have to fix this one up and I don't think that's the right way to go.

Cheers,
Quentin

#3 lore raw

Hi Anthony,

Quoted 4 lines · Anthony Davies

Hi Quentin

Happy to contribute but not all that familiar with emailing patches, sorry.

The Signed-off-by needs to be present in the commit log already, it is not related to mailing list submission. It is added with git commit --signoff (or git commit -s), c.f. https://docs.yoctoproject.org/contributor-guide/submit-changes.html. You're not the first one to forget it (or not know about it), nor will you be the last one, so no worries :)

Quoted 3 lines

I lumped them together because if you modify the KERNEL_IMAGETYPE you trigger the bug.

But... you're not modifying the KERNEL_IMAGETYPE, you're merely allow it to be changed. So you're technically not introducing a bug. And if we wanted to be pedantic, we could say that this bug can technically already be triggered by changing the KERNEL_IMAGETYPE in the machine configuration file (and not in local.conf).

If you want to make sure one cannot modify the KERNEL_IMAGETYPE and break the build, then you can add the commit handling the devicetree before the one allowing to override the image type.

Quoted 5 lines

I agree moving it out of the include file would be the best way to go but if you dont have the directory in the KERNEL_DEVICETREE it will fail to compile, quickly searching other layers are handling it similar to how I have, probably just in a more robust way.

This means we really need to fix this in openembedded-core! We shouldn't rely on all layers to fix it themselves if we can avoid it.

Regards,
Quentin

#4 lore raw
Quoted 20 lines · Quentin Schulz via lists.yoctoproject.org

Hi Anthony,

Quoted 4 lines · Anthony Davies

Hi Quentin

Happy to contribute but not all that familiar with emailing patches, sorry.

The Signed-off-by needs to be present in the commit log already, it is not related to mailing list submission. It is added with git commit
--signoff (or git commit -s), c.f.
https://docs.yoctoproject.org/contributor-guide/submit-changes.html. You're not the first one to forget it (or not know about it), nor will you be the last one, so no worries :)

Quoted 3 lines

I lumped them together because if you modify the KERNEL_IMAGETYPE you trigger the bug.

But... you're not modifying the KERNEL_IMAGETYPE, you're merely allow it to be changed. So you're technically not introducing a bug. And if we wanted to be pedantic, we could say that this bug can technically already be triggered by changing the KERNEL_IMAGETYPE in the machine configuration file (and not in local.conf).

If you want to make sure one cannot modify the KERNEL_IMAGETYPE and break the build, then you can add the commit handling the devicetree before the one allowing to override the image type.

Quoted 8 lines
Quoted 5 lines

I agree moving it out of the include file would be the best way to go but if you dont have the directory in the KERNEL_DEVICETREE it will fail to compile, quickly searching other layers are handling it similar to how I have, probably just in a more robust way.

This means we really need to fix this in openembedded-core! We shouldn't rely on all layers to fix it themselves if we can avoid it.

Could you please provide the error log, which version of OE-Core/poky you're building so we know a bit where to look :) ?

Cheers,
Quentin

#5 lore raw
In reply to [email protected]

Hi Anthony,

Quoted 97 lines · Anthony Davies via lists.yoctoproject.org

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

From: Anthony Davies <[email protected]>

Apologies, this is the correct patch

Updated inc files to allow overriding KERNEL_IMAGETYPE in local.conf

Fixed bug where dtb couldnt be found when generating KERNEL_IMAGETYPE other then fitImage image due to KERNEL_DEVICETREE containing the dtb directory which is not available in the DEPLOY_DIR_IMAGE directory

---
  conf/machine/include/px30.inc         | 2 +-
  conf/machine/include/rk3066.inc       | 2 +-
  conf/machine/include/rk3188.inc       | 2 +-
  conf/machine/include/rk3288.inc       | 2 +-
  conf/machine/include/rk3328.inc       | 2 +-
  conf/machine/include/rk3399.inc       | 2 +-
  conf/machine/include/rockchip-wic.inc | 5 ++++-
  7 files changed, 10 insertions(+), 7 deletions(-)
conf/machine/include/px30.inc +1 -1
index a3727fb..badcbcd 100644
@@ -12,7 +12,7 @@ require conf/machine/include/rockchip-wic.inc
 
  KBUILD_DEFCONFIG ?= "defconfig"
  KERNEL_CLASSES = "kernel-fitimage"
-KERNEL_IMAGETYPE = "fitImage"
+KERNEL_IMAGETYPE ?= "fitImage"
 
  TFA_PLATFORM = "px30"
  TFA_BUILD_TARGET = "bl31"
conf/machine/include/rk3066.inc +1 -1
index fa97906..3510df2 100644
@@ -11,4 +11,4 @@ SERIAL_CONSOLES = "115200;ttyS2"
 
  KBUILD_DEFCONFIG = "multi_v7_defconfig"
  KERNEL_FEATURES:append:rk3066 = " bsp/rockchip/remove-non-rockchip-arch-arm.scc"
-KERNEL_IMAGETYPE = "zImage"
+KERNEL_IMAGETYPE ?= "zImage"
conf/machine/include/rk3188.inc +1 -1
index bc96a0c..830f908 100644
@@ -11,4 +11,4 @@ SERIAL_CONSOLES = "115200;ttyFIQ0"
 
  KBUILD_DEFCONFIG = "multi_v7_defconfig"
  KERNEL_FEATURES:append:rk3188 = " bsp/rockchip/remove-non-rockchip-arch-arm.scc"
-KERNEL_IMAGETYPE = "zImage"
+KERNEL_IMAGETYPE ?= "zImage"
conf/machine/include/rk3288.inc +1 -1
index b4c559d..e682c0b 100644
@@ -11,6 +11,6 @@ SERIAL_CONSOLES = "115200;ttyS2"
 
  KBUILD_DEFCONFIG ?= "multi_v7_defconfig"
  KERNEL_FEATURES:append:rk3288 = " bsp/rockchip/remove-non-rockchip-arch-arm.scc"
-KERNEL_IMAGETYPE = "zImage"
+KERNEL_IMAGETYPE ?= "zImage"
 
  UBOOT_SUFFIX ?= "bin"
conf/machine/include/rk3328.inc +1 -1
index f9f8792..6be777c 100644
@@ -13,7 +13,7 @@ require conf/machine/include/rockchip-wic.inc
  KBUILD_DEFCONFIG ?= "defconfig"
  KERNEL_FEATURES:append:rk3328 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
  KERNEL_CLASSES = "kernel-fitimage"
-KERNEL_IMAGETYPE = "fitImage"
+KERNEL_IMAGETYPE ?= "fitImage"
 
  TFA_PLATFORM = "rk3328"
  TFA_BUILD_TARGET = "bl31"
conf/machine/include/rk3399.inc +1 -1
index 88c87af..5a3f439 100644
@@ -13,7 +13,7 @@ require conf/machine/include/rockchip-wic.inc
  KBUILD_DEFCONFIG ?= "defconfig"
  KERNEL_FEATURES:append:rk3399 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
  KERNEL_CLASSES = "kernel-fitimage"
-KERNEL_IMAGETYPE = "fitImage"
+KERNEL_IMAGETYPE ?= "fitImage"
 
  TFA_PLATFORM = "rk3399"
  TFA_BUILD_TARGET = "bl31"
conf/machine/include/rockchip-wic.inc +0 -0
index 635288c..8ff6066 100644

conf/machine/include/rockchip-wic.inc WKS_FILE_DEPENDS ?= " \ · line 16

Quoted 6 lines
conf/machine/include/rockchip-wic.inc +3 -0
@@ -11,9 +11,12 @@ WKS_FILE_DEPENDS ?= " \
         virtual/bootloader \
         virtual/kernel \
         "
+
+KERNEL_DEVICETREE_BASENAME = "${@os.path.basename('${KERNEL_DEVICETREE}')}"
+

KERNEL_DEVICETREE is a space-separated list so we need to handle it this way I think?

Something like:
"""
${@os.path.basename(x) for x in (d.getVar("KERNEL_DEVICETREE") or "").split() """

but which is valid Python :) (not tested).

Otherwise, I guess this could be added to oe-core directly no? What do you think?

Cheers,
Quentin

Quoted 20 lines
conf/machine/include/rockchip-wic.inc +1 -2
  IMAGE_BOOT_FILES = " \
         ${KERNEL_IMAGETYPE} \
-       ${@bb.utils.contains('KERNEL_IMAGETYPE', 'fitImage', '', '${KERNEL_DEVICETREE}', d)} \
+       ${@bb.utils.contains('KERNEL_IMAGETYPE', 'fitImage', '', '${KERNEL_DEVICETREE_BASENAME}', d)} \
         "
 
  # use the first-defined <baud>;<device> pair in SERIAL_CONSOLES
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#61114): https://lists.yoctoproject.org/g/yocto/message/61114
Mute This Topic: https://lists.yoctoproject.org/mt/101589776/6293953
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-