Getting Fedora 21 on the Raspberry Pi 2
By Jon Archer
The recent release of the Raspberry Pi 2 uses a newer version of the ARM architecture spec, the ARM Cortex-A7 uses ARMv7 whereas the previous model ARM11 uses ARMv6. The great thing about this is the majority of Linux distros already provide an Image for this architecture. More importantly, Fedora already have images.
There is a slight caveat to the above statement however, that being they won’t just work with the Pi 2. The process isn’t that difficult either just a few steps:
Download the image you require, for this we’ll go with the Fedora 21 minimal - http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Images/armhfp/Fedora-Minimal-armhfp-21-5-sda.raw.xz
Flash the image to an SD card xzcat Fedora-Minimal-armhfp-21-5-sda.raw.xz |dd of=/dev/mmcblk0 bs=1M
Make sure the card is unmounted
fdisk the card:
- remove partition 1
- add a new partition where the old partition 1 was, with type B (FAT32)
- write and exit
Clone the Pi firmware repository - git clone https://github.com/raspberrypi/firmware.git
Mount the card again
- mkdir /mnt/sdcard
- mount /dev/mmcblk0p3 /mnt/sdcard
- mount /dev/mmcblk0p1 /mnt/sdcard/boot
Copy the contents of the boot directory from the repository you just cloned to the new boot directory and the kernel modules to the lib/modules directory on the main root partition
- cp -r firmware/boot/* /mnt/sdcard/boot/
- cp -r firmware/modules/3.18.7-v7+/* /mnt/sdcard/lib/modules/
Edit the fstab file to reflect the new UUID of the partition and change from being an ext to a vfat type
- blkid /dev/mmcblk0p1 - this will give the UUID of the partition
- vi /mnt/sdcard/etc/fstab and edit the line which contains /boot to contain the above info
Create a /mnt/sdcard/boot/cmdline.txt file containing the following:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait
Create a /mnt/sdcard/boot/config.txt file containing the following: #uncomment to overclock the arm. 700 MHz is the default. arm_freq=700# NOOBS Auto-generated Settings: hdmi_force_hotplug=1 config_hdmi_boost=4 overscan_left=24 overscan_right=24 overscan_top=16 overscan_bottom=16 disable_overscan=0 core_freq=250 sdram_freq=400 over_voltage=0
save and close any open files on the sd card then unmount and ensure all writes are complete
- umount /mnt/sdcard/boot
- umount /mnt/sdcard
You should now be able to remove the SD card from your PC and boot it in your new shiny Raspberry Pi 2
I’m sure it won’t be long before dedicated images are available, but for now this seems to work for me. I haven’t tried any more than the minimal install, with these your mileage may vary.
Note: Please remember this will only work on the newer Raspberry Pi 2.
Extra steps suggested by Tim Bosse
14. Install rpi-update. Install binutils and tar.
Download and setup rpi-update.
# curl -L --output /usr/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update && sudo chmod +x /usr/bin/rpi-update
15. Run rpi-update as root.
I find this is important to run any time you get kernel updates from Fedora repos.
I have a wireless USB dongle that I use.
16. Install NetworkManager-wifi and NetworkManager-tui (because I find nmcli not so much fun).
I’ve created an image based on steps 1-13 it’s fairly rough and ready so YMMV