Styx Xilinx Zynq FPGA Module

Styx: Partitioning SD Card for PetaLinux

106 views July 28, 2023 milna-ms 0

Introduction

PetaLinux is an embedded Linux development tool chain provided by Xilinx, a leading provider of programmable logic devices (FPGAs) and system-on-chip (SoC) solutions. There are different methods of programming a board using PetaLinux. This article is focused on one of the methods, SD boot mode and will provide you a step-by-step guide on how to partition and format an SD card specifically for PetaLinux. We are utilising an SD card with a capacity of 16 GB and we also recommend users to use SD card with a size greater than 4 GB.

Let’s get started

Step 1: 

Insert the SD card into your Linux PC and open the terminal window. Then, enter the following command.

sudo fdisk /dev/sdc

Note: Not every SD card have the name “sdc”. To determine the name of your specific SD card, you can use the command “ls /dev” in the terminal. This will help you identify the correct name for your SD card device.

Step 2: 

To create the first partition, enter “n” in the terminal, followed by selecting the partition type as primary (p), and then press “Enter” twice. It is recommended to allocate at least 1GB of space based on your requirements. In this example, the value “2111122” is provided as the last sector value, which will result in the creation of partition 1 with a size of 1 GB.

Enter “y” for the follow up question.

Step 3:

To create the second partition, you can follow the same steps as before, but this time you can skip providing a value for the last sector.

To finalize and save the partitioning of the SD card, enter “w” in the terminal. This will write the changes to the partition table and save them on the SD card.

Step 4:

We need to assign name and format for each partition. The first partition is designated for the boot and will be formatted with the FAT file system, while the second partition is intended for the root file system and will utilize the EXT4 file system. For this purpose, you can use the following commands in the terminal.

sudo mkfs.vfat -F 32 -n BOOT /dev/sdc1
sudo mkfs.ext4 -L rootfs /dev/sdc2

If everything went well, you should now have an SD card with two partitions, and it is ready for you to copy the necessary files for the booting process.

Was this helpful?

Leave A Comment
*
*