New U-Boot image for better USB drive compatibility?


  • K
    Custom Avatar

    Is there any chance I / we could get a newer version of u-boot?

    I have replaced the internal USB flash drive on several ERLites (for various reasons), and I've noticed that some USB drives are not quite compatible. The most common issue I've seen is that u-boot hangs immediately after scanning the USB bus:

    U-Boot 1.1.1 (UBNT Build ID: 4493936-g009d77b) (Build time: Sep 20 2012 - 15:48:51)
    
    BIST check passed.
    UBNT_E100 r1:2, r2:14, serial #: DC9FDB286BEE
    Core clock: 500 MHz, DDR clock: 266 MHz (532 Mhz data rate)
    DRAM:  512 MB
    Clearing DRAM….... done
    Flash:  4 MB
    Net:   octeth0, octeth1, octeth2
    
    USB:   (port 0) scanning bus for devices...
          USB device not responding, giving up (status=0)
    1 USB Devices found
           scanning bus for storage devices...
    No device found. Not initialized? 
    

    After poking around on the web, it looks like issues similar to these have been resolved in newer versions of u-boot. It seems to me like the version of u-boot (1.1.1) you're using is ancient...

    I'm not sure exactly why this is happening, but it could be a power-on timing issue; the USB bus is scanned very soon after power-on (like 1 second or less), and maybe the USB drive I'm using hasn't had time to initialize itself yet. I'm pretty sure either a small delay would help, or, reset the USB bus once and scan it again if nothing is found the first time around.

    Interestingly, I CAN boot the ERLite successfully from this USB drive, if I issue a "usb reset" command to u-boot. When I do this manually, the drive is found, and I can manually boot the box and it starts up normally. Also, you can do a reset or reboot and it will start up properly as long as you don't cycle the power.

    usb reset
    (Re)start USB...
    USB:   (port 0) scanning bus for devices... 1 USB Devices found
           scanning bus for storage devices...
      Device 0: Vendor: PNY      Prod.: USB 2.0 FD       Rev: 1100
                Type: Removable Hard Disk
                Capacity: 30685.8 MB = 29.9 GB (62844672 x 512)
    Octeon ubnt_e100# fatload usb 0 $loadaddr vmlinux.64;bootoctlinux $loadaddr coremask=0x3 root=/dev/sda2 rootdelay=15 rw rootsqimg=squashfs.img rootsqwdir=w mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@3072k(eeprom)
    

    Of course this requires interaction with the console on a cold start; it would be great if we could get u-boot to either delay after the reset of retry automatically.


  • A
    Beta Testers

    Upgrading bootloader could be potentially dangerous and lead to brick state. One way to recover will be to unsolder and reprogram NOR flash.There might be some JTAG pins but i'd rather use the other way. I also noticed the very small delay for detecting USB flash leads to some USB sticks not being detected. I would like a newer bootloader too, or the possibility to specify a delay but i really doubt that this will be generally available.


  • N
    Beta - EdgeRouter

    As abu_cwarky mentioned, updating uboot would be a dangerous potentially device-bricking operation so I don't see it happening tbh.

    That said, uboot has an option called bootdelay which determines how long it waits for input to break the boot process - what happens if you up that setting (which can be saved to presist across boots with saveenv) to be 10s or something? Seems like a much safer option if that works.


  • K
    Custom Avatar

    I tried the bootdelay setting, with both a 2 second and 10 second delay. Either the delay is happening after the USB problem occurs, or it just doesn't help. I did notice a delay, but the error message appears just as soon after power-on as before.

    I think a USB bus reset is likely necessary.

    I can understand why ubnt would not want to upgrade the bootloader, but they may run into this problem themselves in the near future if the USB drives they are using are different for some reason.

    FWIW, there are two bootloader images in NOR flash, so there is still a possibility to "recover" if you load a bad image. I don't think ubnt would make a new bootloader generally available, but they might build a newer one just for us tinkerers. :smileyhappy: After all, we are replacing the USB flash drive, monkeying around with u-boot anyway, so the possibility of "bricking" a device is understandable, and I at least take full responsibility if that should happen…


  • N
    Beta - EdgeRouter

    Yeah, the concern is of course about a rise in warranty claims from people bricking units by doing so. Of course the easy answer is "that's ok, just say warranty is void if you use that" - but that's not actually legally possible in many countries.

    Using a newer bootloader on newly manufacturerd devices is a bit different than updating the bootloader on devices that already exist. Most of the cons to the latter don't apply to the former. The big issue with that though is there's now two different bootloader versions running on the same product depending on when it was made, which can make future testing and QA difficult as any changes have to be sure that they will run on both variants.

    It really comes down to risk and cost vs reward.


  • U
    Previous Employees

    The uboot we're using for each model is from the vendor SDK for the board. It is possible to get a newer uboot to work on the existing board but it would be like bringing up the board all over again, so even ignoring the warranty issue, at this time we really don't have the resources to do that.

    By the way, this is not officially supported or recommended of course, but since you're already in there, maybe try prepending "usb reset" to "bootcmd"?


  • N
    Beta - EdgeRouter

    UBNT-ancheng wrote:

    By the way, this is not officially supported or recommended of course, but since you're already in there, maybe try prepending "usb reset" to "bootcmd"?


    Hey that's a pretty good idea. I didn't know you could chain multiple commands together in the bootcmd - could chain in a sleep as well if an additional delay is needed before or after the usb reset too.


  • K
    Custom Avatar

    WOOHOO IT WORKS!!!

    Briiliant idea ancheng! :ubnt_banana: It's good enough for me! Now why didn't I think of that? :smileytongue:

    Well, at least if you guys run into a similar problem with USB drives in the future, you know of a quick "fix"…

    U-Boot 1.1.1 (UBNT Build ID: 4493936-g009d77b) (Build time: Sep 20 2012 - 15:48:51)
    
    BIST check passed.
    UBNT_E100 r1:2, r2:14, serial #: DC9FDB286BEE
    Core clock: 500 MHz, DDR clock: 266 MHz (532 Mhz data rate)
    DRAM:  512 MB
    Clearing DRAM....... done
    Flash:  4 MB
    Net:   octeth0, octeth1, octeth2
    
    USB:   (port 0) scanning bus for devices... 
          USB device not responding, giving up (status=0)
    1 USB Devices found
           scanning bus for storage devices...
    No device found. Not initialized?                                                 0 
    (Re)start USB...
    USB:   (port 0) scanning bus for devices... 1 USB Devices found
           scanning bus for storage devices...
      Device 0: Vendor: PNY      Prod.: USB 2.0 FD       Rev: 1100
                Type: Removable Hard Disk
                Capacity: 30685.8 MB = 29.9 GB (62844672 x 512)
    reading vmlinux.64
    ............................
    
    5683792 bytes read
    

    Here's the settings I ended up going with:

    oldbootcmd=fatload usb 0 $loadaddr vmlinux.64;bootoctlinux $loadaddr coremask=0x3 root=/dev/sda2 rootdelay=15 rw rootsqimg=squashfs.img rootsqwdir=w mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@3072k(eeprom)
    bootcmd=sleep 1; usb reset; sleep 1; $(oldbootcmd)
    

  • K
    Beta Testers

    Would you mind giving me some copy pasta on how to do this please, my router seems to kick the bucket every couple of weeks (Always about 10 mins after I've left for work!) and it wont recover till I come home and manually console in to reset.

    I've had a look at U-Boot docs but its a bit beyond my skill level.


  • C
    Beta Testers

    I'm using SanDisk 8GB Cruzer FIT as image storage for this router (because original ones were faulty very often after short period of time) and I have to add this two command to boot sequence

    sleep 10;usb reset;
    

    and works well.

    An "usb reset" alone (without prepending sleep or if sleep was too short, like 1-2s) was started too early, because this usb pen needs more time to settle.

    The whole setenv command looks like:

    setenv bootcmd 'sleep 10;usb reset;fatload usb 0 $loadaddr vmlinux.64;bootoctlinux $loadaddr coremask=0x3 root=/dev/sda2 rootdelay=15 rw rootsqimg=squashfs.img rootsqwdir=w mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@3072k(eeprom)'
    

  • P
    Custom Avatar

    Thanks it works fine!

    I got twelve edgerouter that burned off internal medium. It is a real shame, ubiquiti tries to reduce production costs using cheaper medium.


  • D
    Beta Testers

    Keep in min the bootcmd is different on the ERPOE from the ERLITE!

    The correct one for ERPOE (with fix) is:

    setenv bootcmd 'sleep 10;usb reset;fatload usb 0 $loadaddr vmlinux.64;bootoctlinux $loadaddr coremask=0x3 root=/dev/sda2 rootdelay=15 rw rootsqimg=squashfs.img rootsqwdir=w mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@1024k(eeprom)'
    

  • C
    Beta Testers

    Ok. I have got a new batch of Cruizer Fits that don't boot like an older revision without manually setting the ENV as shown in previous posts. It comes up nicely until a powercycle. Is there a way to write/save that so I don't have to run that each time a reboot is necessary or have to physically console into the router?

    Thanks!


  • D
    Beta Testers

    'saveenv'


  • C
    Beta Testers

    Thanks! This has to be the best user/support forums that I have ever used. Always quick and helpful responses.


  • Beta Testers

    I know this is an old thread, but I have the same problem with the Cruzer Fit not booting. In the process of trying to resolve the issue I meesed the boot file up, but the information presented here permitted me to get the ERPOE5 to where it would boot again using a previously bootable 8GB Cruzer Fit. I still cannot get the router to work with the 16GB Cruzer Fit.

    Does sleep 10 mean that it will wait 10 seconds?

    What exactly does the physical mapping define? Will this change if I use a drive of different capacity?

    What is the correct command for the ERPOE5? Is the one posted by danhausen correct for the ERPOR5?

    I know lots of neebie questions, but your help is very much appreciated.


  • Beta Testers

    Can you tell me what the command would look like for the ERPOE?


  • B

    See post #12.


  • B

    For future reference, it's would be good to have default env settings available.

    Can somebody post dump from ERPoe?

    Here's one from ERL

    Octeon ubnt_e100# printenv
    bootcmd=fatload usb 0 $loadaddr vmlinux.64;bootoctlinux $loadaddr coremask=0x3 root=/dev/sda2 rootdelay=15 rw rootsqimg=squashfs.img rootsqwdir=w mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@3072k(eeprom)
    bootdelay=0
    baudrate=115200
    download_baudrate=115200
    nuke_env=protect off $(env_addr) +$(env_size);erase $(env_addr) +$(env_size)
    autoload=n
    ethact=octeth0
    loadaddr=0x9f00000
    numcores=2
    stdin=serial
    stdout=serial
    stderr=serial
    env_addr=0x1fbfe000
    env_size=0x2000
    flash_base_addr=0x1f800000
    flash_size=0x400000
    uboot_flash_addr=0x1f880000
    uboot_flash_size=0x70000
    flash_unused_addr=0x1f8f0000
    flash_unused_size=0x310000
    bootloader_flash_update=bootloaderupdate
    

  • Beta Testers

    Here are the env settings for the ERPoE-5:

    Octeon ubnt_e100# printenv

    bootcmd=fatload usb 0 $loadaddr vmlinux.64;bootoctlinux $loadaddr coremask=0x3 root=/dev/sda2 rootdelay=15 rw rootsqimg=squashfs.img rootsqwdir=w mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@1024k(eeprom)
    bootdelay=0
    baudrate=115200
    download_baudrate=115200
    nuke_env=protect off $(env_addr) +$(env_size);erase $(env_addr) +$(env_size)
    autoload=n
    ethact=octeth0
    loadaddr=0x9f00000
    numcores=2
    stdin=serial
    stdout=serial
    stderr=serial
    env_addr=0x1fbfe000
    env_size=0x2000
    flash_base_addr=0x1f400000
    flash_size=0x800000
    uboot_flash_addr=0x1f480000
    uboot_flash_size=0x70000
    flash_unused_addr=0x1f4f0000
    flash_unused_size=0x710000
    bootloader_flash_update=bootloaderupdate

    Environment size: 675/8188 bytes

    ERPoE-5 Boot Environment.pdf


Posts 30Views 3
Log in to reply

Looks like your connection to Ubiquiti Networks Community was lost, please wait while we try to reconnect.