Skip to contentSkip to conversation

fitImage align 8-byte for ARM64

DISCUSSION Matthias Schoepfer 4 participants 7 messages Jan 6, 2020 – Jan 8, 2020

lore
Share & tools
lore
#0 lore raw

Hi!

I have had trouble booting a fitImage packed kernel for dragonboard410c, which is an ARM64 platform. After days and days of debugging, I found that the fdt is 4-byte aligned. But within the linux kernel, Documentation/arm64/booting.txt says, fdt must be 8 byte aligned.

If I change the alignment by means of fdt_high, the Kernel boots, otherwise, it hangs.

Is there an option to align the fitImage to 8-byte boundaries, and if not, is it feasible to submit a patch or will this never have a chance to get merged?!

Thanks and Regards,

Matthias Schöpfer

Signature · 2 lines
Dr.-Ing. Matthias Schöpfer
matthias.schoepfer at googlemail.com
#1 lore raw
Quoted 7 lines · Matthias Schoepfer

Hi!

I have had trouble booting a fitImage packed kernel for dragonboard410c, which is an ARM64 platform. After days and days of debugging, I found that the fdt is 4-byte aligned. But within the linux kernel, Documentation/arm64/booting.txt says, fdt must be 8 byte aligned.

Quoted 6 lines

If I change the alignment by means of fdt_high, the Kernel boots, otherwise, it hangs.

Is there an option to align the fitImage to 8-byte boundaries, and if not, is it feasible to submit a patch or will this never have a chance to get merged?!

That's interesting. It sounds like you need to look at boot_relocate_fdt() perhaps? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200106/613fe223/attachment.sig>
#2 lore raw

Hi Tom,

thanks for your reply. As far as I can understand this code, only if fdt_high is set to 0xffffffffffffffff (which is the very case for dragonboard410c) a not aligned mapping of the fdt can happen. In this case, the address is images->ft_addr, which I *think* comes from the fitImage creation?!

I wonder, whether just removing fdt_high is a valid solution...

Regards,

Matthias

Quoted 19 lines · Tom Rini
Quoted 7 lines · Matthias Schoepfer

Hi!

I have had trouble booting a fitImage packed kernel for dragonboard410c, which is an ARM64 platform. After days and days of debugging, I found that the fdt is 4-byte aligned. But within the linux kernel, Documentation/arm64/booting.txt says, fdt must be 8 byte aligned.

Quoted 6 lines

If I change the alignment by means of fdt_high, the Kernel boots, otherwise, it hangs.

Is there an option to align the fitImage to 8-byte boundaries, and if not, is it feasible to submit a patch or will this never have a chance to get merged?!

That's interesting. It sounds like you need to look at boot_relocate_fdt() perhaps? Thanks!

Signature · 2 lines
Dr.-Ing. Matthias Schöpfer
matthias.schoepfer at googlemail.com
#3 lore raw
Quoted 9 lines · Matthias Schoepfer

Hi Tom,

thanks for your reply. As far as I can understand this code, only if fdt_high is set to 0xffffffffffffffff (which is the very case for dragonboard410c) a not aligned mapping of the fdt can happen.
In this case, the address is images->ft_addr, which I *think* comes from the fitImage creation?!

I wonder, whether just removing fdt_high is a valid solution...

Ah. Yes, generally speaking fdt_high shouldn't be set as it stops us from relocating things to ensure alignment. Making use of bootm_size instead (to ensure that everything is within a certain area of memory) is better for the general case. So please, update the default environment and CC the board maintainer, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200106/32290254/attachment.sig>
#4 lore raw

Re: fitImage align 8-byte for ARM64【请注意,邮件由[email protected]代发】

In reply to Tom Rini

Hi Tom, Simon,

Quoted 9 lines · Tom Rini
Quoted 7 lines · Matthias Schoepfer

Hi!

I have had trouble booting a fitImage packed kernel for dragonboard410c, which is an ARM64 platform. After days and days of debugging, I found that the fdt is 4-byte aligned. But within the linux kernel, Documentation/arm64/booting.txt says, fdt must be 8 byte aligned.

Quoted 9 lines
Quoted 6 lines

If I change the alignment by means of fdt_high, the Kernel boots, otherwise, it hangs.

Is there an option to align the fitImage to 8-byte boundaries, and if not, is it feasible to submit a patch or will this never have a chance to get merged?!

That's interesting. It sounds like you need to look at boot_relocate_fdt() perhaps? Thanks!

When I use the FIT image, I met another issue:

- The emmc/sd read is by block which is 512byte;

- The FIT image header is always not 512byte align, and the entry of

  image in FIT is always not aligned to block;

- The image read from block device always need memory coppy which

  make it slow.

I can truncate the image in FIT align to 512 byte, but not able to make the

header which is dtb 512byte align,  any idea to implement this?

Thanks,

- Kever

#5 lore raw

fitImage align 8-byte for ARM64【请注意,邮件由[email protected]代发】

Quoted 30 lines · Kever Yang

Hi Tom, Simon,

Quoted 9 lines · Tom Rini
Quoted 7 lines · Matthias Schoepfer

Hi!

I have had trouble booting a fitImage packed kernel for dragonboard410c, which is an ARM64 platform. After days and days of debugging, I found that the fdt is 4-byte aligned. But within the linux kernel, Documentation/arm64/booting.txt says, fdt must be 8 byte aligned.

Quoted 9 lines
Quoted 6 lines

If I change the alignment by means of fdt_high, the Kernel boots, otherwise, it hangs.

Is there an option to align the fitImage to 8-byte boundaries, and if not, is it feasible to submit a patch or will this never have a chance to get merged?!

That's interesting. It sounds like you need to look at boot_relocate_fdt() perhaps? Thanks!

When I use the FIT image, I met another issue:

- The emmc/sd read is by block which is 512byte;

- The FIT image header is always not 512byte align, and the entry of

  image in FIT is always not aligned to block;

Quoted 7 lines

- The image read from block device always need memory coppy which

  make it slow.

I can truncate the image in FIT align to 512 byte, but not able to make the

header which is dtb 512byte align,  any idea to implement this?

I don't quite follow, sorry. Don't you control where the image will be written to in eMMC?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200107/c2979eab/attachment.sig>
#6 lore raw

Re: fitImage align 8-byte for ARM64【请注意,邮件由[email protected]代发】

Hi Kever,

Quoted 34 lines · Tom Rini
Quoted 32 lines · Kever Yang

Hi Tom, Simon,

Quoted 9 lines · Tom Rini
Quoted 7 lines · Matthias Schoepfer

Hi!

I have had trouble booting a fitImage packed kernel for dragonboard410c, which is an ARM64 platform. After days and days of debugging, I found that the fdt is 4-byte aligned. But within the linux kernel, Documentation/arm64/booting.txt says, fdt must be 8 byte aligned.

Quoted 9 lines
Quoted 6 lines

If I change the alignment by means of fdt_high, the Kernel boots, otherwise, it hangs.

Is there an option to align the fitImage to 8-byte boundaries, and if not, is it feasible to submit a patch or will this never have a chance to get merged?!

That's interesting. It sounds like you need to look at boot_relocate_fdt() perhaps? Thanks!

When I use the FIT image, I met another issue:

- The emmc/sd read is by block which is 512byte;

- The FIT image header is always not 512byte align, and the entry of

image in FIT is always not aligned to block;

- The image read from block device always need memory coppy which

Quoted 8 lines
Quoted 5 lines

make it slow.

I can truncate the image in FIT align to 512 byte, but not able to make the

header which is dtb 512byte align, any idea to implement this?

I don't quite follow, sorry. Don't you control where the image will be written to in eMMC?

In the SPL FIT implementation, it reads the blocks from MMC in such a way that the first byte of the image is at the required load address, and the FIT metadata is before that. See spl_load_simple_fit().

Regards,
Simon