wiki:malibu/boot

Version 2 (modified by Tim Harvey, 12 months ago) ( diff )

move U-Boot details to new page

Malibu Boot Firmware

The 'Boot Firmware' for Malibu is defined as the combination of the firmware stages through up to and including the bootloader. This can be broken down into the following stages:

  • Boot ROM (internal on CN913x SoC): fetch first level boot firmware from boot device (ie eMMC) into L2 cache
  • ATF (ARM Trusted Firmware)
  • Bootloader (U-Boot)

Gateworks provides pre-built Boot Firmware ready to flash onto boot devices as well as source for building and/or modifying the boot firmware yourself.

CN913x BOOT ROM

The BOOT ROM is firmware baked into the SoC and is in charge of loading code from the 'boot device' into L2 cache, verifying signatures (if using trusted boot) and executing it.

The BOOT ROM fetches code from an offset, verifies a header, and jumps to that code. If the header verification fails it will move on to the next offset. The offsets vary per boot device:

  • eMMC:
    • boot0/boot1 hardware partitions: LBA0 (0)
    • data hardware partition: LBA1 (512B), LBA34 (512B*34), LBA4096 (2M), LBA8192 (4M), LBA12288 (6M)
  • SD:
    • LBA1 (512B), LBA34 (512B*34), LBA4096 (2M), LBA8192 (4M), LBA12288 (6M)

Note that LBA refers to Logical Block Address which is a block device unit of 512 bytes.

The image header contains a 4-byte magic pattern to identify the boot image, 32bit checksums, a load address, an execution address, a 1byte uart config to configure the serial port for boot info, a baudrate for the serial port and some extension data.

The CN913x Boot flow is documented in chapter 28 of the ARMADA 80xx Family Functional Specification which can be obtained under NDA with Marvell.

Boot Firmware Image

The boot firmware image contains all of the components of the 'Boot Firmware':

  • ARM Trusted Firmware
  • Marvell DDR configuration software; this is a Binary ROM extension (BLE) for the ATF
  • U-Boot; this is a BL33 for the ATF

The boot firmware for Malibu is placed on the boot0 emmc hardware partition so that it is separated from the OS image.

Malibu Boot Firmware Image Map:

  • imx8mm:
start-end len item
0x00000000 - 0x003f0000 4032K ATF (including ddr config as BLE and U-Boot as BL33)
0x0003f000 - 0x00400000 64K U-Boot env (redundant 32KB env)

Compressed Disk Images

Gateworks releases compressed disk images that can be easily flashed using the U-Boot Bootloader or Linux (booted on a ramdisk based root filesystem). These disk images contain a partition table so they are tailored to the specific device size they are intended for. Additionally they are commonly configured for a small partition size to keep flash programming time at a minimum. This requires resizing the rootfs filesystem in order to take advantage of the remaining flash space.

Once you have a root filesystem directory/tarball and have a kernel Image you can create a compressed disk image that can be installed easily from the bootloader.

The creation of the compressed disk image is demonstrated in the Malibu BSP makefile

Once you have a compressed disk image you can install this using the methods described in malibu/firware-update. For example in the bootloader:

setenv dev 0 # emmc device; use mmc list to see all mmc devs
tftpboot ${loadaddr} image.img.gz && gzwrite mmc ${dev} ${loadaddr} ${filesize}

If you created a filesystem that did not stretch to the partition it was installed on (as we create a minimally sized filesystem image to fit within the eMMC device for faster programming) you will want to resize it after booting to Linux. This is a one time operation after flashing a compressed disk image and can be done using the 'growpart_once' script that we install on the Ubuntu Root filesystems found in the script here (search for growpart_once)

To install the kernel and root filesystem on a removable block storage device see linux/blockdev.

U-Boot Bootloader

Gateworks supports the U-Boot Bootloader for the Malibu product family.

The purpose of a bootloader is to load the Linux kernel and execute it passing it configuration parameters such as an optional kernel command-line, an optional initial ramdisk filesystem, and a device-tree.

The following items are supported in the Gateworks U-Boot for Malibu:

  • eth0 (RGMII)
  • USB Host mode (USB Mass Storage and USB Networking for various USB Ethernet adapters supported by U-Boot
  • eMMC / microSD

The following items are not currently supported in the Gateworks U-Boot for Malibu:

  • PCIe support
  • USB device mode support (for USB OTG)

see uboot for more info

Note: See TracWiki for help on using the wiki.