Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package: add socketcan package
@ 2011-04-18 16:52 kevin.joly at armadeus.com
  2011-04-19 20:36 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: kevin.joly at armadeus.com @ 2011-04-18 16:52 UTC (permalink / raw)
  To: buildroot

From: Kevin JOLY <joly.kevin25@gmail.com>

Signed-off-by: Julien Boibessot <julien.boibessot@armadeus.com>
Signed-off-by: Kevin Joly <joly.kevin25@gmail.com>
Signed-off-by: Kevin JOLY <joly.kevin25@gmail.com>
---
 package/Config.in              |    1 +
 package/socketcan/Config.in    |   15 +++++++++++++++
 package/socketcan/socketcan.mk |   33 +++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100644 package/socketcan/Config.in
 create mode 100644 package/socketcan/socketcan.mk

diff --git a/package/Config.in b/package/Config.in
index 014c2c0..f41d915 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -427,6 +427,7 @@ source "package/rsync/Config.in"
 source "package/samba/Config.in"
 source "package/ser2net/Config.in"
 source "package/socat/Config.in"
+source "package/socketcan/Config.in"
 source "package/spawn-fcgi/Config.in"
 source "package/squid/Config.in"
 source "package/tcpdump/Config.in"
diff --git a/package/socketcan/Config.in b/package/socketcan/Config.in
new file mode 100644
index 0000000..e8d7a39
--- /dev/null
+++ b/package/socketcan/Config.in
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_SOCKETCAN
+	bool "Socket CAN"
+	help
+	  The socketcan package is an implementation of CAN protocols
+	  (Controller Area Network) for Linux. CAN is a networking technology
+	  which has wide-spread use in automation, embedded devices, and
+	  automotive fields.
+
+	  While there have been other CAN implementations for Linux based on
+	  character devices, Socket CAN uses the Berkeley socket API,
+	  the Linux network stack and implements the CAN device drivers as
+	  network interfaces.  The CAN socket API has been designed as similar
+	  as possible to the TCP/IP protocols to allow programmers, familiar
+	  with network programming, to easily learn how to use CAN sockets.
+
diff --git a/package/socketcan/socketcan.mk b/package/socketcan/socketcan.mk
new file mode 100644
index 0000000..ee8efc0
--- /dev/null
+++ b/package/socketcan/socketcan.mk
@@ -0,0 +1,33 @@
+#############################################################
+#
+# Socket CAN
+#
+#############################################################
+PROGRAMS_ISOTP = isotpdump,isotprecv,isotpsend,isotpsniffer,isotptun,isotpserver
+PROGRAMS_CANGW = cangw
+PROGRAMS_SLCAN = slcan_attach,slcand
+PROGRAMS_CAN_UTILS = can-calc-bit-timing,candump,cansniffer,cansend,canplayer,cangen,canbusload,log2long,log2asc,asc2log,canlogserver,bcmserver,slcanpty,canfdtest
+PROGRAMS = {$(PROGRAMS_ISOTP),$(PROGRAMS_CANGW),$(PROGRAMS_SLCAN),$(PROGRAMS_CAN_UTILS)}
+SOCKETCAN_VERSION = 1235
+SOCKETCAN_SOURCE = socketcan-svn-rev$(SOCKETCAN_VERSION).tar.gz
+SOCKETCAN_SITE = http://svn.berlios.de/svnroot/repos/socketcan/trunk/
+SOCKETCAN_SITE_METHOD = svn
+
+define SOCKETCAN_BUILD_CMDS
+	$(MAKE) -C $(SOCKETCAN_DIR)/can-utils CC="$(TARGET_CC)"
+endef
+
+define SOCKETCAN_INSTALL_TARGET_CMDS
+	$(MAKE) DESTDIR=$(TARGET_DIR) -C $(SOCKETCAN_DIR)/can-utils install
+	$(TARGET_STRIP) $(TARGET_DIR)/usr/local/bin/$(PROGRAMS)
+endef
+
+define SOCKETCAN_CLEAN_CMDS
+	$(MAKE) -C $(SOCKETCAN_DIR)/can-utils clean
+endef
+
+define SOCKETCAN_UNINSTALL_TARGET_CMDS
+	rm -rf $(SOCKETCAN_DIR)
+endef
+
+$(eval $(call GENTARGETS,package,socketcan))
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] package: add socketcan package
  2011-04-18 16:52 [Buildroot] [PATCH] package: add socketcan package kevin.joly at armadeus.com
@ 2011-04-19 20:36 ` Thomas Petazzoni
       [not found]   ` <4DAE88BF.6070301@armadeus.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2011-04-19 20:36 UTC (permalink / raw)
  To: buildroot

Hello Kevin,

Thanks for this submission. A couple of comments below.

On Mon, 18 Apr 2011 18:52:40 +0200
kevin.joly at armadeus.com wrote:

> diff --git a/package/socketcan/Config.in b/package/socketcan/Config.in
> new file mode 100644
> index 0000000..e8d7a39
> --- /dev/null
> +++ b/package/socketcan/Config.in
> @@ -0,0 +1,15 @@
> +config BR2_PACKAGE_SOCKETCAN
> +	bool "Socket CAN"
> +	help
> +	  The socketcan package is an implementation of CAN protocols
> +	  (Controller Area Network) for Linux. CAN is a networking technology
> +	  which has wide-spread use in automation, embedded devices, and
> +	  automotive fields.
> +
> +	  While there have been other CAN implementations for Linux based on
> +	  character devices, Socket CAN uses the Berkeley socket API,
> +	  the Linux network stack and implements the CAN device drivers as
> +	  network interfaces.  The CAN socket API has been designed as similar
> +	  as possible to the TCP/IP protocols to allow programmers, familiar
> +	  with network programming, to easily learn how to use CAN sockets.

Maybe this package should be called SOCKETCANUTILS or something like
that ? It isn't the Socket CAN implementation by itself, since that
thing is inside the kernel.

Moreover, we typically insert the project URL as a last line of the
help text.

> @@ -0,0 +1,33 @@
> +#############################################################
> +#
> +# Socket CAN
> +#
> +#############################################################
> +PROGRAMS_ISOTP = isotpdump,isotprecv,isotpsend,isotpsniffer,isotptun,isotpserver
> +PROGRAMS_CANGW = cangw
> +PROGRAMS_SLCAN = slcan_attach,slcand
> +PROGRAMS_CAN_UTILS = can-calc-bit-timing,candump,cansniffer,cansend,canplayer,cangen,canbusload,log2long,log2asc,asc2log,canlogserver,bcmserver,slcanpty,canfdtest
> +PROGRAMS = {$(PROGRAMS_ISOTP),$(PROGRAMS_CANGW),$(PROGRAMS_SLCAN),$(PROGRAMS_CAN_UTILS)}

This program list is only used for stripping and it's useless, see
below.

> +SOCKETCAN_VERSION = 1235
> +SOCKETCAN_SOURCE = socketcan-svn-rev$(SOCKETCAN_VERSION).tar.gz
> +SOCKETCAN_SITE = http://svn.berlios.de/svnroot/repos/socketcan/trunk/
> +SOCKETCAN_SITE_METHOD = svn
> +
> +define SOCKETCAN_BUILD_CMDS
> +	$(MAKE) -C $(SOCKETCAN_DIR)/can-utils CC="$(TARGET_CC)"
> +endef

Replace $(SOCKETCAN_DIR) with $(@D).

If you pass TARGET_CC, you also probably want to pass TARGET_CFLAGS
somehow, so that the code gets compiled for the proper sub-architecture.

> +define SOCKETCAN_INSTALL_TARGET_CMDS
> +	$(MAKE) DESTDIR=$(TARGET_DIR) -C $(SOCKETCAN_DIR)/can-utils install

SOCKETCAN_DIR -> @D

> +	$(TARGET_STRIP) $(TARGET_DIR)/usr/local/bin/$(PROGRAMS)

This is not needed, Buildroot will automagically strip all binaries
from the target filesystem. So just remove this line.

However, I see that things are installed into usr/local/bin in the
target filesystem, which is unusual. Could you tweak the think so that
it gets installed in usr/bin ?

> +define SOCKETCAN_CLEAN_CMDS
> +	$(MAKE) -C $(SOCKETCAN_DIR)/can-utils clean
> +endef
> +
> +define SOCKETCAN_UNINSTALL_TARGET_CMDS
> +	rm -rf $(SOCKETCAN_DIR)
> +endef

@D and @D here as well.

Thanks again!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] package: add socketcan package
       [not found]   ` <4DAE88BF.6070301@armadeus.com>
@ 2011-04-20  8:15     ` Thomas Petazzoni
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2011-04-20  8:15 UTC (permalink / raw)
  To: buildroot

Hello,

Please keep the list in Cc.

On Wed, 20 Apr 2011 09:18:23 +0200
JOLY <kevin.joly@armadeus.com> wrote:

> Thanks for your reply. I will correct that but I can't change the 
> install location (/usr/local/bin) because there is no options in the 
> makefile of socketcan-utils, we can choose the target root but not
> the directory to install the binaries.

You can make a one-line patch to can-utils/Makefile to change

PREFIX = /usr/local

to

PREFIX ?= /usr/local

and then pass "PREFIX=/usr" at make install.

This patch could be submitted to the upstream SocketCAN project, but in
the mean time, you can add it to the package directory in Buildroot.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-20  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 16:52 [Buildroot] [PATCH] package: add socketcan package kevin.joly at armadeus.com
2011-04-19 20:36 ` Thomas Petazzoni
     [not found]   ` <4DAE88BF.6070301@armadeus.com>
2011-04-20  8:15     ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox