user2913869
user2913869

Reputation: 521

Yocto/Bitbake recipe for adding empty directory to rootfs Embedded Linux

Is there any recipe for adding a new, empty directory to the rootfs? I tried adding this into one of my bbappend file:

do_install() {
   install -d ${D}/tmp/myNewDir
}
FILES_${PN} += "/tmp/myNewDir"

but I am getting a non descriptive error, Function failed: do_install

Upvotes: 5

Views: 13861

Answers (2)

Tomas Novotny
Tomas Novotny

Reputation: 1929

There are several ways. The image command way is already described by StackedUser.

You can also try to extend some of your recipes (as you are doing in your question). I guess that you are seeing the error because you are overwriting the do_install task. You are probably wanting to extend it, so you should add _append to the task name, i.e.:

do_install_append () {
   install -d ${D}/tmp/myNewDir
}

BTW, the error "Function failed: do_install" you are hitting usually show an error code or a problematic command. Maybe there is something.

Another way is to create a simple recipe and add it to the image, here is a stub:

SUMMARY = "XXX project directory structure"
# FIXME - add proper license below
LICENSE = "CLOSED"
PV = "1.0"

S = "${WORKDIR}"

inherit allarch

do_install () {
        install -d ${D}/foo/bar
}

FILES_${PN} = "/foo/bar"

Upvotes: 14

StackedUser
StackedUser

Reputation: 337

In our image recipe we have something like this to create a new directory:

create_data_dir() {
   mkdir -p ${IMAGE_ROOTFS}/data
}

IMAGE_PREPROCESS_COMMAND += "create_data_dir;"

Upvotes: 4

Related Questions