Reputation: 53
I need to add a file to the /boot directory produced by a yocto build. I've created a recipe that is trying to do this:
SRCREV = "48cabcbc64484ca6c201746e526a11b4b43eb359"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-uEnv.patch file://0002-disable-boot-interrupt.patch file://uEnv.txt"
FILES_${PN} += "/boot/uEnv.txt"
do_install_append() {
install -m 0744 ${WORKDIR}/uEnv.txt ${D}/${base_prefex}/boot
}
This recipe does some patching of u-boot too, but for now I'm just interested in the parts that are trying to add uEnv.txt to the boot directory. I know this recipe is being processed. If I rename the uEnv.txt file, for example, it throws an error. So I know it's trying to install it. But when I examine the rootfs created by yocto, the file is missing.
Does anyone know what I'm doing wrong? Maybe the problem is with ${D}/${base_prefex}/boot
and I'm just not putting it in the right place? I've tried putting it in other places, though, like ${D}${sysconfdir}/
without success.
Upvotes: 1
Views: 1354
Reputation: 4294
Here are some idea that you can try:
u-boot
already have a variable to work with Env files (Check poky/meta/recipes-bsp/u-boot/u-boot.inc
)
It checks for UBOOT_ENV
variable if it is present and it copies it to /boot
:
do_install() {
...
if [ -n "${UBOOT_ENV}" ]
then
install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
fi
...
}
do_deploy() {
...
if [ -n "${UBOOT_ENV}" ]
then
install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
fi
...
}
I assume that your recipe is a bbappend
for uboot
because it has a patch.
So you can try the following:
SRCREV = "48cabcbc64484ca6c201746e526a11b4b43eb359"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-uEnv.patch file://0002-disable-boot-interrupt.patch file://uEnv.txt"
UBOOT_ENV = "uEnv"
UBOOT_ENV_SUFFIX = "txt"
More more note to be considered, if your Uboot is trying to fetch the uEnv.txt
file from rootfs/boot then it is okay, but if it trying to get it from the boot
partition (if you have one) then you should add it to that partition with (In your machine conf or local conf):
BOOT_FILES_append = " uEnv.txt"
Upvotes: 2