How to cross compil mini_httpd for the kong's firmware WNR3500Lv2

1 post / 0 new
d0ctrie
d0ctrie's picture
How to cross compil mini_httpd for the kong's firmware WNR3500Lv2

Hello everyone, 

First thank for your firmware kong and thank to o.Charuel  for this tutorial. 

compil env : 

* Debian 8.2

* packets : gcc g++ binutils patch bzip2 flex bison make gettext unzip zlib1g-dev libc6 subversion

* Have a standard user sudoer

Login with standard user (NOT ROOT)

 
# Go in home directory
    cd
 
# create a directory for the toolchain
    mkdir toolchains && cd toolchains
 
# Download the toolchains (with ftp of dd-wrt, 1.8 Go)
    wget ftp://ftp.dd-wrt.com/toolchains/toolchains.tar.xz && tar -xf toolchains.tar.xz
 
# Export the toolchains on your PATH (you have to make it every time you close your terminal)
    export GCCMIPS=~/toolchains/toolchain-mipsel_74kc+dsp2_gcc-5.1.0_musl-1.1.9/bin
    export PATH=$GCCMIPS:$PATH
 
# test :
    mipsel-linux-uclibc-gcc --version
    # must return : `mipsel-linux-uclibc-gcc (OpenWrt GCC 5.1.0 r45933) 5.1.0 ....`
 
It's OK !
 
cross compile mini_httpd.
Go in home directory
    cd
 
# Download code source of mini_httpd.
    wget http://acme.com/software/mini_httpd/mini_httpd-1.21.tar.gz && tar -xzf mini_httpd-1.21.tar.gz
 
# Remove the 359 line of the Makefile
    cd mini_httpd-1.21 && sudo sed -i '359d' mini_httpd.c
 
# Add the compiler in the Makefile
    sed -i 's/CC =.*/CC = mipsel-linux-uclibc-gcc/' Makefile
 
# Compil
    make mini_httpd
 
# After some seconds, you have a binary OK
    file mini_httpd
    # must return : `mini_httpd: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked, interpreter /lib/ld-musl-mipsel-sf.so.1, stripped`