November 21, 2019, 06:24:35 pm

News:

Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/


SOLVED: Why does Network boot on Cubietruck not work????

Started by diracsbracket, July 11, 2014, 02:33:32 am

Previous topic - Next topic

diracsbracket

July 11, 2014, 02:33:32 am Last Edit: July 18, 2014, 06:22:48 am by diracsbracket
Hi,
I am trying to boot my Cubietruck from network, using the 3.4 kernel.
Getting the script.bin and uImage kernel from the TFTP server works, using DHCP.
- Since my Debian client is a VMware virtual machine, I had to connect the VM directly to my physical
  Ethernet card, and use the "Bridged" mode, for TFTP to work (it just won't work with NAT).

However, when trying to setup my rootfs via NFS, it miserably fails, and I'm getting quite frustrated now.
- I tried to follow the oh so dated - and sometimes plainly wrong - sunxi guidelines from their webpages
http://linux-sunxi.org/How_to_boot_the_A10_or_A20_over_the_network

The error I get is:

<3>VFS: Unable to mount root fs via NFS, trying floppy.
[  114.091031] VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6
Please append a correct "root=" boot option; here are the available partitions:


I have set up the NFS server correctly, I can access it from e.g. my Windows 7 host, where I can see and access all my files in the /tftpboot/rootfs directory.

My uboot environment is:

U-Boot SPL 2014.04-10688-g39b2fdd (Jul 08 2014 - 07:52:51)
Board: Cubietruck
DRAM: 2048 MiB
CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
spl: not an uImage at 1600

U-Boot 2014.04-10688-g39b2fdd (Jul 08 2014 - 07:52:51) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Board: Cubietruck
I2C:   ready
DRAM:  2 GiB
MMC:   SUNXI SD/MMC: 0
In:    serial
Out:   serial
Err:   serial
Net:   dwmac.1c50000
Hit any key to stop autoboot:  0
sun7i#
sun7i#
sun7i#
sun7i# printenv
autoboot=run loadkernel && run setargs && true && bootm 0x48000000
autoload=no
baudrate=115200
boot_ram=saved_stdout=$stdout;setenv stdout nc;if iminfo 0x41000000; then true; setenv stdout $saved_stdout; source 0x41000000;else setenv stdout $saved_stdout/rootfs,nfsvers=3 ip=192.168.11.9:192.168.11.6:192.168.11.1:255.255.255.0::eth0:off
bootcmd=dhcp; tftp 0x43000000 script.bin; tftp 0x48000000 uImage; bootm 0x48000000
bootdelay=2
bootfile=script.bin
bootm_size=0x10000000
bootscr=boot.scr
console=ttyS0,115200
device=mmc
dnsip=192.168.11.1
ethact=dwmac.1c50000
ethaddr=02:8c:03:01:39:12
fileaddr=43000000
filesize=b4a0
gatewayip=192.168.11.1
ipaddr=192.168.11.9
kernel=uImage
loadbootenv=fatload $device $partition $scriptaddr ${bootenv} || ext2load $device $partition $scriptaddr boot/${bootenv} || ext2load $device $partition $scriptaddr ${bootenv}
loadbootscr=fatload $device $partition $scriptaddr ${bootscr} || ext2load $device $partition $scriptaddr boot/${bootscr} ||ext2load $device $partition $scriptaddr ${bootscr}
loadkernel=if bootpath=/boot/ && ext2load $device $partition 0x43000000 ${bootpath}${script} && ext2load $device $partition 0x48000000 ${bootpath}${kernel};then true; elif bootpath=/ && fatload $device $partition 0x43000000 ${script} && fatload $device $partition 0x48000000 ${kernel};then true; elif bootpath=/ && ext2load $device $partition 0x43000000 ${bootpath}${script} && ext2load $device $partition 0x48000000 ${bootpath}${kernel};then true; else false;fi
loglevel=8
netmask=255.255.255.0
nfsroot=192.168.11.6:/tftpboot/rootfs
panicarg=panic=10
partition=0:1
script=script.bin
scriptaddr=0x44000000
serverip=192.168.11.6
setargs=if test -z \\"$root\\"; then if test \\"$bootpath\\" = "/boot/"; then root="/dev/mmcblk0p1 rootwait"; else root="/dev/mmcblk0p2 rootwait"; fi; fi; setenv bootargs console=${console} root=${root} loglevel=${loglevel} ${panicarg} ${extraargs}
stderr=serial
stdin=serial
stdout=serial


I am using the "legacy" sunxi kernel 3.4.

setenv nfsroot 192.168.11.6:/tftpboot/rootfs
setenv bootcmd "dhcp; tftp 0x43000000 script.bin; tftp 0x48000000 uImage; bootm 0x48000000"
setenv bootargs "console=ttyS0,115200 root=/dev/nfs nfsroot=${nfsroot} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}::eth0:off"


Of course, I also checked that the uImage was built with all the necessary options for NFS:

CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
# CONFIG_NFS_V4_1 is not set
CONFIG_ROOT_NFS=y
# CONFIG_NFS_FSCACHE is not set
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
CONFIG_NFSD=m
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
# CONFIG_NFSD_FAULT_INJECTION is not set
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y


Finally, I have also disabled all firewalls (Windows & Linux) as well as my anti-virus software for the test.

What in a name am I not doing correctly ?
Thank you for your help!!

diracsbracket

July 18, 2014, 06:10:20 am #1 Last Edit: July 22, 2014, 11:29:17 pm by diracsbracket
Hi,
Finally it works.

Darren from Cubietech provided me with this link (in Chinese):
http://forum.cubietech.com/forum.php?mod=viewthread&tid=1418&page=1#pid18547

In particular, following the description therein, I added CONFIG_SUNXI_EMAC=y to the kernel config.
In the menuconfig GUI, this can be found in Device Drivers --> Network device support --> *** CAIF transport drivers *** section --> Ethernet driver support --> Allwinner Ethernet MAC support
[EDIT]: This setting is no longer required as it is replaced by CONFIG_SUNXI_GMAC

But also, you need to make CONFIG_SUNXI_GMAC=y (default=m).
CONFIG_SUNXI_GMAC is found in Device Drivers --> Network device support --> *** CAIF transport drivers *** section --> Ethernet driver support --> Sunxi platform 10/100/1000Mbps Ethernet driver

Also, I added init=/sbin/init  to the bootargs, also as in the description in the above link.

Beware that there are some errors on the webpage of the link, since the latest uBoot version (I am using a 2014 version) does not have the nfs command any more. However, you can use the dhcp and tftp commands to download the script.bin and uImage files from the TFTP server you have set up, as shown below. Also, the syntax for the ip= argument is wrong - the serverip part is missing.

I use the following settings now (replace serverip by your TFTP/NFS server IP address of course):

setenv serverip 192.168.11.6
setenv nfsroot ${serverip}:/tftpboot/rootfs
setenv bootcmd "dhcp; tftp 0x43000000 script.bin; tftp 0x48000000 uImage; bootm 0x48000000"
setenv bootargs "console=ttyS0,115200 root=/dev/nfs init=/sbin/init nfsroot=${nfsroot} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}::eth0:off"
saveenv

rose28357

Quote from: diracsbracket on July 18, 2014, 06:10:20 am
In particular, following the description therein, I added CONFIG_SUNXI_EMAC=y to the kernel config.

Was there also an option for gmac ? That would provide GBit ethernet.

diracsbracket

July 22, 2014, 04:53:12 am #3 Last Edit: July 22, 2014, 05:04:45 am by diracsbracket
Hi,
I edited my previous mail as there seem nothing wrong with the main sunxi-linux branch, after all.
I included the CONFIG_SUNXI_GMAC option though, as it is this option that seems essential to be built into the kernel for NFS rootfs to work.


rose28357

gmac replaces emac. so
CONFIG_SUNXI_EMAC=n
should work either.

diracsbracket

July 22, 2014, 05:04:13 am #5 Last Edit: July 22, 2014, 11:29:55 pm by diracsbracket
OK. Thanks for that! I edited the above message.