Aram
Aram

Reputation: 11

Yocto apache build: how to enable mod_cgid by default?

We are using Yocto for an embedded Linux build.

We are building apache2 using the recipe from

meta-openembedded/meta-webserver/recipes-httpd/apache2

When we load the image, CGI execution is disabled. We can see that in the apache2 config file (/etc/apache2/httpd.conf) the line to load mod_cgid.so is commented out:

#LoadModule cgid_module lib/apache2/modules/mod_cgid.so

We need the above line to be uncommented as part of the build, versus having to uncomment it manually, which is what we have to do now.

The README.cmake instructions for apache2 say that you can set a build flag for each module ("I" to build and leave disabled, "A" to build and enable). But looking in CMakelists.txt I see an entry for mod_cgi.c (with flag set to I), but no entry for mod_cgid.c:

SET(MODULE_LIST 
... 
"modules/generators/mod_autoindex+A+directory listing" 
"modules/generators/mod_cgi+I+CGI scripts" 
"modules/generators/mod_info+I+server information" 
... 
)

I tried adding an entry for mod_cgid.c. I also tried changing the entry for mod_cgi.c. Neither modification resulted in the desired change to httpd.conf.

How can I make this change such that it can be added to a patch file? I need a patch file so I can add it to a Yocto recipe.

Any ideas?

Thanks, Aram

Upvotes: 0

Views: 1218

Answers (1)

PierreOlivier
PierreOlivier

Reputation: 1556

To modify the httpd.conf file installed on the image, you need to create a *.bbappend file.

Two possibilities:

  • Use sed in the bbappend to modify your httpd.conf file
  • Replace the original httpd.conf by the one you provide (with your uncommented line)

For the first possibility, you can have a look here.

For the second possiblity, this is an example of what to do :

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += " file://httpd.conf "

do_install_append() {
    install -d ${D}${sysconfdir}/apache2
    install -m 0644 ${WORKDIR}/httpd.conf ${D}${sysconfdir}/apache2/httpd.conf
}

The *.bbappend file must be named apache2_%.bbappend or apache2_.bbappend.

The file tree in your meta will be:

meta-my-meta
├──recipes-httpd
│  └──apache2
│     ├──apache2_%.bbappend
│     └──apache2
│        └──httpd.conf
│ 
└──recipes-...

Upvotes: 1

Related Questions