Architectures/Fedora ARM Kernels

From FedoraProject

< Architectures
Revision as of 21:11, 8 June 2011 by Dmarlin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Building and Installing a Fedora Kernel Package on ARM Systems


To be able to build and install a Fedora kernel package on ARM systems in a similar manner to installing on an x86 PC.

Since ARM-based hardware varies greatly, I decided to start with a single architecture and focus on the board(s) for which I have access. It is my hope that this can be expanded to support other ARM variants and boards over time. The specific ARM systems initially targeted are the Beagle-xM and Panda boards. These are TI OMAP3 and OMAP4, respectively.

Kernel Version

Although F13 Beta is the base version of Fedora currently running on the boards, a more recent stable kernel from F15 was selected for the kernel baseline. The plan is to tract the F15 kernel versions, keeping up with the most recent builds until F16 is released.

This newer kernel version has a dependency for a newer (F15 based) version of linux-firmware, so it was also built and installed.

Building the Kernel Package

The kernel.spec file and Makefile.config were modified to add ARM OMAP specific support, and an applicable kernel config file was added. The kernel package was then built on a Panda board using the following command:

rpmbuild -ba --target=armv7l SPECS/kernel.spec

The source and binary packages are available via yum:

The Fedora ARM kernel source tree is also available in git:

git clone ssh:// git branch kernel origin/kernel

A scratch build through Koji can be performed using:

fedpkg --dist=f13 srpm arm-koji build dist-f13 --arch-override=armv7l --scratch kernel-<KERNEL_VERSION>.fc13.src.rpm

Installing the Fedora ARM Kernel

Both the boards selected for testing use the uBoot bootloader, so support was added to the grubby package to automate the creation of appropriate images to allow automatic boot of the installed kernel. This is accomplished through the uBoot autoboot script and appropriate image selection.


  • uBoot does not support a "boot menu", like lilo or grub
  • uboot partitions are vfat, which means no hard links
  • uboot does not support symlinks


  • uBoot will use an autoboot script (boot.scr)
  • The kernel will boot using an initrd
  • The uBoot partition (vfat) will be mounted on /boot/uboot
  • the "default" boot images will use "standard" named files (i.e. uImage, uInitrd)


To automate the kernel installation for uBoot, the grubby package was modified as follows:

  • require uboot-utils
  • add sections to handle uBoot images in both update and remove
  • run mkimage in the RPM posttrans script if uBoot is configured
  • copy the new images to uImage and uInitrd (making it the default)
  • remove the corresponding version of uBoot images when a kernel is removed

A simple text file was added that keeps a log of the installed kernel versions (assuming they were installed via yum or rpm). When a new kernel is installed its version is appended to the list. When a kernel is removed its version entry is removed from the list. The last entry in the list is always assumed to be the default. If the default kernel is removed, the "new default" version of the uBoot image files (the new "last" version in the list) are copied to uImage and uInitrd.

Minimal error checking is performed by the install and remove code.

One other caveat, the uBoot directory may not always be mounted, since it is not required once Linux is booted. If the uBoot partition is not already mounted, grubby will attempt to mount it and proceed. If grubby had to perform the mount, the partition will be unmounted when the process is complete (left in the same state as before the transaction).

This is an example of how the uBoot directory should look after installing a kernel:

  -rwxr-xr-x 1 root root   20632 May  5 10:15 MLO
  -rwxr-xr-x 1 root root     240 May 16 13:02 boot.cmd
  -rwxr-xr-x 1 root root     312 May 16 13:05 boot.scr
  -rwxr-xr-x 1 root root     112 Jun  1 18:12 klist.txt
  -rwxr-xr-x 1 root root  146536 May  5 10:16 u-boot.bin
  -rwxr-xr-x 1 root root 3934012 Jun  1 18:12 uImage
  -rwxr-xr-x 1 root root 3934012 Jun  1 18:12 uImage-
  -rwxr-xr-x 1 root root 8476083 Jun  1 18:12 uInitrd
  -rwxr-xr-x 1 root root 8476083 Jun  1 18:12 uInitrd-

This is an example of the autoboot command file (boot.cmd):

setenv bootargs console=ttyO2,115200n8 ro rootwait root=/dev/mmcblk0p4 init=/sbin/init earlyprintk rd_NO_PLYMOUTH setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; fatload mmc 0:1 81600000 uInitrd; bootm 80300000 81600000' boot <code>

Your command options may vary, depending on your specific configuration, but the uImage and uInitrd files must be used for this method to work.

This file can be converted to the autoboot script (boot.scr) using the following command:

<code> mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "PandaBoard boot script" -d boot.cmd boot.scr

The name of the uBoot directory, the device partition used, the name of the installed kernel version list, and the image file names used are all configurable through the /etc/sysconfig/uboot file. The defaults are provided:

Important Note
Please make any changes to this configuration _before_ performing any kernel installation or removal. Changing these after a kernel has been installed may cause future attempts to install or remove kernels to fail. The most likely values to change are UBOOT_DIR and/or UBOOT_DEVICE, since these are based on how your flash device is partitioned and mounted.

Installing the Kernel

Set Up the Repository

  • get the arm-omap yum repo definition:

sudo yum --nogpgcheck install

  • update grubby to get the modified version:

sudo yum --enablerepo=arm-omap update grubby

  • make any required changes to the uBoot configuration (optional)

sudo vi /etc/sysconfig/uboot

Install the Kernel

  • install the latest ARM OMAP kernel version:

sudo yum --enablerepo=arm-omap install kernel-omap

If all goes well, the latest kernel-omap version should installed, the uBoot images copied to the default uBoot image files, and the latest kernel-omap version appended to the installed kernel version list file (klist.txt). On the next reboot, the new kernel version should be booted automatically.