Search code examples
yoctobitbake

What is the difference between image and package directory in Yocto


I wrote a basic hello world recipe

DESCRIPTION = "Simple helloworld C application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://userprog.c file://ReadMe.txt"

S = "${WORKDIR}"

do_compile() {
    ${CC} -DUSE_SYSCALL userprog.c ${LDFLAGS} -o userprog
}

do_install() {
    install -d ${D}${bindir}
    install -m 0755 userprog ${D}${bindir}
    install -d ${D}${docdir}
    install -m 0644 ReadMe.txt ${D}${docdir}
}

After, looking at the WORKDIR, the contents of 'package' and 'image' folder are same.

$ tree image/

image/
└── usr
    ├── bin
    │   └── userprog
    └── share
        └── doc
            └── ReadMe.txt

$ tree package

package
└── usr
    ├── bin
    │   └── userprog
    └── share
        └── doc
            └── ReadMe.txt

What is the difference between both folders, I know image folder is controlled in do_install task, what about in package folder?


Solution

  • images/ is for staging install dir, something like make install DESTDIR=<..>

    package is for do_package task which is then further split into individual output packages in packages-split,

    even though the content looks similar context is different, since it operates on PACKAGES and FILES variables, and if the files are not mentioned in these variables it won't copy those from image/ into package/ it is described in detail in Yocto project manual