cross compile tcpdump tool

來源:互聯網
上載者:User

cross compile tcpdump:
step 1: down libpcap-1.3.0.tar.gz form http://www.tcpdump.org/
step 2: down tcpdump-4.3.0.tar.gz form http://www.tcpdump.org/
step 3: tar xvf libpcap-1.3.0.tar.gz
step 4: tar xvf tcpdump-4.3.0.tar.gz
step 5: cd libpcap-1.3.0, touch cross_configure.sh as follow:
        MIPS_TOOLCHAIN_DIR=/opt/mips-4.4/bin
        export CROSS_COMPILE="${MIPS_TOOLCHAIN_DIR}/mips-linux-gnu-"
        export AR="${CROSS_COMPILE}ar"
        export AS="${CROSS_COMPILE}as"
        export LD="${CROSS_COMPILE}ld"
        export NM="${CROSS_COMPILE}nm"
        export CC="${CROSS_COMPILE}gcc -Os -pipe -O2  -mtune=mips32r2 -mabi=32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -EL"
        export FC="${CROSS_COMPILE}gfortran "
        export RANLIB="${CROSS_COMPILE}ranlib"
        export STRIP="${CROSS_COMPILE}strip"
        export OBJCOPY="${CROSS_COMPILE}objcopy"  
        export CFLAGS="-Os -pipe -O2  -mtune=mips32r2 -mabi=32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -EL"
        export CXXFLAGS="-Os -pipe -O2  -mtune=mips32r2 -mabi=32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -EL"

        ./configure --target=mipsel-linux --host=mipsel-linux --with-pcap=linux
step 6: ./cross_configure.sh, make
step 7: cd tcpdump-4.3.0, touch cross_configure.sh as follow:
                MIPS_TOOLCHAIN_DIR=/opt/mips-4.4/bin
                export CROSS_COMPILE="${MIPS_TOOLCHAIN_DIR}/mips-linux-gnu-"
                export AR="${CROSS_COMPILE}ar"
                export AS="${CROSS_COMPILE}as"
                export LD="${CROSS_COMPILE}ld"
                export NM="${CROSS_COMPILE}nm"
                export CC="${CROSS_COMPILE}gcc -Os -pipe -O2  -mtune=mips32r2 -mabi=32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -EL"
                export FC="${CROSS_COMPILE}gfortran "
                export RANLIB="${CROSS_COMPILE}ranlib"
                export STRIP="${CROSS_COMPILE}strip"
                export OBJCOPY="${CROSS_COMPILE}objcopy"  
                export CFLAGS="-Os -pipe -O2  -mtune=mips32r2 -mabi=32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -EL"
                export CXXFLAGS="-Os -pipe -O2  -mtune=mips32r2 -mabi=32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -EL"

                ./configure --target=mipsel-linux --host=mipsel-linux
step 8: ./cross_configure.sh, make
step 9: cp tcpdump-4.3.0/tcpdump to target board.
step A: use "tcpdump -w test.cap" capture packages and save to test.cap file.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.