cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1,454 Views
Registered: ‎01-28-2020

PetaLinux: Safely copy RootFS to SD card

Jump to solution

Hello:

I'm trying to configure PetaLinux 2019.2 to use with the package DNNDK v3.1 on a ZedBoard. At the site where you download this package, https://www.xilinx.com/products/design-tools/ai-inference/ai-developer-hub.html#edge, Xilinx includes a .img file for ZedBoard, containing an already configured PetaLinux project. I tried to use this image and it works fine. The problem is that I want to create a custom Vivado project for my application, therefore I need to configure a new PetaLinux project myself. To emulate the Xilinx configuration, I've extracted the .bsp file included in the zcu-dpu-trd package that can also be downloaded from the previous link. Now, my project has a similar configuration to the dpu-trd one, therefore I built and package the project, and executed the following commands to mount my SD card.

cp images/linux/BOOT.BIN /media/arroas/BOOT/

cp images/linux/image.ub /media/arroas/BOOT/

cp images/linux/boot.scr /media/arroas/BOOT/

cd images/linux

sudo tar xvf rootfs.tar.gz -C /media/arroas/RootFS

My problem is  I have notized that the RootFS file system is not correctly copied to the SD card. When I enter the SD card RootFS partition, I've checked several files in /usr/lib/pkgcofig, for example, and all the files are blank. If I check that same directory at my host, the files aren't blank, therefore, I believe the problem happens when copying the filesystem.

I don't know if there is any way around this issue. The ZedBoard .img provided by Xilinx is flashed with Etcher, and it didn't give any problems. For this reason I though it would be a good option to create a .img file with my project and flash it to the SD card with Etcher, bit I haven't been able to create a .img file with my project either.

Any help is welcomed, thank you in advance!

1 Solution

Accepted Solutions
hungdbk92
Participant
Participant
1,316 Views
Registered: ‎12-09-2019

Hi xrancano@alumnos.uvigo.es 

Your SD card partitions look fine. But you should try following things:

- Re-format the card. Set the maximum capacity for the RootFS
- Remove the existing files in the card before doing the copy
- Do a sync after done extracting the rootfs
- Un-mount the card before unplug it

sudo rm -rf /media/arroas/BOOT/*
sudo cp BOOT.BIN image.ub /media/arroas/BOOT/

sudo rm -rf /media/arroas/RootFS/*
sudo tar -C /media/arroas/RootFS -xzvf rootfs.tar.gz
sync

sudo umount -l /media/arroas/BOOT/
sudo umount -l /media/arroas/RootFS/

 

Regards,

Hung

View solution in original post

3 Replies
1,332 Views
Registered: ‎01-28-2020

Hello:

I have re-read the PetaLinux Documentation, page 66, where it says that the BOOT partition is recommended to have 500 Mb, while the SD card can take up the rest of the SD space. In my case, my SD partition has 16 GB in theory. When I open the SD with GParted, the real size is 14.86 GB. At first, I was creating a BOOT partition of 1GB, and the 13.89 GB left were assigned to the RootFS partition.

The .img file provided by Xilinx generates a 1GB BOOT partition and 3GB RootFS partition, leaving the rest of the space unallocated.

image.png

If I do this with my project, the issue hardly ever happens. I'm not sure why, but in the documentation, page 66, it is said to ensure that the partitions are 4MB aligned. English is not my first language, and I'm not quite sure what the aligning means, but I think that this might be what was causing the issues.

If anyone can provide the exact explanation I will mark that as the accepted solution.

Thank you in advance!

0 Kudos
hungdbk92
Participant
Participant
1,317 Views
Registered: ‎12-09-2019

Hi xrancano@alumnos.uvigo.es 

Your SD card partitions look fine. But you should try following things:

- Re-format the card. Set the maximum capacity for the RootFS
- Remove the existing files in the card before doing the copy
- Do a sync after done extracting the rootfs
- Un-mount the card before unplug it

sudo rm -rf /media/arroas/BOOT/*
sudo cp BOOT.BIN image.ub /media/arroas/BOOT/

sudo rm -rf /media/arroas/RootFS/*
sudo tar -C /media/arroas/RootFS -xzvf rootfs.tar.gz
sync

sudo umount -l /media/arroas/BOOT/
sudo umount -l /media/arroas/RootFS/

 

Regards,

Hung

View solution in original post

1,276 Views
Registered: ‎01-28-2020
Hello @hungdbk92 and thank you for the reply:
The problem seems to have banished.
0 Kudos