porting lighttpd to arm with lua

Development:
    kernel:2.6.31-14-generic ubuntu9.10
    cross-tools:arm-linux-gcc version 4.1.2
Target
    kernel: 2.6.28.9 MOZART380 armv5tejl

<1> Prepare
    1.make the directory for install
        cd /
        sudo mkdir /exchange
        sudo mkdir -p /exchange/lighttpd
        sudo chmod -r 777 /exchange
        sudo chown zhaohui -R /exchange
    2.install the lua
        you can install the lua to arm by:
        http://hi.baidu.com/videoforlinux/blog/item/7d9ea3b36704e54e09230211.html
        export LUA_CFLAGS="-I/home/zhaohui/ARM/resp/lua/include"
        export LUA_LIBS="-L/home/zhaohui/ARM/resp/lua/lib -llua"
    3.configure the compile tools
        export CC=arm-linux-gcc
        export RANLIB=arm-linux-ranlib
        export STRIP=arm-linux-strip

<2> Download and unpack
    1.download the package:
        wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.gz
        tar xzvf lighttpd-1.4.18.tar.gz
        cd lighttpd-1.4.18
    2.configure the package
        ./configure     --prefix=/exchange/lighttpd
                --host=arm-linux
                --with-magnet
                --with-lua
                --enable-static
                --disable-FEATURE
                --disable-ipv6
                --disable-lfs
<3> Make and install
    1.make and install
        make
        make install
    2.copy the file
        sudo cp -r /exchange/lighttpd /path/to/NFS/rootfs/exchange
        sudo cp lighttpd-1.4.18/doc/lighttpd.conf /?/rootfs/exchange/lighttpd/sbin/
        arm-linux-readelf -d /?/rootfs/exchange/lighttpd/sbin/lighttpd | grep .so.
        [copy the *.so.? to /?/rootfs/lib]
    3.configure file
        sudo gedit .../sbin/lighttpd.conf
        ///////////////////////////////////////
        server.document-root        = "/exchange/lighttpd/html/"
        ///////////////////////////////////////
        comment the lines
        +++++++++++++++++++++++++++++++++++++++
        #$HTTP["url"] =~ "\.pdf$" {
        #  server.range-requests = "disable"
        #}
        +++++++++++++++++++++++++++++++++++++++
<4> Test lighttpd
    1.start the daemon
        .../sbin/lighttpd -f ../sbin/lighttpd.conf
    2.view from url
        http://ip
        [just for static pages]
    
Q/A
1.error message
 "./lighttpd: symbol 'lua_pushinteger': can't resolvesymbol
1970-01-01 13:44:21: (plugin.c.165) dlopen() failed for: /exchange/lighttpd/lib/mod_magnet.so
1970-01-01 13:44:21: (server.c.621) loading plugins finally failed "
A: linked issue
    The key words of 'dlopen' tell us that lighttp links a dynamic library.
    Another words of 'lua_pushinteger' tell us that is an API include in Lua
       Then, check the liblua.so
    Step1:
        gedit the Makefile in lua
        add the lines as below
        TO_LIB_S= liblua.so following TO_LIB= liblua.a
       cd src && $(INSTALL_DATA) $(TO_LIB_S) $(INSTALL_LIB)following cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
       cd src && cd $(INSTALL_LIB) && $(RANLIB)$(TO_LIB_S) following cd src && cd $(INSTALL_LIB) &&$(RANLIB) $(TO_LIB)
        @echo "TO_LIB_S = $(TO_LIB_S)" following @echo "TO_LIB = $(TO_LIB)"
        
        gedit the Makefile in lua/src
        add     LUA_S=    liblua.so             followed     LUA_A=    liblua.a
        modify     ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)     to         ALL_T= $(LUA_A) $(LUA_S) $(LUA_T) $(LUAC_T)
        add     $(LUA_S): $(CORE_O) $(LIB_O)
                $(CC) $? -fPIC -shared -o $@    to         certain place
    
    step2:
        reinstall the lua and lighttpd and copy to board

你可能感兴趣的:(lighttpd,lua,download,include,plugins,makefile)