Skip to contentSkip to conversation

ocf: new package

PATCH New Gustavo Zacarias 2 participants 4 messages Jan 27, 2012 – Jan 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ocf: new package

Add the OCF package and linux kernel extension.

---
 linux/Config.ext.in    |    7 +++++++
 linux/linux-ext-ocf.mk |   21 +++++++++++++++++++++
 package/Config.in      |    1 +
 package/ocf/Config.in  |   12 ++++++++++++
 package/ocf/ocf.mk     |   30 ++++++++++++++++++++++++++++++
 5 files changed, 71 insertions(+), 0 deletions(-)
 create mode 100644 linux/linux-ext-ocf.mk
 create mode 100644 package/ocf/Config.in
 create mode 100644 package/ocf/ocf.mk
linux/Config.ext.in +7 -0
index 172fa76..64c1476 100644
@@ -23,6 +23,13 @@ config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH
 	  Download it at http://download.gna.org/adeos/patches/v2.6/$(ARCH)/
 	  and verify that your kernel version in buildroot matches.
 
+# OCF
+config BR2_LINUX_KERNEL_EXT_OCF
+	bool "Open Cryptographic Framework (OCF)"
+	select BR2_PACKAGE_OCF
+	help
+	  OCF Kernel part.
+
 # RTAI
 config BR2_LINUX_KERNEL_EXT_RTAI
        bool "RTAI Real-time patch"
linux/linux-ext-ocf.mk new file +21 -0
new file mode 100644
index 0000000..af8b809
@@ -0,0 +1,21 @@
+##################################################
+# Linux OCF extension
+#
+# Patch the linux kernel with OCF
+##################################################
+
+ifeq ($(BR2_LINUX_KERNEL_EXT_OCF),y)
+LINUX_DEPENDENCIES += ocf
+
+# Prepare kernel patch
+# The linux-3.2.1.patch is just the main inclusion, most of the code
+# resides in the ocf/ subdir.
+define OCF_PREPARE_KERNEL
+	support/scripts/apply-patches.sh $(LINUX_DIR) \
+		$(OCF_DIR)/patches/ linux-3.2.1-ocf.patch ; \
+	cp -rf $(OCF_DIR)/ocf $(LINUX_DIR)/crypto/ocf ;
+endef
+
+LINUX_PRE_PATCH_HOOKS += OCF_PREPARE_KERNEL
+
+endif #BR2_LINUX_EXT_OCF
package/Config.in +1 -0
index e35c09a..6a74df1 100644
@@ -269,6 +269,7 @@ source "package/gnutls/Config.in"
 source "package/libgcrypt/Config.in"
 source "package/libgpg-error/Config.in"
 source "package/libnss/Config.in"
+source "package/ocf/Config.in"
 source "package/openssl/Config.in"
 endmenu
 
package/ocf/Config.in new file +12 -0
new file mode 100644
index 0000000..4cdb5c3
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_OCF
+	bool "ocf"
+	help
+	  OCF-Linux is a Linux port of the OpenBSD/FreeBSD Cryptographic
+	  Framework (OCF). This port aims to bring full asynchronous HW/SW
+	  crypto acceleration to the Linux kernel and applications
+	  running under Linux.
+
+	  You need to enable the OCF linux kernel extension or provide
+	  a prepatched kernel to make this option useful.
+	  
+	  http://ocf-linux.sourceforge.net/
package/ocf/ocf.mk new file +30 -0
new file mode 100644
index 0000000..c409464
@@ -0,0 +1,30 @@
+#############################################################
+#
+# ocf
+#
+#############################################################
+
+OCF_VERSION = 20120127
+OCF_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/ocf-linux
+OCF_SOURCE = ocf-linux-$(OCF_VERSION).tar.gz
+OCF_INSTALL_STAGING = YES
+
+define OCF_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 644 $(@D)/ocf/cryptodev.h \
+		$(STAGING_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+define OCF_UNINSTALL_STAGING_CMDS
+	rm -f $(STAGING_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+define OCF_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 644 $(@D)/ocf/cryptodev.h \
+		$(TARGET_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+define OCF_UNINSTALL_TARGET_CMDS
+	rm -f $(TARGET_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+$(eval $(call GENTARGETS))
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 2/2 openssl: split out ocf

Ditch OCF and switch to the proper package.

---
 package/openssl/Config.in                |    1 +
 package/openssl/ocf-cryptodev-20101223.h |  480 ------------------------------
 package/openssl/openssl.mk               |   10 +-
 3 files changed, 3 insertions(+), 488 deletions(-)
 delete mode 100644 package/openssl/ocf-cryptodev-20101223.h
package/openssl/Config.in +1 -0
index 3e09d88..0240603 100644
@@ -25,6 +25,7 @@ config BR2_PACKAGE_OPENSSL_ENGINES
 config BR2_PACKAGE_OPENSSL_OCF
 	bool "openssl ocf support"
 	depends on BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_OCF
 	help
 	  Enable openssl cryptodev (OCF) hardware acceleration support.
 	  This requires kernel patches from the ocf-linux project otherwise
package/openssl/ocf-cryptodev-20101223.h deleted +0 -480

480 lines not on this page · raw message

package/openssl/openssl.mk +2 -8
index cb29fe4..d638ce1 100644
@@ -12,14 +12,8 @@ OPENSSL_TARGET_ARCH = generic32
 OPENSSL_CFLAGS = $(TARGET_CFLAGS)
 
 ifeq ($(BR2_PACKAGE_OPENSSL_OCF),y)
-OPENSSL_CFLAGS += -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
-
-define OPENSSL_INSTALL_CRYPTODEV_H
-$(INSTALL) -D package/openssl/ocf-cryptodev-20101223.h \
-	$(STAGING_DIR)/usr/include/crypto/cryptodev.h
-endef
-
-OPENSSL_POST_EXTRACT_HOOKS += OPENSSL_INSTALL_CRYPTODEV_H
+	OPENSSL_CFLAGS += -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
+	OPENSSL_DEPENDENCIES += ocf
 endif
 
 # Some architectures are optimized in OpenSSL
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 2/2 openssl: split out ocf

Quoted 16 lines · On Friday 27 January 2012 13:36:02 Gustavo Zacarias wrote:

Ditch OCF and switch to the proper package.

---
 package/openssl/Config.in                |    1 +
 package/openssl/ocf-cryptodev-20101223.h |  480 ------------------------------
 package/openssl/openssl.mk               |   10 +-
 3 files changed, 3 insertions(+), 488 deletions(-)
 delete mode 100644 package/openssl/ocf-cryptodev-20101223.h
package/openssl/Config.in +0 -0
index 3e09d88..0240603 100644

package/openssl/Config.in config BR2_PACKAGE_OPENSSL_ENGINES · line 31

Quoted 7 lines
package/openssl/Config.in +1 -0
@@ -25,6 +25,7 @@ config BR2_PACKAGE_OPENSSL_ENGINES
 config BR2_PACKAGE_OPENSSL_OCF
        bool "openssl ocf support"
        depends on BR2_PACKAGE_OPENSSL
+       select BR2_PACKAGE_OCF
        help
          Enable openssl cryptodev (OCF) hardware acceleration support.
          This requires kernel patches from the ocf-linux project otherwise

Maybe it's useful to refer to the OCF kernel extension in the help
text.

[snip]

Quoted 10 lines
package/openssl/openssl.mk +0 -0
index cb29fe4..d638ce1 100644
@@ -12,14 +12,8 @@ OPENSSL_TARGET_ARCH = generic32
 
 OPENSSL_CFLAGS = $(TARGET_CFLAGS)
 
 ifeq ($(BR2_PACKAGE_OPENSSL_OCF),y)
 

package/openssl/openssl.mk OPENSSL_TARGET_ARCH = generic32 · line 18

Quoted 10 lines
package/openssl/openssl.mk +2 -8
-OPENSSL_CFLAGS += -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
-
-define OPENSSL_INSTALL_CRYPTODEV_H
-$(INSTALL) -D package/openssl/ocf-cryptodev-20101223.h \
-       $(STAGING_DIR)/usr/include/crypto/cryptodev.h
-endef
-
-OPENSSL_POST_EXTRACT_HOOKS += OPENSSL_INSTALL_CRYPTODEV_H
+       OPENSSL_CFLAGS += -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS
+       OPENSSL_DEPENDENCIES += ocf

I don't think we usually put indentation in make conditionals.

Regards,
Arnout

Quoted 4 lines
package/openssl/openssl.mk +0 -0
 endif

# Some architectures are optimized in OpenSSL

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 1/2 ocf: new package

In reply to Gustavo Zacarias
Quoted 3 lines · On Friday 27 January 2012 13:36:01 Gustavo Zacarias wrote:

Add the OCF package and linux kernel extension.

Quoted 16 lines
---
 linux/Config.ext.in    |    7 +++++++
 linux/linux-ext-ocf.mk |   21 +++++++++++++++++++++
 package/Config.in      |    1 +
 package/ocf/Config.in  |   12 ++++++++++++
 package/ocf/ocf.mk     |   30 ++++++++++++++++++++++++++++++
 5 files changed, 71 insertions(+), 0 deletions(-)
 create mode 100644 linux/linux-ext-ocf.mk
 create mode 100644 package/ocf/Config.in
 create mode 100644 package/ocf/ocf.mk
linux/Config.ext.in +0 -0
index 172fa76..64c1476 100644

linux/Config.ext.in config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH · line 32

Quoted 10 lines
linux/Config.ext.in +7 -0
@@ -23,6 +23,13 @@ config BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH
 	  Download it at http://download.gna.org/adeos/patches/v2.6/$(ARCH)/
 	  and verify that your kernel version in buildroot matches.
 
+# OCF
+config BR2_LINUX_KERNEL_EXT_OCF
+	bool "Open Cryptographic Framework (OCF)"
+	select BR2_PACKAGE_OCF
+	help
+	  OCF Kernel part.
+

I guess this is an attempt to keep the options alphabetical... but
they're not :-) I'd put OCF at the top or at the bottom. The top is closest to alphabetical.

Quoted 15 lines
linux/Config.ext.in +0 -0
 # RTAI
 config BR2_LINUX_KERNEL_EXT_RTAI
        bool "RTAI Real-time patch"
linux/linux-ext-ocf.mk new file +6 -0
new file mode 100644
index 0000000..af8b809
@@ -0,0 +1,21 @@
+##################################################
+# Linux OCF extension
+#
+# Patch the linux kernel with OCF
+##################################################
+

linux/linux-ext-ocf.mk line 16

Quoted 10 lines
linux/linux-ext-ocf.mk new file +10 -0
+ifeq ($(BR2_LINUX_KERNEL_EXT_OCF),y)
+LINUX_DEPENDENCIES += ocf
+
+# Prepare kernel patch
+# The linux-3.2.1.patch is just the main inclusion, most of the code
+# resides in the ocf/ subdir.
+define OCF_PREPARE_KERNEL
+	support/scripts/apply-patches.sh $(LINUX_DIR) \
+		$(OCF_DIR)/patches/ linux-3.2.1-ocf.patch ; \
+	cp -rf $(OCF_DIR)/ocf $(LINUX_DIR)/crypto/ocf ;

I'm not sure if 'cp -rf' is the best option here... First of all, '-a'
seems better in order to keep symlinks. Second, the '-f' removes the files before they're overwritten, which is kind of pointless I think -- if they need to be removed, do an 'rm -rf' first. Instead of cpio I'd use the tar-path (cfr. Peter's correction to the linux-firmware package) (actually, I'd have used cpio rather than tar because it's a bit simpler internally, but that's just personal preference).

Quoted 5 lines
linux/linux-ext-ocf.mk new file +5 -0
+endef
+
+LINUX_PRE_PATCH_HOOKS += OCF_PREPARE_KERNEL
+
+endif #BR2_LINUX_EXT_OCF

[snip]

Quoted 6 lines
package/ocf/ocf.mk new file +0 -0
new file mode 100644
index 0000000..c409464

package/ocf/ocf.mk line 9

Quoted 9 lines
package/ocf/ocf.mk new file +9 -0
@@ -0,0 +1,30 @@
+#############################################################
+#
+# ocf
+#
+#############################################################
+
+OCF_VERSION = 20120127
+OCF_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/ocf-linux
+OCF_SOURCE = ocf-linux-$(OCF_VERSION).tar.gz

The official name is "OCF-Linux", so why not call the package ocf-linux
(and remove the OCF_SOURCE assignment)?

Quoted 5 lines
package/ocf/ocf.mk new file +5 -0
+OCF_INSTALL_STAGING = YES
+
+define OCF_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 644 $(@D)/ocf/cryptodev.h \
+		$(STAGING_DIR)/usr/include/crypto/cryptodev.h

package/ocf/ocf.mk line 24

Quoted 10 lines
package/ocf/ocf.mk new file +10 -0
+endef
+
+define OCF_UNINSTALL_STAGING_CMDS
+	rm -f $(STAGING_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+define OCF_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 644 $(@D)/ocf/cryptodev.h \
+		$(TARGET_DIR)/usr/include/crypto/cryptodev.h
+endef

/usr/include gets removed unless BR2_HAVE_DEVFILES, of course, so
doesn't it make sense to do this conditionally?

package/ocf/ocf.mk line 30

Quoted 7 lines
package/ocf/ocf.mk new file +6 -0
+
+define OCF_UNINSTALL_TARGET_CMDS
+	rm -f $(TARGET_DIR)/usr/include/crypto/cryptodev.h
+endef
+
+$(eval $(call GENTARGETS))

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F