Versions Compared

Key

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

...

  • 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 and
       a mark for recognition 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 checksum header and checksum 
       a mark for recognition into the binary, the tool mkimage can perform these additions

...

Partition                     Required for                                Size
W95 FAT32 (LBA)       Kernel and Device Tree Blob            > 20 MB
Linux ext(2/3 or 4)     Linux Distribution                        > 150 MB to 2 GB
Altera / a2                 SPL u-boot and Main u-boot      >= 1 or 2 MB

...


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 → 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

...

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

Type p to list all existing partitions.
Type d to erase a partition.
Type n to edit a new partition.
Type t to set the partition type (default is Linux / 83).
Type a to mark partition as active.

Output for p:    For convenience, the partition table listed is the one which the SD card needs to be setup to
                         Sizes may vary

...

To create the partition table run:
   sudo umount /dev/sdX*     (unmounts deviceumounts=unmount  *=all partitions)
   sudo sfdisk /dev/sdX < PathToTextFile


(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.

...

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)

...

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

...

Usually these folder is placed inside the mnt folder, for example:
   sudo mkdir /mnt/card   card   (create mounting point folder)

Mount it:
   sudo mount /dev/sdXp /mnt/card   card   (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   sudo sync   (imported, empty all buffers)

...

The tool should be in the folder:
   \intelFPGA\18.1\embedded\host_tools\altera\diskutils
Copy the   SPL u-boot.bin   and   the Main u-boot.img   to it, change to the directory:
   cd pathToAlt-boot-disk-utilutil   (cd=change directory)
and run:
   sudo pathToAlt-boot-disk-util -p preloaderImage.bin -b mainU-boot.img -a write /dev/sdX   sdX   (the tool finds the a2 partition)

Lastly, unmount the Sd card ( sudo umount /dev/sdX* ) and test it.


(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

SPL u-boot        -    U-Boot SPL 2013.01.01 (Jan 02 2020 - 11:23:24) ...

main u-boot      -    U-Boot 2013.01.01 (Jan 06 2020 - 10:45:30) ...

Kernel loading   -    Starting kernel ...

rootfs loading    -    Welcome to Poky (Yocto Project Reference Distro) 2.7.2 (warrior)!



U-Boot SPL 2013.01.01 (Jan 02 2020 - 11:23:24)
BOARD : Altera SOCFPGA Cyclone V Board
CLOCK: EOSC1 clock 25000 KHz
CLOCK: EOSC2 clock 25000 KHz
CLOCK: F2S_SDR_REF clock 0 KHz
CLOCK: F2S_PER_REF clock 0 KHz
CLOCK: MPU clock 600 MHz
CLOCK: DDR clock 333 MHz
CLOCK: UART clock 100000 KHz
CLOCK: MMC clock 50000 KHz
CLOCK: QSPI clock 400000 KHz
RESET: COLD
INFO : Watchdog enabled
SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SDRAM: 2048 MiB
ALTERA DWMMC: 0


U-Boot 2013.01.01 (Jan 06 2020 - 10:45:30)

CPU : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone V Board
I2C: ready
DRAM: 2 GiB
MMC: ALTERA DWMMC: 0
In: serial
Out: serial
Err: serial
Skipped ethaddr assignment due to invalid EMAC address in EEPROM
Net: mii0
Warning: failed to set MAC address

Hit any key to stop autoboot: 0
reading u-boot.scr
** Unable to read file u-boot.scr **
Optional boot script not found. Continuing to boot normally
reading zImage
4584536 bytes read in 219 ms (20 MiB/s)
reading socfpga.dtb
19377 bytes read in 5 ms (3.7 MiB/s)
## Flattened Device Tree blob at 00000100
Booting using the fdt blob at 0x00000100
reserving fdt memory region: addr=0 size=1000
Loading Device Tree to 03ff8000, end 03fffbb0 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.0-g27c406b-dirty (soceds@ubuntu) (gcc version 5.5.0 (Linaro GCC 5.5-2017.10) ) #3 SMP Tue Mar 26 23:45:18 EDT 2019
[ 0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt:Machine model: Trenz M Series Cyclone V SoC Development Kit
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] percpu: Embedded 14 pages/cpu @eefcb000 s26944 r8192 d22208 u57344
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 522752
[ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait

...

[ 1.849673] systemd[1]: Detected architecture arm.

Welcome to Poky (Yocto Project Reference Distro) 2.7.2 (warrior)!

[ 1.888466] systemd[1]: Set hostname to <arrow-sockit>.
[ 2.113176] systemd[1]: File /lib/systemd/system/systemd-journald.service:12 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
[ 2.130237] systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)
[ 2.444313] systemd[1]: Listening on udev Control Socket.
[ OK ] Listening on udev Control Socket.
[ 2.486269] systemd[1]: Listening on Syslog Socket.
[ OK ] Listening on Syslog Socket.
[ 2.517683] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ OK ] Started Forward Password R???uests to Wall Directory Watch.


...

[ OK ] Started Update UTMP about System Runlevel Changes.

Poky (Yocto Project Reference Distro) 2.7.2 arrow-sockit ttyS0

arrow-sockit login: