hello world

          隨筆 - 2, 文章 - 63, 評論 - 0, 引用 - 0
          數據加載中……

          開發板上搭建lighttpd環境

          要在開發板上搭建lighttpd環境,首先要在ubuntu上搭建交叉編譯環境,然后對lighttpd的源碼進行編譯,最后將編譯好的文件和配置文件拷貝到開發板上,就可以運行了。

          1、在ubuntu下搭建交叉編譯環境
               1) 將開發板提供的gcc拷貝到ubuntu環境下,如我本地拷貝完后的bin目錄為:
               /home/acer/source/arm-gcc/fsl-linaro-toolchain/bin/
               2) 配置ubuntu的環境變量文件:
                我的ubuntu版本是10.04,打開/etc/bash.bashrc文件,然后在文件末尾增加環境變量。

                網上通用配置都包括如下一句
                export PATH=/opt/liunx/arm-gcc/fsl-linaro-toolchain/bin:$PATH
                但是因為開發板不同,我的還要增加如下幾句:
                 export ARCH=arm
                 export CROSS_COMPILE=/home/acer/source/arm-gcc/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-
                 配置完成后,保存文件

                3)重新加載環境變量:
                 source /etc/bash.bashrc
               
                4)驗證交叉編譯環境,我的會輸出如下提示:
                 acer@ace:~/lighttpd/lighttpd-1.4.18$ arm-linux-gcc -v
          Using built-in specs.
          COLLECT_GCC=arm-linux-gcc
          COLLECT_LTO_WRAPPER=/opt/liunx/arm-gcc/fsl-linaro-toolchain/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.6.2/lto-wrapper
          Target: arm-fsl-linux-gnueabi
          Configured with: /work/build/.build/src/gcc-linaro-4.6-2011.06-0/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-fsl-linux-gnueabi --prefix=/work/fsl-linaro-toolchain-2.13 --with-sysroot=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --enable-languages=c,c++ --with-pkgversion='Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpfr=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpc=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-ppl=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-cloog=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-libelf=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm -L/work/build/.build/arm-fsl-linux-gnueabi/build/static/lib -lpwl' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-multilib --with-local-prefix=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --disable-nls --enable-c99 --enable-long-long --with-system-zlib
          Thread model: posix
          gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20)

          至此,交叉編譯環境搭建完畢

          2、ubuntu上編譯lighttpd
          我的lighttpd版本為1.4.18,可以自己去lighttpd官網上下載。

          1)配置configure命令
          首先進入lighttpd安裝文件夾下
          cd /home/acer/lighttpd/lighttpd1.4.18
          ./configure --prefix=/lighttpd --host=arm-linux --build=i486-linux-gnu --disable-FEATURE -disable-ipv6 -diable-lfs
          2)編譯
          make
          3)構建
          創建/lighttpd文件夾(同configure中的prefix跟的路徑),然后授權,最后在lighttpd的安裝文件夾下構建
          sudo mkdir /lighttpd
          sudo chmod 777 /lighttpd
          cd /home/acer/lighttpd/lighttpd1.4.18
          make install

          上述三步運行完之后,在/lighttpd下會生成lib、bin、sbin、share四個文件夾,這就是要拷貝到開發板上的文件。

          3、開發板,創建目錄,同時拷貝文件到開發板:
          1)創建根目錄/lighttpd(同編譯時configure命令中的prefix后跟的路徑),授予權限
          mkdir /lighttpd
          chmod 777 /lighttpd

          然后將ubuntu上/lighttpd中的四個文件夾lib、bin、sbin、share拷貝到開發板的/lighttpd下,具體什么方式,自己定吧,我們使用tftp考的的,在此不冗述。

          2)創建web根目錄/htdocs
          mkdir /htdocs
          chmod 777 /htdocs

          3)創建日志保存目錄/var/log/lighttpd
          mkdir /var/log/lighttpd
          chmod 777 /var/log/lighttpd

          4、配置并拷貝配置文件到開發板
          在ubuntu的lighttpd安裝文件中,找到lighttpd.config文件
          cd /home/acer/lighttpd/lighttpd1.4.18/doc
          打開lighttpd.config,作如下修改:
          server.document-root        = "/htdocs/"
          server.errorlog             = "/var/log/lighttpd/error.log"
          然后注釋掉:
          #$HTTP["url"] =~ "\.pdf$" {
          #  server.range-requests = "disable"
          #}
          保存后,將lighttpd.config拷貝到開發板的/etc/目錄下,至此,已經配置完成

          5、啟動lighttpd
          在開發板上運行:
          /lighttpd/sbin/lighttpd -f /etc/lighttpd.conf

          然后將一個.html文件放到/htdocs文件夾下,訪問web服務器試下吧!

          參考文件:
          http://www.linuxidc.com/Linux/2011-09/43619.htm
          http://www.linuxidc.com/Linux/2013-06/85902.htm
          http://blog.163.com/ljf_gzhu/blog/static/131553440201211522317367/

          posted on 2015-03-19 11:08 聽風 閱讀(811) 評論(0)  編輯  收藏 所屬分類: 嵌入式

          主站蜘蛛池模板: 顺昌县| 台北市| 日喀则市| 汕尾市| 金沙县| 婺源县| 聂拉木县| 靖宇县| 易门县| 宝应县| 禹州市| 改则县| 平谷区| 玉环县| 青州市| 崇义县| 中牟县| 西华县| 东安县| 龙门县| 随州市| 大田县| 五台县| 紫云| 石柱| 洛扎县| 舞钢市| 垣曲县| 平江县| 内黄县| 宕昌县| 梅州市| 台东县| 安福县| 丹棱县| 比如县| 平罗县| 德惠市| 磐安县| 江阴市| 宝应县|