Patchwork adding dhcpcd

login
register
mail settings
Submitter John Stile
Date March 6, 2013, 10:57 p.m.
Message ID <1362610654.20183.176.camel@genx>
Download mbox | patch
Permalink /patch/225675/
State Superseded
Headers show

Comments

John Stile - March 6, 2013, 10:57 p.m.
Dear Thomas Petazzoni,
On Wed, 2013-03-06 at 22:29 +0100, Thomas Petazzoni wrote:
> Dear John Stile,
> 
> On Wed, 06 Mar 2013 13:20:28 -0800, John Stile wrote:
> 
> > The version that was downloaded was from the make file that you said
> > wasn't very good, so I tried to make a new makefile but it just doesn't
> > work.  
> > 
> > Could it be a problem that I am using buildroot-2011.11?
> > My project can't really upgrade right now, but I wonder if that could be
> > the cause.  
> 
> Aaaah, you're using 2011.11!
> 
> So, yes indeed that explains it all.
> 
> Change the last line from:
> 
> $(eval $(generic-package))
> 
> to:
> 
> $(eval $(call GENTARGETS))
> 
> Best regards,
> 
> Thomas
Aaaah,  that helps.  But it looks like it is not calling the configure
step.  I have attached the current version as a patch.

>>> dhcpcd 5.6.7 Downloading
--2013-03-06 14:50:35--  http://roy.marples.name/downloads/dhcpcd//dhcpcd-5.6.7.tar.bz2
Resolving roy.marples.name... 77.75.106.61, 2a01:348:31:2:209:5bff:fe84:887d
Connecting to roy.marples.name|77.75.106.61|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85983 (84K) [application/octet-stream]
Saving to: ‘/home/jstile/svn_rmserver/buildroot-2011.11/dl/dhcpcd-5.6.7.tar.bz2’

100%[==========================================================================================================================>] 85,983      76.5KB/s   in 1.1s   

2013-03-06 14:50:36 (76.5 KB/s) - ‘/home/jstile/svn_rmserver/buildroot-2011.11/dl/dhcpcd-5.6.7.tar.bz2’ saved [85983/85983]

>>> dhcpcd 5.6.7 Extracting
bzcat /home/jstile/svn_rmserver/buildroot-2011.11/dl/dhcpcd-5.6.7.tar.bz2 | tar --strip-components=1 -C /home/jstile/svn_rmserver/buildroot-2011.11/output/build/dhcpcd-5.6.7  -xf -
>>> dhcpcd 5.6.7 Patching package//dhcpcd
>>> dhcpcd 5.6.7 Configuring
>>> dhcpcd 5.6.7 Building
/usr/bin/make -j2  CC="/home/jstile/svn_rmserver/buildroot-2011.11/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc" LD="/home/jstile/svn_rmserver/buildroot-2011.11/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-ld"  -C /home/jstile/svn_rmserver/buildroot-2011.11/output/build/dhcpcd-5.6.7 all
make[1]: Entering directory `/home/jstile/svn_rmserver/buildroot-2011.11/output/build/dhcpcd-5.6.7'
Makefile:11: config.mk: No such file or directory
make[1]: *** No rule to make target `config.mk'.  Stop.
make[1]: Leaving directory `/home/jstile/svn_rmserver/buildroot-2011.11/output/build/dhcpcd-5.6.7'
make: *** [/home/jstile/svn_rmserver/buildroot-2011.11/output/build/dhcpcd-5.6.7/.stamp_built] Error 2


------------------
patch
------------------
Adding pacakge dhcpcd to buildroot

signed-off-by: John Stile <john@stilen.com>
gilles.talis@gmail.com - March 6, 2013, 11:48 p.m.
Hi John,

2013/3/6 John Stile <john@stilen.com>:
> +define DHCPD_CONFIGURE_CMDS
> +       (cd $@D) && \
> +       $(DHCPCD_PATH) $(DHCPCD_ENV) \
> +       ./configure \
> +       $(CONFIG_ARGS) )
> +endef

I think there's a small typo here. It should be:
define DHCPCD_CONFIGURE_CMDS
instead of
define DHCPD_CONFIGURE_CMDS

This might make the difference.

regards,
Gilles.
John Stile - March 7, 2013, 1:44 a.m.
Hello Gilles Talis,
On Wed, 2013-03-06 at 15:48 -0800, Gilles Talis wrote:
> Hi John,
> 
> 2013/3/6 John Stile <john@stilen.com>:
> > +define DHCPD_CONFIGURE_CMDS
> > +       (cd $@D) && \
> > +       $(DHCPCD_PATH) $(DHCPCD_ENV) \
> > +       ./configure \
> > +       $(CONFIG_ARGS) )
> > +endef
> 
> I think there's a small typo here. It should be:
> define DHCPCD_CONFIGURE_CMDS
> instead of
> define DHCPD_CONFIGURE_CMDS
> 
> This might make the difference.
> 
That did help.  Thank you.
The build now fails because it can't find ifaddrs.h:
ipv6.c:34:21: error: ifaddrs.h: No such file or directory
net.c:56:21: error: ifaddrs.h: No such file or directory

But I do see the file here:
./output/toolchain/uClibc-0.9.32/include/ifaddrs.h

Is there a good way to specify the path in my .mk file?

----------------
patch
----------------

Adding pacakge dhcpcd to buildroot

signed-off-by: John Stile <john@stilen.com>

--- a/buildroot-2011.11/package/Config.in	2013-03-06 11:40:52.000000000
-0800
+++ b/buildroot-2011.11/package/Config.in	2013-02-28 14:59:32.000000000
-0800
@@ -409,6 +409,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 source "package/dhcp/Config.in"
 endif
 source "package/dhcpdump/Config.in"
+source "package/dhcpcd/Config.in"
 source "package/dnsmasq/Config.in"
 source "package/dropbear/Config.in"
 source "package/ebtables/Config.in"

--- a/buildroot-2011.11/package/dhcpcd/Config.in	2013-03-06
11:44:03.000000000 -0800
+++ b/buildroot-2011.11/package/dhcpcd/Config.in	2013-03-06
07:55:53.000000000 -0800
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_DHCPCD
+	bool "dhcpcd"
+	depends on BR2_INET_IPV6
+	help
+	an RFC2131 compliant DHCP client

--- a/buildroot-2011.11/package/dhcpcd/dhcpcd.mk	2013-03-06
17:41:03.000000000 -0800
+++ b/buildroot-2011.11/package/dhcpcd/dhcpcd.mk	2013-03-06
17:38:29.000000000 -0800
@@ -0,0 +1,48 @@
+#############################################################
+#
+# dhcpcd
+#
+#############################################################
+
+DHCPCD_VERSION = 5.6.7
+DHCPCD_SOURCE = dhcpcd-$(DHCPCD_VERSION).tar.bz2
+DHCPCD_SITE = http://roy.marples.name/downloads/dhcpcd/
+DHCPCD_LICENSE = BSD-2c
+DHCPCD_INSTALL_STAGING = NO
+
+
+CONFIG_ARGS += --target=$(BR2_GCC_TARGET_ARCH)
+
+#CONFIG_ARGS += --with-cc=$(TARGET_CC)
+
+ifeq ($(BR2_USE_MMU),n)
+    CONFIG_ARGS += --disable-fork
+endif 
+
+ifeq ($(BR2_INET_IPV6),)
+    DHCPCD_CFLAGS += -UHASIPv6
+endif
+
+define DHCPCD_CONFIGURE_CMDS
+	(cd $(@D); \
+	./configure $(CONFIG_ARGS) )
+endef
+
+define DHCPCD_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS)  CC="$(TARGET_CC)" LD="$(TARGET_LD)"
PATH=$(TARGET_PATH) $(DHCPCD_CFLAGS) -C $(@D) all
+endef
+
+define DHCPCD_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/dhcpcd $(TARGET_DIR)/usr/bin/dhcpcd
+	$(INSTALL) -D -m 0644 $(@D)/dhcpcd.conf $(TARGET_DIR)/etc/dhcpcd.conf
+endef
+
+define DHCPCD_DEVICES
+	#/dev/foo  c  666  0  0  42  0  -  -  -
+endef
+
+define DHCPCD_PERMISSIONS
+	/usr/bin/dhcpcd  f  4755  0  0  -  -  -  -  -
+endef
+
+$(eval $(call GENTARGETS))
gilles.talis@gmail.com - March 7, 2013, 4:51 a.m.
Hi John,

> That did help.  Thank you.
> The build now fails because it can't find ifaddrs.h:
> ipv6.c:34:21: error: ifaddrs.h: No such file or directory
> net.c:56:21: error: ifaddrs.h: No such file or directory
>
> But I do see the file here:
> ./output/toolchain/uClibc-0.9.32/include/ifaddrs.h
>
> Is there a good way to specify the path in my .mk file?
Did you build your toolchain with Buildroot? In buildroot-2011.11,
this feature is not enabled in uClibc-0.9.32 configuration.
In order to enable it, you can follow these steps (if you built your
toolchain using buildroot):

1. in  toolchain/uClibc/uClibc-0.9.32.config, replace
# UCLIBC_SUPPORT_AI_ADDRCONFIG is not set
with
UCLIBC_SUPPORT_AI_ADDRCONFIG=y

2. run "make clean" then
3. run "make". Toolchain will be rebuilt with ifaddrs.h

This should get you going.
Gilles.
John Stile - March 7, 2013, 7:31 a.m.
Hello Gilles,
On Wed, 2013-03-06 at 20:51 -0800, Gilles Talis wrote:
> Hi John,
> 
> > That did help.  Thank you.
> > The build now fails because it can't find ifaddrs.h:
> > ipv6.c:34:21: error: ifaddrs.h: No such file or directory
> > net.c:56:21: error: ifaddrs.h: No such file or directory
> >
> > But I do see the file here:
> > ./output/toolchain/uClibc-0.9.32/include/ifaddrs.h
> >
> > Is there a good way to specify the path in my .mk file?
> Did you build your toolchain with Buildroot? In buildroot-2011.11,
> this feature is not enabled in uClibc-0.9.32 configuration.
> In order to enable it, you can follow these steps (if you built your
> toolchain using buildroot):
> 
> 1. in  toolchain/uClibc/uClibc-0.9.32.config, replace
> # UCLIBC_SUPPORT_AI_ADDRCONFIG is not set
> with
> UCLIBC_SUPPORT_AI_ADDRCONFIG=y
> 
> 2. run "make clean" then
> 3. run "make". Toolchain will be rebuilt with ifaddrs.h
> 
> This should get you going.
> Gilles.
That did get me quite a bit farther.

... now it fails to find a few more symbols:
bpf.c:32:21: error: net/bpf.h: No such file or directory
In file included from bpf.c:49:
bpf-filter.h:33: error: array type has incomplete element type
bpf-filter.h:36: error: 'BPF_LD' undeclared here (not in a function)
bpf-filter.h:36: error: 'BPF_H' undeclared here (not in a function)
bpf-filter.h:36: error: 'BPF_ABS' undeclared here (not in a function)
bpf-filter.h:37: error: 'BPF_JMP' undeclared here (not in a function)
bpf-filter.h:37: error: 'BPF_JEQ' undeclared here (not in a function)
bpf-filter.h:37: error: 'BPF_K' undeclared here (not in a function)
bpf-filter.h:46: error: 'BPF_RET' undeclared here (not in a function)
bpf-filter.h:78: error: array type has incomplete element type
bpf-filter.h:85: error: 'BPF_B' undeclared here (not in a function)
bpf-filter.h:89: error: 'BPF_JSET' undeclared here (not in a function)
bpf-filter.h:91: error: 'BPF_LDX' undeclared here (not in a function)
bpf-filter.h:91: error: 'BPF_MSH' undeclared here (not in a function)
bpf-filter.h:93: error: 'BPF_IND' undeclared here (not in a function)

I can see output/build/dhcpcd-5.6.7/bpf.c
has: #include "bpf-filter.h"

I can see the symbols are defined in several files.
./output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/linux/filter.h
./output/toolchain/linux/include/linux/filter.h
./output/toolchain/uClibc_dev/usr/include/linux/filter.h
./output/toolchain/linux-2.6.38.8/include/linux/filter.h

Are there more magical ideas to keep this compile going?
Possibly another uClibc option?
gilles.talis@gmail.com - March 7, 2013, 8:53 a.m.
Hi John,

2013/3/6 John Stile <john@stilen.com>:
> That did get me quite a bit farther.
>
> ... now it fails to find a few more symbols:
> bpf.c:32:21: error: net/bpf.h: No such file or directory
> In file included from bpf.c:49:
> bpf-filter.h:33: error: array type has incomplete element type
> bpf-filter.h:36: error: 'BPF_LD' undeclared here (not in a function)
> bpf-filter.h:36: error: 'BPF_H' undeclared here (not in a function)
> bpf-filter.h:36: error: 'BPF_ABS' undeclared here (not in a function)
> bpf-filter.h:37: error: 'BPF_JMP' undeclared here (not in a function)
> bpf-filter.h:37: error: 'BPF_JEQ' undeclared here (not in a function)
> bpf-filter.h:37: error: 'BPF_K' undeclared here (not in a function)
> bpf-filter.h:46: error: 'BPF_RET' undeclared here (not in a function)
> bpf-filter.h:78: error: array type has incomplete element type
> bpf-filter.h:85: error: 'BPF_B' undeclared here (not in a function)
> bpf-filter.h:89: error: 'BPF_JSET' undeclared here (not in a function)
> bpf-filter.h:91: error: 'BPF_LDX' undeclared here (not in a function)
> bpf-filter.h:91: error: 'BPF_MSH' undeclared here (not in a function)
> bpf-filter.h:93: error: 'BPF_IND' undeclared here (not in a function)
>
> I can see output/build/dhcpcd-5.6.7/bpf.c
> has: #include "bpf-filter.h"
>
> I can see the symbols are defined in several files.
> ./output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/linux/filter.h
> ./output/toolchain/linux/include/linux/filter.h
> ./output/toolchain/uClibc_dev/usr/include/linux/filter.h
> ./output/toolchain/linux-2.6.38.8/include/linux/filter.h
Which OS are you trying to build this on? bpf.c is compiled only on
non-linux based-platforms (e.g. BSD).
I have tried myself on my ubuntu machine and dhcpcd builds fine.

Thanks
Gilles.
John Stile - March 7, 2013, 2:53 p.m.
Hello Gilles Talis,
On Thu, 2013-03-07 at 00:53 -0800, Gilles Talis wrote:
> Hi John,
> 
> 2013/3/6 John Stile <john@stilen.com>:
> > That did get me quite a bit farther.
> >
> > ... now it fails to find a few more symbols:
> > bpf.c:32:21: error: net/bpf.h: No such file or directory
> > In file included from bpf.c:49:
> > bpf-filter.h:33: error: array type has incomplete element type
> > bpf-filter.h:36: error: 'BPF_LD' undeclared here (not in a function)
> > bpf-filter.h:36: error: 'BPF_H' undeclared here (not in a function)
> > bpf-filter.h:36: error: 'BPF_ABS' undeclared here (not in a function)
> > bpf-filter.h:37: error: 'BPF_JMP' undeclared here (not in a function)
> > bpf-filter.h:37: error: 'BPF_JEQ' undeclared here (not in a function)
> > bpf-filter.h:37: error: 'BPF_K' undeclared here (not in a function)
> > bpf-filter.h:46: error: 'BPF_RET' undeclared here (not in a function)
> > bpf-filter.h:78: error: array type has incomplete element type
> > bpf-filter.h:85: error: 'BPF_B' undeclared here (not in a function)
> > bpf-filter.h:89: error: 'BPF_JSET' undeclared here (not in a function)
> > bpf-filter.h:91: error: 'BPF_LDX' undeclared here (not in a function)
> > bpf-filter.h:91: error: 'BPF_MSH' undeclared here (not in a function)
> > bpf-filter.h:93: error: 'BPF_IND' undeclared here (not in a function)
> >
> > I can see output/build/dhcpcd-5.6.7/bpf.c
> > has: #include "bpf-filter.h"
> >
> > I can see the symbols are defined in several files.
> > ./output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/linux/filter.h
> > ./output/toolchain/linux/include/linux/filter.h
> > ./output/toolchain/uClibc_dev/usr/include/linux/filter.h
> > ./output/toolchain/linux-2.6.38.8/include/linux/filter.h
> Which OS are you trying to build this on? bpf.c is compiled only on
> non-linux based-platforms (e.g. BSD).
> I have tried myself on my ubuntu machine and dhcpcd builds fine.
> 
> Thanks
> Gilles.
I am building on: uname -a
Linux genx 3.3.8-gentoo #2 SMP Tue Oct 9 10:31:27 PDT 2012 x86_64 Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz GenuineIntel GNU/Linux
Maybe my generated confing.mk is wrong (from the configure step)
What is in your config.mk?
My config.mk contains:
# 
SYSCONFDIR=	/etc
SBINDIR=	/sbin
LIBEXECDIR=	/libexec
DBDIR=		/var/db
RUNDIR=		/var/run
LIBDIR=		/lib
MANDIR=		/usr/share/man
CC=		gcc
SRCS+=		bpf.c if-bsd.c platform-bsd.c
COMPAT_SRCS+=	compat/arc4random.c
COMPAT_SRCS+=	compat/closefrom.c
COMPAT_SRCS+=	compat/strlcpy.c
SERVICEEXISTS=	/sbin/rc-service -e $$1
SERVICECMD=	/sbin/rc-service $$1 -- -D $$2
SERVICESTATUS=	service_command $$1 status >/dev/null 2>\&1
HOOKSCRIPTS=	50-ntp.conf

Additionally, are the toolchain/uClibc/uClibc-0.9.32.config variables
available inside my dhcpcd.mk, so I can add the dependency on
UCLIBC_SUPPORT_AI_ADDRCONFIG?
Thomas Petazzoni - March 7, 2013, 3:03 p.m.
Dear John Stile,

On Thu, 07 Mar 2013 06:53:10 -0800, John Stile wrote:

> Additionally, are the toolchain/uClibc/uClibc-0.9.32.config variables
> available inside my dhcpcd.mk, so I can add the dependency on
> UCLIBC_SUPPORT_AI_ADDRCONFIG?

No. The latest Buildroot has UCLIBC_SUPPORT_AI_ADDRCONFIG enabled by
default in the uClibc configuration.

Thomas

Patch

--- a/buildroot-2011.11/package/Config.in	2013-03-06 11:40:52.000000000 -0800
+++ b/buildroot-2011.11/package/Config.in	2013-02-28 14:59:32.000000000 -0800
@@ -409,6 +409,7 @@  if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 source "package/dhcp/Config.in"
 endif
 source "package/dhcpdump/Config.in"
+source "package/dhcpcd/Config.in"
 source "package/dnsmasq/Config.in"
 source "package/dropbear/Config.in"
 source "package/ebtables/Config.in"

--- a/buildroot-2011.11/package/dhcpcd/Config.in	2013-03-06 11:44:03.000000000 -0800
+++ b/buildroot-2011.11/package/dhcpcd/Config.in	2013-03-06 07:55:53.000000000 -0800
@@ -0,0 +1,5 @@ 
+config BR2_PACKAGE_DHCPCD
+	bool "dhcpcd"
+	depends on BR2_INET_IPV6
+	help
+	an RFC2131 compliant DHCP client

--- a/buildroot-2011.11/package/dhcpcd/dhcpcd.mk	2013-03-06 14:54:11.000000000 -0800
+++ b/buildroot-2011.11/package/dhcpcd/dhcpcd.mk	2013-03-06 14:50:13.000000000 -0800
@@ -0,0 +1,45 @@ 
+#############################################################
+#
+# dhcpcd
+#
+#############################################################
+
+DHCPCD_VERSION = 5.6.7
+DHCPCD_SOURCE = dhcpcd-$(DHCPCD_VERSION).tar.bz2
+DHCPCD_SITE = http://roy.marples.name/downloads/dhcpcd/
+DHCPCD_LICENSE = BSD-2c
+DHCPCD_INSTALL_STAGING = NO
+DHCPCD_PATH	:= PATH=$(CROSS_PATH)
+DHCPCD_ENV 	:= $(CROSS_ENV)
+
+CONFIG_ARGS =: --target=$(BR2_GCC_TARGET_ARCH)
+
+ifeq ($(BR2_USE_MMU),n)
+    CONFIG_ARGS =: --disable-fork
+endif 
+
+define DHCPD_CONFIGURE_CMDS
+	(cd $@D) && \
+	$(DHCPCD_PATH) $(DHCPCD_ENV) \
+	./configure \
+	$(CONFIG_ARGS) )
+endef
+
+define DHCPCD_BUILD_CMDS
+	$(MAKE)  CC="$(TARGET_CC)" LD="$(TARGET_LD)"  -C $(@D) all
+endef
+
+define DHCPCD_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/dhcpcd $(TARGET_DIR)/usr/bin/dhcpcd
+	$(INSTALL) -D -m 0644 $(@D)/dhcpcd.conf $(TARGET_DIR)/etc/dhcpcd.conf
+endef
+
+define DHCPCD_DEVICES
+	#/dev/foo  c  666  0  0  42  0  -  -  -
+endef
+
+define DHCPCD_PERMISSIONS
+	/usr/bin/dhcpcd  f  4755  0  0  -  -  -  -  -
+endef
+
+$(eval $(call GENTARGETS))