Search code examples
linuxchmodyoctobitbakeopenembedded

With BitBake, can I set permissions to 000?


In a BitBake .bbappend file, I have the following:

SRC_URI += "file://foo.file"
do_install_append() {
  install -m 000 foo.file ${D}${sysconfdir}/foo.file
}
FILES_${PN} += "${sysconfdir}/foo.file"

The foo.file is created in the proper directory, but the permissions are -rw-------. Within a normal shell, I can install -m 000 on a file which sets permissions to ---------- just fine.

Is there a way to remove read & write privileges for the file owner using BitBake?

UPDATE: I've run the following commands within an IMAGE_PREPROCESS_COMMAND:

install -m 0000 ${DEPLOY_DIR_IMAGE}/foo.file ${IMAGE_ROOTFS}/home/root
ls -lah ${IMAGE_ROOTFS}/home/root >> ${IMAGE_ROOTFS}/home/root/lslog

After the bitbake has finished execution, I navigate to ${IMAGE_ROOTFS}/home/root and do an ls -la and I see that the permissions on foo.file are -rw-------, but when I look what's inside the ${IMAGE_ROOTFS}/home/root, the permissions are ----------. I thought this might help diagnose what's going on here.


Solution

  • Boot up the image on your target machine and you'll find that the file permissions appear as they are in your lslog, the file permissions are changed after the image creation process is complete.