UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer mishuk
Observer
4,636 Views
Registered: ‎09-11-2017

modify existing rootfs files

Jump to solution

Hello!

Currently I`m using Petalinux 2017.2.  I wonder what is a proper way to modify files already existing in rootfs?  For instance, those in /etc folder.  I tried adding custom application fstab-mount-sd, which replaces original /etc/fstab file, but after running:

      $>petalinux-build -c fstab-mount-sd

      $>petalinux-build -c rootfs

I get original /etc/fstab in rootfs.cpio

 

Please, help me!

Tags (3)
1 Solution

Accepted Solutions
Moderator
Moderator
6,594 Views
Registered: ‎10-06-2016

Re: modify existing rootfs files

Jump to solution

Hi @mishuk

 

The approach of using a custom application just for modyfing an existing file within your rootfs is not a valid approach. As it's known, since 2016.4 release Petalinux is based on Yocto, so the way that the rootfs is populated is based on layers/recipes, so the best way to get information for this kind of questions is also looking for existing information related to Yocto.

 

I will base this answer on a existing post in the intel user forums, which can be used as a reference in this case.

 

As Petalinux project already has a user customization layer use (meta-user), create the folder structure for the recipe within it, rather than creating your own layer.

$ ls project-spec/meta-user/recipes-core/base-files/
base-files  base-files_%.bbappend
$ ls project-spec/meta-user/recipes-core/base-files/base-files
fstab

 

This way your own fstab will replace the one within your petalinux base-files recipe:

<petalinux_install_dir>/components/yocto/source/aarch64/layers/core/meta/recipes-core/base-files/base-files/fstab

Regards,

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.
5 Replies
Moderator
Moderator
6,595 Views
Registered: ‎10-06-2016

Re: modify existing rootfs files

Jump to solution

Hi @mishuk

 

The approach of using a custom application just for modyfing an existing file within your rootfs is not a valid approach. As it's known, since 2016.4 release Petalinux is based on Yocto, so the way that the rootfs is populated is based on layers/recipes, so the best way to get information for this kind of questions is also looking for existing information related to Yocto.

 

I will base this answer on a existing post in the intel user forums, which can be used as a reference in this case.

 

As Petalinux project already has a user customization layer use (meta-user), create the folder structure for the recipe within it, rather than creating your own layer.

$ ls project-spec/meta-user/recipes-core/base-files/
base-files  base-files_%.bbappend
$ ls project-spec/meta-user/recipes-core/base-files/base-files
fstab

 

This way your own fstab will replace the one within your petalinux base-files recipe:

<petalinux_install_dir>/components/yocto/source/aarch64/layers/core/meta/recipes-core/base-files/base-files/fstab

Regards,

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.
Moderator
Moderator
4,595 Views
Registered: ‎10-06-2016

Re: modify existing rootfs files

Jump to solution

By the way, I will add that I changed the custom recipe in order to prevent bitbake warning messages related to the fact of using append or prepend for FILESEXTRAPATHS variable:

 

FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"

 


Ibai
Don’t forget to reply, kudo, and accept as solution.
Observer mishuk
Observer
4,563 Views
Registered: ‎09-11-2017

Re: modify existing rootfs files

Jump to solution

Thank a lot !  It works!  Some silly question: do I need to replace "%" in

project-spec/meta-user/recipes-core/base-files/base-files/base-files_%.bbappend

with exact version from

<petalinux_install_dir>/components/yocto/source/aarch64/layers/core/meta/recipes-core/base-files/base-files_3.0.14.bb

 I mean "3.0.14" ?

Tags (3)
0 Kudos
Moderator
Moderator
4,558 Views
Registered: ‎10-06-2016

Re: modify existing rootfs files

Jump to solution

Hi @mishuk

 

It's up to you. I mean, using the exact version makes your patch only be applied to certain version of base-files recipe (will work in this release). The % usage is  more generic and it's applied to any version of the recipe.

 

Regards


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
Explorer
Explorer
2,738 Views
Registered: ‎05-22-2008

Re: modify existing rootfs files

Jump to solution

I am trying to modify some similar files, located in /etc/ and trying to follow the solution here,

 

my recipes-core directory doesn't contain a folder called "base-files". Only an "images" folder, with "petalinux-image.bbappend"

 

I haven't drilled into Yocto much yet, so this might be a version issue; i'm using petalinux 2017.3, but what should be base-files?

0 Kudos