Welcome! Log In Create A New Profile

Advanced

Best way for automounting external USB drive(s)

Posted by tcatone 
Re: Best way for automounting external USB drive(s)
March 11, 2020 08:27PM
Mike,


> I have a Pogo Pro that is out of service so if I
> have some time, I'll give it a try. So you want
> me to try the 2013.10-tld5 environments instead of
> whatever is on the box? I don't know the u-boot
> on the Pro, so I'll have to check that.

If uboot is 2013.10-tld-x it should work to set them to the new envs. It is best that you use serial console to populate them (non-destructive test). Let me know when you are ready. Only a few envs change needed to test this capability.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 12, 2020 10:59AM
Thanks guys.

Learning a lot here.

I booted up with another USB plugged in up front and everything booted fine. Playing around with that I decided to move around my rootfs usb. It was plugged in the back of the pogoplug in the top slot. I moved it around to the bottom slot and plugged in a couple of other drives including "Hitch" and it boots just fine now. Hitch is the everyday drive - so that is really all I need.

I guess there is a process where it looks for the boot rootfs? It must be happier finding the rootfs in the bottom slot?

Anyway - I'd mark the boot issue solved at this point.

Now the only question I have left - is exfat the best file system for a large usb? If it is should I just install support on the 'plug?

root@debian:~# apt-get install exfat-fuse
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  fuse libfuse2
Recommended packages:
  exfat-utils
The following NEW packages will be installed:
  exfat-fuse fuse libfuse2
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 214 kB of archives.
After this operation, 479 kB of additional disk space will be used.
Do you want to continue? [Y/n]

I did N at this point but let me know what you think.

Anyway - I am having some fun with this 'plug now.
Thanks Bodhi and Mike. I really appreciate all of your help.

TC
Re: Best way for automounting external USB drive(s)
March 12, 2020 02:36PM
I have always had the root USB plugged into the front port. I usually use a little mini device, Sandisk Cruzer Fit. It's unobtrusive and I seem to recall a recommendation from the beginning of the Pogo Plug era to use the front port for the OS.

I can't make a recommendation re: exfat. I did not read everything I linked to yesterday. With only circumstantial information, if it was designed specifically for large USB drives and you want to use large USB drives, then you should probably be setup to handle them. Try the install of exfat support, see how it works, if it's a problem, remove it. I'd recommend more research so your comfortable with your decision.
Re: Best way for automounting external USB drive(s)
March 12, 2020 03:13PM
@Bodhi
Here's the info on my Pogo Pro:
root@PogoPro:~# uname -a
Linux PogoPro 4.1.0-oxnas-tld-1 #3 SMP PREEMPT Wed Jul 1 05:11:47 PDT 2015 armv6l GNU/Linux
root@PogoPro:~# grep -a --null-data U-Boot /dev/mtd0
U-Boot 2013.10-tld-3 for ox820
FW environments:
root@PogoPro:~# fw_printenv
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200n8
bootcmd=run dt_bootcmd_usb
bootdelay=10
console=console=ttyS0,115200n8
dt_bootcmd_usb=usb start; run dt_usb_bootcmd; usb stop; reset
dt_bootm=bootm $uimage_addr $uinitrd_addr $dtb_addr
dt_load_dtb=ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
dt_load_initrd=ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
dt_load_uimage=ext2load usb 0:1 $uimage_addr /boot/uImage
dt_usb_boot=run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
dt_usb_bootcmd=run usb_set_bootargs; run dt_usb_boot
dtb_addr=0x62c00000
ethact=mii0
ethaddr=00:25:31:01:b7:7b
if_netconsole=ping $serverip
ipaddr=192.168.0.222
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=run if_netconsole start_netconsole
serverip=192.168.0.220
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version
stderr=serial
stdin=serial
stdout=serial
uimage_addr=0x60500000
uinitrd_addr=0x60e00000
usb_device=0:1
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10

If this looks good, let me know how to proceed. I don't have the serial connected ATM, but will when we're ready to test.
Re: Best way for automounting external USB drive(s)
March 12, 2020 06:53PM
TC,

> I booted up with another USB plugged in up front
> and everything booted fine. Playing around with
> that I decided to move around my rootfs usb. It
> was plugged in the back of the pogoplug in the top
> slot. I moved it around to the bottom slot and
> plugged in a couple of other drives including
> "Hitch" and it boots just fine now. Hitch is the
> everyday drive - so that is really all I need.
>
> I guess there is a process where it looks for the
> boot rootfs? It must be happier finding the
> rootfs in the bottom slot?

No it does not have such process. The box's behavior in enumerating USB drives is unpredictable. It's really depending on the Pogo hardware that spun up during power up.

With that said, without any envs logic to tell u-boot how to find the rootfs, the best location for the USB rootfs is the port next to the Ethernet port. But it is just a best location when all USB drives are equal. In the future, when you reboot or power up, the first drive to be enumerated might not be that one, and could be any USB that is plugged in at the moment.

To have this configured to boot consistently each time, you would either:

1. Install newer u-boot: uboot.2015.10-tld-2
or
2. Redfine the envs to script the logic. That's what I asked Mike to do a test with serial console so that it would be available for you, Mike and other people with 2013.10-tld-4 u-boot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 12, 2020 07:34PM
Mike,

Download the attached envs file uboot.2015.10-tld-3.ox820.environment.

cd /boot
cp -a uboot.2015.10-tld-3.ox820.environment uEnv.txt
sync

And reboot with serial console. Interrupt u-boot and copy/paste these envs to execute:

setenv devices 'usb ide'
setenv disks  '0 1 2 3'

setenv uenv_import 'echo importing envs ...; env import -t 0x60500000 $filesize'
setenv uenv_init_devices 'setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;'
setenv uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;'
setenv uenv_read_disk 'if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi'
setenv uenv_read 'echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi'
setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi'

And then

run bootcmd_uenv

It migh result in some error here, but I need to see it. If there is no error then proceed.

printenv

Please post the entire serial console log here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 4 time(s). Last edit at 03/18/2020 05:36PM by bodhi.
Attachments:
open | download - uboot.2015.10-tld-3.ox820.environment (2.6 KB)
Re: Best way for automounting external USB drive(s)
March 12, 2020 08:24PM
OK, got it. Will be tomorrow, I expect.
Re: Best way for automounting external USB drive(s)
March 13, 2020 05:07AM
Looks like my envs setup is incompleted:) will be back tomorrow for the revised instruction.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 17, 2020 05:52PM
I can confirm that the Pogo Pro with u-boot 2013-10 will not boot with a vfat USB plugged in in addition to the rootfs USB. It cannot find the rootfs drive, seems to get stuck on the vfat drive and where it can't understand the filesystem. I can get a serial log, if needed.
Re: Best way for automounting external USB drive(s)
March 17, 2020 09:44PM
Mike,

I've modified the post above.

https://forum.doozan.com/read.php?2,97669,98084#msg-98084

I only want to see it executes the bootcmd_uenv successfully, no need to boot.

Please try again and post serial console log here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 18, 2020 12:51PM
Results: no errors, but nothing echoed, just return to prompt after run bootcmd_uenv. Unfortunately, I didn't look at your last post closely and booted. Note the different environment size the 2 times I printed them, before and after the run bootcmd_uenv command.

Debian GNU/Linux 7 PogoPro ttyS0

U-Boot SPL 2013.10 (Apr 27 2014 - 19:08:27)
  Boot device: NAND
Attempting to set PLLA to 800 MHz ...
  plla_ctrl0 : 0000030a
  plla_ctrl1 : 00400000
  plla_ctrl2 : 007f0068
  plla_ctrl3 : 00000193

PLLA Set


U-Boot 2013.10-tld-3 (May 15 2014 - 14:54:14) for OXNAS

DRAM:  128 MiB
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:
Led:    GREEN
mii0
Main Loop
Hit any key to stop autoboot:  0
OX820 # setenv uenv_import 'echo importing envs ...; env import -t 0x60500000 $f                          ilesize'
OX820 # setenv uenv_init_devices 'setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;'
OX820 # setenv uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;'
OX820 # setenv uenv_read_disk 'if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi'
OX820 # setenv uenv_read 'echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi'
OX820 # setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi'
OX820 # printenv
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200n8
bootcmd=run dt_bootcmd_usb
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
console=console=ttyS0,115200n8
dt_bootcmd_usb=usb start; run dt_usb_bootcmd; usb stop; reset
dt_bootm=bootm $uimage_addr $uinitrd_addr $dtb_addr
dt_load_dtb=ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
dt_load_initrd=ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
dt_load_uimage=ext2load usb 0:1 $uimage_addr /boot/uImage
dt_usb_boot=run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
dt_usb_bootcmd=run usb_set_bootargs; run dt_usb_boot
dtb_addr=0x62c00000
ethact=mii0
ethaddr=00:25:31:01:b7:7b
if_netconsole=ping $serverip
ipaddr=192.168.0.222
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=run if_netconsole start_netconsole
serverip=192.168.0.220
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60500000 $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uimage_addr=0x60500000
uinitrd_addr=0x60e00000
usb_device=0:1
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10

Environment size: 1949/131068 bytes
OX820 # run bootcmd_uenv
>>>>>Nothing happened here, just returned the Ox820 prompt
>>>>>Printed environment again
OX820 # printenv
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200n8
bootcmd=run dt_bootcmd_usb
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
console=console=ttyS0,115200n8
dt_bootcmd_usb=usb start; run dt_usb_bootcmd; usb stop; reset
dt_bootm=bootm $uimage_addr $uinitrd_addr $dtb_addr
dt_load_dtb=ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
dt_load_initrd=ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
dt_load_uimage=ext2load usb 0:1 $uimage_addr /boot/uImage
dt_usb_boot=run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
dt_usb_bootcmd=run usb_set_bootargs; run dt_usb_boot
dtb_addr=0x62c00000
ethact=mii0
ethaddr=00:25:31:01:b7:7b
if_netconsole=ping $serverip
init_ide=ide reset
init_mmc=mmc rescan
init_usb=usb start
ipaddr=192.168.0.222
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=run if_netconsole start_netconsole
serverip=192.168.0.220
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60500000 $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do runuenv_read_disk; done; done;uenv_loaded=0
uenv_read=echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uimage_addr=0x60500000
uinitrd_addr=0x60e00000
usb_device=0:1
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10

Environment size: 2029/131068 bytes



Edited 1 time(s). Last edit at 03/18/2020 12:53PM by mikeh49.
Re: Best way for automounting external USB drive(s)
March 18, 2020 05:36PM
Hi Mike,

I've added 2 more envs to the instruction above.

setenv devices 'usb ide'
setenv disks  '0 1 2 3'

Please try again!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 18, 2020 06:41PM
Results:
OX820 # run bootcmd_uenv
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

Reset IDE: SATA PHY not ready for device 0
ide_preinit failed

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 0 ...
2640 bytes read in 151 ms (16.6 KiB/s)

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 1 ...
** Bad device usb 1 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 2 ...
** Bad device usb 2 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 3 ...
** Bad device usb 3 **

no IDE devices available

no IDE devices available

no IDE devices available

no IDE devices available
importing envs ...
OX820 #

environments:
OX820 # printenv
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200n8
bootcmd=run dt_bootcmd_usb
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
console=console=ttyS0,115200n8
devices=usb ide
disks=0 1 2 3
dt_bootcmd_usb=usb start; run dt_usb_bootcmd; usb stop; reset
dt_bootm=bootm $uimage_addr $uinitrd_addr $dtb_addr
dt_load_dtb=ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
dt_load_initrd=ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
dt_load_uimage=ext2load usb 0:1 $uimage_addr /boot/uImage
dt_usb_boot=run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
dt_usb_bootcmd=run usb_set_bootargs; run dt_usb_boot
dtb_addr=0x62c00000
ethact=mii0
ethaddr=00:25:31:01:b7:7b
if_netconsole=ping $serverip
ipaddr=192.168.0.222
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=run if_netconsole start_netconsole
serverip=192.168.0.220
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60500000 $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uimage_addr=0x60500000
uinitrd_addr=0x60e00000
usb_device=0:1
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10

Environment size: 1988/131068 bytes
Re: Best way for automounting external USB drive(s)
March 18, 2020 07:34PM
Strange, looks like it is working:

loading envs from usb 0 ...
2640 bytes read in 151 ms (16.6 KiB/s)

But the envs were not imported.


Let's try

setenv devices usb
setenv disks  '0 1 2 3'
setenv uenv_import 'echo importing envs ...; env import -t 0x60500000 $filesize'
setenv uenv_init_devices 'setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;'
setenv uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;'
setenv uenv_read_disk 'if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi'
setenv uenv_read 'echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi'
setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi'

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 18, 2020 07:39PM
I think I know what the problem was. I've changed the logic since I released this u-boot.

Setting device to USB will work around it, I hope.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 18, 2020 08:42PM
More results:
OX820 #
OX820 # setenv devices usb
OX820 # setenv disks  '0 1 2 3'
OX820 # setenv uenv_import 'echo importing envs ...; env import -t 0x60500000 $filesize'
OX820 # setenv uenv_init_devices 'setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;'
OX820 # setenv uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;'
OX820 # setenv uenv_read_disk 'if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi'
OX820 # setenv uenv_read 'echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi'
OX820 # setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi'
OX820 # printenv
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200n8
bootcmd=run dt_bootcmd_usb
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
console=console=ttyS0,115200n8
devices=usb
disks=0 1 2 3
dt_bootcmd_usb=usb start; run dt_usb_bootcmd; usb stop; reset
dt_bootm=bootm $uimage_addr $uinitrd_addr $dtb_addr
dt_load_dtb=ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
dt_load_initrd=ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
dt_load_uimage=ext2load usb 0:1 $uimage_addr /boot/uImage
dt_usb_boot=run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
dt_usb_bootcmd=run usb_set_bootargs; run dt_usb_boot
dtb_addr=0x62c00000
ethact=mii0
ethaddr=00:25:31:01:b7:7b
if_netconsole=ping $serverip
init_ide=ide reset
init_mmc=mmc rescan
ipaddr=192.168.0.222
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=run if_netconsole start_netconsole
serverip=192.168.0.220
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60500000 $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_initetenv=init_usb usb start
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uimage_addr=0x60500000
uinitrd_addr=0x60e00000
usb_device=0:1
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10

Environment size: 2063/131068 bytes
OX820 # run bootcmd_uenv
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 0 ...
2640 bytes read in 151 ms (16.6 KiB/s)

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 1 ...
** Bad device usb 1 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 2 ...
** Bad device usb 2 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 3 ...
** Bad device usb 3 **
importing envs ...
OX820 #

I'd like to think I entered the environments correctly.



Edited 1 time(s). Last edit at 03/19/2020 04:00AM by mikeh49.
Re: Best way for automounting external USB drive(s)
March 19, 2020 05:23AM
> importing envs ...

So after this,

printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 19, 2020 08:31AM
OK, now I get it, what an idiot. Will be added shortly.
OX820 # printenv
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200n8
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x60500000 0x60e00000 0x62c00000; else bootm 0x60500000 0x60e00000; fi; else if run load_dtb; then bootm 0x60500000 - 0x62c00000; else bootm 0x60500000; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
console=console=ttyS0,115200n8
device=0:1
devices=usb
disks=0 1 2 3
dt_bootcmd_usb=usb start; run dt_usb_bootcmd; usb stop; reset
dt_bootm=bootm $uimage_addr $uinitrd_addr $dtb_addr
dt_load_dtb=ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
dt_load_initrd=ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
dt_load_uimage=ext2load usb 0:1 $uimage_addr /boot/uImage
dt_usb_boot=run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
dt_usb_bootcmd=run usb_set_bootargs; run dt_usb_boot
dtb_addr=0x62c00000
dtb_file=/boot/dts/ox820-pogoplug-pro.dtb
ethact=mii0
ethaddr=52:3b:20:9c:11:51
filesize=a50
if_netconsole=ping $serverip
init_ide=ide reset
init_mmc=mmc rescan
init_usb=usb start
ipaddr=192.168.0.222
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device 0x62c00000 $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device 0x60500000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 0x60500000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60500000 $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_initetenv=init_usb usb start
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_loaded=1
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uimage_addr=0x60500000
uinitrd_addr=0x60e00000
usb_custom_params=zswap.enabled=1
usb_device=0:1
usb_ready_retry=15
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10

Environment size: 3562/131068 bytes



Edited 1 time(s). Last edit at 03/19/2020 09:41AM by mikeh49.
Re: Best way for automounting external USB drive(s)
March 19, 2020 05:40PM
Hi Mike,

Looks very good!

So with this set of envs, you can plug in as many USB as you want.

Your USB rootfs is already labeled rootfs. All other USB drives have data only, and their partitions are labeled with other names.

At the u-boot prompt, go ahead and adjust the number of disks to 10... or whatever necessary and, boot:

setenv disks '0 1 2 3 4 5 6 7 8 9'
boot

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 19, 2020 06:48PM
Sorry to say, it doesn't work. I plugged in a random vfat USB, not labeled rootfs, entered boot at the u-boot prompt, and it went into a boot loop. I then reentered the setenv commands, ran bootcmd_uenv and got the importing envs response and then the u-boot prompt. Plugged in the second USB and entered boot. A full serial log below:
U-Boot 2013.10-tld-3 (May 15 2014 - 14:54:14) for OXNAS

DRAM:  128 MiB
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:
Led:    GREEN
mii0
Main Loop
Hit any key to stop autoboot:  0
OX820 # setenv devices usb
OX820 # setenv disks  '0 1 2 3'
OX820 # setenv uenv_import 'echo importing envs ...; env import -t 0x60500000 $filesize'
OX820 # setenv uenv_init_devices 'setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;'
OX820 # uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;'
Unknown command 'uenv_load' - try 'help'
OX820 # setenv uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;'
OX820 # setenv uenv_read_disk 'if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi'
OX820 # setenv uenv_read 'echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi'
OX820 # setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi'
OX820 # run bootcmd_uenv
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 0 ...
2640 bytes read in 151 ms (16.6 KiB/s)

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 1 ...
** Bad device usb 1 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 2 ...
** Bad device usb 2 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 3 ...
** Bad device usb 3 **
importing envs ...
OX820 # printenv
autoload=no
baudrate=115200
bootargs=console=ttyS0,115200n8
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x60500000 0x60e00000 0x62c00000; else bootm 0x60500000 0x60e00000; fi; else if run load_dtb; then bootm 0x60500000 - 0x62c00000; else bootm 0x60500000; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
console=console=ttyS0,115200n8
device=0:1
devices=usb ide
disks=0 1 2 3
dt_bootcmd_usb=usb start; run dt_usb_bootcmd; usb stop; reset
dt_bootm=bootm $uimage_addr $uinitrd_addr $dtb_addr
dt_load_dtb=ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
dt_load_initrd=ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
dt_load_uimage=ext2load usb 0:1 $uimage_addr /boot/uImage
dt_usb_boot=run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
dt_usb_bootcmd=run usb_set_bootargs; run dt_usb_boot
dtb_addr=0x62c00000
dtb_file=/boot/dts/ox820-pogoplug-pro.dtb
ethact=mii0
ethaddr=52:3b:20:9c:11:51
filesize=a50
if_netconsole=ping $serverip
init_ide=ide reset
init_mmc=mmc rescan
init_usb=usb start
ipaddr=192.168.0.222
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device 0x62c00000 $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device 0x60e00000 /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device 0x60500000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=41000000.nand
mtdparts=mtdparts=41000000.nand:14m(boot),-(data)
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 0x60500000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x60500000 $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_loaded=1
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uimage_addr=0x60500000
uinitrd_addr=0x60e00000
usb_custom_params=zswap.enabled=1
usb_device=0:1
usb_ready_retry=15
usb_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10

Environment size: 3530/131068 bytes
OX820 # boot
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found

Reset IDE: SATA PHY not ready for device 0
ide_preinit failed

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 0 ...
Unknown command 'load' - try 'help'

no IDE devices available
running scan_disk ...
Scan device usb
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
device usb 0:1
Unknown command 'load' - try 'help'
device usb 1:1
Unknown command 'load' - try 'help'
device usb 2:1
Unknown command 'load' - try 'help'
device usb 3:1
Unknown command 'load' - try 'help'
Scan device ide

Reset IDE: SATA PHY not ready for device 0
ide_preinit failed
device ide 0:1
Unknown command 'load' - try 'help'
device ide 1:1
Unknown command 'load' - try 'help'
device ide 2:1
Unknown command 'load' - try 'help'
device ide 3:1
Unknown command 'load' - try 'help'
loading uImage ...
Unknown command 'load' - try 'help'
loading uInitrd ...
Unknown command 'load' - try 'help'
loading DTB /boot/dts/ox820-pogoplug-pro.dtb ...
Unknown command 'load' - try 'help'
Wrong Image Format for bootm command

Led:    ORANGE (Failed)
ERROR: can't get kernel image!
resetting ...
Re: Best way for automounting external USB drive(s)
March 19, 2020 07:25PM
Mike,

Ah. We are very close, but I forgot to adjust the load commands. Recall that in the first go round I use "load", which is not supported by this u-boot version. And then I changed the load command to use ext2load in the current envs:


setenv devices usb
setenv disks  '0 1 2 3'
setenv uenv_import 'echo importing envs ...; env import -t 0x60500000 $filesize'
setenv uenv_init_devices 'setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;'
setenv uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;'
setenv uenv_read_disk 'if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi'
setenv uenv_read 'echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi'
setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi'



So the default evns inside uEnv.txt need to be adjusted further. Any load command must be replaced by ext2load.

Here is the revised envs to be copied to uEnv.txt.

Attached: uboot.2015.10-tld-3.ext2load.ox820.environment

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Attachments:
open | download - uboot.2015.10-tld-3.ext2load.ox820.environment (2.6 KB)
Re: Best way for automounting external USB drive(s)
March 19, 2020 08:05PM
OK, booted with just the rootfs USB connected:
OX820 # setenv devices usb
OX820 # setenv disks  '0 1 2 3'
OX820 # printenv devices
devices=usb
OX820 # setenv uenv_import 'echo importing envs ...; env import -t 0x60500000 $filesize'
OX820 # setenv uenv_init_devices 'setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;'
OX820 # setenv uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;'
OX820 # setenv uenv_read_disk 'if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi'
OX820 # setenv uenv_read 'echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi'
OX820 # setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi'
OX820 # run bootcmd_uenv
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 0 ...
2660 bytes read in 151 ms (16.6 KiB/s)

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 1 ...
** Bad device usb 1 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 2 ...
** Bad device usb 2 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 3 ...
** Bad device usb 3 **
importing envs ...
OX820 # boot
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

Reset IDE: SATA PHY not ready for device 0
ide_preinit failed

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 0 ...
2660 bytes read in 151 ms (16.6 KiB/s)

no IDE devices available
importing envs ...
running scan_disk ...
Scan device usb
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
device usb 0:1
1 bytes read in 189 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
etc...

Do I have to do some fw_savenv so the setenv we just did are not erased at the next boot?

I decided to keep it simple with just the single USB. I'd like to not lose all we've done so far. :)
Re: Best way for automounting external USB drive(s)
March 19, 2020 09:14PM
Awesome :)


> Do I have to do some fw_savenv so the setenv we
> just did are not erased at the next boot?

You can either saveenv at the u-boot prompt after entering all setenv's, or in Debian, do

fw_setenv devices usb
fw_setenv disks  '0 1 2 3'
fw_setenv uenv_import 'echo importing envs ...; env import -t 0x60500000 $filesize'
fw_setenv uenv_init_devices 'setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;'
fw_setenv uenv_load 'run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in $disks; do run uenv_read_disk; done; done;'
fw_setenv uenv_read_disk 'if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi'
fw_setenv uenv_read 'echo loading envs from $devtype $disknum ...; if ext2load $devtype $disknum:1 0x60500000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi'
fw_setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi'


> I decided to keep it simple with just the single
> USB. I'd like to not lose all we've done so far.
> :)

Now save the envs and then, go for broke and plug in more USBs :)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 20, 2020 02:01PM
Testing results:

2 USB connected, rootfs in front USB, vfat USB in one of the back connectors, boot process not interrupted:
U-Boot 2013.10-tld-3 (May 15 2014 - 14:54:14) for OXNAS

DRAM:  128 MiB
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:
Led:    GREEN
mii0
Main Loop
Hit any key to stop autoboot:  0
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
Wrong Image Format for bootm command

Led:    ORANGE (Failed)
ERROR: can't get kernel image!
stopping USB..
resetting ...

Note that USB in back connector gets sda1.

Same as above, but interrupt boot and run bootcmd_uenv:
Hit any key to stop autoboot:  0
OX820 # run bootcmd_uenv
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 0 ...
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 1 ...
2660 bytes read in 150 ms (16.6 KiB/s)

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 2 ...
** Bad device usb 2 **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 3 ...
** Bad device usb 3 **
importing envs ...
OX820 # boot
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found

Reset IDE: SATA PHY not ready for device 0
ide_preinit failed

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83
loading envs from usb 0 ...
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **

no IDE devices available
running scan_disk ...
Scan device usb
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
device usb 0:1
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
device usb 1:1
1 bytes read in 188 ms (0 Bytes/s)
Found bootable drive on usb 1
loading uImage ...
4488520 bytes read in 519 ms (8.2 MiB/s)
loading uInitrd ...
3005928 bytes read in 366 ms (7.8 MiB/s)
loading DTB /boot/dts/ox820-pogoplug-pro.dtb ...
7029 bytes read in 215 ms (31.3 KiB/s)
## Booting kernel from Legacy Image at 60500000 ...
   Image Name:   Linux-4.1.0-oxnas-tld-1
   Image Type:   ARM Linux Kernel Image (uncompressed
>>> and away we go >>>

It looks like bootcmd_uenv is not getting called or not running when called in the loaded environments:
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset

I don't know the sequence of the environment commands execution, so I may be all wet.

I'll try a few other things and report anything interesting.
Re: Best way for automounting external USB drive(s)
March 20, 2020 05:13PM
Thanks Mike,

Right! there is one more env to save.

Power up, interrupt serial console, and

setenv bootcmd 'run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset'
boot

If it boot into Debian OK (whether only with single USB, or multiple USB), then set it permanently:

fw_setenv bootcmd 'run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; reset'

And reboot. And observe serial console log.

If it has problem with vfat again, I'll take a look to see how to change the envs.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 20, 2020 05:20PM
OK, will do and report shortly. It can handle the vfat device if I interrupt boot, run bootcmd_uenv and then boot. It fusses about it but keeps looking for a bootable device, eventually finds it, and boots OK. So, the basic logic is OK, it just needs to run.

UPDATE: Turns out 2 environments needed to be added: bootcmd_uenv and bootcmd_exec, with that it boots with the rootfs and 2 other USBs. I made them permanent from Debian and it booted successfully.

As you noted up-thread, the lowest USB on the back is the first enumerated and the front is last. With the rootfs USB in the lowest port, it gets sda1.

Here's the serial log of a successful boot:
Hit any key to stop autoboot:  0
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 3 Storage Device(s) found

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 2  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     63              1013697         0080377c-01     0b Boot
loading envs from usb 0 ...
2660 bytes read in 151 ms (16.6 KiB/s)

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 2  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     63              1013697         0080377c-01     0b Boot
loading envs from usb 1 ...
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 2  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     63              1013697         0080377c-01     0b Boot
loading envs from usb 2 ...
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            7985152         dcac294f-01     83


Partition Map for USB device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     32              125792          6f0def6b-01     06 Boot


Partition Map for USB device 2  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     63              1013697         0080377c-01     0b Boot
loading envs from usb 3 ...
** Bad device usb 3 **
importing envs ...
running scan_disk ...
Scan device usb
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 3 Storage Device(s) found
device usb 0:1
1 bytes read in 189 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
4488520 bytes read in 514 ms (8.3 MiB/s)
loading uInitrd ...
3005928 bytes read in 372 ms (7.7 MiB/s)
loading DTB /boot/dts/ox820-pogoplug-pro.dtb ...
7029 bytes read in 216 ms (31.3 KiB/s)
## Booting kernel from Legacy Image at 60500000 ...
   Image Name:   Linux-4.1.0-oxnas-tld-1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4488456 Bytes = 4.3 MiB
   Load Address: 60008000
   Entry Point:  60008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 60e00000 ...
   Image Name:   initramfs-4.1.0-oxnas-tld-1
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    3005864 Bytes = 2.9 MiB
   Load Address: 60000000
   Entry Point:  60000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 62c00000
   Booting using the fdt blob at 0x62c00000
   Loading Kernel Image ... OK
   Loading Ramdisk to 67b4c000, end 67e29da8 ... OK
   Loading Device Tree to 67b47000, end 67b4bb74 ... OK
>>> and so on >>>

Now that we have the environments in NAND (I guess) do we need to load from /boot/Uenv.txt on every boot?



Edited 1 time(s). Last edit at 03/20/2020 06:17PM by mikeh49.
Re: Best way for automounting external USB drive(s)
March 21, 2020 01:59AM
Hi Mike,

> UPDATE: Turns out 2 environments needed to
> be added: bootcmd_uenv and bootcmd_exec,
> with that it boots with the rootfs and 2 other
> USBs. I made them permanent from Debian and it
> booted successfully.

Cool!

> As you noted up-thread, the lowest USB on the back
> is the first enumerated and the front is last.
> With the rootfs USB in the lowest port, it gets
> sda1.

Right. The idea is that we don't care which drive letter the rootfs drive is assigned to. It should be always be found by u-boot and boot sucessfully. I usually plug in USB rootfs in front port so I can see the small LED light while it is booting.

> Now that we have the environments in NAND (I
> guess) do we need to load from /boot/Uenv.txt on
> every boot?

Not yet.

Now reboot to serial console prompt, run

run bootcmd_uenv
printenv
and then
saveenv

After this, boot into Debian, and remove uEnv.txt.

cd /boot
mv uEnv.txt uEnv.txt.save
And then reboot a couple times to make sure it always work. After that your box is all set.

But I would like to go further, and make something everybody can use. Boot into Debian, and
cd /boot
fw_printenv > uboot.2013.10-tld-4.ox820.environment

Please attach the file uboot.2013.10-tld-4.ox820.environment here.

After that, I will make a shell script and then you do a final test with it, also set the envs to your specific environment (ipaddr, serverip, ethaddr).

And we'll have a script that will work for 2013-2015 u-boot version.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
March 21, 2020 09:21AM
All worked OK. Three boots, with and without extra USBs, consistent results each time, serial log looked as expected. It complains about uEnv.txt not found, but keeps going.
loading envs from usb 0 ...
** File not found /boot/uEnv.txt **

In this case the rootfs was usb 0.


Environments file attached.



Edited 1 time(s). Last edit at 03/21/2020 09:24AM by mikeh49.
Attachments:
open | download - uboot.2013.10-tld-4.ox820.environment (3.4 KB)
Re: Best way for automounting external USB drive(s)
March 21, 2020 05:21PM
> All worked OK. Three boots, with and without
> extra USBs, consistent results each time, serial
> log looked as expected. It complains about
> uEnv.txt not found, but keeps going.

Cool! let me reformat it in a shell script, with some envs removed and post back.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Best way for automounting external USB drive(s)
April 05, 2020 04:15PM
Hi guys!

I hope everyone is safe and healthy.

I know it is not exactly the answer you guys are working toward - but I have had no trouble boots since moving my rootfs usb plug to the one closest to the Cat5 port.

I am now moving on to my next pogoplug adventure.

I am trying to backup my big 1 tb drive and come up with a regular backup schedule etc.

But I am having troubles with the rsync command.

So my source partition is mounted with autofs at /share/hitch/ and the destination partition is at /share/hammer/

I have tried a bunch of rsync commands....

rsync -ravHl --delete /share/hitch/ /share/hammer/
rsync -rvHX --delete /share/hitch/ /share/hammer/
rsync -r /share/hitch/ /share/hammer/
rsync -av /share/hitch /share/hammer
rsync -ravHl --delete /share/hitch/* /share/hammer/


I bet I am missing something really easy - but I can't figure it out yet. Any pointers are really appreciated.

Thanks in advance,
TC

====
Moderator edit: please use code tags (formatted code button) to post logs and commands.



Edited 1 time(s). Last edit at 04/05/2020 06:16PM by bodhi.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: