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

Compare with Current View Page History

« Previous Version 22 Next »

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:

  • Generate SD card partitions and filesystems
    • SD card structure
    • Partition generation
    • Filesystems generation
    • SD card modification
  • Copy files to partitions

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:

  • Insert the SD card into your linux system.
  • Start a terminal.
  • Identify the SD card via shell command lsblk
  • Attention: If the wrong identifier is selected, the following commands can destroy the host system! Therefore, be aware to use the correct identifier.
  • The identifier is similar to sdXXX, where XXX symbols the identified SD card. To detect the SD card, it could help to look for the expected SD card size. After that, remove the SD card, use lsblk and look whether the expected device is removed. Then, insert the SD card again and check with lsblk which identifiert is selected for the SD card.
  • Start the tool fdisk as root via sudo fdisk /dev/sdXXX
  • Look at the partition structure via inserting p → Enter
  • Attention: Deleting the partitions in the next step destroys the saved information. If the information are needed save them before continuing!
  • Then delete all partitions via d → Enter
  • After all partitions are deleted the SD card structure can be created.

Creating the partition #1:

  • Create a new partitions via inserting n → Enter
  • Select the primar partition via inserting p → Enter
  • Set the partittion number to via inserting 1 → Enter
  • Select the first sector via inserting 2048 → Enter
  • Select the last sector via inserting +20M → Enter
  • Set partition type via t → Enter
  • Select the first partition via 1 → Enter, if it is not automatically selected.
  • Select the partition type "W95 FAT32 (LBA)" via c → Enter

Creating the partition #2:

  • Create a new partitions via inserting n → Enter
  • Select the primar partition via inserting p → Enter
  • Set the partittion number to via inserting 2 → Enter
  • Select the first sector via inserting Enter
  • Select the last sector (according to your SD card size) via inserting +2G → Enter
  • Set partition type via t → Enter
  • Select the first partition via 2 → Enter
  • Select the partition type "Linux, default value" via 83 → Enter

Creating the partition #3:

  • Create a new partitions via inserting n → Enter
  • Select the primar partition via inserting p → Enter
  • Set the partittion number to via inserting 3 → Enter
  • Select the first sector via inserting Enter
  • Select the last sector via inserting +20M → Enter
  • Set partition type via t → Enter
  • Select the first partition via 3 → Enter
  • Select the partition type "Altera boot partition" via a2 → Enter

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!

  • Write new settings to the SD card via w → Enter
  • Close the program via q → Enter

Filesystem generation

The filesystems are created with the linux tool mkfs.

  • Create a vFAT filesystem on partition 1 via sudo mkfs -t vfat /dev/sdXXX1, whereby XXX symbols the above detected SD card identifier.
  • Create a ext3 filesystem on partition 2 via sudo mkfs.ext3 /dev/sdXXX1, whereby XXX symbols the above detected SD card identifier.
  • No extra filesystem for partition 3 is needed.

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):

  • Insert the SD card to a Linux or Windows OS.

vFAT Partition 1:

  • Copy the linux kernel zImage.bin file to the vFAT partition 1 as zImage file. That means, the ".bin" extension has be deleted.
  • Copy the device tree blob socfpga.dtb file to the vFAT partition 1 as socfpga.dtb file. The file needs this name.
  • Copy the bootloader u-boot.img file to the vFAT partition 1 as u-boot.img file. The file needs this name.

ext3 Partition 2:

  • Copy the linux root filesystem to the ext3 partition 2.

0xA2 Partition 3:

  • Insert the SD card to a Windows OS.
  • Start the SoC EDS Shell as administrator. To do that navigate to C:\intelFPGA\18.1\embedded\ , right click on the file "Embedded_Command_Shell.bat", and select "Run as administrator". Click Yes in the window "User Account Control".
  • Identify one of the SD card letter(s).
  • Copy the preloader to the 0xA2 partition 3 via alt-boot-disk-util -p <path to the preloader image>preloader-mkpimage.bin -a write -d <SD card letter>

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


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)

Soweit ist das folgende wohl überflüssig, da schon erwähnt auf den Seiten zuvor:--------------
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.



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



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 and bold, comments to a command follow the command
inside brackets.
Example:
   commands_in_cursive_letters_and_bolt   (comment in brackets)

Identify your SD card

Insert 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)

!!!!!! kommando für die Identifizierung

!!!! Warnung deutlicher

!!!!! Name ist variable sdc

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 with one partition sdc1

Format the card

fANG MIT AUTO AN; SOLLTE Es wegen dem Texteditrot zu fehlern kommen, → manuell machen

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

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

Disk /dev/sdc: 7740 MB, 7740588032 bytes
239 heads, 62 sectors/track, 1020 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: 0x982b3f12

Device         Boot       Start          End             Blocks         Id            System
/dev/sdc1                  2048          616448       307200+     c             (W95 FAT32 (LBA))
/dev/sdc2                  616449      3074049     1228800+   83           Linux
/dev/sdc3                  3074050    3094530     10240+       a2           Unknown



Step 1: Erase all partitions → Type d and select a partition number to delete or go with the suggested one
            Repeat for all partitions

Step 2: Create a partition → Type n.
            One can type in all required values by hand, but the tool offers usefull values by default.
            To accept them, yout press enter.

            Partition type → Select p   ;    Partition number → Enter   ;   First sector → Enter
            Last sector → +size{K,M,G} / example: 20 MB partition →  +20M

Step 3: Set partition type → Type t
            c=W95 FAT32 (LBA)    a2=Altera boot partition   83=Linux, default value

Step 4: Repeat step 2 and 3 until all partitions are created

Step 5: Write the new table to th SD card → Type w

Step 6: Close programm → Type q

Automated approach:

MISSING:
 - Partitionensgröße editieren
 - HINWEIS → Besser nicht 8GB bei einer 8GB-Karte verwenden, wegen defekter Sektoren

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

------------------------------
unit: sectors

/dev/sdb1 : start= 2048, size= 204800, Id= c
/dev/sdb2 : start= 206848, size= 4096000, Id=83
/dev/sdb3 : start= 4302848, size= 4096, Id=a2
/dev/sdb4 : start= 0, size= 0, Id= 0
------------------------------

To create the partition table run:
   sudo umount /dev/sdX*     (umounts=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.

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:

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











  • No labels