ARM64 – HiKey – Change to UEFI Boot..

After some more testing, including trying (unsuccessfully) the HiKey version of Kernel 4.1-rc4 # git clone -b hikey-mainline-rebase –single-branch   I was frustrated by the complete lack of kernel boot info on screen, after the proprietary bootloader had finished.. More research found that this bootloader was described as somewhat deficient in the ‘fit for purpose’ department, and I really ought to update to a more effective one…

There is a pre-release version of U-Boot available, but UEFI/grub is also now an option, which made more sense..     The only drawback to the current version of UEFI is that it can only boot from Emmc, not an SD Card, but as long as the kernel image (Image) and dtb (hi6220-hikey.dtb) and initrd are resident on the Emmc boot partition, then the rootfs can still be on the SD Card..     I also created a SWAP file on the Emmc root partition..

[root@rghikey ~]# cat /etc/fstab
/dev/mmcblk1p2  /           ext4  defaults 1 1
/dev/mmcblk1p1  /boot       vfat  defaults 1 2
/dev/mmcblk0p6  /boot-emmc  vfat  defaults 1 2
/dev/mmcblk0p9  /root-emmc  ext4  defaults 1 2
/root-emmc/SWAP none        swap  defaults 0 0

So.. I have the root filesystem on the SD Card, and mount the Emmc boot and root partitions as /boot-emmc and /root-emmc respectively, and then copy the Image and .dtb files to the /boot-emmc partition after compilation..     This is far more useful, as by editing the grub configuration file in the Emmc boot directory (/boot-emmc/grub/grub.cfg) I can arrange for multiple Kernel versions to be available for booting, to fall-back to a known/good version if the boot fails..

$ cat /boot-emmc/grub/grub.cfg 
set default="0" 
set timeout=10 
menuentry 'Fedora Linux' { 
    linux /Image console=ttyAMA0,115200n8 earlycon=pl011,0xf8015000 root=/dev/mmcblk1p2 rw roo
twait initrd=initrd.img efi=noruntime 
    initrd /initrd.img 
    devicetree /hi6220-hikey.dtb 
menuentry 'Fedora Linux OLD' { 
    linux /Image.old console=ttyAMA0,115200n8 earlycon=pl011,0xf8015000 root=/dev/mmcblk1p2 rw
 rootwait initrd=initrd.img efi=noruntime 
    initrd /initrd.img 
    devicetree /hi6220-hikey.dtb.old 
menuentry 'Fedora Linux 4.1-rc4' { 
    linux /Image-41rc4 console=ttyAMA0,115200n8 earlycon=pl011,0xf8015000 root=/dev/mmcblk1p2 
rw rootwait initrd=initrd.img efi=noruntime 
    initrd /initrd.img 
    devicetree /hi6220-hikey.dtb-41rc4 
Apart from the multi-version boot convenience, the resulting console output gives far more early-kernel-boot info than the old bootloader, enabling proper diagnosis of boot failures, rather than an empty screen.
Caveats..    You may need to try different versions of the UEFI binaries, as I found that the July 19 version failed, but an earlier version worked OK..    You will also need to connect  a proper uart/usb console to the circuit board, which may involve some careful soldering.. (see previous article
More to come – including the USB port catch-22, and Bluetooth woes..!
Robert Gadsdon.    July 22, 2015.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.