Building the SD Card under Quartus Prime 23.1¶
- Table of contents
- Building the SD Card under Quartus Prime 23.1
Introduction¶
The MitySOM-5CSx family of modules are capable of booting, running from, and accessing an SD card, assuming the carrier board has an SD card interface.
Configuration requirements¶
- The
BSEL
pins must be set to0x5
(101b
) since the device uses 3.3V. Note:0x4
(100b
) is for a 1.8V device, so don't use it. - The
CSEL
pins must be strapped to match your clock configuration. - The
MSEL
pins must be strapped to match your desired FPGA configuration.
SD card structure¶
The SD cards from Critical Link are setup with the following structure. Note: There should be three partitions on the SD card after the image is written. The image contains the MBR which stores the partition information.
Offset | Size | Partition | Filesystem |
---|---|---|---|
0x00400000 |
0x10000000 |
1 |
fat |
0x10400000 |
0x00100000 |
2 |
|
0x10500000 |
0x2FB00000 |
3 |
ext3 |
Building the SD Card from the Quartus Project Makefile¶
Prerequisites¶
- Linux (tested on Ubuntu 22.04)
- libguestfs-tools insteall
sudo apt-get install libguestfs-tools
- vmlinux set a readable (note: this needs to be done every time the kernel is upgraded)
sudo chmod a+r /boot/vmlinuz*
Steps¶
- Copy the filesystem tarball built from Yocto (mitysom-image-base-mitysom-5cs.tar.gz) to the preloader folder in the reference FPGA project
- Enter the following command that will allow you to use the Quartus tools from the command line. Note that the NIOS2 is not required in the design, this is just a convenience script to update your shell path.
/opt/intelFPGA_pro/23.1/nios2eds/nios2_command_shell.sh
- Run the following command to build the SD card image
make sd_image
Outputs¶
Description | Location |
SD Card Binary | <Quartus Project Folder>/software/preloader/sd_card.img |
Updating the full SD card¶
Warning: Be sure you are writing to your SD card and not another drive on your system! You can confirm which device you want to write to (i.e. /dev/mmcblk0 or /dev/sdd) by running the df command and finding where your SD card reader is mounted.
Replace the mmcblkX shown in the command below with your device: (i.e. mmcblk0 or sdd)
sudo umount /dev/mmcblkX* sudo dd if=sd_card.img of=/dev/mmcblkX bs=4M status=progress sync
ADVANCED: Updating Individual Parts¶
Updating the U-Boot environment¶
The U-Boot environment is stored immediately after the MBR on the SD card and not on a partition. In order to write the U-Boot environment, you will need to write it raw to the partition using the dd command.
Warning: Be sure you are writing to your SD card and not another drive on your system! You can confirm which device you want to write to (i.e. /dev/mmcblk0 or /dev/sdd) by running the df command and finding where your SD card reader is mounted.
Replace the mmcblkX shown in the command below with your device: (i.e. mmcblk0 or sdd)
sudo umount /dev/mmcblkX* sudo dd if=ubootenv.bin of=/dev/mmcblkX bs=512 seek=1 sync
Updating the FPGA image¶
The Critical Link provided FPGA .rbf file is stored on the first partition of the SD card, which has the Windows FAT filesystem. This means that they can easily be updated from either a Windows machine or a Linux machine.
Replace the mmcblkXp1 shown in the command below with the first partition of your device: (i.e. mmcblk0p1 or sdd1)
sudo mount /dev/mmcblkXp1 /mnt sudo cp dev_5cs.rbf /mnt sync sudo umount /mnt
Updating U-Boot & SPL¶
U-Boot and the SPL are stored on the second partition of the SD card, which does not have a filesystem. In order to write the U-Boot & SPL image, you will need to write it raw to the partition using the dd command.
Warning: Be sure you are writing to your SD card and not another drive on your system! You can confirm which device you want to write to (i.e. /dev/mmcblk0 or /dev/sdd) by running the df command and finding where your SD card reader is mounted.
Replace the mmcblkXp2 shown in the command below with the second partition of your device: (i.e. mmcblk0p2 or sdd2)
sudo umount /dev/mmcblkXp2 sudo dd if=u-boot-with-spl.sfp of=/dev/mmcblkXp2 bs=64k sync
Updating the kernel¶
The Critical Link provided Linux root filesystem is stored on the third partition, which is formatted with the EXT3 filesystem. This partition can easily be updated from a Linux host.
Replace the mmcblkXp3 shown in the command below with the third partition of your device: (i.e. mmcblk0p3 or sdd3)
sudo mount /mmcblkXp3 /mnt sudo cp zImage /mnt/boot sync sudo umount /mnt
Updating the device tree¶
The Critical Link provided Linux root filesystem is stored on the third partition, which is formatted with the EXT3 filesystem. This partition can easily be updated from a Linux host.
Replace the mmcblkXp3 shown in the command below with the third partition of your device: (i.e. mmcblk0p3 or sdd3)
sudo mount /mmcblkXp3 /mnt sudo cp mitysom_5csx_devkit.dtb /mnt/boot sync sudo umount /mnt
Go to top