i.MX6 NFS booting with Ubuntu 12.04.02 Precise

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6 NFS booting with Ubuntu 12.04.02 Precise

8,499 Views
CurtisWald
NXP Employee
NXP Employee

One of the booting methods supported by the MX6Q-SDB is to read U-Boot from a SDCARD, load the Linux kernel (uImage) from a TFTP server and NFS mount a root file system from a host. Please refer to Setting_Up_LTIB_Host.pdf in the Linux Bundle for i.MX 6Quad/Dual for host configuration steps.

U-Boot environment variables are used to provide the details of the boot mode. Here are definitions of variables to consider changing from the default values for your environment. NOTE for the definitive guide please see http://denx.de.

To set an environment variable use the setenv command. The syntax is setenv variableName value. ‘=‘ character is not valid for setenv. 

Thus setenv variableName=value will be rejected.

To show variables use the printenv command.

U-Boot Variable

Description

bootdelay

Count down in seconds before U-Boot begins boot process. To halt, strike any key and the U-Boot prompt is presented

bootcmd

U-Boot executes this definition after the bootdelay

serverip

IP address of the host. This provides the TFTP server and exports directory for NFS mounting.

ipaddr

IP address of the target (MX6Q-SDB)

bootcmd_net

Configuration used for network booting: setup bootargs, tftp read uImage Linux kernel from TFTP server host and store in DDR memory, jump to loaded Kernel and begin executing.

bootargs_base

Clear the bootargs environment string and setup the console string:  console=ttymxc0,115200

nfsroot

The NFS exported directory of the host specified by serverip.

bootargs_nfs

This builds upon bootargs, adding to the console setup the NFS specifics:

root=/dev/nfs

ip=dhcp nfsroot=${serverip}:${nfsroot},v2,tcp

NOTE: the default setting has v3 which specifies NFS protocol version. Ubuntu 12.04.02 Precise was rejecting this setting, changing to v2 was successful. Please refer to the man page on nfs for additional details.

bootargs

This variable is passed to the kernel.

This discussion was based on Freescale BSP Linux release L3.0.35-4.0.0 for the MX6Q-SDB platform.

The working U-Boot environment for NFS Boot :

MX6Q SABRESD U-Boot > printenv

bootdelay=3

baudrate=115200

netmask=255.255.255.0

loadaddr=0x10800000

rd_loadaddr=(0x1300000)

netdev=eth0

ethprime=FEC0

uboot=u-boot.bin

kernel=uImage

bootcmd_net=run bootargs_base bootargs_nfs; tftpboot ${loadaddr} ${kernel}; bootm

bootcmd=run bootcmd_net

ethact=FEC0

ipaddr=192.168.1.20

bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v2,tcp

video=video=mxcfb0:dev=ldb,LDB-XGA,if=RGB666 ldb=sin1

serverip=192.168.1.100

nfsroot=/var/fs/mx6q/caam/rootfs

extra=caam

bootargs_base=setenv bootargs console=ttymxc0,115200 ${video} ${extra}

stdin=serial

stdout=serial

stderr=serial

Environment size: 792/8188 bytes


Labels (2)
7 Replies

1,436 Views
billyang
Contributor III

Hi Curtis,

Sorry, I am a little bit new to NFS booting.  I tried to boot nfs using u-boot from my nitrogen6x board following some other instructions, but I got failed so far. All my linux developing environment and target board settings are the same as you mentioned that is ubuntu 12.04.3.

I read your instructions now and have a question related to bootcmds. What is command to be run? e.g. run bootcmd_net or run bootcmd_mmc. I saw the bootcmd_net is embedded in bootcmd_mmc. I don't understand bootcmd_mmc configuration. Why does it use mmc dev 3 and mmc read ${loadaddr} 0x800 0x2000; and then bootm bootcmd=run bootcmd_net?

Or you may just simple let me know what do I need to run for booting nfs confiuration? Do I just run bootcmd_mmc or I need to run both bootcmd_net and bootcmd_mmc?

Regards,

-Bill

0 Kudos

1,436 Views
CurtisWald
NXP Employee
NXP Employee

Hi Bill,

For NFS booting, the end goal is to define the bootargs u-boot environment variable that is passed from u-boot to the Linux kernel.

You are free to define and name environment variables in u-boot any way you like, just ensure that the 'bootargs' variable is correct as this contains the string used by the Linux kernel.

To see from the example above how bootargs is constructed, the env variable u-boot looks at once the bootdelay counts down is bootcmd.

In the u-boot shell you can run the following printenv commands to see definitions of variables:

printenv bootcmd

printenv bootcmd_net

printenv bootargs_base

printenv bootargs_nfs

Of course you could skip all this complexity and just set bootargs to the string you need for your environment.

Please refer to http://www.denx.de/wiki/DULG/UBootEnvVariables for definitions.

1,436 Views
billyang
Contributor III

Thanks, Curtis,

Below is my bootargs settings that I followed your samples above.

baudrate=115200
bootargs=console=ttymxc1,115200
bootargs_base=setenv bootargs console=ttymxc1,115200
bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp root=/dev/mmcblk0p1 rootwait
bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v2,tcp
bootcmd=run bootcmd_net
bootcmd_mmc=run bootargs_base bootargs_mmc; mmc dev 0; mmc read ${loadaddr} 0x800 0x2000; bootm'
bootcmd_net=run bootargs_base bootargs_nfs; tftpboot ${loadaddr} ${kernel}; bootm
bootdelay=3
clearenv=if sf probe || sf probe || sf probe 1 ; then sf erase 0xc0000 0x2000 && echo restored environment to factory default ; fi
console=ttymxc1
ethact=FEC
ethaddr=1e:ed:19:17:1a:b3
ethprime=FEC
fileaddr=10800000
filesize=35d470
ipaddr=192.168.0.85
kernel=uImage
loadaddr=10800000

netdev=eth0
netmask=255.255.255.0
nfsroot=/home/byang/ltib/rootfs
serverip=192.168.0.86
stdin=serial,usbkbd
stdout=serial,vga

When I run bootcmd, it got kernel running and also mount the filesystem until it hangs on nfs server not responding as shows below.

Using FEC device
TFTP from server 192.168.0.86; our IP address is 192.168.0.85
Filename 'uImage'.
Load address: 0x10800000
Loading: #################################################################
         #################################################################
         #################################################################
         #############################################
         3.9 MiB/s
done
Bytes transferred = 3527792 (35d470 hex)
## Booting kernel from Legacy Image at 10800000 ...
   Image Name:   Linux-3.0.35-g4f6f427-dirty
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3527728 Bytes = 3.4 MiB
   Load Address: 10008000
   Entry Point:  10008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

...................................

Mounting filesystems
Booted NFS, not relocating: /tmp /var
Running sysctl
Setting up networking on loopback device:
Setting up networking on eth0:
udhcpc (v1.20.2) started
Sending discover...
Sending select for 192.168.0.66...
Lease of 192.168.0.66 obtained, lease time 86400
nfs: server 192.168.0.86 not responding, still trying

It hangs on forever. I don't understand the reason and wonder if you have any comment regarding either the bootargs setting or my network settings.

Thanks,

-Bill

0 Kudos

1,436 Views
CurtisWald
NXP Employee
NXP Employee

Bill,

I would recommend trying to validate your export of the nfs mount point.

The command "showmount -e" run from your host will show what is being exported.

You can try and mount the exported directory to see if it is generally available, then try from the target board.

-Curtis

0 Kudos

1,436 Views
LeonardoSandova
Specialist I

Hi Curt,

In the post's title, you specified an Ubuntu version, however I believe your instructions hold for every Linux OS, right?

0 Kudos

1,436 Views
CurtisWald
NXP Employee
NXP Employee

This was tested only on 12.04.02 Ubuntu Precise, each distribution has unique characteristics so cannot claim *every Linux*.

0 Kudos

1,436 Views
LeonardoSandova
Specialist I

Oh I see the booargs_nfs note! Thanks for the tip!

0 Kudos