All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stile <john@stilen.com>
To: buildroot@busybox.net
Subject: [Buildroot] adding dhcpcd
Date: Tue, 05 Mar 2013 08:21:17 -0800	[thread overview]
Message-ID: <1362500477.20183.74.camel@genx> (raw)
In-Reply-To: <5130F7CA.6090203@zacarias.com.ar>

On Fri, 2013-03-01 at 15:47 -0300, Gustavo Zacarias wrote:
> On 03/01/2013 03:37 PM, John Stile wrote:
> 
> > I have a need for an RFC2131 compliant DHCP client, which dhcpcd
> > advertises to be (specifically  it needs to detect if a dhcp server
> > becomes available).
> > 
> > I am using buildroot-2011.11.
> > 
> > I tried to add my own package to buildroot, to build dhcpcd, but I have
> > no idea how to go about integrating into the system.
> > 
> > I configure static vs. dynamic via /etc/network/interfaces, but should I
> > do next?  
> > 
> > How does the default system decide what to do with networking?
> > What is the default dhcp client, and why isn't it RFC2131 compliant?
> 
> Hi.
> If you're using a default buildroot skeleton without touching much then
> /etc/init.d/S40network is called on system startup (from
> /etc/init.d/rcS, which is invoked by init [/etc/inittab]).
> S40network does an "ifup -a" (interface up, all) which is a busybox
> applet/command that reads /etc/network/interfaces and does what it's
> appropiate according to the configuration.
> If your busybox config is default then udhcpc is built (busybox's dhcp
> client) and that's what's used for DHCP.
> For dhcpcd you probably don't want to use ifup nor S40network, you
> probably want to run dhcpcd directly, something like "dhcpcd -b eth0" or
> so. If link status messages are available it'll wait until carrier is
> detected, and do the usual DHCP dance.
> Regards.
> 
Does this look like a good make file for buildroot?  
Is this the right place to get advice on a make file, or even submit?
I put this together from various sources/references.
---------------
Makefile
---------------
# -*-makefile-*-
#############################################################
#
# dhcpcd
#
#############################################################

DHCPCD_VERSION=3.2.3
DHCPCD_SOURCE=dhcpcd-$(DHCPCD_VERSION).tar.bz2
DHCPCD_SITE=http://roy.marples.name/downloads/dhcpcd/
DHCPCD_DIR=$(BUILD_DIR)/dhcpcd-$(DHCPCD_VERSION)
DHCPCD_CAT:=$(BZCAT)
DHCPCD_BINARY:=dhcpcd
DHCPCD_TARGET_BINARY:=usr/bin/$(DHCPCD_BINARY)
#DHCPCD_DEPENDENCIES += ntp
DHCPCD_PATH	:= PATH=$(CROSS_PATH)
DHCPCD_ENV 	:= $(CROSS_ENV)
# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

$(DL_DIR)/$(DHCPCD_SOURCE):
	$(call DOWNLOAD,$(DHCPCD_SITE),$(DHCPCD_SOURCE))

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

$(DHCPCD_DIR)/.unpacked: $(DL_DIR)/$(DHCPCD_SOURCE)
	$(DHCPCD_CAT) $(DL_DIR)/$(DHCPCD_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	touch $@

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

$(DHCPCD_DIR)/.patched: $(DHCPCD_DIR)/.unpacked
	support/scripts/apply-patches.sh $(DHCPCD_DIR) package/dhcpcd dhcpcd-$(DHCPCD_VERSION)\*.patch\* 
	touch $@

$(DHCPCD_DIR)/.configured: $(DHCPCD_DIR)/.patched
	@$(cd $(DHCPCD_DIR) && \
	$(DHCPCD_PATH) $(DHCPCD_ENV)  \
	./configure --target="armv5te"
	@$(call clean, $(DHCPCD_DIR)/config.cache)
	touch $@

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

$(DHCPCD_DIR)/$(DHCPCD_BINARY): $(DHCPCD_DIR)/.configured
	$(MAKE) $(TARGET_CONFIGURE_OPTS) \
	HAVE_FORK=yes HAVE_INIT=SYSV \
	-C $(DHCPCD_DIR)
	@$(call touch $(DHCPCD_DIR)/.stamp_built )

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

$(TARGET_DIR)/$(DHCPCD_TARGET_BINARY): $(DHCPCD_DIR)/$(DHCPCD_BINARY)
	cp -dpf $(DHCPCD_DIR)/dhcpcd $@
	$(STRIPCMD) --strip-unneeded $@
	cp -dfp $(DHCPCD_DIR)/dhcpcd.sh $(TARGET_DIR)/etc/init.d/

# ----------------------------------------------------------------------------
# One rule to rule them all
# ----------------------------------------------------------------------------
dhcpcd: $(TARGET_DIR)/$(DHCPCD_TARGET_BINARY)

# Source download rule. Main purpose to download the source package. Since some
# people would like to work offline, it is mandotory to implement a rule which
# downloads everything this package needs.
dhcpcd-source: $(DL_DIR)/$(DHCPCD_SOURCE)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

dhcpcd-clean:
	-$(MAKE) -C $(DHCPCD_DIR) clean

# Directory clean rule. Main purpose is to remove the build directory, forcing
# a new extraction, patching and rebuild the next time Buildroot is made.
dhcpcd-dirclean:
	rm -rf $(DHCPCD_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
# This is how the dhcpcd package is added to the list of rules to build.
ifeq ($(BR2_PACKAGE_DHCPCD),y)
TARGETS+=dhcpcd
endif

# vim: syntax=make

-------------
Config.in
-------------
config BR2_PACKAGE_DHCPCD
	        bool "dhcpcd"
	        help
	          an RFC2131 compliant DHCP client

  reply	other threads:[~2013-03-05 16:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 18:37 [Buildroot] adding dhcpcd John Stile
2013-03-01 18:47 ` Gustavo Zacarias
2013-03-05 16:21   ` John Stile [this message]
2013-03-05 18:47     ` Thomas Petazzoni
2013-03-06 18:01       ` John Stile
2013-03-06 18:58         ` Thomas Petazzoni
2013-03-06 19:50           ` John Stile
2013-03-06 20:05             ` Reuben Dowle
2013-03-06 20:08               ` Thomas Petazzoni
2013-03-06 20:41                 ` John Stile
2013-03-06 20:54                   ` Thomas Petazzoni
2013-03-06 21:02                     ` John Stile
2013-03-06 21:14                       ` Thomas Petazzoni
2013-03-06 21:20                         ` John Stile
2013-03-06 21:29                           ` Thomas Petazzoni
2013-03-06 22:57                             ` John Stile
2013-03-06 23:48                               ` Gilles Talis
2013-03-07  1:44                                 ` John Stile
2013-03-07  4:51                                   ` Gilles Talis
2013-03-07  7:31                                     ` John Stile
2013-03-07  8:53                                       ` Gilles Talis
2013-03-07 14:53                                         ` John Stile
2013-03-07 15:03                                           ` Thomas Petazzoni
2013-03-07 15:30                                             ` John Stile
2013-03-07 17:15                                               ` Thomas Petazzoni
2013-03-06 20:06             ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362500477.20183.74.camel@genx \
    --to=john@stilen.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.