Set patch_ddr_size from Linux user space

Hello,

Is there a way to set patch_ddr_size from Linux afterwards, not from the U-Boot.

Basically I don’t have access to the serial port, I just have access to USB or ethernet.

Thanks for your time.

hi @mthpvg

Why do you need to run this from Linux? In our regular images, when uboot is updated then the command is launched automatically.

How did you install/update the image if you don’t have uart connection? Do you have a display connected to the viola Board?

Best regards, Jaski

Hi @jaski.tx,

We use an old uboot from 2.6 and we use the serial/uart to flash the colibri.

Usually we do patch_ddr_size; mmc partconf 0 1 1 0; reset but this step was missing in some of our products. Now the Colibri is sealed inside a box with no access to the serial port but with access to a USB port that can also be used for ethernet.

We never integrated the patch_ddr_size functionality outside of U-Boot. Nowadays, we anyway use SPL to achieve the same so we have definitely no plans to ever work on patch_ddr_size again. That said, you may just set e.g. bootcmd to do your patch_ddr_size using fw_setenv from Linux user space and reboot. Just make sure after patch_ddr_size you set your bootcmd back to your regular one.

Thanks @marcel.tx. Out of curiosity what would happen if patch_ddr_size was invoked on each boot?

Out of curiosity what would happen if patch_ddr_size was invoked on each boot?

I believe other than a few wasted CPU cycles upon boot increasing boot time of course nothing bad should happen but let me quickly check…

Yes, patch_ddr_size will just not find the 32-bit memory width value and therefore nothing gets written upon subsequent invocations.

Good to know, thanks.

I’m stunned by the quality of the answers one can get on this website :).

For those interested, in user space we did:

fw_setenv bootcmd

Check that bootcmd is gone with: fw_printenv

If you still see bootcmd, re-run: fw_setenv bootcmd (strangely, we had two bootcmd)

Finally:

fw_setenv bootcmd 'patch_ddr_size; env default -a; saveenv; reset'
reboot

This new bootcmd will:

  • Execute the missing patch_ddr_size
  • Load the default env and save it
    (replace our bootcmd with the
    default one)
  • Reboot through reset

The trick is that the bootcmd is back to its default value. We left no trace.

Perfect, thanks for sharing!