How to copy fw_env.config and u-boot-initial-env to SD card image during build

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to copy fw_env.config and u-boot-initial-env to SD card image during build

1,703 次查看
ScottSJ
Contributor II

Hello,

I'm trying to have the yocto build system copy the fw_env.config and u-boot-initial-env files to the SD card image. I can build the entire uboot and rootfs and create the SD card. I can copy the 2 files manually to the /etc directory after the system is running. They work correctly, so I know the files are good. However, I need the files in the SD card image so they're used the first time the system boots.

I'm using an 8MPLUS EVK. The two files are being created as part of the u-boot-imx build. I've tried many web searches but can't find update the build to put them in the SD card image. I have found many places that show how to copy the files manually, but nothing that updates the yocto build itself. (Searches often use the filenames as separate words. For example, "fw_env.config" finds "fw", "env", and "config")

Thanks,
Scott

标记 (1)
0 项奖励
回复
7 回复数

503 次查看
timriao
Contributor I

I am working on project with 8MPLUS EVK in these days.  I am also facing the same issue.  Looking for a solution.

 

 

0 项奖励
回复

634 次查看
moose
Contributor IV

@ScottSJ have you find a way to fix this? I am facing the same issue.

0 项奖励
回复

1,648 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Hi @ScottSJ 

there are some references in u-boot recipe in the directory of sources/meta-freescale-3rdparty/recipes-bsp/u-boot. hope that can help you.

 

Best regards

Harvey

0 项奖励
回复

1,624 次查看
ScottSJ
Contributor II

Hello,

Yes, I've looked at u-boot-boundary_2022.04.bb, u-boot-kontron_2020.01.bb, and u-boot-toradex_2020.07.bb.
All 3 recipes mention fw_env.config. The last one also mentions u-boot-initial-env.
After "bitbake u-boot-imx" both files are created / updated in build/tmp/deploy/images/evk-example
However, after "bitbake evk-example", neither file is included in the tar file or the wic disk image.

I'm need a way to copy the u-boot-initial-env file created by u-boot-imx and include it in the disk image.

Thanks,
Scott

0 项奖励
回复

522 次查看
roke
Contributor III

Do you have Yocto source code?

fw_env.config

https://github.com/nxp-imx-support/meta-swupdate-imx/blob/mickledore_6.1.36_2.1.0/recipes-bsp/u-boot/u-boot-imx_%25.bbappend


do_install:append:mx8qxp-nxp-bsp () {

    echo "/dev/mmcblk1 0x700000 0x2000" > ${D}/${sysconfdir}/fw_env.config
    echo "/dev/mmcblk1 0x702000 0x2000" >> ${D}/${sysconfdir}/fw_env.config
    echo "${MACHINE} ${SWU_HW_REV}" > ${D}/${sysconfdir}/hwrevision
    install -D -m 644  ${D}/${sysconfdir}/fw_env.config  ${DEPLOYDIR}
    install -D -m 644  ${D}/${sysconfdir}/hwrevision  ${DEPLOYDIR}

}

 

Yocto already has code to copy u-boot-initial-env to sysconfig dir, should be /etc

u-boot-initial-env

https://github.com/yoctoproject/poky/blob/mickledore-4.2/meta/recipes-bsp/u-boot/u-boot.inc


                   install -D -m 644 ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX}
                    ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
                    ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}

                    # Install the uboot-initial-env
                    if [ -n "${UBOOT_INITIAL_ENV}" ]; then
                        install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR}
                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}
                        ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
                    fi
                fi
            done
            unset j
        done
        unset i
    else
        install -D -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
        ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}

        # Install the uboot-initial-env
        if [ -n "${UBOOT_INITIAL_ENV}" ]; then
            install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR}
            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}
            ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${PV}-${PR} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
        fi
    fi

 

0 项奖励
回复

1,527 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Seems not a way yocto do install for rootfs after checking its recipes and configuration files. 

Have you tried to run post processing commands ROOTFS_POSTPROCESS_COMMAND += "<shell_command>; ... " or do_install task? 

 

Best regards

Harvey 

0 项奖励
回复

518 次查看
roke
Contributor III

Harvey,

 

How do you check the recipes and configuration files?

 

Have you ever tried  enable the u-boot initial env and build the yocto? 

0 项奖励
回复