dhcp cross compile

This document describes how to cross-compile DHCP package, provided by Internet
Software Consortium (www.isc.org ), for power pc platform.

1. Getting the package


Get the latest package from http://www.isc.org/products/DHCP/ (at the time
of writing it is dhcp-3.0pl2.tar.gz) and untar it to your home directory:

> cd /home/gorjup
> tar xzvf dhcp-3.0pl2.tar.gz

2. Cross-compiling


After you have installed your development kit (I used DTDK-0.3 toolchain, built by
Markus Haag ), set the proper environment variables:

> export CROSS_COMPILE=ppc-linux-
> PATH=$PATH:/opt/dtdk-0.3/mpc860/bin
> export CC=ppc-linux-gcc
> export AR=ppc-linux-ar
> export STRIP=ppc-linux-strip
> export RANLIB=ppc-linux-ranlib
> export LD=ppc-linux-ld
> export NM=ppc-linux-nm

Go to the dhcp directory and configure the dhcp package:

> cd /home/gorjup/dhcp-3.0pl2
> ./configure

Now a new directory, named work.linux-2.2, has been created. Go to this directory
and edit Makefiles. In all makefiles (in the main one and in all the subdirectories)
you need to do some changes:

> cd work.linux-2.2

- add the destination directory for cross-compiled files and man pages:

DESTDIR = /home/gorjup/target_ppc_dhcp

- change line, beginning with RANLIB:

- RANLIB = ranlib
+ RANLIB = ppc-linux-ranlib

- add the definition for CC variable:
+ CC = ppc-linux-gcc

In following makefiles:
common/Makefile, dhcpctl/Makefile, dst/Makefile, minires/Makefile and omapip/Makefile
you need to replace ar binutility with ppc-linux-ar.
You find ar binutility at the end of Makefiles.
Now cross-compile the package:

> make
> make install

At the end you can strip the binaries by using ppc-linux-strip.

3. Testing


In directory /home/gorjup/target_ppc_dhcp you will find all necessary files that
you need to add to the file system of your target.
Then you can test the client, server and relay agent:

Starting client:

# dhclient -q

Option -q disables printing out copyrights on the screen.

Starting server:

# dhcpd -q

Starting relay agent:

# dhcrelay -q x.x.x.x

x.x.x.x is an IP address of the remote DHCP server.

===========================================================================

# dhclient ra0                                                                 
Internet Systems Consortium DHCP Client V3.0.3                                 
Copyright 2004-2005 Internet Systems Consortium.                               
All rights reserved.                                                           
For info, please visit http://www.isc.org/products/DHCP                        
                                                                               
execve (/sbin/dhclient-script, ...): No such file or directory                  
Listening on LPF/ra0/00:24:a5:21:05:d6                                         
Sending on   LPF/ra0/00:24:a5:21:05:d6                                         
Sending on   Socket/fallback                                                   
DHCPREQUEST on ra0 to 255.255.255.255 porRcv Wcid(1) AddBAReq                  
t 67                                                                           
Start Seq = 00000000                                                           
DHCPACK from 192.168.7.1                                                       
execve (/sbin/dhclient-script, ...): No such file or directory                 
bound to 192.168.7.100 -- renewal in 3369 seconds.

--------------------------------------------------------------------------

There isn't "bash" in the directory "/bin/bash" belonging to your file system. So you should modify words "#!/bin/bash" in file "/sbin/dhclient-script " to "#!/bin/sh"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值