Building u-boot to change kernel command line

You have a problem with your Wandboard and want to ask the community for help.

Building u-boot to change kernel command line

Postby seb-esperanto » Thu Jun 11, 2015 7:00 pm

Hi,
I followed instructions at http://wiki.wandboard.org/Kodi_/_XBMC_for_Wandboard
but I wanted the linux kernel to boot with kernel parameter root=/dev/sda1

so I changed u-boot-fslc/include/configs/wandboard.h
(#define CONFIG_EXTRA_ENV_SETTINGS section)

I compiled with make wandboard_spl_defconfig
and then I copied u-boot.img to /boot on /dev/mmcblk0p1

But /proc/cmdline still contains root=/dev/mmcblk2p2 instead of root=/dev/sda1 :?

What should I do ?
seb-esperanto
 
Posts: 8
Joined: Thu May 14, 2015 6:15 pm

Re: Building u-boot to change kernel command line

Postby Tapani » Fri Jun 12, 2015 3:17 am

At boot u-boot reads the last saved environment from the boot device.

You seem to have changed the u-boot default built-in environment. To set that environment you can do a
Code: Select all
setenv default -f

(they keep changing the exact syntax all the time! it used to be "setenv default" and I have seen "setenv default -a -f" or similar too.. )

Then you can save it with
Code: Select all
saveenv


Another option is to just set the variable you want to change: (at u-boot prompt) set the variable by "setenv variable value":
Code: Select all
setenv bootargs 'root=/dev/sda1 rw'

and then save the environment by
Code: Select all
saveenv



Personally I prefer to first set the environment, try it out without saving (by 'boot'),
and if everything is ok, reboot, re-set and then save.
Tapani
 
Posts: 712
Joined: Tue Aug 27, 2013 8:32 am

Re: Building u-boot to change kernel command line

Postby seb-esperanto » Fri Jun 12, 2015 6:00 am

Okay !
Thank you Tapani for your quick answer.

Unfortunately not so easy for me :
I don't own a serial cable, and there is no serial port on my computer... :?
That's why I tried to change things at compile time...

I will post any news about this...
seb-esperanto
 
Posts: 8
Joined: Thu May 14, 2015 6:15 pm

Re: Building u-boot to change kernel command line

Postby Tapani » Mon Jun 15, 2015 3:21 am

The environment is stored somewhere in the first megabyte of the SD card. (Cannot remember the offset).
So the quick and dirty way to clear any stored settings:
- backup your partition table (the first 1k (512) bytes):
Code: Select all
dd if=sdcard of=partition_table_backup bs=1k count=1

- clear most of the first megabyte:
Code: Select all
dd if=/dev/zero of=sdcard bs=950k count=1 oflag=dsync

- re install u-boot (dd SPL and if you use raw u-boot, install u-boot.img with dd)
- restore partition table:
Code: Select all
dd if=sdcard of=partition_table_backup of=sdcard bs=1k count=1 oflag=dsync

- in case you prefer u-boot in file system instead of raw, copy it to the boot/ foldr
Tapani
 
Posts: 712
Joined: Tue Aug 27, 2013 8:32 am


Return to Getting started

Who is online

Users browsing this forum: No registered users and 9 guests