Skip to contentSkip to conversation

How to import image build name to application recipe?

DISCUSSION Gennady Abramov 2 participants 4 messages Sep 10, 2024

lore
Share & tools
lore
#0 lore raw

Dear community,

I'm trying to build  A+B+Data distro + update distros using RAUC and populate Data partition with default configuration files.

Thus, I want a particular recipe, if "full" image build, install particular default configuration files, and if "update" image build,  not to do that, maintain only symlinks to /data partition. I included if ${IMAGE_BASENAME} in application do_install:append(), but this doesn't work!

do_install:append () {
# If building full image, install default config to /data/ partition if [ ${IMAGE_BASENAME} = "image-full" ]; then
install -Dm 0755 ${WORKDIR}/app.conf ${D}/data/etc/app/app.conf fi
#in any case, replace default config from distribution to link to /data/etc/ rm ${D}/etc/app/app.conf
ln -s /data/etc/app/app.conf ${D}/etc/app/app.conf
}

I included
export IMAGE_BASENAME = "core-image-full-cmdline" in "image-full.bb", but this still doesn't help.

By replacing "if [ ${IMAGE_BASENAME} " with predefined variable, I found that "if " works well itself, so probably using IMAGE_BASENAME is not correct.

So, probably I should use other variable or initialize it somehow other way. I think that is typical scenario, and I missing something obvious, but still cannot find it. Any advice?

#1 lore raw

You need to make two slightly different recipes (put common bits into an .inc), and then install one or the other to the respective images.

Alex

Quoted 39 lines · Gennady Abramov via lists.yoctoproject.org

Dear community,

I'm trying to build A+B+Data distro + update distros using RAUC and populate Data partition with default configuration files.

Thus, I want a particular recipe, if "full" image build, install particular default configuration files, and if "update" image build, not to do that, maintain only symlinks to /data partition. I included if ${IMAGE_BASENAME} in application do_install:append(), but this doesn't work!

do_install:append () {
# If building full image, install default config to /data/ partition
if [ ${IMAGE_BASENAME} = "image-full" ]; then

         install -Dm 0755 ${WORKDIR}/app.conf ${D}/data/etc/app/app.conf

fi
#in any case, replace default config from distribution to link to /data/etc/
rm ${D}/etc/app/app.conf
ln -s /data/etc/app/app.conf ${D}/etc/app/app.conf
}

I included
export IMAGE_BASENAME = "core-image-full-cmdline" in "image-full.bb", but this still doesn't help.

By replacing "if [ ${IMAGE_BASENAME} " with predefined variable, I found that "if " works well itself, so probably using IMAGE_BASENAME is not correct.

So, probably I should use other variable or initialize it somehow other way. I think that is typical scenario, and I missing something obvious, but still cannot find it. Any advice?

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63811): https://lists.yoctoproject.org/g/yocto/message/63811
Mute This Topic: https://lists.yoctoproject.org/mt/108372539/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Alex,
So, am I understand correctly, it is impossible to import destination image name inside particular application recipe?

#3 lore raw

Yes. You can build many images with the same bitbake invocation, they’re defined with recipes, and the application recipe is built only once for all of them. Any image specific variable including the image name is visible only from the tasks of the image recipe.

Alex

Quoted 4 lines · Gennady Abramov via Lists.Yoctoproject.Org

Hi Alex,
So, am I understand correctly, it is impossible to import destination image name inside particular application recipe?