Search code examples
raspberry-piyoctobitbakeyocto-recipe

Use yocto image output as file on another yocto image


I have yocto recipe, which builds raspberry pi image. Lets call it main image. It's output is main-image.wic.bz2 file. I would like to build another RPi image, used for recovery from USB flash. Lets call it recovery image. I know, how to achieve boot of this image from USB flash, but now I need to somehow get main-image.wic.bz2 as file in recovery image. I'm still pretty new in yocto, so I would like to know, what is best way to achieve this. Thanks for your advice.


Solution

  • Well, I have found it. It's actually pretty easy, there is ${DEPLOY_DIR_IMAGE} variable, which points to build/tmp/deploy/images/raspberrypi4. So there is my solution.

    SUMMARY = "Recovery data package"
    DESCRIPTION = ""
    HOMEPAGE = ""
    LICENSE = "CLOSED"
    
    EXTRA_IMAGEDEPENDS = "main-image"
    
    do_install() {
        install -d ${D}/usr/static
        install ${DEPLOY_DIR_IMAGE}/main-image-raspberrypi4.wic.bz2 ${D}/usr/static
    }
    
    FILES:${PN} += "/usr/static"