Parent

GRUB on ARM

Linux loader

Both ARM and ARM64 are now supported in upstream GRUB - both are available in the grub 2.02 betas, and included in several Linux distributions. The ARM port supports U-Boot (but should shortly support also UEFI), and the ARM64 port supports UEFI.

On all of these, GRUB supports an additional command compared to other ports; devicetree <file> is used to load a .dtb file from a local filesystem.

Kernel requirements

The only real requirements on the kernel are that:

  • It is built as a simple zImage (arm) or Image (arm64) - none of that uImage wizardry!
  • it is built with Flattened Device Tree (FDT) support (arm) and
    • that it does not simply append that device tree to the kernel image.

Since, for the moment, the kernel source tree is also the repository for the device tree descriptor sources, .dtb files are generated in linux/arch/arm/boot/ for the platform(s) enabled in your configuration.

Building GRUB

The normal use-case for GRUB is building it natively in the system where it is going to run, but GRUB also supports being cross-compiled in case you are building for a software model or suchlike. Either way, grab the source code from the upstream repository:

   1 $ git clone git://git.savannah.gnu.org/grub.git

There are various build dependencies - for Debian/Ubuntu, do:

   1 $ sudo apt-get build-dep grub
   2 $ sudo apt-get install build-essential automake

Then (since this is a source checkout, not a release version):

   1 $ cd grub
   2 $ ./autogen.sh

And then, to build natively:

   1 $ ./configure --prefix=/usr/local && make && make install

Or to cross-compile:

   1 $ ./configure --prefix=/usr/local --target=<target platform> && make && make install

Where <target platform> is aarch64-linux-gnu for arm64 or arm-linux-gnueabihf for arm.

Running GRUB

make install installs the GRUB tools, object files and modules, but to actually run it on your platform, you need to generate a grub image using those tools.

For a native installation, $ sudo grub-install should be sufficient.

For cross compilation, the simplest option might be to create a standalone GRUB image by running

   1 $ grub-mkstandalone -o grub.img -O <target platform>

where <target platform> can be arm-uboot, arm-efi or arm64-efi.

LEG/Engineering/Kernel/GRUB (last modified 2014-10-08 21:36:57)