dhcp cross compile

來源:互聯網
上載者:User

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"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.