Problem with u-boot reading uEnv.txt from sdcard on beaglebone black

1,066 views
Skip to first unread message

onio

unread,
Dec 21, 2017, 6:00:00 AM12/21/17
to BeagleBoard
HI All,

I have built custom zImage and am335-boneblack.dtb file together with u-boot and its associated files.
The problem I am having is getting u-boot to automatically boot Linux kernel image from SD Card using the uEnv.txt file. I have partitioned my SD card into 2 part, first partition contains FAT partition while the second is an ext4 . The first partition contains the following files
  1. u-boot.img
  2. MLO
  3. zImage
  4. am335x-boneblack.dtb
  5. uEnv.txt 
I am not currently using the second partition as I am using NFS for the root files system. I can halt the u-boot boot process which causes it  to drop to the u-boot command prompt at which point I can then enter the following commands manually.
  • setenv serverip 192.168.1.100
  • setenv ipaddr 192.168.1.101
  • setenv npath /home/onio/rootfs
  • setenv bootargs console=ttyO0,115200 root=/dev/nfs rw nfsroot=${serverip}:${npath} ip=${ipaddr}
  • saveenv
  • fatload mmc 0:1 0x80200000 zImage
  • fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb
  • bootz 0x80200000 - 0x80f00000

As previously mentioned I can enter the above commands at the u-boot prompt and the board would boot to Linux command prompt. I want to avoid the process of entering this data manually and get u-boot to do the loading and booting of the board using the uEnv.txt file. If my understanding is correct u-boot should be able to perform this process automatically. 

Many thanks in advance.

Regards

onio

NB:
The "serverip" is the IP address of my development PC and ipaddr is the IP address of the beaglebone black. The root file system is located in the following path /home/onio/rootfs on the development PC.

Message has been deleted

onio

unread,
Dec 21, 2017, 9:43:55 PM12/21/17
to BeagleBoard
Hi All,

I think I found a answer to the question I posted above. It may not be the most elegant solution but it works for now so I would move on, but I thought to share my findings here. Below is my new uEnv.txt file which I put on the first partition of the sd card

bootpart=0:1
bootdir=
loadimage=fatload mmc ${bootpart} ${loadaddr} zImage
loadfdt=fatload mmc ${bootpart} ${fdtaddr} am335x-boneblack.dtb
bootargs_nfs=setenv ipaddr 192.168.1.6;setenv serverip 192.168.1.22;setenv bootargs console=ttyO0,115200 root=/dev/nfs rw nfsroot=${serverip}:/home/onio/rootfs ip=${ipaddr} rootfstype=ext4 rootwait
uenvcmd=run loadimage;run loadfdt;run bootargs_nfs; printenv bootargs; bootz ${loadaddr} - ${fdtaddr};

The solution was to assign a valid "u-boot instruction" to a variable and then use the u-boot uenvcmd=run variable command to execute the assigned variable instruction 


Example:
bootargs_nfs=setenv ipaddr 192.168.1.6;setenv serverip 192.168.1.22;setenv bootargs console=ttyO0,115200 root=/dev/nfs rw nfsroot=${serverip}:/home/onio/rootfs ip=${ipaddr} rootfstype=ext4 rootwait
uenvcmd=run bootargs_nfs;


Sets host ip address to 192.168.1.6
sets server ip address to 192.168.1.22
sets bootargs to use nfs etc
Reply all
Reply to author
Forward
0 new messages