• u-boot usb mass storage discovery problems

    From bob prohaska@21:1/5 to All on Mon Nov 15 23:26:08 2021
    Is there a readable guide to configuring u-boot so it can
    find usb hard disks during boot of a raspberry pi 3b+ ?

    Below is a sample of a recent boot attempt, using a serial
    console. The hair-puller is the scan for usb storage devices
    following usb reset. Sometimes it works, sometimes it doesn't.
    I've tinkered with setting delays in config.txt and with
    usb_pgood_delay being between .1 and 40000, understood to be
    in milliseconds. Nothing seems to make a consistent difference,
    but after enough attempts the disk shows up and can be booted.
    It happens this is booting FreeBSD, but hopefully some folks
    using other OS's might be able to offer hints. Once the disk
    is found and booted the drive seems to work fine.

    The disk is housed in a usb3-SATA enclosure and connected via
    a usb3 powered hub plugged into a (usb2) port on the Pi3.

    Resetting system ...

    U-Boot 2020.10 (Apr 09 2021 - 03:55:54 +0000)

    DRAM: 948 MiB
    RPI 3 Model B (0xa02082)
    MMC: mmc@7e300000: 0
    Loading Environment from FAT... In: serial
    Out: vidconsole
    Err: vidconsole
    Net: No ethernet found.
    starting USB...
    Bus usb@7e980000: USB DWC2
    scanning bus usb@7e980000 for devices... unable to get device descriptor (error=-22)
    4 USB Device(s) found
    scanning usb for storage devices... 0 Storage Device(s) found
    Hit any key to stop autoboot: 0
    U-Boot> usb reset
    resetting USB...
    Bus usb@7e980000: USB DWC2
    scanning bus usb@7e980000 for devices... unable to get device descriptor (error=-22)
    usb_new_device: Cannot read configuration, skipping device 152d:0583
    4 USB Device(s) found
    scanning usb for storage devices... 0 Storage Device(s) found
    U-Boot> setenv usb_pgood_delay 1
    U-Boot> usb reset
    resetting USB...
    Bus usb@7e980000: USB DWC2
    scanning bus usb@7e980000 for devices... unable to get device descriptor (error=-22)
    5 USB Device(s) found
    scanning usb for storage devices... 0 Storage Device(s) found
    U-Boot> usb reset
    resetting USB...
    Bus usb@7e980000: USB DWC2
    scanning bus usb@7e980000 for devices... unable to get device descriptor (error=-22)
    5 USB Device(s) found
    scanning usb for storage devices... 0 Storage Device(s) found
    U-Boot> usb reset
    resetting USB...
    Bus usb@7e980000: USB DWC2
    scanning bus usb@7e980000 for devices... unable to get device descriptor (error=-22)
    5 USB Device(s) found
    scanning usb for storage devices... 1 Storage Device(s) found


    U-Boot> run bootcmd_usb0

    Device 0: Vendor: SABRENT Rev: 1214 Prod:
    Type: Hard Disk
    Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
    ... is now current device
    Scanning usb 0:1...
    Found EFI removable media binary efi/boot/bootaa64.efi
    libfdt fdt_check_header(): FDT_ERR_BADMAGIC
    Scanning disk mmc@7e300000.blk...
    ** Unrecognized filesystem type **
    Scanning disk usb_mass_storage.lun0...
    ** Unrecognized filesystem type **
    Found 6 disks
    No EFI system partition
    BootOrder not defined
    EFI boot manager: Cannot load any image
    1259212 bytes read in 33 ms (36.4 MiB/s)
    libfdt fdt_check_header(): FDT_ERR_BADMAGIC
    Booting /efi\boot\bootaa64.efi

    From this point on boot is normal.

    If anybody has hints please share them....

    Thanks for reading,

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Wills@21:1/5 to bob prohaska on Sat Mar 5 20:28:56 2022
    Hi,

    On Monday, November 15, 2021 at 6:26:09 PM UTC-5, bob prohaska wrote:
    Is there a readable guide to configuring u-boot so it can
    find usb hard disks during boot of a raspberry pi 3b+ ?

    Below is a sample of a recent boot attempt, using a serial
    console. The hair-puller is the scan for usb storage devices
    following usb reset. Sometimes it works, sometimes it doesn't.
    I've tinkered with setting delays in config.txt and with
    usb_pgood_delay being between .1 and 40000, understood to be
    in milliseconds.

    Thank you for this, setting usb_pgood_delay=4000 helped my Pi find it's USB storage and let me boot from it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bob prohaska@21:1/5 to Steve Wills on Sun Mar 6 17:43:22 2022
    Steve Wills <steve.wills@gmail.com> wrote:

    Thank you for this, setting usb_pgood_delay=4000 helped my Pi find it's USB storage and let me boot from it.

    Very glad it helped! The idea came from a correspondent on the
    freebsd-arm mailing list, not my own insights...8-(

    There still remains need for a readable u-boot manual. I have
    figured out that even if a Pi (3 in this case) has no microSD
    card and still managed to find and start u-boot on a USB device
    it's unable to save environment variable to the USB device, it
    still wants to write the change to microSD.

    Perhaps recompiling u-boot with appropriate options will either
    make the location of uboot.env selectable, or maybe there's a
    more clever trick. If anybody knows please make a noise.....

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Wills@21:1/5 to bob prohaska on Mon Mar 7 06:42:00 2022
    On Sunday, March 6, 2022 at 12:43:24 PM UTC-5, bob prohaska wrote:
    Very glad it helped! The idea came from a correspondent on the
    freebsd-arm mailing list, not my own insights...8-(

    There still remains need for a readable u-boot manual. I have
    figured out that even if a Pi (3 in this case) has no microSD
    card and still managed to find and start u-boot on a USB device
    it's unable to save environment variable to the USB device, it
    still wants to write the change to microSD.

    Perhaps recompiling u-boot with appropriate options will either
    make the location of uboot.env selectable, or maybe there's a
    more clever trick. If anybody knows please make a noise.....

    These lines in /usr/ports/sysutils/u-boot-rpi3/files/rpi3_fragment:

    CONFIG_OF_EMBED=n
    CONFIG_OF_BOARD=y
    CONFIG_CMD_BMP=y
    CONFIG_ENV_IS_IN_FAT=y
    CONFIG_ENV_FAT_INTERFACE="usb"
    CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
    CONFIG_ENV_FAT_FILE="uboot.env"
    CONFIG_RPI_EFI_NR_SPIN_PAGES=2
    CONFIG_PREBOOT="setenv usb_pgood_delay 4000; usb start"

    seem to produce a u-boot which will delay by default and *save* it's environment to the fat on usb, but it still doesn't *load* those. Still trying to figure that out. This commit seems to have added a way to delay loading the environment:

    https://github.com/u-boot/u-boot/commit/06fd853890f23491605bfd6c9ab0116b79e15aaa

    but I'm not sure how to trigger it after the (properly delayed) usb start finishes.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)