wiki:Projects/Apache_Runtime

Version 6 (modified by C Rempel, on Jun 26, 2012 at 4:18:09 AM) (diff)

Apache Runtime

Status: Exploratory

This project is designed to help a developer interested in porting the Apache Runtime to RTEMS, it is by no means complete.

The Apache Runtime RTEMS port may make the most sense if it were part of an Apache package; Apache requires alot of software: Apache Runtime (apr), XML parser (Exat), Apache Utilities, Perl Compatible Regular Expression (pcre), and of course, the Apache HTTPD server. Porting Apache to RTEMS makes the most widely used webserver available to RTEMS system developers. I did the first port of Apache to RTEMS as my master's project, but I wanted a port that would "last the ages", so I am working on a port that can be updated with changes in Apache and RTEMS in less than 2 weeks by an embedded systems developer.

Although, my original port was a brute-force approach to the RTEMS source tree, my current attempt utilizes the RTEMS Addon Packages build system. When doing an RTEMS Addon Packges port, there are three files that need to be modified: Makefile.<<lib>>, Makefile, and BuildTests?.sh

The shared memory module of the Apache Runtime Library requires memory management (mman) support. To get mman support, you can use the mmap_kit inside of the RTEMS Graphics toolkit

~$ git clone git://git.rtems.org/rtems-graphics-toolkit.git ~$ cd rtems-graphics-toolkit/mmap_kit ~$ make && make install

Now you that have very basic memory management (mman) support, you can install the Apache Runtime Library.

Makefile.apr

These are the configurations needed to get Apache Runtime Library 1.4.6 to run on the May 2012 RTEMS development branch.

# # Configure/build/install the Apache Runtime Library #

include ../RTEMS_Makefiles/Makefile.common

# # Memory requirements: 841 kB #

As the Apache Runtime uses non-recursive make, this makes all the o-optimize subdirectories to mirror the subdirectories in the source that will be built

all:

rm -rf o-optimize test/o-optimize mkdir o-optimize o-optimize/atomic o-optimize/atomic/unix mkdir o-optimize/dso o-optimize/dso/unix mkdir o-optimize/file_io o-optimize/file_io/unix mkdir o-optimize/locks o-optimize/locks/unix mkdir o-optimize/memory o-optimize/memory/unix mkdir o-optimize/misc o-optimize/misc/unix mkdir o-optimize/mmap o-optimize/mmap/unix mkdir o-optimize/network_io o-optimize/network_io/unix mkdir o-optimize/passwd mkdir o-optimize/poll o-optimize/poll/unix mkdir o-optimize/random o-optimize/random/unix mkdir o-optimize/shmem o-optimize/shmem/unix mkdir o-optimize/strings mkdir o-optimize/support o-optimize/support/unix mkdir o-optimize/tables mkdir o-optimize/threadproc o-optimize/threadproc/unix mkdir o-optimize/time o-optimize/time/unix mkdir o-optimize/user o-optimize/user/unix mkdir test/o-optimize/ test/o-optimize/internal test/o-optimize/data

Next, for me, there were several configurations to get the Apache Runtime build system to recognize all the functions available to the RTEMS system. Ac_cv stands for Auto Conf Cached Variables -- one preset BEFORE the configuration. The headers use ac_cv_header_..._h. The functions use ac_cv_func_... The defines use ac_cv_define... The cached configurations can be found in the Auto Conf Manual and the Apache Runtime configure script. The most interesting was pre-setting ac_cv_filedev_zero, so the configuration would continue through a cross-compile. The second most interesting was defining the size of struct iovec to get the configuration to recognize that iovec was a type defined in RTEMS, (according to the Auto Conf manual, getting the size is how the configuation script determines that a struct is a type).

ac_decision_USE_SHMEM_MMAP_ANON=no \ ac_cv_header_sys_mman_h=yes \ ac_cv_func_mmap=yes \ ac_cv_func_munmap=yes \

ac_cv_define_MAP_ANON=yes \

ac_cv_filedev_zero=no \ ac_cv_func_setpgrp_void=no \ apr_cv_process_shared_works=no \ apr_cv_tcp_nodelay_with_cork=no \ ac_cv_sizeof_struct_iovec=100 \ ac_cv_gethostbyname_r_arg=char \ ac_cv_working_getnameinfo=no \

The -Defines were taken from FreeBSD: Source to sys/mman.h. The fact that the CFLAGS were -Defined MAY indicate this could be the source of issues for debugging (when I get to the testing phase).

CFLAGS='-DPROT_READ=0x01 -DPROT_WRITE=0x02 -DMAP_SHARED=0x0001 -DMAP_ANON=0x1000' \ ./configure \

--host=$(RTEMS_CPU)-rtems4.11 \ --prefix=$(exec_prefix) \ --libdir=$(exec_prefix)/$(RTEMS_BSP)/lib \ --includedir=$(exec_prefix)/$(RTEMS_BSP)/lib/include \ --disable-shared \ --enable-static \ --disable-dso \ --disable-lfs \ --enable-threads \ --disable-libtool

make make install

It builds, but it's not tested...= Next Steps =

The next step will be getting the Apache Test Suite up and running in rtems-addon-packages/examples/apr. I'm currently looking at a simpler package to learn more about the rtems-addon-packages/examples I imagine it will be weeks before I get back to this.