cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Scholar
Scholar
1,661 Views
Registered: ‎08-24-2011

How to enforce rebuilding of rootfs in Petalinux?

I have a package that contains only script files. Unfortunately, when I modify its contents and run:

petalinux-build

the rootfs.cpio.gz is not recreated, and the generated initramfs still contains the old scripts.

I've tried to explicitly clean my package:

petalinux-build -c my-package -x clean
petalinux-build

but it also doesn't help.

The only way to refresh the initramfs is to do:

petalinux-build -x mrproper
petalinux-build

which is not a solution, as it takes one hour.

Is there any faster method to enforce recreating the initramfs with the new scripts?

 

0 Kudos
4 Replies
Highlighted
Scholar
Scholar
1,654 Views
Registered: ‎08-24-2011

I've managed to rebuild the rootfs.cpio.gz by the following sequence of operations:

petalinux-build -c my-package -x do_cleanall
petalinux-build -c rootfs -x do_cleanall
petalinux-build

It is still quite slow, but much faster than using "mrproper".

Highlighted
Adventurer
Adventurer
1,614 Views
Registered: ‎08-07-2014

Hello @wzab,

I'm using Vivado 2017.2 and I do a slightly different sequence of commands. You could try and check if it's faster:

petalinux-build -c your_app -x do_clean
petalinux-build -c your_app
petalinux-build -x do_populate_sysroot
petalinux-build -c rootfs 
petalinux-build -x package

Since I'm packaging a BOOT.BIN and image.ub to boot from SDCard, my final command is a

petalinux-package --boot --fsbl <...> --fpga <...> --u-boot --force

Not sure if you need that last one.
Actually I run that sequence in only one shell command line:

petalinux-build -c your_app -x do_clean && petalinux-build -c your_app &&  petalinux-build -x do_populate_sysroot && petalinux-build -c rootfs && petalinux-build -x package && petalinux-package [...]

regards

Brasilino

0 Kudos
Highlighted
1,291 Views
Registered: ‎08-06-2018

(Using petalinux 2018.2):

Here's a workaround I've found that's a little sloppy, but doesn't take an hour.  The problem I was specifically trying to solve was how to force a rebuild of the initramfs after I made a change that updated the contents of one of my user packages.  FYI the user package also had issues rebuilding after source changes, so I actually have to rebuild it as well:

petalinux-build -c my-package -x cleanall && petalinux-build -c my-package
petalinux-config -c rootfs
(add or remove a spurious debug utility program)
petalinux-build

The process of petalinux-build will kickoff initramfs construction tasks in the kernel recipe after rootfs is rebuilt.  Here are two other things I tried that DIDN'T help:

1. petalinux-build -c kernel -x do_bundle_initramfs -f won't work because it does not force rootfs to be rebuilt, this task appears to be executed after rootfs is done.

2. petalinux-build -c rootfs -x do_rootfs -f won't work because "ERROR: Force building is not supported for image targets"

0 Kudos
Highlighted
Visitor
Visitor
1,120 Views
Registered: ‎05-25-2018

I also encountered this issue and did a bit more digging.  I believe the underlying issue relates to versioning of the the package.  If petalinux/yocto cannot determine the version, it assigns a default version (i.e. 1.0-r0 or something similar) and if the version does not change then the package is assumed the same and the dependencies do not get rebuilt correctly.

In my case, I am in development and pulling the package source from a git repository.  The repository changes, but I don't update the receipe.

Adding:

PV = "0.0-git${SRCPV}" 

 to the recipe makes the version depend on the git revsion and cause a rebuild of the rootfs when my package changes.

Applicable documentation:

https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-AUTOREV

https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-PV

https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#var-SRCPV