Build

We use devcontainer to maintain a consistent build environment.

To build all supported EDK2 variants, please run make deb within devcontainer.

Set BUILD_TARGET to DEBUG in src/Makefile to build for debug artifacts.

Edit DSC in src/Makefile to reduce amount of variants that will be built. You should also edit debian/edk2-cix.install to exclude unbuild variants, otherwise debuild will complain that those files are missing.

Debug

Serial connection

The following UARTs can be used to debug EDK2 on Radxa Orion O6:

  • UART1: EC
  • UART2: AP
  • UART3: Debug
  • UART4: PM
  • UART5: SE

UART2 is the default management console for EDK2 and the operationg system.

UART3 is only available when EDK2 is build as DEBUG image.

All UARTs other than UART1 use 115200 baud. EC UART can be viewed with the following command:

picocom -b 460800 --imap lfcrlf /dev/ttyX

In general, the log output order after power is connected is as follow:

EC ---Power On---> SE ---> AP ---> Debug

If you enable devenv, then you can run edk2-console to launch above 4 UART consoles at once. Please first create a local devenv.local.nix based on devenv.local.nix.example to define the local UART devices before using this command.

Installation

Once build completes, you can find the complete set of artifacts under debian/edk2-cix/usr/share/edk2/.

Follow Installation guide to continue.

If you enable devenv, then you can run edk2-install </dev/data_partition> from the project root as a faster method to copy those files to a prepared USB disk.

Update BIOS from RadxaOS

Since 0.3.0-1, edk2-cix now integrates with RadxaOS to provide an easy to use BIOS update entry. This makes updating BIOS easier to operate, while also allow a given image to ship its own matching BIOS.

How to start BIOS update?

Restart the system, and choose Install EDK2 option for your product.

Below is the complete process of upgrading BIOS from 0.2.2-1 to 0.3.0-1:

asciicast

Install a different version of BIOS

Like other system components in RadxaOS, edk2-cix are regularly released and published in Radxa maintained apt archives. Users can use rsetup to perform system update to acquire the latest version of edk2-cix.

Installing a new version of edk2-cix package will update the bootloader entry to that specific version. User still needs to explicitly launch it during boot up to actually have BIOS updated.

If user wants to install a different version of BIOS, they can simply install the edk2-cix package of that version, and perform installation after reboot.

In some cases, the system will be unbootable due to mismatched kernel and BIOS. This can happen after a system update. The user can either use the bootloader menu to select an previously installed kernel, or update the matching BIOS for the latest kernel.

In rare cases, when neither of the above methods are available, user can try to manually install the BIOS.

Manually install released binary

Full demo

Below is the full process of upgrading an 0.1.0 debug build to 0.1.1-1 release build.

Ventoy were used and HDMI display were connected. The actual process happened over serial.

asciicast


Where to find releases?

You can find all released Debian packages under GitHub Release page.

Similar to our other firmware packages, each release contains both the binary package as well as the metapackages.

Taking release 0.1.1-1 as an example, you can see 2 packages:

NameSizeType
edk2-cix_0.1.1-1_all.deb4.79 MBBinary package
edk2-orion-o6_0.1.1-1_all.deb2.09 KBMetapackage

As usual, the binary package is the one with a large size, and the metapackage is usually only a few KB.

Also, the binary package will usually share the name with the code repository, while metapackages will usually named after a specific product.

Download and extrace the release

To prepare a BIOS update disk, first, download and extract the package:

mkdir extract
cd extract
wget https://github.com/radxa-pkg/edk2-cix/releases/download/0.1.1-1/edk2-cix_0.1.1-1_all.deb
ar vx *.deb
tar xvf data.tar.xz

Create the BIOS update disk

You should now have BIOS for all supported platforms, as well as some supporting files

$ find usr/share/edk2/
usr/share/edk2/
usr/share/edk2/cix
usr/share/edk2/cix/merak
usr/share/edk2/cix/merak/BuildOptions
usr/share/edk2/cix/merak/BurnImage.efi
usr/share/edk2/cix/merak/FlashUpdate.efi
usr/share/edk2/cix/merak/Shell.efi
usr/share/edk2/cix/merak/VariableInfo.efi
usr/share/edk2/cix/merak/cix_flash.bin
usr/share/edk2/cix/merak/startup.nsh
usr/share/edk2/radxa
usr/share/edk2/radxa/orion-o6
usr/share/edk2/radxa/orion-o6/BuildOptions
usr/share/edk2/radxa/orion-o6/BurnImage.efi
usr/share/edk2/radxa/orion-o6/FlashUpdate.efi
usr/share/edk2/radxa/orion-o6/Shell.efi
usr/share/edk2/radxa/orion-o6/VariableInfo.efi
usr/share/edk2/radxa/orion-o6/cix_flash.bin
usr/share/edk2/radxa/orion-o6/startup.nsh

Copy them to a USB disk formatted in FAT file system, and connect them to the target board.

Optionally, you can use Ventoy to create a BIOS update disk that can also be used to load Linux ISOs, as long as the size is under 4 GiB (due to FAT32 limitation).

Ventoy is a popular ISO multi-boot tool. It also supports booting EFI applications and ARM64 architecture.

First, use Ventoy to create a bootable USB disk. Make sure you select GPT partition table in the option.

You will then reformat the first partition with FAT file system, as the default file system exFAT is not supported by EDK2.

You can copy the EDK2 build artifacts to the first partition as usual.

Enter UEFI Shell

You will need to enter UEFI Shell to run the script to update the BIOS. There are 2 ways to achieve that:

Via UEFI Setup

Press Escape key when prompted on the console. Then enter Boot Manager menu and select UEFI Shell.

Via Ventoy

When you boot the system and missed the Escape prmopt, if there is no other bootable media, EDK2 should boot into Ventoy.

Caution

If screen is connected, Ventoy will boot into graphical mode. Under this mode you will have no output on UART2, but you can still control the menu with it.

You can enable Force Text Mode under the display menu to allow output on UART2.

Inside Ventoy UI you should have Shell.efi listed as an option if you copied everything. Run it to enter UEFI Shell.

Caution

If you built for multiple EDK2 variants you may have multiple Shell.efi listed in Ventoy. They are generally compatible with different platforms, but when in doubt, only use the one come with your target platform, and only copy the EDK2 variant for your platform.

Update BIOS from UEFI Shell

Once inside the UEFI Shell, you should first be greeted by a list of available storage devices and their physical paths.

If you only have the USB disk connected, it should be listed as fs0.

You can rescan the storage device with map -r command, which will reprint the available devices as well.

You can run BIOS flash script from UEFI Shell now. It uses Windows convention, so an example command would be:

fs0:\radxa\orion-o6\startup.nsh

Info

Before 0.3.0-1, startup.nsh is called setup.nsh.

The first backslash is not mandatory:

fs0:radxa\orion-o6\startup.nsh

There is limited auto completion in the UEFI Shell when pressing Tab key.

Running this command will flash your BIOS. Follow its prompt to complete the process.