Friday, February 22, 2008

How to build hostapd package+openSSL

1. use openssl package to generate cross-compiled crypto libray libssl.a and libcrypto.a
2. Edit Makefile, change
gcc=powerpc-405-linux-gnu-gcc
LIBS += -lssl -lcrypto to LIBS += libssl.a libcrypto.a
3. Edit defconfig, comment/uncomment or add the follwoing lines
#CONFIG_DRIVER_HOSTAP=y
CONFIG_DRIVER_MADWIFI=y
CFLAGS += -I. # include current directory

4. copy defconfig .config
5. copy madwifi driver include directories: include and net80211 into current hostapd directories
mkdir net80211
mkdir include
cp ~/madwifi-ng-r3406-20080326/include/*.h include
cp ~/madwifi-ng-r3406-20080326/net80211/*.h net80211


6. copy ssl include directory into openssl directory
mkdir openssl
cp ~/openssl-0.9.8g/include/openssl/*.h openssl/.

7. run make

===========================
How to cross compile openssl
===========================
0. apply hostapd-0.6.3, openssl-0.9.8.g patch:openssl-0.9.8g-tls-extensions.patch
cd ~/openssl-0.9.8g
patch -p1 <../hostapd-0.6.3/patches/openssl-0.9.8g-tls-extensions.patch

1. run ./Configure, or run_configure
#!/bin/bash
if [ -n "$1" ]
then
rootfs=$1
else
rootfs="/localhome/wli/rootfs"
fi
./Configure --openssldir=$rootfs os/compile:powerpc-405-linux-gnu-gcc
2. Make

1 comment:

Stephen said...

Hi, I try to cross compile at hostapd. But it always error in file format(always intel 80386).
Could you mind shared the experience or suggestion ?