April 3, 2017

Installing U-Boot on an Orange Pi

I begin with an 8G "Verbatim" brand micro SD card still in the shrink wrap. I pop this into my USB card reader/writer and plug it into my linux system. It has a vfat partition (that we don't care about) and mounts from /dev/sdc1. Fdisk shows the following:
fdisk -l
Disk /dev/sdc: 7.3 GiB, 7822376960 bytes, 15278080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1        8192 15278079 15269888  7.3G  b W95 FAT32
The first partition begins after skipping 4M of space, so we have plenty of room before the partition for U-boot. Not that we care all that much if all we want to do is play with U-boot. The Orange Pi boot loader ignores the partition table and just looks for the SPL a fixed distance into the SD card. We install U-boot via:
dd if=u-boot-sunxi-with-spl.bin of=/dev/sdc bs=1024 seek=8
435+1 records in
435+1 records out
445597 bytes (446 kB, 435 KiB) copied, 0.000751595 s, 593 MB/s
Then I carefully insert the card into my Orange Pi PC plus and apply power. It works! I want it to enter the U-boot command line by default. Printenv shows the full set of environment setting for U-boot. I change the setting for bootcmd as follows:
printenv
bootcmd=run loadsplash; run distro_bootcmd
...
setenv bootcmd bootp
saveenv
Saving Environment to MMC...
Writing to MMC(0)... done
This suffices for now for some testing I want to do.


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org