I do this with an SD card holding Ubuntu Server (Ubuntu Xenial). To my surprise (and dismay) the U-Boot on this card has no networking configured. So I will have to either build U-boot from source or get lucky with some other SD card image. This card runs U-Boot 2014.07, built Nov 09, 2016. Once it boots, it announces itself as "Ubuntu 16.04.1 LTS Orangepi ttyS0".
unrar l *.rar unrar e *.rar unxz Raspbian_server_For_PC2_H5_V0_1.img.xz md5sum Raspbian_server_For_PC2_H5_V0_1.img cat *.md5sum su dd if=Raspbian_server_For_PC2_H5_V0_1.img of=/dev/sdf bs=128k exitThis verifies (visually) the md5sum, then puts the image onto a brand new 16G microSD card I have handy. The image itself is just over 1G, so there is a lot of wasted room on the card, but that is OK. Insert the card into the PC 2, connect power and interrupt the boot sequence by typing.
U-Boot 2014.07-g486bfb4 (Mar 27 2017 - 14:27:38) Allwinner TechnologyTyping "help" shows no network commands configured here either, so no luck. Typing "boot" continues the boot, and it eventually announces itself as
Raspbian GNU/Linux 8 OrangePI ttyS0 uname -a Linux OrangePI 3.10.65 #3 SMP PREEMPT Tue Nov 15 09:46:50 CST 2016 aarch64 GNU/Linux cat /proc/cpuinfo cat /proc/cpuinfo Processor : AArch64 Processor rev 4 (aarch64) processor : 0 processor : 1 processor : 2 processor : 3 Features : fp asimd aes pmull sha1 sha2 crc32 wp half thumb fastmult vfp edsp neon vfpv3 tlsi vfpv4 idiva idivt CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 Hardware : sun50iw2 Serial : 44005035c120103e078cYou login as root, password "orangepi".
I needed to install several python related packages on my Fedora system first:
su dnf install swig dnf install python-devel python3-develAfter this I edited the Makefile, adding the following near the top. I prefer this to setting an environment variable, because I am lazy, and typically I have to build U-Boot many times before I get what I want and need.
CROSS_COMPILE=aarch64-linux-gnu-After this:
cd u-boot-2018.09 make orangepi_pc2_defconfig makeThat rattles along nicely, but ultimately gives me a warning like this:
WARNING: BL31 file bl31.bin NOT found, resulting binary is non-functional Please read the section on ARM Trusted Firmware (ATF) in board/sunxi/README.sunxi64
git clone https://github.com/apritzel/arm-trusted-firmware.git git checkout allwinner export CROSS_COMPILE=aarch64-linux-gnu- make PLAT=sun50iw1p1 DEBUG=1 bl31There are many branches (use "git branch -a" to take a look). This builds beautifully without errors or warnings and concludes with the following message:
Built build/sun50iw1p1/debug/bl31.bin successfullyThe instructions then state: "The resulting binary is build/sun50iw1p1/debug/bl31.bin. Either put the location of this file into the BL31 environment variable or copy this to the root of your U-Boot build directory (or create a symbolic link)." I copied the file to the U-boot root, then repeated the U-Boot build via:
make clean makeAs far as I am concerned, the final product is u-boot-sunxi-with-spl.bin. I grab a 16G microSD card that I previously put Raspbian on. Looking at it with fdisk, I see:
Command (m for help): p Disk /dev/sdf: 14.9 GiB, 15931539456 bytes, 31116288 sectors Device Boot Start End Sectors Size Id Type /dev/sdf1 40960 172031 131072 64M b W95 FAT32 /dev/sdf2 172032 2365440 2193409 1G 83 LinuxI don't care about this (though I am curious), so I do:
su dd if=/dev/zero of=/dev/sdf bs=64k count=100 dd if=u-boot-sunxi-with-spl.bin of=/dev/sdx bs=8k seek=1 78+1 records in 78+1 records out 639712 bytes (640 kB, 625 KiB) copied, 0.000664059 s, 963 MB/s syncI insert this into the PC 2, apply power, and absolutely nothing happens. It is a dead as a doornail. Hmmm.
git clone -b sunxi https://github.com/linux-sunxi/u-boot-sunxi.git cd u-boot-sunxi grep sunxi boards.cfg | awk '{print $7}'This looks like a truly ancient U-Boot. No configs directory.
The above is supposed to yield a list of possible targets, however there is nothing that looks even remotely like an H5 or an Orange Pi. Also there is no genboardscfg.py file anywhere as per the instructions.
They say this is unmaintained, and brother, you better believe it.
cd u-boot-2017.05 Add to Makefile: CROSS_COMPILE=aarch64-linux-gnu- make orangepi_pc2_defconfig makeThis builds nicely with some warnings about syntax in a DTS file, as well as warnings about macros being redefined in some Python header file. Hopefully these can be ignored, because I am ignoring them.
The file board/sunxi/README.pine64 is worth reading and does mention bl31.bin along with something called boot0.img. The upshot of all this is that as of 2017.05 no SPL was being built and tools from pine64 including a binary blob from Allwinner called boot0.img is needed to produce a bootable disk. I could pursue all of this, but before I do I want to investigate more recent U-Boot distributions since by 2018.09 an SPL was being offered.
Tom's electronics pages / tom@mmto.org