Welcome! Log In Create A New Profile

Advanced

Use uEnv.txt for Testing

Posted by SiliCAT 
Use uEnv.txt for Testing
January 22, 2018 09:25PM
My Pogo server have run on the NFS for more than 1 year, and I never worry about the lifespan of the SD card. An old IDE hard disk is attached to the Openwrt router by USB 2.0 and provide a stable rootfs for the Pogo.
Several months ago I got a new ASUS-merlin router, I am going to move the rootfs to the new one. This time, I'll try using uEnv.txt to test the NFS booting.

I put all tsunulukai's envs in uEnv.txt
cat /boot/uEnv.txt
net_dhcp_c=1
net_dhcp_s=1
net_c_ipaddr=
net_c_netmask=
net_c_gatewayip=
net_nfs_path=/srv/nfs/hosts/dockstar
net_nfs_dtb=boot/dts/kirkwood-dockstar.dtb
net_nfs_initrd=boot/uInitrd
net_nfs_kernel=boot/uImage
console=ttyS0,115200
autoload=no
net_check_dhcp_c=if test $net_dhcp_c -eq 1 ; then run net_set_c_ip_dhcp; else run net_set_c_ip_stat; fi;echo ** IP Address:  $ipaddr; echo ** Subnet Mask: $netmask; echo ** Def Gateway: $gatewayip
net_set_c_ip_dhcp=dhcp; echo; echo ** Getting IP Settings by DHCP (net_dhcp_c = 1):
net_set_c_ip_stat=setenv ipaddr $net_c_ipaddr; setenv netmask $net_c_netmask; setenv gatewayip $net_c_gatewayip; echo; echo ** Using static IP Settings (net_dhcp_c = 0):
net_check_dhcp_s=if test $net_dhcp_s -eq 1 && test $net_dhcp_c -eq 1 ; then run net_set_s_ip_dhcp; else run net_set_s_ip_stat; fi; echo ** NFS Boot Server: $net_nfs_server; echo
net_set_s_ip_dhcp=setenv net_nfs_server $serverip;echo; echo ** Getting NFS Boot Server by DHCP (net_dhcp_s and net_dhcp_c = 1):
net_set_s_ip_stat=echo; echo ** Using static NFS Boot Server (net_dhcp_s or net_dhcp_c = 0) :
net_load_dtb=echo NFS loading DTB     :$net_nfs_server:$net_nfs_path/$net_nfs_dtb ...   ; nfs $load_dtb_addr    $net_nfs_server:$net_nfs_path/$net_nfs_dtb; echo
net_load_initrd=echo NFS loading uInitrd :$net_nfs_server:$net_nfs_path/$net_nfs_initrd ...; nfs $load_initrd_addr $net_nfs_server:$net_nfs_path/$net_nfs_initrd; echo
net_load_uimage=echo NFS loading uImage  :$net_nfs_server:$net_nfs_path/$net_nfs_kernel ...; nfs $load_uimage_addr $net_nfs_server:$net_nfs_path/$net_nfs_kernel; echo
net_bootcmd=run net_check_dhcp_c; run net_check_dhcp_s; run net_set_bootargs; run net_bootcmd_exec
net_set_bootargs=setenv serverip $net_nfs_server; setenv bootargs console=$console root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=$net_nfs_server:$net_nfs_path/,rsize=32768,wsize=32768,hard,intr,udp,v3 ip=$ipaddr:$net_nfs_server:$gatewayip:$netmask:dockstar:eth0:off $mtdparts $custom_params; echo ** Kernel Boot Arguments:; echo ** $bootargs; echo
net_bootcmd_exec=run net_load_uimage; if run net_load_initrd; then if run net_load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi

In netconsole:
run bootcmd_uenv

The envs are successfully imported
loading envs from mmc 0 ...
2346 bytes read in 15 ms (152.3 KiB/s)
importing envs ...



Edited 1 time(s). Last edit at 01/22/2018 09:25PM by SiliCAT.
Re: Use uEnv.txt for Testing
January 23, 2018 03:32AM
SiliCAT,

There is a simpler setup:
https://forum.doozan.com/read.php?2,28351


Quote

"Section Three" Boot from NFS share

The following link gives the steps necessary to configure your u-boot to boot from the NFS share. Please note though that although it discusses using TFTP in the process, this is not necessary and those steps can be avoided.
Boot your Dockstar/Plug by TFTP/NFS

an example uboot statement kindly provided by the master of u-boot @bodhi is included below for you to amend / modify to match your share description and nfs path

bootcmd_nfs=setenv nfs_server "192.168.0.224"; setenv nfs_path "/srv/nfs/hosts/tldDebian2"; setenv nfs_bootcmd "run nfs_set_bootargs; run nfs_boot"; setenv nfs_ipconfig "192.168.0.229:192.168.0.224:192.168.0.1:255.255.0.0:tldDebian2::off"; setenv nfs_set_bootargs "setenv bootargs console=ttyS0,115200 root=/dev/nfs nfsroot=$nfs_server:$nfs_path,v3 rootfstype=nfs rootwait ip=$nfs_ipconfig $mtdparts"; setenv nfs_load_uimage "nfs 0x800000 $nfs_server:$nfs_path/boot/uImage"; setenv nfs_load_uinitrd "nfs 0x1100000 $nfs_server:$nfs_path/boot/uInitrd"; setenv nfs_load_dtb "nfs 0x1c00000 $nfs_server:$nfs_path/boot/dts/kirkwood-pogo_e02.dtb"; setenv nfs_bootm "bootm 0x800000 0x1100000 0x1c00000"; setenv nfs_boot "run nfs_load_uimage; run nfs_load_uinitrd; run nfs_load_dtb; run nfs_bootm"; echo "Booting NFS root…"; run nfs_bootcmd

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Use uEnv.txt for Testing
January 23, 2018 12:14PM
Hi bodhi,
Very good reference and very clear guidance.
But I encountered the same problem, as I was using the old uboot.
nfs_load_uimage=nfs 0x800000 $nfs_server:$nfs_path/boot/uImage
nfs_load_uinitrd=nfs 0x1100000 $nfs_server:$nfs_path/boot/uInitrd
nfs_load_dtb=nfs 0x1c00000 $nfs_server:$nfs_path/boot/dts/kirkwood-pogo_e02.dtb
These will make the booting process hang up.
Luckily Merlin provides a switch to enable the legacy NFS V2 support. It might work with this option.



Edited 1 time(s). Last edit at 01/23/2018 12:21PM by SiliCAT.
Re: Use uEnv.txt for Testing
January 23, 2018 02:28PM
SiliCAT.,

As I recalled, with Debian stretch, you need to set the NFS version in the rootfs to enable NFS V2 to make it work with old u-boot. The new u-boot (2017.07-tld-1) has NFS V3 so it would work right away.

See:
https://forum.doozan.com/read.php?3,12261,35307#msg-35307

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 01/23/2018 02:46PM by bodhi.
Re: Use uEnv.txt for Testing
January 23, 2018 06:04PM
Hi bodhi,

I tried, but it was not what I expected.
U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:34:01 -0700)
Pogoplug V4

SoC:   Kirkwood 88F6192_A1
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  128 MiB
MMC:   MVEBU_MMC: 0
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
No link on egiga0
ping failed; host 172.16.16.118 is not alive
Using egiga0 device

ARP Retry count exceeded; starting again
ping failed; host 172.16.16.118 is not alive
Using egiga0 device

ARP Retry count exceeded; starting again
ping failed; host 172.16.16.118 is not alive
Using egiga0 device

ARP Retry count exceeded; starting again
ping failed; host 172.16.16.118 is not alive
Using egiga0 device

ARP Retry count exceeded; starting again
ping failed; host 172.16.16.118 is not alive
Hit any key to stop autoboot:  0
Pogov4> dhcp
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 252
*** Unhandled DHCP Option in OFFER/ACK: 252
DHCP client bound to address 192.168.1.99 (12 ms)
*** Warning: no boot file name; using 'C0A80163.img'
Using egiga0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.99
Filename 'C0A80163.img'.
Load address: 0x800000
Loading: *
TFTP error: 'file /tmp/mnt/sda1/tftpboot/C0A80163.img not found' (1)
Not retrying...
Pogov4> nfs 0x1c00000 192.168.1.1:/tmp/mnt/sda1/nfs/pogo.hosts/PogoplugV4/boot/dts/kirkwood-pogoplug_v4.dtb
*** ERROR: Cannot mount
T T T T T T T T T T
The light blinked red continuously so I had to shut the power down.

But after I enabled the router's legacy NFS V2 support, It came out
Pogov4> nfs 0x1c00000 192.168.1.1:/tmp/mnt/sda1/nfs/pogo.hosts/PogoplugV4/boot/dts/kirkwood-pogoplug_v4.dtb
###
done
Bytes transferred = 10266 (281a hex)
Re: Use uEnv.txt for Testing
January 23, 2018 06:56PM
SiliCAT,

That's probably a different problem. I'm using U-Boot 2017.07-tld-1 on 2 Pogo V4 boxes, and both NFS rootfs are on a Debian stretch server (with no V2 enabled).

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Use uEnv.txt for Testing
January 24, 2018 08:16AM
Hi bodhi,

Making the whole booting process on NFSv3, is elegant and perfect.

But I met another problem, the Pogo is able to boot, but the rootfs is read-only. (I can mount the NFS rootfs on my rpi and it's a rw filesystem)

I've changed fstab to
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/root       /               nfs    noatime,errors=remount-ro 0 1


My Pogo's envs:
autoload=no
nfs_server=192.168.1.1
nfs_path=/tmp/mnt/sda1/nfs/pogo.hosts/PogoplugV4
tftp_load_uimage=tftp 0x800000 uImage
tftp_load_uinitrd=tftp 0x1100000 uInitrd
tftp_load_dtb=tftp 0x1c00000 dts/kirkwood-pogoplug_v4.dtb
net_bootm=bootm 0x800000 0x1100000 0x1c00000
bootcmd_net=echo "Booting NFS root..."; dhcp; run net_bootcmd
net_bootcmd=run nfs_set_ip; run nfs_set_bootargs; run net_boot
nfs_set_ip=setenv nfs_ipconfig $ipaddr:$nfs_server:$gatewayip:$netmask:PogoplugV4::off
nfs_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/nfs nfsroot=$nfs_server:$nfs_path,v3 rootfstype=nfs rootwait ip=$nfs_ipconfig $mtdparts
net_boot=run tftp_load_uimage; run tftp_load_uinitrd; run tftp_load_dtb; run net_bootm
Re: Use uEnv.txt for Testing
January 24, 2018 10:52AM
There might be a mistake in the Wiki.
root=/dev/nfs rw
without the rw, the filesystem is mounted as read-only.
Re: Use uEnv.txt for Testing
January 24, 2018 11:56AM
SiliCAT,

> There might be a mistake in the Wiki.
>
> root=/dev/nfs rw
>
> without the rw, the filesystem is mounted
> as read-only.


That's odd. I did not have to specify rw. What is the permission of your top level? does it look like this:

drwxr-xr-x 25 root root  4096 Feb 24  2015 tldDebian2

Note: that tldDebian2 folder is specified in my bootcmd_nfs:

Quote

bootcmd_nfs=setenv nfs_server "192.168.0.224"; setenv nfs_path "/srv/nfs/hosts/tldDebian2"; setenv nfs_bootcmd "run nfs_set_bootargs; run nfs_boot"; setenv nfs_ipconfig "192.168.0.229:192.168.0.224:192.168.0.1:255.255.0.0:tldDebian2::off"; setenv nfs_set_bootargs "setenv bootargs console=ttyS0,115200 root=/dev/nfs nfsroot=$nfs_server:$nfs_path,v3 rootfstype=nfs rootwait ip=$nfs_ipconfig $mtdparts"; setenv nfs_load_uimage "nfs 0x800000 $nfs_server:$nfs_path/boot/uImage"; setenv nfs_load_uinitrd "nfs 0x1100000 $nfs_server:$nfs_path/boot/uInitrd"; setenv nfs_load_dtb "nfs 0x1c00000 $nfs_server:$nfs_path/boot/dts/kirkwood-pogo_e02.dtb"; setenv nfs_bootm "bootm 0x800000 0x1100000 0x1c00000"; setenv nfs_boot "run nfs_load_uimage; run nfs_load_uinitrd; run nfs_load_dtb; run nfs_bootm"; echo "Booting NFS root…"; run nfs_bootcmd

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Use uEnv.txt for Testing
January 24, 2018 12:37PM
Hi bodhi,

The top level on the router:
SiliCAT@RT-AC68U:/tmp/mnt/sda1/nfs/pogo.hosts# ls -l
drwxr-xr-x   21 SiliCAT  root          4096 Jan 24 13:00 PogoplugV4

All my envs in the uEnv.txt are
autoload=no
nfs_server=192.168.1.1
nfs_path=/tmp/mnt/sda1/nfs/pogo.hosts/PogoplugV4
tftp_load_uimage=tftp 0x800000 uImage
tftp_load_uinitrd=tftp 0x1100000 uInitrd
tftp_load_dtb=tftp 0x1c00000 dts/kirkwood-pogoplug_v4.dtb
net_bootm=bootm 0x800000 0x1100000 0x1c00000
bootcmd_net=echo "Booting NFS root..."; dhcp; run net_bootcmd
net_bootcmd=run nfs_set_ip; run nfs_set_bootargs; run net_boot
nfs_set_ip=setenv nfs_ipconfig $ipaddr:$nfs_server:$gatewayip:$netmask:PogoplugV4:eth0:off
nfs_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/nfs rw nfsroot=$nfs_server:$nfs_path,v3 rootfstype=nfs rootwait ip=$nfs_ipconfig $mtdparts
net_boot=run tftp_load_uimage; run tftp_load_uinitrd; run tftp_load_dtb; run net_bootm

bootcmd_exec=run bootcmd_net
And it works when I add the rw

-SiliCAT



Edited 2 time(s). Last edit at 01/24/2018 12:39PM by SiliCAT.
Re: Use uEnv.txt for Testing
January 24, 2018 01:04PM
SiliCAT,

> drwxr-xr-x 21 SiliCAT root 4096 Jan 24 13:00 PogoplugV4

Try root root.

> drwxr-xr-x 21 root root 4096 Jan 24 13:00 PogoplugV4

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Use uEnv.txt for Testing
January 24, 2018 01:57PM
Hi bodhi,

Looks like there is no root user in asuswrt-merlin.
admin is Asuswrt's UID 1. It's root, but with a different name. and admin will be replaced by a login ID which is chosen by the user.
There is a root group.



Edited 1 time(s). Last edit at 01/24/2018 02:00PM by SiliCAT.
Re: Use uEnv.txt for Testing
January 24, 2018 04:08PM
SiliCAT Wrote:
-------------------------------------------------------
> Hi bodhi,
>
> Looks like there is no root user in
> asuswrt-merlin.
> admin is Asuswrt's UID 1. It's root, but with a
> different name. and admin will be replaced by a
> login ID which is chosen by the user.
> There is a root group.


I meant in the Debian stretch rootfs.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Use uEnv.txt for Testing
January 25, 2018 01:19PM
Hi bodhi,

I don't have a Debian stretch NFS server yet.

I think you are right. I believe there are some differences between the NFS on WRT and on the Debian, which lead to different result.


- SiliCAT
Re: Use uEnv.txt for Testing
January 26, 2018 08:41AM
Hi bodhi,

I managed to get a nfs server on Ubuntu 16.04.3 LTS (Xenial Xerus)

Settings on the server:
/srv/nfs-export *(rw,sync,no_subtree_check,no_root_squash)

Without the rw option, it still got a read-only rootfs on the pogo client.
silicat@pogotest:~$ touch test
touch: cannot touch 'test': Read-only file system

My uEnv.txt:
autoload=no
nfs_server=172.16.16.207
nfs_path=/srv/nfs-export/Testbed/pogoplug.hosts/rootfs/4.4.0/tldDebian2
nfs_load_uimage=nfs 0x800000 $nfs_server:$nfs_path/boot/uImage
nfs_load_uinitrd=nfs 0x1100000 $nfs_server:$nfs_path/boot/uInitrd
nfs_load_dtb=nfs 0x1c00000 $nfs_server:$nfs_path/boot/dts/kirkwood-pogoplug_v4.dtb
nfs_bootm=bootm 0x800000 0x1100000 0x1c00000
bootcmd_nfs=echo "Booting NFS root..."; dhcp; run nfs_bootcmd
nfs_bootcmd=run nfs_set_ip; run nfs_set_bootargs; run nfs_boot
nfs_set_ip=setenv nfs_ipconfig $ipaddr:$nfs_server:$gatewayip:$netmask:tldDebian2:eth0:off
nfs_set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/nfs nfsroot=$nfs_server:$nfs_path,v3 rootfstype=nfs rootwait ip=$nfs_ipconfig $mtdparts
nfs_boot=run nfs_load_uimage; run nfs_load_uinitrd; run nfs_load_dtb; run nfs_bootm
bootcmd_exec=run bootcmd_nfs

- SiliCAT



Edited 1 time(s). Last edit at 01/26/2018 10:17AM by SiliCAT.
Re: Use uEnv.txt for Testing
January 26, 2018 09:08AM
SiliCAT

On the server, what is the permission of

ls -l /srv
ls -l /srv/nfs-export

And also verify with

exportfs -s

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Use uEnv.txt for Testing
January 26, 2018 09:46AM
Hi bodih,

On the server:
silicat@odroid:/srv/nfs-export/Testbed/pogoplug.hosts/rootfs/4.4.0$ cd
silicat@odroid:~$ ls -l /srv
total 4
drwxr-xr-x 3 root root 4096 Jan 26 07:46 nfs-export
silicat@odroid:~$ ls -l /srv/nfs-export
total 4
drwxr-xr-x 3 root root 4096 Jan 26 07:44 Testbed
silicat@odroid:~$ ls -l /srv/nfs-export/Testbed/pogoplug.hosts/rootfs/4.4.0/
total 4
drwxr-xr-x 21 root root 4096 Jan 26 08:26 tldDebian2

Looks like the 16.04.3 LTS exportfs command doesn't have a '-s' option.
silicat@odroid:~$ exportfs -s
exportfs: invalid option -- 's'
usage: exportfs [-afhioruv] [host:/path]
silicat@odroid:~$ uname -r
4.14.5-92
Re: Use uEnv.txt for Testing
January 26, 2018 02:44PM
Perhaps it's a different version of NFS server. Here is mine.

dpkg -l | grep nfs
ii  libnfsidmap2:armel                     0.25-5.1                       armel        NFS idmapping library
ii  nfs-common                             1:1.3.4-2.1                    armel        NFS support files common to client and server
ii  nfs-kernel-server                      1:1.3.4-2.1                    armel        support for NFS kernel server

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Use uEnv.txt for Testing
January 26, 2018 03:34PM
Hi bodhi,

It is different.
ii  libnfsidmap2:armhf              0.25-5                                     armhf        NFS idmapping library
ii  nfs-common                      1:1.2.8-9ubuntu12.1                        armhf        NFS support files common to client and server
ii  nfs-kernel-server               1:1.2.8-9ubuntu12.1                        armhf        support for NFS kernel server

- SiliCAT
Re: Use uEnv.txt for Testing
January 26, 2018 03:57PM
SiliCAT,


I think you should use the rw option in u-boot env for now. In the future, if you have another Pogo, you can try to put the NFS rootfs on it and see if you will get the same result as I did.

This issue is minor, but I like the server to determine the access mode and avoid changing u-boot env.

-bodhi
===========================
Forum Wiki
bodhi's corner
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: