Getting Fedora 21 on the Raspberry Pi 2 13

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:

  1. 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
  2. Flash the image to an SD card xzcat Fedora-Minimal-armhfp-21-5-sda.raw.xz |dd of=/dev/mmcblk0 bs=1M
  3. Make sure the card is unmounted
  4. fdisk the card:
    1. remove partition 1
    2. add a new partition where the old partition 1 was, with type B (FAT32)
    3. write and exit
  5. mkfs.vfat /dev/mmcblk0p1
  6. Clone the Pi firmware repository – git clone https://github.com/raspberrypi/firmware.git
  7. Mount the card again
    1. mkdir /mnt/sdcard
    2. mount /dev/mmcblk0p3 /mnt/sdcard
    3. mount /dev/mmcblk0p1 /mnt/sdcard/boot
  8. 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
    1. cp -r firmware/boot/* /mnt/sdcard/boot/
    2. cp -r firmware/modules/3.18.7-v7+/* /mnt/sdcard/lib/modules/
  9. Edit the fstab file to reflect the new UUID of the partition and change from being an ext to a vfat type
    1. blkid /dev/mmcblk0p1 – this will give the UUID of the partition
    2. vi /mnt/sdcard/etc/fstab and edit the line which contains /boot to contain the above info
  10. 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

  11. 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
  12. save and close any open files on the sd card then unmount and ensure all writes are complete
    1. umount /mnt/sdcard/boot
    2. umount /mnt/sdcard
    3. sync
  13. 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.

Update:

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

https://jfarcher.fedorapeople.org/Fedora-Minimal-armhfp-rpi-21-5-sda.raw.xz

13 thoughts on “Getting Fedora 21 on the Raspberry Pi 2

  1. Reply Tim Bosse Feb 20,2015 4:15 pm

    Thanks for this. Following your guide worked well. I added a few steps to get things working better for me.

    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).

  2. Reply Scott Dowdle Feb 20,2015 9:12 pm

    Any chance you’d consider dd’ing up the finished product and putting it somewhere for download?

  3. Reply Jon Archer Feb 21,2015 12:09 pm

    Tim, thanks for that I’ll add those to the main post.

    Scott, yes I was planning to create an image and upload somewhere.

  4. Reply Jon Archer Feb 21,2015 4:41 pm

    I’ve put an image up https://jfarcher.fedorapeople.org/Fedora-Minimal-armhfp-rpi-21-5-sda.raw.xz
    root password is initially blank so will need setting, also Tims steps will need adding.

  5. Reply Bruce Feb 21,2015 5:05 pm

    Thanks for this, Jon. I was just dd’ing the Fedora 21 Workstation image to a micro SD when I found this article. It boots up, Gnome starts, and it presents the language option screen. But for some reason I couldn’t get my mouse or keyboard to work. I probably need to try a different mouse/keyboard combination.

  6. Reply Jon Archer Feb 21,2015 5:11 pm

    Bruce, did you modify the workstation image to get it to boot or did you just DD it?

  7. Reply Bruce Feb 21,2015 5:43 pm

    Sorry, I wasn’t too clear. Yes, I modified the image per your instructions, although I commented out the arm_freq line in config.txt. I did not follow Tim’s instructions. I’ll see if the networking is functional and see if I can dig through the system logs.

  8. Reply Jon Archer Feb 21,2015 5:46 pm

    Cool, be interested to hear your progress. The workstation image was my next adventure.

  9. Reply Bruce Feb 21,2015 6:27 pm

    Wilco.

    As expected, the network is firewalled off. But I was able to extra the systemd log by copying it off the micro SD and doing:

    journalctl –full –file=system.journal > system.journal.txt

    It looks like the USB is fine, and it’s just an xorg configuration issue:

    Feb 21 16:57:01 localhost kernel: usb 1-1.4: new full-speed USB device number 10 using dwc_otg
    Feb 21 16:57:01 localhost kernel: usb 1-1.4: New USB device found, idVendor=046d, idProduct=c52b
    Feb 21 16:57:01 localhost kernel: usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Feb 21 16:57:01 localhost kernel: usb 1-1.4: Product: USB Receiver
    Feb 21 16:57:01 localhost kernel: usb 1-1.4: Manufacturer: Logitech
    Feb 21 16:57:01 localhost kernel: input: Logitech USB Receiver as /devices/platform/bcm2708_usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:046D:C52B.0007/input/input3
    Feb 21 16:57:01 localhost kernel: hid-generic 0003:046D:C52B.0007: input,hidraw0: USB HID v1.11 Keyboard [Logitech USB Receiver] on usb-bcm2708_usb-1.4/input0
    Feb 21 16:57:01 localhost kernel: input: Logitech USB Receiver as /devices/platform/bcm2708_usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:046D:C52B.0008/input/input4
    Feb 21 16:57:01 localhost kernel: hid-generic 0003:046D:C52B.0008: input,hiddev0,hidraw1: USB HID v1.11 Mouse [Logitech USB Receiver] on usb-bcm2708_usb-1.4/input1
    Feb 21 16:57:01 localhost kernel: hid-generic 0003:046D:C52B.0009: hiddev0,hidraw2: USB HID v1.11 Device [Logitech USB Receiver] on usb-bcm2708_usb-1.4/input2
    Feb 21 16:57:01 localhost mtp-probe[26262]: checking bus 1, device 10: “/sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.4″
    Feb 21 16:57:01 localhost mtp-probe[26262]: bus: 1, device: 10 was not an MTP device
    Feb 21 16:57:01 localhost gdm-Xorg-:0[320]: (II) config/udev: Adding input device Logitech USB Receiver (/dev/input/mouse0)
    Feb 21 16:57:01 localhost gdm-Xorg-:0[320]: (II) No input driver specified, ignoring this device.
    Feb 21 16:57:01 localhost gdm-Xorg-:0[320]: (II) This device may have been added with another device file.

    That’s a bit surprising, because I thought xorg had got to the point where it would work without configuration in most cases. Should be reasonably easy to move on, though.

  10. Reply LennyC Feb 22,2015 1:43 am

    Extremely useful post. Thanks a bunch to you and others for all the great info.

  11. Reply Bruce Feb 22,2015 3:26 pm

    I was able to get things working further:
    – Mount the rootfs from the micro SD on a PC
    – cd to the root of the mounted rootfs
    – symlink the multi-user systemd target:
    ln -sf /usr/lib/systemd/system/multi-user.target etc/systemd/system/default.target
    – Edit etc/passwd to remove the x from the root user, thereby clearing the root password
    – Unmount the rootfs, remove the micro SD
    – Boot the Pi 2 with the micro SD, which will start in text mode
    – Find a keyboard that works (I only had one of three work)
    – Log in as root
    – Change the root password
    – Install openssh-server to allow remote login in future
    – Run through Tim’s rpi-update steps
    – Now remove the /etc/systemd/system/default.target symlink
    – Reboot

    It should boot into the gnome initial setup. The USB keyboard and mouse compatibility is definitely improved after running rpi-update.

    In actual fact I rebooted before removing the symlink, and manually changed to the graphical.target “runlevel”. I then went through the gnome setup (though the resolution was wrong), rebooted, and everything was working.

    It’s pretty slow, but it does work. I need to look into what rpi-update actually does, and how far the Pi support is from getting into the master Linux kernel sources.

  12. Reply Ravi Sreeram Feb 27,2015 6:20 pm

    I renamed the file as “Fedora-Minimal-armhfp-rpi-21-5-sda.img” after unzip and on windows 7 use “Win32DiskImager”. It works ( hope someone is looking for it )

  13. Reply Scott Dowdle Feb 27,2015 9:03 pm

    I took the image and got a fairly complete XFCE desktop environment with Midori, Abiword, Gnumeric, and GIMP… all fitting on a 4GB microSD card… with about 450MB of free space on /.

    Sound doesn’t work for me so I’m not sure how to get that to work. Says no sound device found. The Fedora kernel gets installed but doesn’t get used. I’m ignorant on how to get stuff to /boot as I know nothing about ARM booting… nor the Raspberry Pi 2 specifically.

    Comments about potential future builds:

    1) /boot is 500MB. That is a bit big. Maybe 250MB or 100MB?

    2) It has a swap partition that is 122MB. I know the Raspbian distro also has a swap partition… but some in IRC have nagged me about how bad swap on SD cards is with wearing them out faster. Should we really have a swap partition?

    3) I installed LibreOffice, Firefox, Inkscape, xchat, and pidgin… but had to pull that stuff back out to get it to fit on a 4GB card with some free space left. If you have a bigger card, put the card into a desktop system and use gparted and resize /. Then you’ll have plenty of room to install whatever you want.

    I know there is Pidora but their mailing list (so far as I cn tell) has been dark for a while. I’m not sure how long it will take them to catch up to the Pi 2… so this isn’t a bad start.

Leave a Reply