Provisioning Fedora CoreOS on the Raspberry Pi 4
Fedora CoreOS produces 64-bit ARM (aarch64
) artifacts. These images can be used as the Operating System for the Raspberry Pi 4 device. Before trying to get FCOS up and running on your Raspberry Pi 4 you’ll want to Update the EEPROM to the latest version and choose how you want to boot the Raspberry Pi 4. There are two options:
U-Boot is the way the Raspberry Pi 4 has traditionally been booted. The EDK2 Firmware is an effort to provide a layer that will make RPi4 SystemReady ES (SBBR compliant) similar to most larger 64-bit ARM servers.
Updating EEPROM on Raspberry Pi 4
The Raspberry Pi 4 uses an EEPROM to boot the system. The EEPROM/Firmware in the past had problems reading a FAT16 EFI partition, which FCOS uses. For the best experience getting FCOS to run on the RPi4 please update the EEPROM to the latest version. To check if you have the latest version you can go to the raspberrypi/rpi-eeprom releases page and make sure the version reported by your Raspberry Pi on boot is from around the same date as the last release.
The Raspberry Pi Documentation recommends using the Raspberry Pi Imager for creating a boot disk that can be used to update the EEPROM. If you’re on a flavor of Fedora Linux the Raspberry Pi Imager is packaged up and available in the repositories. You can install it with:
dnf install rpi-imager
You can successfully use rpi-imager from inside a Toolbx container.
|
If not on Fedora Linux you’ll need to follow the documentation for obtaining the imager.
Once you have the imager up and running (on Fedora you can run it with rpi-imager
on the command line), you’ll see the imager application load:
At this point you can follow the documentation for how to create the disk and then update your Raspberry Pi 4.
Installing FCOS and Booting via U-Boot
To run FCOS on a Raspberry Pi 4 via U-Boot the SD card or USB disk needs to be prepared on another system and then the disk moved to the RPi4. After writing FCOS to the disk a few more files will need to be copied in place on the EFI partition of the FCOS disk. Check out the Raspberry Pi Documentation to read more about what these files are for.
In this case we can grab these files from the uboot-images-armv8
, bcm2711-firmware
, bcm283x-firmware
, bcm283x-overlays
RPMs from the Fedora Linux repositories. First download them and store them in a temporary directory on your system:
RELEASE=39 # The target Fedora Release. Use the same one that current FCOS is based on.
mkdir -p /tmp/RPi4boot/boot/efi/
sudo dnf install -y --downloadonly --release=$RELEASE --forcearch=aarch64 --destdir=/tmp/RPi4boot/ uboot-images-armv8 bcm283x-firmware bcm283x-overlays
Now extract the contents of the RPMs and copy the proper u-boot.bin
for the RPi4 into place:
The following commands to extract the contents of the RPMs, the use of coreos-installer , and copying of the files to the ESP partition should be done from outside a Toolbx container. The root user in the container maps to a different user ID (UID) than the root (UID=0 ) user on the host. Attempting to run some of these commands in the container and some of these commands on the host can result in permission errors or ownership errors and may impact your ability to successfully install Fedora CoreOS.
|
for rpm in /tmp/RPi4boot/*rpm; do rpm2cpio $rpm | sudo cpio -idv -D /tmp/RPi4boot/; done
sudo mv /tmp/RPi4boot/usr/share/uboot/rpi_arm64/u-boot.bin /tmp/RPi4boot/boot/efi/rpi-u-boot.bin
Run coreos-installer
to install to the target disk. There are various ways to run coreos-installer
and install to a target disk. We won’t cover them all here, but this workflow most closely mirrors the "Installing from the container" documentation.
FCOSDISK=/dev/sdX
STREAM=stable # or `next` or `testing`
sudo coreos-installer install -a aarch64 -s $STREAM -i config.ign --append-karg nomodeset $FCOSDISK
We pass in --append-karg nomodeset here to workaround an issue where monitor output will be lost during system boot.
|
Make sure you provide an Ignition config when you run coreos-installer .
|
Fedora CoreOS has a default core user that can be used to explore the OS. If you want to use it, finalize its configuration by providing e.g. an SSH key.
|
Now mount the ESP partition and copy the files over:
FCOSEFIPARTITION=$(lsblk $FCOSDISK -J -oLABEL,PATH | jq -r '.blockdevices[] | select(.label == "EFI-SYSTEM")'.path)
mkdir /tmp/FCOSEFIpart
sudo mount $FCOSEFIPARTITION /tmp/FCOSEFIpart
sudo rsync -avh --ignore-existing /tmp/RPi4boot/boot/efi/ /tmp/FCOSEFIpart/
sudo umount $FCOSEFIPARTITION
Now take the USB/SD card and attach it to the RPi4 and boot.
It can take some time to boot, especially if the disk is slow. Be patient. You may not see anything on the screen for 20-30 seconds. |
Installing FCOS and Booting via EDK2
There is a EDK2 UEFI firmware implementation for the RPi4 (pftf/RPi4) that attempts to make the RPi4 SystemReady ES (SBBR compliant) and allows you to pretend that the RPi4 is similar to any other SystemReady server hardware.
You can write the firmware to a disk (USB or SD card) and then boot/install FCOS as you would on any bare metal server. However, the firmware files need to be on an SD card or USB disk and will take up either the SD card slot or a USB slot. Depending on your needs this may be acceptable or not. Depending on the answer you have a few options:
-
Separate Firmware Disk (aka "separate disk mode")
-
Combined Fedora CoreOS + EDK2 Firmware Disk (aka "combined disk mode")
These options are covered in the following sections. Regardless of which option you choose you’ll want to consider if you need to either Change the 3G RAM limit or Enable DeviceTree Boot.
EDK2: Separate Firmware Disk Mode
In separate disk mode the EDK2 firmware will take up either the SD card slot or a USB slot on your RPi4. Once the firmware disk is attached to the system you’ll be able to follow the bare metal install documentation and pretend like the RPi4 is any other server hardware.
To create a disk (SD or USB) with the firmware on it you can do something like:
VERSION=v1.34 # use latest one from https://github.com/pftf/RPi4/releases
UEFIDISK=/dev/sdX
sudo mkfs.vfat $UEFIDISK
mkdir /tmp/UEFIdisk
sudo mount $UEFIDISK /tmp/UEFIdisk
pushd /tmp/UEFIdisk
sudo curl -LO https://github.com/pftf/RPi4/releases/download/${VERSION}/RPi4_UEFI_Firmware_${VERSION}.zip
sudo unzip RPi4_UEFI_Firmware_${VERSION}.zip
sudo rm RPi4_UEFI_Firmware_${VERSION}.zip
popd
sudo umount /tmp/UEFIdisk
Attaching this disk to your Pi4 you can now install FCOS as you would on any bare metal server.
The separate firmware disk will need to stay attached permanently for future boots to work. |
EDK2: Combined Fedora CoreOS + EDK2 Firmware Disk
In combined disk mode the EDK2 firmware will live inside the EFI partition of Fedora CoreOS, allowing for a single disk to be used for the EDK2 firmware and FCOS.
There are a few ways to achieve this goal:
-
Install Directly on RPi4
-
Prepare Pi4 Disk on Alternate Machine
EDK2: Combined Disk Mode Direct Install
When performing a direct install, meaning you boot (via the EDK2 firmware) into the Fedora CoreOS live environment (ISO or PXE) and run coreos-installer
, you can mount the EFI partition (2nd partition) of the installed FCOS disk after the installation is complete and copy the EDK2 firmware files over:
UEFIDISK=/dev/mmcblkX or /dev/sdX
FCOSDISK=/dev/sdY
FCOSEFIPARTITION=$(lsblk $FCOSDISK -J -oLABEL,PATH | jq -r '.blockdevices[] | select(.label == "EFI-SYSTEM")'.path)
mkdir /tmp/mnt{1,2}
sudo mount $UEFIDISK /tmp/mnt1
sudo mount $FCOSEFIPARTITION /tmp/mnt2
sudo rsync -avh /tmp/mnt1/ /tmp/mnt2/
sudo umount /tmp/mnt1 /tmp/mnt2
Now you can remove the extra disk from the RPi4 and reboot the machine.
It can take some time to boot, especially if the disk is slow. Be patient. You may not see anything on the screen for 20-30 seconds. |
EDK2: Combined Disk Mode Alternate Machine Disk Preparation
When preparing the RPi4 disk from an alternate machine (i.e. creating the disk from your laptop) then you can mount the 2nd partition after running coreos-installer
and pull down the EDK2 firmware files.
First, run coreos-installer
to install to the target disk:
FCOSDISK=/dev/sdX
STREAM=stable # or `next` or `testing`
sudo coreos-installer install -a aarch64 -s $STREAM -i config.ign $FCOSDISK
Now you can mount the 2nd partition and pull down the EDK2 firmware files:
FCOSEFIPARTITION=$(lsblk $FCOSDISK -J -oLABEL,PATH | jq -r '.blockdevices[] | select(.label == "EFI-SYSTEM")'.path)
mkdir /tmp/FCOSEFIpart
sudo mount $FCOSEFIPARTITION /tmp/FCOSEFIpart
pushd /tmp/FCOSEFIpart
VERSION=v1.34 # use latest one from https://github.com/pftf/RPi4/releases
sudo curl -LO https://github.com/pftf/RPi4/releases/download/${VERSION}/RPi4_UEFI_Firmware_${VERSION}.zip
sudo unzip RPi4_UEFI_Firmware_${VERSION}.zip
sudo rm RPi4_UEFI_Firmware_${VERSION}.zip
popd
sudo umount /tmp/FCOSEFIpart
Now take the USB/SD card and attach it to the RPi4 and boot.
It can take some time to boot, especially if the disk is slow. Be patient. You may not see anything on the screen for 20-30 seconds. |
EDK2 Firmware: Changing the 3G limit
If you have a Pi4 with more than 3G of memory you’ll most likely want to disable the 3G memory limitation. In the EDK2 firmware menu go to
-
Device Manager
→Raspberry Pi Configuration
→Advanced Configuration
→Limit RAM to 3GB
→Disabled
-
F10
to save →Y
to confirm -
Esc
to top level menu and selectreset
to cycle the system.
EDK2 Firmware: GPIO via DeviceTree
With the EDK2 Firmware in ACPI mode (the default) you won’t get access to GPIO (i.e. no Pi HATs will work). To get access to GPIO pins you’ll need to change the setting to DeviceTree mode in the EDK2 menus.
-
Device Manager
→Raspberry Pi Configuration
→Advanced Configuration
→System Table Selection
→DeviceTree
-
F10
to save →Y
to confirm -
Esc
to top level menu and selectreset
to cycle the system.
After boot you should see entries under /proc/device-tree/
and also see /dev/gpiochip1
and /dev/gpiochip2
:
[core@localhost ~]$ ls /proc/device-tree/ | wc -l
35
[core@localhost ~]$ ls /dev/gpiochip*
/dev/gpiochip0 /dev/gpiochip1
You can interface with GPIO from userspace using libgpiod and associated bindings or tools.
|
Want to help? Learn how to contribute to Fedora Docs ›