How To Enable Nginx Service In Yocto
Yocto: How to add NGINX module?
Yocto Project is a great project — you can use it to create your ain Linux distribution. Yes! Yous tin can be a petty scrap like Ubuntu. :-)
Nginx is a web server which tin can also be used as a opposite proxy, load balancer, mail proxy and HTTP cache.
A great characteristic of NGINX is that its functionality tin be extended using third-political party modules. Every NGINX module may be a separate projection with its own git repository that contains some files. But NGINX module is non a stand-alone executable. Instead a module is compiled into NGINX using --add-module
flag used at the ./configure
step.
For example (see file meta-webserver/recipes-httpd/nginx/nginx.inc):
./configure \
--crossbuild=Linux:${TUNE_ARCH} \
--with-int=4 \
...
--add-module=/path/to/my-module
But here the trouble begins! Where to place the git repository of the NGINX module (/path/to/my-module)? NGINX package expects to find all its dependecy in recipe-sysroot
directory before the NGINX compilation begins. That is the configuration step should look like below:
./configure \
...
--add-module=${STAGING_DIR_TARGET}/my-module
Well, it ways that my-module
that is a separate git repository has somehow to be copied to STAGING_DIR_TARGET
. Just the only directories that are beingness copied to NGINX's recipe-sysroot
(during the creation of recipe-sysroot
of NGINX) are SYSROOT_DIRS
of all the build-fourth dimension prerequite (see DEPENDS
) packages. The SYSROOT_DIRS
is divers as:
SYSROOT_DIRS="/usr/include /usr/lib /lib /usr/share"
That is, the just directories that are copied to NGINX's recipe-sysroot
from our NGINX module are empty, because the only directoty that has any significant for NGINX module is the my-module
directory that contains all the module source code files.
So, what's the trick? How to do this?
Later on some grepping here and at that place, the play tricks is this…
First, to let bitbake copy all my-module
source code files to /image
directory nosotros need to define do_install
recipe office as beneath:
do_install () {
cd ${S}
git checkout-alphabetize -a --prefix=${D}/${PN}/
cd -
}
Next, to packet my-module
directory we demand to define FILES_
as below:
FILES_${PN} = "${PN}/*"
Third, we demand to extend SYSROOT_DIRS
or NGINX module to include the my-module
directory:
SYSROOT_DIRS += "/${PN}"
Or, put together, the fox looks like:
At present, we can easily add any NGINX module to Yocto build in a Yocto-natural way!
—Kosta Z
How To Enable Nginx Service In Yocto,
Source: https://medium.com/@zertsekel/yocto-how-to-add-nginx-module-35f03dd2ede3
Posted by: whitcombatuddrefould.blogspot.com
0 Response to "How To Enable Nginx Service In Yocto"
Post a Comment