cancel
Showing results for 
Search instead for 
Did you mean: 

U-boot logo corrupted by kernel ramfs image decompression

nikolaynikolov
Associate

We have a custom board based on STM32MP157C-DK2. U_boot shows a splash image(logo). Then U-boot starts the kernel from a fip image. I the same fip image there is a ramfs partition in cpio.gz format which is used as rootfs by the kernel. When kernel starts it decompresses the ramfs partition. During this decompression the logo on the screen gets corrupted. I am sure this corruption happens during the decompression as I put 1 ms delay in the kernel code where it is decompressed and I can see how the logo gets slowly corrupted for about 20 seconds. This is the result of the corruption:

IMG_20240903_120123_c.jpg

This happens because we have 1Gb of ram starting at address 0xC0000000 and framebuffer in U-boot occupies the top part of the ram which is around 0xfff00000. Obviously this is the address space which kernel uses to decompress the ramfs partition. I have this in the kernel dts:

reserved-memory {
  #address-cells = <1>;
  #size-cells = <1>;
  ranges;

  gpu_reserved: gpu@fa000000 {
    reg = <0xfa000000 0x4000000>;
    no-map;
  };
};

But this does not help to prevent the kernel to use this address to decompress the ramfs partition.
I can change the framebuffer address in U-boot to prevent this corruption to happen in kernel but I do not think this is proper solution as I am not sure which address to use for it as it might cause another corruption in U-boot or in kernel.

Is there a proper solution for this problem?
Is it possible to instruct kernel to use another safe address range for the ramfs?

2 REPLIES 2
Olivier GALLIEN
ST Employee

Hi @nikolaynikolov 

You issue seems related to memory mapping with 1Gb configuration

This page will likely help : 

How to configure a 256MB DDR mapping from STM32 MPU Distribution Package - stm32mpu

Olivier 

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi Olivier,

Thanks for the response!

Issue looks like related to memory mapping but in the link you provided I cannot find solution for the problem I have. I still cannot see where my mapping is wrong. Reserved memory is as described - at the top part of the memory and still kernel uses this part of the memory for the ramfs image. I still cannot find a way to configure the kernel to use another part of the memory for it.

Nikolay