Re: Saving environment variables in u-boot

From: Mark Millard via freebsd-arm <freebsd-arm_at_freebsd.org>
Date: Thu, 16 Dec 2021 19:12:01 UTC

On 2021-Dec-16, at 10:07, bob prohaska <fbsd@www.zefox.net> wrote:

> How does one go about saving environment variables in u-boot on 
> Raspberry Pi 3? For example,
> 
> Bus usb@7e980000: USB DWC2
> scanning bus usb@7e980000 for devices... 6 USB Device(s) found
>       scanning usb for storage devices... 0 Storage Device(s) found
> U-Boot> editenv usb_pgood_delay
> edit: 2
> U-Boot> usb reset              
> resetting USB...
> Bus usb@7e980000: USB DWC2
> scanning bus usb@7e980000 for devices... 6 USB Device(s) found
>       scanning usb for storage devices... 1 Storage Device(s) found
> U-Boot> saveenv
> Saving Environment to FAT... Failed (1)

I expect that is based on there being a microsd card with
a FAT file system on it, possibly containing the u-boot that
is in use. I doubt that it supports saving to a FAT on USB
media. Do you have an appropriate microsd card in place?

> U-Boot> 
> 
> It appears that setting usb_pgood_delay to 2 helped, so I'd like to
> try it without manual intervention. 
> 
> It must be admitted that repeated manual tries of this experiment yield
> inconsistent results, so this particular test case is mostly an example.
> 
> Still, how does one change and save settings in u-boot?  
> 

Someone else that had such issues dealt with it by patching
the the build instructions for the u-boot port involved and
used their own port builds. What they reported was that they
tried:

QUOTE
> # cat files/patch-include_configs_rpi.h
> --- include/configs/rpi.h.orig  2021-06-12 23:20:03.061510000 -0000
> +++ include/configs/rpi.h       2021-06-12 23:20:14.131306000 -0000
> @@ -209,6 +209,9 @@
>       ENV_DEVICE_SETTINGS \
>       ENV_DFU_SETTINGS \
>       ENV_MEM_LAYOUT_SETTINGS \
> +       "usb_pgood_delay=10000\0" \
> +       "usb_ready_retry=5\0" \
> +       "usb_max_blk=20\0" \
>       BOOTENV
END QUOTE

But that was for the u-boot-rpi4 or u-boot-rpi-arm64 ports.
(They also later mentioned using "usb_pgood_delay=2000\0"
instead, a figure they found in a bunch of configrations.)

So something somewhat analogous might help if you are willing
to build and use your own u-boot port variant.


===
Mark Millard
marklmi at yahoo.com