Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

At the moment [09.01.2020] it is just understood which files are necessary
to boot a Linux or an bare metal application onto the HPS of a Cyclone 5 / 10 or Aria chip

Requirements


All steps to format / setup a bootable SD card can only be performed within a Linux installation.
(Windows Subsystem for Linux is not capable to format a SD card)

An installation of INTEL SoC FPGA EMBEDDED DEVELOPMENT SUITE, so the tools
bsp-editor, alt-boot-disc-util and SoC EDS Command Shell are present.

Background


The boot process of the HPS consists of several stages:

  • Boot ROM
     - Hard coded into the chip
     - It's purpose is to detect the selected boot source
     - Perform minimal Setup of the HPS
     - Load the next Boot stage [Preloader / u-boot-spl] into the On chip RAM [OCRAM]
        therefore the preloader / SPL u-boot is limited to 64 kByte on Cyclone 5 devices

  • Preloader
     - Perform additional HPS initialization
     - Bring up SDRAM
     - Load the next boot stage from Flash to SDRAM and jump to it
     - Preloader-optins:
            u-boot - SPL
            SoC EDS - MPL [Altera bare-metal libraries - HWLibs]
     - For Cyclone 5 devices, the preloader consists of 4 identical copies. each 64 kB in size,
        256 kb in total
     - When generating the preloader, it can be necessary to manually add a header and checksum
       into the binary, the tool mkpimage can perform these additions

  • Main Bootloader
     - Load Linux [u-boot] or Bare Metal Application into the RAM
     - Jump to it.
       In case of Linux, load Kernel, followed by the loading of the Linux rootfs
     - When generating the preloader, it can be necessary to manually add a header and checksum 
       into the binary, the tool mkimage can perform these additions



Partitions within the SD card


The SD card can be partitioned or not, a partitioned SD card offers the advantage of a separation / persistent data storage.
Partitions of the SD card:

...

Unknown - partition for u-boot config script and how to setup (uboot.scr)
                   The main u-boot environment can be saved with saveenv
vfat-partition:          optional - Linux-Config-Script / main u-boot instead a2-partition


Format the SD card


To partition the SD card, Linux offers the command line tool fdisk [sfdisk].
        BEWARE!    fdisk  [sfdisk] can operate on every disk within the system and does not ask for approval.

Console commands are in cursive letters, comments to a command follow the command
inside brackets.
Example:
   commandInCorsiveLetters   (comment in brackets)

Identify your SD card

Inserd the Sd card into the system, start a console [Ctrl + Alt + t] and type:
     lsblk   (list the disks conected to the system / Get SD-card-path)

...

RM = Removable ? → sdc is the SD card with one partition sdc1

Format the card - Manual approach:

To format the card, start the tool fdisk by typing:
     sudo fdisk /dev/sdc   (sudo=grant root, enter password    fdisk=tool   /dev/...=SD card)
The command promt changes to Command (m for help).

...

Step 6: Close programm → Type q


Format the card - Automated approach:

Copy to a textfile and save the following in between ----- .

...

(To read the partition table from a storage device - sudo sfdisk -d /dev/sdX > PathToTextFile)

Data of each partition

Before writing data to the partitions, unmount the device
      sudo umount /dev/sdX*
and plage the SD card  in and out of the card reader.

W95 Fat32 partition

The W95 Fat32 partition needs to be formated.
   sudo umount /dev/sdX*
   sudo mkfs -t vfat /dev/sdXp (p=partition number, needs to be 1)

After the operation finishes, use a data browser to copy the
Linux kernel / zImage(.bin)   and the   device tree blob / socfpga.dtb.

ext(2/3/4) partition

The ext(2/3/4) partition is formated via:
   sudo mkfs.ext3 /dev/sdXp   (p=partition number, should be 2)

...

Extract the ... .tar.gz file to the partition:
   sudo tar -xvf pathToCompressed.tar.gz -C /mnt/card/   (x=decompress v=show progress -C=extract to)
   sudo sync   (imported, empty all buffers)

a2 partition

This partition need no formatting, the data needs to be copied with the tool
alt-boot-disk-util .

...

(The tool dd can also be used to write the preloader - sudo dd if=pathToSplUboot of=/dev/sdXp seek=0 bs=64k conv=fsync)


Console output of boot process

BootRom           -    no output

...