cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mishuk
Participant
Participant
6,952 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
ibaie
Xilinx Employee
Xilinx Employee
8,910 Views
Registered: ‎10-06-2016

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.

View solution in original post

5 Replies
ibaie
Xilinx Employee
Xilinx Employee
8,911 Views
Registered: ‎10-06-2016

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.

View solution in original post

ibaie
Xilinx Employee
Xilinx Employee
6,911 Views
Registered: ‎10-06-2016

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.
mishuk
Participant
Participant
6,879 Views
Registered: ‎09-11-2017

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
ibaie
Xilinx Employee
Xilinx Employee
6,874 Views
Registered: ‎10-06-2016

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
mckinjo4
Explorer
Explorer
5,054 Views
Registered: ‎05-22-2008

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