cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
wzab
Mentor
Mentor
5,261 Views
Registered: ‎08-24-2011

Petalinux 2016.4 fails to create the rootfs.cpio file when "SD card" selected in Image Packaging Configuration

Jump to solution

Hi,

 

According to the pages 48 and 49 of the Petalinux 2016.4 documentation , Petalinux should create the rootfs.cpio file, that I could later on unpack on my SD card:

9. The generated rootfs.cpio file will be present in images/linux directory.

[...]

3. Copy rootfs.cpio file to rootfs partition of SD card and extract the file system.
$ cp images/linux/rootfs.cpio /media/rootfs/
$ cd /media/rootfs
$ sudo pax -rvf rootfs.cpio


However, unfortunately, after the "petalinux-build" I get only the root filesystem images in two files:

rootfs.ext3 and rootfs.ext4 . This behavior obviously disagrees with the quoted documentation.

 

Is it possible to configure the Petalinux 2016.4 so that it produces rootfs.cpio instead of ext3 and ext4 images?

In fact I can see, that the rootfile system in both cpio and tar.gz formats is created and available in the build/tmp/deploy/images/plnx_aarch64 directory of my project (I use the ZynqMP platform) via the following symlinks:

 

  • petalinux-user-image-plnx_aarch64.cpio
  • petalinux-user-image-plnx_aarch64.cpio.gz
  • petalinux-user-image-plnx_aarch64.tar.gz

So probably I can copy them from there, but as this is not documented, I'm a little afraid if this is a reliable solution.

 

Regards,

Wojtek

0 Kudos
1 Solution

Accepted Solutions
debrajr
Moderator
Moderator
8,644 Views
Registered: ‎04-17-2011
You can still use the .cpio file from build/tmp/deploy/images/plnx_aarch64, that should help. Few of the customer tried that already: https://forums.xilinx.com/t5/Embedded-Linux/Petalinux-2016-4-boot-from-SD-with-ext4-rootfs/td-p/742310/page/2
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
debrajr
Moderator
Moderator
5,234 Views
Registered: ‎04-17-2011

I had worked on this before and there is an issue with the documentation which we would be fixing. Once you select SD as Rootfs type in Image Packaging Configuration, petalinux-build would generate rootfs.ext4 format file (only in images folder). It still generates the rootfs.cpio in the directory you mentioned but you can use the rootfs.ext4 file to boot. You need to have a EXT4 partition for root/ in you SD card for that. You can follow the steps below as you wont be able to use the rootfs.ext4 as is.

 

1) After petalinux-build go to <project-dir>/build/tmp/deploy/images/plnx_aarch64 or plnx_arm

 

2) Edit fitImage.its-1.0-r0. Remove the ramdisk@0 node from the images and configurations of fitImage.its-1.0-r0 file

 

3) Run the command:

$ mkimage -f fitImage.its-1.0-r0 ${plnx_project_folder}/images/linux/image.ub

 

4) Build the boot.bin using the "petalinux-package" command.

 

5) Copy the boot.bin and *updated* image.ub into the SD boot/first partition.

 

6) Copy the rootfs.ext4 to root partition as you were doing before. (Ensure the root partition is in EXT4 format)

$ sudo mount rootfs.ext4 /mnt o loop
$ sudo cp -rf /mnt/* /media/root/ 

 This would be part of an answer record while we fix the docs at our end.

Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
wzab
Mentor
Mentor
5,216 Views
Registered: ‎08-24-2011

Unfortunately the rootfs.ext(3 or 4) file requires further resizing to fully utilize the partition, while rootfs.tar.gz or rootfs.cpio may be simply unpacked to existing partition.

I need to prepare a script, that will be used by a person that is not a Linux expert.

Definitely unpacking the cpio or tar.gz is much safer, than doing dd, and then resizefs.

In case if improper block device/partition is used, the results of the second procedure may be disastrous.

 

Well, I know, that I can check the volume label before the dd to make sure, that this is the right card/partition.

Anyway, the archive based approach was so convenient, that I simply don't understand why it has been obsoleted?

Will the archive files in the deploy directory still be available in the next  versions of Petalinux?

 

With best regards,

Wojtek

0 Kudos
debrajr
Moderator
Moderator
8,645 Views
Registered: ‎04-17-2011
You can still use the .cpio file from build/tmp/deploy/images/plnx_aarch64, that should help. Few of the customer tried that already: https://forums.xilinx.com/t5/Embedded-Linux/Petalinux-2016-4-boot-from-SD-with-ext4-rootfs/td-p/742310/page/2
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------

View solution in original post

0 Kudos