Skip to contentSkip to conversation

kernel-fitimage.bbclass: Allow set/unset load address for FDT

PATCH Superseded Nikunj Kela 2 participants 3 messages Feb 14, 2017 – Feb 15, 2017 4 messages not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-fitimage.bbclass: Allow set/unset load address for FDT

Allow the load address for the FDT segment in the fitImage. This allows U-Boot to dynamically decide where to load the FDT.

UBOOT_FDT_LOADADDRESS - Specifies the load address used by u-boot
for the FDT

---
 meta/classes/kernel-fitimage.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)
meta/classes/kernel-fitimage.bbclass +6 -0
index 1c3b4b7..7f9da49 100644
@@ -127,6 +127,11 @@ EOF
 fitimage_emit_section_dtb() {
 
 	dtb_csum="sha1"
+	fdt_loadline=""
+
+	if [ -n "${UBOOT_FDT_LOADADDRESS}" ]; then
+		fdt_loadline="load = <${UBOOT_FDT_LOADADDRESS}>;"
+	fi
 
 	cat << EOF >> ${1}
                 fdt@${2} {
@@ -135,6 +140,7 @@ fitimage_emit_section_dtb() {
                         type = "flat_dt";
                         arch = "${UBOOT_ARCH}";
                         compression = "none";
+                        ${fdt_loadline}
                         hash@1 {
                                 algo = "${dtb_csum}";
                         };
Signature · 1 line
2.5.0
#5 lore raw
In reply to a message not in the archive

Whoops. Dropped the list. Adding it back.

Quoted 93 lines · Nikunj Kela

I do agree that this can be fixed in u-boot however I saw a commit for initrd load/entry addresses that make use of UBOOT_RD_* variables in OE, so I thought of adding one for FDT load address.

Quoted 86 lines · Rick Altherr

I don't see harm in taking this patch but it does encourage a poor practice.

They probably set the U-Boot boot command to 'bootm <kernel_addr> <initrd_addr> <fdt_addr>' which is what you do for legacy images. With FIT, only the address of the FIT itself is strictly needed. Instead of pinning the FDT and initrd to fixed address, the U-Boot boot command can be a HUSH script that checks the FIT for initrd and FDT and falls back to fixed address if not found.

I did this recently in OpenBMC's U-Boot for Aspeed SoCs. I'm on my phone so I don't have a link handy. The advantage is a more compact RAM layout since U-Boot only allocates exactly the RAM required for the copies.

Rick

Quoted 68 lines · Nikunj Kela

Recently, on freescale ls1043a reference board, I came across a situation where if I don't specify the FDT load address in the fitImage, the uboot picks up some address however kernel doesn't boot. I looked at the freescale supplied BSP and found that load address is required for their FDT.

Quoted 58 lines · Rick Altherr

The attached patch seems to do exactly the opposite of the commit message. When no "load" property is set for the fdt node, U-Boot will allocate memory dynamically and copy the fdt to the allocated RAM _if needed_. With this patch, if UBOOT_FDT_LOADADDRESS is set, U-Boot will _always_ attempt to copy the fdt to the specified address. I'm surprised you need the FDT at a specific address. Are you able to share more details about the situation you need this option in?

Quoted 45 lines · Nikunj Kela

Allow the load address for the FDT segment in the fitImage. This allows U-Boot to dynamically decide where to load the FDT.

UBOOT_FDT_LOADADDRESS - Specifies the load address used by u-boot
for the FDT

---
 meta/classes/kernel-fitimage.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)
meta/classes/kernel-fitimage.bbclass +6 -1
index 1c3b4b7..7f9da49 100644
@@ -127,6 +127,11 @@ EOF
 fitimage_emit_section_dtb() {
 
        dtb_csum="sha1"
+       fdt_loadline=""
+
+       if [ -n "${UBOOT_FDT_LOADADDRESS}" ]; then
+               fdt_loadline="load = <${UBOOT_FDT_LOADADDRESS}>;"
+       fi
 
        cat << EOF >> ${1}
                 fdt@${2} {
@@ -135,6 +140,7 @@ fitimage_emit_section_dtb() {
                         type = "flat_dt";
                         arch = "${UBOOT_ARCH}";
                         compression = "none";
+                        ${fdt_loadline}
                         hash@1 {
                                 algo = "${dtb_csum}";
                         };
--

2.5.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#6 lore raw

At a minimum, please resend with a commit message that correctly describes the change.

Quoted 98 lines · Rick Altherr

Whoops. Dropped the list. Adding it back.

Quoted 94 lines · Nikunj Kela

I do agree that this can be fixed in u-boot however I saw a commit for initrd load/entry addresses that make use of UBOOT_RD_* variables in OE, so I thought of adding one for FDT load address.

Quoted 86 lines · Rick Altherr

I don't see harm in taking this patch but it does encourage a poor practice.

They probably set the U-Boot boot command to 'bootm <kernel_addr> <initrd_addr> <fdt_addr>' which is what you do for legacy images. With FIT, only the address of the FIT itself is strictly needed. Instead of pinning the FDT and initrd to fixed address, the U-Boot boot command can be a HUSH script that checks the FIT for initrd and FDT and falls back to fixed address if not found.

I did this recently in OpenBMC's U-Boot for Aspeed SoCs. I'm on my phone so I don't have a link handy. The advantage is a more compact RAM layout since U-Boot only allocates exactly the RAM required for the copies.

Rick

Quoted 68 lines · Nikunj Kela

Recently, on freescale ls1043a reference board, I came across a situation where if I don't specify the FDT load address in the fitImage, the uboot picks up some address however kernel doesn't boot. I looked at the freescale supplied BSP and found that load address is required for their FDT.

Quoted 58 lines · Rick Altherr

The attached patch seems to do exactly the opposite of the commit message. When no "load" property is set for the fdt node, U-Boot will allocate memory dynamically and copy the fdt to the allocated RAM _if needed_. With this patch, if UBOOT_FDT_LOADADDRESS is set, U-Boot will _always_ attempt to copy the fdt to the specified address. I'm surprised you need the FDT at a specific address. Are you able to share more details about the situation you need this option in?

Quoted 45 lines · Nikunj Kela

Allow the load address for the FDT segment in the fitImage. This allows U-Boot to dynamically decide where to load the FDT.

UBOOT_FDT_LOADADDRESS - Specifies the load address used by u-boot
for the FDT

---
 meta/classes/kernel-fitimage.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)
meta/classes/kernel-fitimage.bbclass +6 -1
index 1c3b4b7..7f9da49 100644
@@ -127,6 +127,11 @@ EOF
 fitimage_emit_section_dtb() {
 
        dtb_csum="sha1"
+       fdt_loadline=""
+
+       if [ -n "${UBOOT_FDT_LOADADDRESS}" ]; then
+               fdt_loadline="load = <${UBOOT_FDT_LOADADDRESS}>;"
+       fi
 
        cat << EOF >> ${1}
                 fdt@${2} {
@@ -135,6 +140,7 @@ fitimage_emit_section_dtb() {
                         type = "flat_dt";
                         arch = "${UBOOT_ARCH}";
                         compression = "none";
+                        ${fdt_loadline}
                         hash@1 {
                                 algo = "${dtb_csum}";
                         };
--

2.5.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core