Search code examples
embedded-linuxyoctobitbake

Bitbake add empty folder to root


I want to create a folder in /home/root during my bitbake build. I have tried two different methods, both of which fail.

The first gives a huge error that I cannot scroll to the top of

do_install_append () {
   install -d ${D}/root/smg_logs
}

The second will build and run, but I do not see the created folder.

create_dirs() {
    mkdir -p root/smg_logs
}

ROOTFS_POSTPROCESS_COMMAND += "create_dirs ; "

If I try the previous with the following

create_dirs() {
    install -d ${D}/home/root/smg_logs
    mkdir -p /home/root/smg_logs
}

ROOTFS_POSTPROCESS_COMMAND += "create_dirs ; "

This allowed my device to boot but it seems that it has overwritten some important code.

Edit: Similar to the links in the answer below, I have tried the following.

do_install_append () {
   install -d ${D}/root/smg_logs
}
FILES_${PN} += "/root/smg_logs"

Solution

  • Same question mentionned here and here

    For the do_install_append method, do not forget to add the folder to the package:

    FILES_${PN} += "/root/smg_logs"
    

    /root/smg_logs or /home/root/smg_logs ?