3

I'm trying to modify the u-boot environment parameters with setenv command.

When I config bootcmd tftpboot 0x80800000 192.168.2.2:uImage2; bootm with bootm specified, uboot start loading the Linux kernel but I can't save parameters with saveenv.

When I config bootcmd without bootm I can save the parameters with saveenv but then uboot can't load the kernel, I got the following log

T T T T T T #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     ##########
done
Bytes transferred = 2378156 (2449ac hex)
Unauthorized > 

I can load the kernel directly by running bootm.

3

I am assuming that you are calling this at the u-boot command line.

bootcmd tftpboot 0x80800000 192.168.2.2:uImage2; bootm

The important note here is that the semicolon is a command separator. A simple fix (untested) would to add the command saveenv before the bootm command.

bootcmd tftpboot 0x80800000 192.168.2.2:uImage2; saveenv; bootm

This would set the variable bootcmd to: tftpboot 0x80800000 192.168.2.2:uImage2

Then saveenv would save the variable(s)

Then bootm would boot the image in memory.

You would not need to do this on every boot if you save the variables after you are content with the boot order.

First set all u-boot variables for your setup. (examples only. adjust for your setup)

  • setenv autostart yes
  • setenv bootfile uImage2
  • setenv ipaddr 192.168.2.2
  • setenv serverip 192.168.2.X
  • setenv bootcmd tftpboot 0x80800000 192.168.2.2:uImage2

OR

  • setenv bootcmd bootp 0x80800000 uImage2

Save the u-boot variables to persistent media

saveenv

Test boot options by running the bootcmd

run bootcmd

Repeat until the variables are set correctly and the bootcmd works.

If U-Boot is not interrupted after the delay established in bootdelay, the automatic boot process takes place. Automatic booting consists of running what is specified in the bootcmd environment variable

Some system variables:

  • bootcmd: Defines a command string that is automatically executed when the initial countdown is not interrupted. Executed only when the bootdelay variable is also defined.
  • autoload: If set to "no" (or any string beginning with 'n'), the rarpboot, bootp, or dhcp command performs a configuration lookup from the BOOTP / DHCP server but does not try to load any image using TFTP.
  • autostart: If set to "yes", an image loaded using the rarpboot, bootp, dhcp or tftpboot commands is automatically started (by internally calling the bootm command).
  • bootfile: Name of the default image to load with TFTP.
  • in fact by setting bootcmd tftpboot 0x80800000 192.168.2.2:uImage2; saveenv; bootm it will save the command bootcmd tftpboot 0x80800000 192.168.2.2:uImage2 then boot and this is not what I wanted. I wanted to save the whole command bootcmd tftpboot 0x80800000 192.168.2.2:uImage2; saveenv; bootm – Makhlouf GHARBI May 18 '17 at 7:59
0

I succedded to save the whole command bootcmd tftpboot 0x80800000 192.168.2.2:uImage2; saveenv; bootm by adding double quotes after bootcmd

setenv bootcmd "tftpboot 0x80800000 192.168.2.2:uImage2; bootm"
  • Why do you have to save the variable bootcmd every time with setenv? Does bootcmd settings not persist between boots? – jc__ May 18 '17 at 14:09
  • no I didnt want to save it everytime, I just wanted to save once the whole command bootcmd tftpboot 0x80800000 192.168.2.2:uImage2; bootm but when I run setenv bootcmd command without quotes, it boot the kernel and I no longer have access to uboot prompt to perform saveenv – Makhlouf GHARBI May 19 '17 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.