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)