Fedora on the Pine64

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:

  1. Edit /etc/fstab to reflect reality.
  2. Disable the root password in /etc/passwd.

With any luck booting the micro SD card in the Pine64 should now work.


Filed under Uncategorized

6 responses to “Fedora on the Pine64

  1. Andreas Bierfert (awjb)

    Thanks for the howto. Actually works fine with vanilla 4.11.0-rc3 (-usb -eth).

    Maybe you should add a note on building/copying the modules.

    [root@pine bin]# uname -a
    Linux pine 4.11.0-rc3 #1 SMP PREEMPT Sat Mar 25 13:39:53 CET 2017 aarch64 aarch64 aarch64 GNU/Linux
    [root@pine bin]# cat /etc/fedora-release
    Fedora release 25 (Twenty Five)

    • rich

      Funnily enough I was playing with it again just now, still using the 4.9 kernel however since AFAIK ethernet is not supported (but USB is??)

      • Andreas Bierfert (awjb)

        Neither ethernet nor usb works for me, so usb should be working. Still figuring out whats wrong.

        And I am seeing https://bugzilla.kernel.org/show_bug.cgi?id=195037

      • rich

        I’m using this kernel. Both USB and ethernet work fine (ethernet only at 100 Mbps, but that might be a cabling / other end issue). To enable USB mass storage I had to configure CONFIG_USB_MUSB_SUNXI=y which required a bunch of other dependent configs.

        I’m not seeing the bug above, but I am seeing a problem where qemu-system-aarch64 processes use 100% of CPU, are unkillable (even with -9) and make no progress. I’m sure that’s something that could be corrected by moving to the mainline kernel, but before that happens I need USB and ethernet to be merged.

        Oh and reboot shuts down the board (doesn’t reboot).

  2. What about wifi? Does it work out of the box?

    • rich

      No, it needs an out of tree driver. Unfortunately I’ve lost the link to it, but if you ask the linux-sunxi folk I’m sure they can help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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