Well getting Fedora running on the Pine64 has been an adventure. Fedora itself doesn’t work out of the box, but that’s to be expected because we’re waiting for some things to go upstream. But thanks to the tireless efforts of the Linux SunXi project I was able to boot the board with a (mostly) open source firmware, self-compiled near-upstream kernel, and a Fedora filesystem.
rjones@pine:~$ uname -a
Linux pine 4.9.0-00036-ge6af24d #14 SMP PREEMPT Sat Mar 18 13:56:36 GMT 2017 aarch64 aarch64 aarch64 GNU/Linux
rjones@pine:~$ cat /etc/fedora-release
Fedora release 25 (Twenty Five)
Below I will describe how to do this, but note that by the time Fedora 26 comes out you should not need to do any of this stuff.
Cross-compile your own kernel as described here. As well as the standard defconfig
you will also need to enable CONFIG_XFS_FS=y
.
Run make dtbs
to create arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dtb
which you will need later.
Read about the AllWinner A64/Pine64 boot process. It’s not necessary to replicate those steps exactly, but it helps to explain why we’re doing the next steps.
Grab one of the firmware images from here (it doesn’t matter which) and write it to your micro SD card. But note this firmware and dtb is out of date, and so you must then get the latest firmware from here and overwrite it:
# dd if=pine64_firmware-20170314.img of=/dev/mmcblk0 bs=8k seek=1
The firmware image above will create a single 100 MB FAT partition. Add further partitions to the partition table on the micro SD card so it looks approximately like this. The root filesystem must be on partition 5 (the first logical partition).
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 204799 202752 99M 6 FAT16
/dev/mmcblk0p2 204800 31116287 30911488 14.8G 5 Extended
/dev/mmcblk0p5 206848 21178367 20971520 10G 83 Linux
/dev/mmcblk0p6 21180416 25374719 4194304 2G 82 Linux swap / Solaris
Make swap on /dev/mmcblk0p6
.
From your kernel build, copy arch/arm64/boot/Image
and arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dtb
to the first (FAT) partition. (This will overwrite the existing out of date dtb file.)
Extract the filesystem from a virt-builder Fedora 25 aarch64 image:
$ virt-builder --arch aarch64 fedora-25
$ virt-filesystems -a fedora-25.img --all --long -h
$ guestfish --ro -a fedora-25.img run : download /dev/sda4 aarch64-root.fs
This is an XFS filesystem image, which is why you have to enable the XFS driver in the custom kernel above.
Now write this to the fifth (first logical) partition:
# dd if=aarch64-root.fs of=/dev/mmcblk0p5 bs=16M
# xfs_growfs /dev/mmcblk0p5
You will now need to mount up the root filesystem and make a few changes. At the very least:
- Edit
/etc/fstab
to reflect reality.
- Disable the root password in
/etc/passwd
.
With any luck booting the micro SD card in the Pine64 should now work.