Re: bitbake of core-image-minimal is sending my fw_env.config file to PC filesystem instead of my squashfs for target

Peter Bergin


On 2021-03-10 00:04, Brian Hutchinson wrote:

I should have done this from the start and started a new topic so please forgive me if you've already seen this on "No u-boot-fslc-fw-utils recipe for Dunfell?" thread.

I added libubootenv to my image because I'm using RAUC for updates etc..

Anyway, I'm building a read-only rootfs with squashfs (already working from my NOR flash) but needed to update that image with libubootenv and needed a fw_env.config file in /etc.

So first attempt was to make a libubootenv_0.3.1.bbappend like:


SRC_URI_append += " file://fw_env.config"

do_install_append() {
       install -d ${D}${sysconfdir}
       install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config

FILES_${PN} += "${sysconfdir}/fw_env.config"

When I would bitbake core-image-minimal, it updated my squashfs file but looking at the resulting tar of the rootfs showed it didn't contain /etc/fw_env.config.  Turns out it's in the directory by itself under tmp/deploy/images/imx8mmevk!

I checked out the examples in meta-freescale-3rdparty/recipes-bsp that some of the toradex boards are using and did some other reading online and can't quite figure out what I'm doing wrong and how to get fw_env.config into my squashfs image.

I'm using Dunfell with this effort and core-image-minimal to keep size down since this is a small NOR I'm working on.

Listing so you can see what I'm talking about:

-rw-r--r-- 2 hutch hutch      1895 Mar  9 15:31 core-image-minimal-imx8mmevk-20210309203126.rootfs.manifest
-rw-r--r-- 2 hutch hutch   9613312 Mar  9 15:32 core-image-minimal-imx8mmevk-20210309203126.rootfs.squashfs
-rw-r--r-- 2 hutch hutch   9201440 Mar  9 15:32 core-image-minimal-imx8mmevk-20210309203126.rootfs.tar.bz2
-rw-r--r-- 2 hutch hutch    532719 Mar  9 15:31 core-image-minimal-imx8mmevk-20210309203126.testdata.json
lrwxrwxrwx 2 hutch hutch        59 Mar  9 15:31 core-image-minimal-imx8mmevk.manifest -> core-image-minimal-imx8mmevk-20210309203126.rootfs.manifest
lrwxrwxrwx 2 hutch hutch        59 Mar  9 15:32 core-image-minimal-imx8mmevk.squashfs -> core-image-minimal-imx8mmevk-20210309203126.rootfs.squashfs
-rw-r--r-- 1 hutch hutch   9605120 Mar  8 09:36 core-image-minimal-imx8mmevk.squashfs_keep
lrwxrwxrwx 2 hutch hutch        58 Mar  9 15:32 core-image-minimal-imx8mmevk.tar.bz2 -> core-image-minimal-imx8mmevk-20210309203126.rootfs.tar.bz2
lrwxrwxrwx 2 hutch hutch        57 Mar  9 15:31 core-image-minimal-imx8mmevk.testdata.json -> core-image-minimal-imx8mmevk-20210309203126.testdata.json
lrwxrwxrwx 2 hutch hutch        34 Mar  9 16:48 fw_env.config -> fw_env.config-imx8mmevk-2020.04-r0
lrwxrwxrwx 2 hutch hutch        34 Mar  9 16:48 fw_env.config-imx8mmevk -> fw_env.config-imx8mmevk-2020.04-r0
-rw-r--r-- 2 hutch hutch      2858 Mar  9 16:48 fw_env.config-imx8mmevk-2020.04-r0

The file /etc/fw_env.config is packaged in u-boot-imx-env (if using u-boot-imx), and more general in ${PN}-env in the file. There is also a generic name for that package independent of which u-boot you are based on at this is u-boot-default-env. Make sure you have u-boot-default-env in your IMAGE_INSTALL variable or RDEPEND on it in some way.

You can use buildhistory bbclass in your builds. With that enabled it is easy to track where files are packaged and also which packages that are installed in your image.

    build$ grep -r '/etc/fw_env.config' buildhistory/ | grep files-in-package
    buildhistory/packages/esp5_nxp_eval-fslc-linux/u-boot-imx/u-boot-imx-env/files-in-package.txt:-rw-r--r-- root       root              137    ./etc/fw_env.config

    build$ grep -r 'u-boot-imx-env' buildhistory/ | grep installed-package-names

Another tool that can be used to find relation between a file and a package is oe-pkgdata-util.

    build$ oe-pkgdata-util find-path /etc/fw_env.config
    u-boot-imx-env: /etc/fw_env.config

I hope this can help you forward!

Best regards,

Join to automatically receive all group messages.