December 8, 2016

Orange PI - U-boot and SPL

The following gives useful information: They state:

The SPL is placed at offset "8" (in 1k blocks) and U-boot goes at offset "40" via commands like the following:

dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8
dd if=u-boot.img of=/dev/sdX bs=1024 seek=40
The offset for u-boot is apparently variable (no doubt by whatever expectations are compiled into the SPL). It used to be 32 rather than 40.

It seems to be common to lump these two binaries into one that can just be copied to offset 8.

Also it says that uEnv.txt is looked for in three different places, as follows:

This version of u-boot support uEnv.txt, and will look for it in the first partition FAT /uEnv.txt or extX /uEnv.txt or extX /boot/uEnv.txt. uEnv.txt contains variables on the form variable=value, one per line. If the variable uenvcmd is set then u-boot will run the commands listed in this variable.

Dirty tricks

Since it is easy enough to recreate an SD card, I decided to toss a wrench into the spokes. First I tried putting /uEnv.txt into the FAT image, but that was ignored. So I decided to delete the unix images and see if u-boot would fail and drop into the u-boot prompt. Indeed it did. I deleted uImage* on the FAT partition. A severely edited transcript of the results follows.
HELLO! BOOT0 is starting!
boot0 version : 4.0.0
....
....
[mmc]: mmc driver ver 2014-12-10 21:20:39
[mmc]: ***Try SD card 0***
[mmc]: SD/MMC Card: 4bit, capacity: 7580MB
[mmc]: vendor: Man 00035344 Snr 8cdf0de0
[mmc]: product: SL08G
[mmc]: revision: 8.0
[mmc]: ***SD/MMC 0 init OK!!!***
sdcard 0 init ok
The size of uboot is 000dc000.
sum=ede66ee7
src_sum=ede66ee7
Succeed in loading uboot from sdmmc flash.
Ready to disable icache.
Jump to secend Boot.
SUNXI_NORMAL_MODE   

U-Boot 2011.09-rc1 (Jun 21 2015 - 19:33:17) Allwinner Technology 

fail to find part named env
Using default environment

** Unable to read "uimage" from mmc 0:1 **
Wrong Image Format for bootm command
ERROR: can't get kernel image!

sunxi#printenv
baudrate=115200
boot_fastboot=fastboot
boot_normal=fatload mmc 0:1 0x43000000 script.bin;fatload mmc 0:1 40007800 uimage;bootm 40007800
boot_recovery=sunxi_flash read 40007800 recovery;boota 40007800
bootargs=console=ttyS0,115200 root=/dev/mmcblk0p2 init=/init loglevel=8 partitions=
bootcmd=run setargs_mmc boot_normal
bootdelay=3
console=ttyS0,115200
init=/init
loglevel=8
mmc_root=/dev/mmcblk0p2
nand_root=/dev/nandd
setargs_mmc=setenv bootargs console=${console} root=${mmc_root} init=${init} loglevel=${loglevel} partitions=${partitions}
setargs_nand=setenv bootargs console=${console} root=${nand_root}init=${init} loglevel=${loglevel} partitions=${partitions}
stderr=serial
stdin=serial
stdout=serial

Environment size: 743/131068 bytes
sunxi#
A number of aspects of this are interesting. One is that this is U-boot circa 2011 !! Note the "sunxi#" prompt from U-boot. It announces that it "cannot find part named env", whatever that means.

Probably the output from printenv is most interesting. Nothing there is set up to look for uEnv.txt. It looks like my ideas of using uEnv.txt to tailor this version of U-boot to network booting were doomed to fail on several counts.


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org