Re: [poky] [question]: Creating tailored image without standard rootfs files?

Einar Jón <[email protected]>
Newsgroups org.yoctoproject.lists.poky
Message-ID <CABhNV22wnHhziPuoz3yBKu=WZMCBsQwj8NrvoVXTD8-MZ4SYxw@mail.gmail.com>
On Wed, 13 Dec 2023 at 19:11, Ross Burton <[email protected]> wrote:

> On 13 Dec 2023, at 15:57, Einar Gunnarsson via lists.yoctoproject.org
> <[email protected]> wrote:
> >
> > Hello,
> >
> > I basically want to be able to build an ext4 image for an extra
> partition that is not a rootfs.
> >
> > So I don't need the kernel, or /run /var /etc folders or anything like
> that.
> > Just a few packages are needed, but with a QT app on that partition,
> loads of dependencies are pulled in and I end up with +80 entries in the
> manifest.
> >
> > This was asked 10 years ago, but I still have the same issue now.
> > https://docs.yoctoproject.org/pipermail/yocto/2013-March/012804.html
> >
> > This image would then be used by wic as well as swupdate, as a non-root
> partition.
> > Are there some tweaks to actually build an image without pulling in
> everything needed for a rootfs*?
> > I tried making my own tweaked version of image.bbclass, but I got lost
> in the abstraction.
> >
> >
> > *) Building a basic container-test-image with a linux-dummy still has
> all the folders /bin /boot /dev /etc /home /lib /media /mnt /proc /run
> /sbin /sys /tmp /usr /var
> > and +20 entries in the manifest (17MB of stuff), just for a 12KB binary
> (/usr/bin/theapp).
>
> If you set PACKAGE_INSTALL in your image then you override the implicit
> packages which can pull in dependencies.
>

Right. I had packagegroup-core-ssh-openssh there, coming through
IMAGE_FEATURES.

Unsetting IMAGE_LINGUAS and IMAGE_FEATURES will ensure that you don’t get
> any surprising features or locales installed.
>

poky/meta-selftest/recipes-test/container-image/container-test-image.bb
does unset IMAGE_LINGUAS.
Clearing IMAGE_FEATURES was the issue, and that pulled in these 20+
packages.

With IMAGE_FEATURES="" there's only one package in the manifest, and the
only extra files are
./etc/ld.so.cache ./etc/timestamp   ./etc/version

The /var/{cache,lib} and /run and folders are still there, but the manifest
is clean and the uncompressed tarball went from 17MB to 20KB.
These I can just get rid of with some  ROOTFS_POSTPROCESS_COMMAND
shenanigans.

However, if you have a non-statically linked Qt app that will obviously
> depend on other pieces of the system (such as libqt, so libx11, etc etc).
> This is a policy choice for you though: should apps in this partition be
> self-contained (so they either pull in their deps, or are statically
> linked), or depend on the contents of the main rootfs?
>
> If the latter then you can either actually build one rootfs and use wic to
> split it into separate partitions, or define a dummy recipe that defines
> the “ABI” that your rootfs provides: this can RPROVIDES the names that you
> don’t want in the second partition (like libx11) and by installing that the
> dependencies will be satisfied.
>

I do want them to depend on the contents of the main rootfs. But splitting
them up only in the wic puts them in the rootfs.ext4.
That creates issues for dm-verity, swupdate and more. I would not like to
deal with those issues.

But at least I have a starting point with container-test-image.bb and
clearing those variables.
Thanks.


> Ross


-- 
Regards
Einar Jón
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.