You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

At the moment [09.01.2020] it is not fully 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
Every detail which not fully clear will be emphasized as questionable.

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]

  • 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]

  • Main Bootloader
     - Load Linux [u-boot] or Bare Metal Application into the RAM
     - Jump to it



Partitions of a SD card


The SD card can be partitioned or not, a partitioned SD card offers the advantage of a separated / persistend data partition.

Partitions of the SD card:

Partition      Device Boot     Start           End        Blocks      Id         System                             Used for
/dev/sdc1            *              2048     616448    307200+       c     W95 FAT32 (LBA)    u-boot, Kernel, Dtb and Linux-Config-Script
/dev/sdc2                        616449   3074049  1228800+     83           Linux                Linux Distribution
/dev/sdc3                      3074050   3094530      10240+     a2        Unknown            SPL u-boot and optional Main u-boot


Format the SD card


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

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

Example output:
NAME  MAJ:MIN  RM      SIZE  RO   TYPE    MOUNTPOINT
sda            8:0         0     120G     0    disk
├─sda1     8:1         0     112G     0    part /
├─sda2     8:2         0         1K     0    part
└─sda5     8:5         0         8G    0     part   [SWAP]
sdc            8:32       1       7,2G    0    disk
└─sdc1     8:33       1         1M    0    part
sr0           11:0         1   1024M    0   rom

RM = Removable → sdc is the sd card



de-10@de10-VirtualBox:~$ sudo fdisk /dev/sdc -> Starte fdisk (optional sfdisk)
[sudo] password for de-10:

Command (m for help): p -> List partitions

Disk /dev/sdc: 7740 MB, 7740588032 bytes
6 heads, 1 sectors/track, 2519722 cylinders, total 15118336 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbc81f5dd

Device Boot Start End Blocks Id System

Wenn partitionen bestehen, alle löschen:

Command (m for help): d -> delete partitionen
Partition number (1-4): 1 -> Select partition to delete
Command (m for help): w -> Write new partition table
Command (m for help): q -> End programm

Neue partitionen anlegen;
de-10@de10-VirtualBox:~$ sudo fdisk /dev/sdc

Command (m for help): n -> New partition
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-15118335, default 2048): 2048 -> Just "Enter" for automode
Last sector, +sectors or +size{K,M,G} (2048-15118335, default 15118335): +2048
-> +sectors, with 512 byte sector, 1 M byte partion created

Command (m for help): p

Device Boot Start End Blocks Id System
/dev/sdc1 2048 4096 1024+ 83 Linux

Partition-Typ in a2 umbenennen, damit diese Partition beim booten vom
Cyclone 5 gefunden werden kann. In dieser Partition wird später der
First-Stage- / Pre- Bootloader gespeichert.
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): a2
Changed system type of partition 1 to a2 (Unknown)


2 Weitere Partitionene erstellen:
Fat32 / VFat ~ 29152 Sectoren / 24576 Blocks groß
- Command (m for help): n, p, 3, "Enter", +29576
- Command (m for help): t=table, c (W95 FAT32 (LBA))
- Command (m for help): a=active, 3

Ext4 ~ 2097152 Sectoren / 1048576 Blocks
- ....
- Nicht nötig, per default als "83" / Linux markiert

Im Ergrbnis erhält man diese Partitionstabelle:
Command (m for help): p
Device Boot Start End Blocks Id System
/dev/sdc1 * 8 42605 21299 c W95 FAT32 (LBA)
/dev/sdc2 42608 44655 1024 a2 Unknown
/dev/sdc3 44656 3454691 1705018 83 Linux
SPEICHERN der Tabelle mittels:
Command (m for help): w

Dateisystem der 2ten und 3ten Partion erzeugen:
de-10@de10-VirtualBox:~$ sudo umount /media/user/Partitions-Name
sudo mkfs -t vfat /dev/sdxp3
sudo mkfs.ext4 /dev/ldx2p2
Möglicherweise nochmal ummounten



PRE-Loader mit inkludiertem Haupt-Boot-Loader installieren / kopieren:
sudo dd if=/home/de-10/Desktop/deployA19.01/u-boot-arrow-sockit-v2019.04+gitAUTOINC+bc38a09daa-r0.sfp of=/dev/sdf1 seek=0


Damit kann der Preloader den U-Boot-bootloader laden und
danack kann wiederum von der Fat-Partition der DTB (Device Tree Blob)
sowie der Linux-kernel zImage geladen werden.








  • No labels