This step shows how to create the SD card. As mentioned in page "Board bring-up overview for TEI0022" this step is for SD card setup which should be done in the following steps:

The section "Generate SD card partitions and filesystems" describes the process to create the needed partitions and filesystems on the SD card via the Linux tool fdisk. Section "Copy files to partitions" shows the moving from files on the partitions with Windows.

Generate SD card partitions and filesystems

The Intel Cyclone V needs a specific SD card structure which should be realized within the following steps in a linux system. Therefore, the structure shall be introduced in the next subsection. Then, in the second subsection the partitions shall be generated. After that, the filesystems shall be created. Then, in the last subsection, the modification shall be written on the SD card.

SD card structure

The SD card needs three partitions, one vfat, one linux and one 0xA2 partition. The following table shows the target SD card partition which shall be generated in the next section.

#PartitionPurposeSize
1W95 FAT32 (LBA)(U-Boot, )Linux Kernel, Device Tree Blob> 20 MB
2Linux ext(2/3 or 4)Linux Root Filesystem> 150 MB to 2 GB
30xA2 Preloader(, U-Boot)>= 2 MB

Partition generation 

To generate the several partitions, the next steps are necessary:

Creating the partition #1:

Creating the partition #2:

Creating the partition #3:

Writing SD card modifications:

The previos settings are not written to the SD card at this point. To write the changes to the card the next steps are necessary. Therefore, if the wrong identifier is selected, the following commands can destroy the host system! Be aware to use the correct identifier! Furthermore, deleting the existing partitions on the card destroys the saved information! If the information are needed save them before continuing!

Filesystem generation

The filesystems are created with the linux tool mkfs.

Copy files to partitions

After preparing the SD card for booting, this section describes the copy process for the relevant files with a Linux and a Windows operating system (OS):

vFAT Partition 1:

ext3 Partition 2:

0xA2 Partition 3:

After doing these steps, the SD card can be inserted into the board and the boot process can be started. If booting runs into linux, the procedure is done.



////////////////////////

Informationsfragmente

mount/umount muss noch beachtet werden!!!!!

Requirements


Was soll das folgende heißen?

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




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.

u-boot.img muss auf diese Partition!!!!

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)

After the operation finishes, use a data browser to copy the Linux root file system / rootfs   to it.

An other approach is needed for a compressed root file system. Befor decompressing a ... .tar.gz file to the SD card, it needs to be mounted to a mounting point. This requires an existing folder to write to. Usually these folder is placed inside the mnt folder, for example:   sudo mkdir /mnt/card   (create mounting point folder)

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


//////////////////////// SOC EDA Installation für Linux !!!!!!!!!!!!!!

a2 partition

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

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-util   (cd=change directory)
and run:
   sudo pathToAlt-boot-disk-util -p preloaderImage.bin -b mainU-boot.img -a write /dev/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)!

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



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
... Skipping lines  until the last one ...
[ 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.
... Skipping lines  until the last one ...
[ OK ] Started Update UTMP about System Runlevel Changes.

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

arrow-sockit login:

/////////////////////////////