The task in question is defined as a shell function. The install
command used within is a shell command, not anything Yocto- or BitBake-specific, so you should be looking at its docs for enlightenment, not relying on BitBake documentation or examples. In the context of Yocto in particular, however, you should be looking at the documentation for the GNU coreutils version of the install
program (as linked above), which is the one you will invariably find on Linux systems.*
From my reading about Yocto and doing do_install, I thought that the -m
option is only for installing files and not directories.
I'm not sure what would make you think that, other than just not seeing it applied to directories before.
What is the effect of doing install -m 0755 -d
, both the -m
and -d
options with the install command?
The -m
option sets the mode (access-control bits) of the installed object(s). Directories have modes just like regular files do, and the -m
option has the same meaning for installing directories as it does for installing regular files.
The -d
option specifies that the names specified for installation are to be taken as directories to be created, along with any missing directories in the specified path. As @jww observed in comments, the effect is analogous to that of mkdir -p
.
These options are orthogonal. When used together, their effects combine in the natural way: the specified directories are created, with parent directories if needed, and all directories created are assigned the specified mode. Setting the modes explicitly to 0755
is superfluous, however, because that's the default. That may be why you are not used to seeing -m
options used for directories.
Also, why is there no ${D} variable like in the majority of other directory installations which I see?
The Yocto specifications for do_install
say that it should install files relative to ${D}
, whereas the variable DEPLOY_DIR_IMAGE
refers to the location for ready-to-install images. It seems like installing to ${DEPLOY_DIR_IMAGE}
would be the wrong thing to do, but that doesn't necessarily mean that it wouldn't produce the desired ultimate effect. Or perhaps the recipe was simply written for some older version of BitBake where it made more sense. In any event, sorting out the the details would be a much deeper and more involved analysis than I am prepared to perform for you.
*install
is not standardized by POSIX. The GNU version was inspired by BSD's program of the same name, and current versions of that have similar options and behavior, including specifically with respect to the -m
and -d
options.
install(1)
man page.-d
is likemkdir -p
. The-m
sets the mode (permissions). Note thatinstall
with options like-d
are non-standard. It won't be available on some operating systems, like AIX or Solarisinstall
. – SchickINSTALL
command variable. – Schick