When U-boot was presented to me, the default behavior is to attempt to read your SD card and look for uboot.script on the first partition of the card which is expected to be vfat. I found this to be a pain because so far all the user lands that I have don’t have a vfat partition as a primary. Usually the first partition is your main user land partition and it’s generally ext3. I wanted to tweak U-boot to be able to boot from a kernel and uboot.script that is placed in the /boot directory in whatever userland I’m using. Marex suggested that it would be easy enough to use logic to accommodate both setups. With a bit of his assistance, I was able to come up with a new environment variable that worked. The old bootcmd variable looked like this:
bootcmd=if mmcinfo && fatload mmc 0 0xa0000000 uboot.script ; then source 0xa0000000; else bootm 0x60000; fi;
If you break this down, you’ll see it looks for the uboot.script on the root directory of the first fat partition on mmc 0. If it finds the uboot.script there, it loads it and executes the commands contained within it. If not, it continues and boots whatever is sitting at the 0x60000 location in flash memory and uses the environment variables currently loaded in u-boot itself. If there is nothing there, it fails. My new bootcmd variable looks like this:
bootcmd=if mmcinfo && ext2load mmc 0 0xa0000000 boot/uboot.script ; then source 0xa0000000 ; elif mmcinfo && fatload mmc 0 0xa0000000 uboot.script ; then source 0xa0000000; else bootm 0x60000; fi;
This one will first look for the uboot.script file under the /boot directory on the first ext2/3 partition for the uboot.image on the first ext2/3 partition. If it is not there or the partition is not ext2/3, it tries to look for the file on the first vfat partition. If it can’t find that it will try to load a kernel that is in your flash memory if it exists.
Of course the old uboot.script does not work with the ext2/3 configuration described above. I went ahead and tweaked the uboot.script.base file as follows:
if ext2load mmc 0 0xa0000000 boot/uImage; then
setenv bootargs console=tty0 console=ttyS2,115200 fbcon=rotate:3 root=/dev/mmcblk0p1 rootdelay=3
bootm 0xa0000000;
fi
I saved it and then ran ./mkscript.sh to make the uboot.script which is actually a binary file and then copied the uboot.script that was created to /boot on the proper SDcard.
To build a new uboot.script file, you need to:
apt-get install uboot-mkimage
the uboot.script.base and mkscript.sh can be found in this file: z2-uboot-06262010.tar.gz.
Note: this file is outdated but does contain the script to rebuild uboot.script.
Earlier today, Mozzwald helped me flash a default static-linked kernel into the flash ram. This allowed me to boot side-track under U-boot for the first time since upgrading to U-boot without ANY changes to side-track. Unfortunately, the mouse driver is broken under this later linux kernel and will probably need to be recompiled.
I could go through the process of flashing that static kernel into memory but I don’t feel comfortable doing so because it’s not very streamlined at this point. If you are interested in the instructions, just speak up on the #zipit channel on freenode and someone will probably be able to help you through it.
If you like the content on this site, please support it by using this link to order from Amazon. You know you were going to go there and buy stuff anyhow so why not help me pay the hosting bill.
1 Trackback or Pingback for this entry:
[…] files in your /boot directory on your sidetrack sd card. As stated in one of my other posts about U-boot, you will need to make sure this line is set as an environment variable in U-boot: bootcmd=if […]