LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 12-20-2017, 07:41 PM   #1
olaoni
LQ Newbie
 
Registered: Feb 2016
Posts: 19

Rep: Reputation: Disabled
u-boot not reading uEnv.txt file from SDCard on Beaglebone black


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 parts, first partition contains FAT partition while the second is an ext4 but not currently used. 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 u-env.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.

Last edited by olaoni; 12-21-2017 at 04:51 AM.
 
Old 12-21-2017, 08:30 PM   #2
olaoni
LQ Newbie
 
Registered: Feb 2016
Posts: 19

Original Poster
Rep: Reputation: Disabled
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

Quote:
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

Code:
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

Last edited by olaoni; 12-21-2017 at 08:35 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom linux kernel does not boot on Beaglebone black mrigendra Linux - Newbie 1 07-17-2016 07:05 AM
Reading .txt file in C btam125 Programming 16 11-06-2015 07:21 AM
Writing and Reading from a txt file. Sunny001 Programming 7 08-08-2009 10:21 PM
How can read from file.txt C++ where can save this file(file.txt) to start reading sam_22 Programming 1 01-11-2007 05:11 PM
reading a txt file vidyashankara Linux - Software 2 06-22-2006 06:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration