2012年8月29日 星期三

Adding trousers and tpm-tools to Buildroot

Adding new package to Buildroot is not difficult, just follow the Buildroot user manual, Chapter 11. Adding new packages to Buildroot.

Both of TrouSers and tpm-tools are autotool-based package, so I follow Chapter 11.3. Infrastructure for autotools-based packages to create Config.in and .mk file.

1. Create directories under the package directory for TrouSers and tpm-tools.

2. package/trousers/Config.in, TrouSers needs openssl, so I set it depends on BR2_PACKAGE_OPENSSL.
config BR2_PACKAGE_TROUSERS
bool "trousers"
depends on BR2_PACKAGE_OPENSSL
help
 The open-source TCG Software Stack.

 http://trousers.sourceforge.net/

3. package/trousers/trousers.mk
#############################################################
#
# trousers
#
#############################################################

TROUSERS_VERSION = 0.3.9
TROUSERS_SOURCE = trousers-$(TROUSERS_VERSION).tar.gz
TROUSERS_SITE = http://nchc.dl.sourceforge.net/project/trousers/trousers/$(TROUSERS_VERSION)
TROUSERS_AUTORECONF = NO
TROUSERS_INSTALL_STAGING = YES
TROUSERS_INSTALL_TARGET = YES

$(eval $(call AUTOTARGETS))

4. package/tpm-tools/Config.in
config BR2_PACKAGE_TPM_TOOLS
bool "tpm-tools"
select BR2_PACKAGE_TROUSERS
depends on BR2_PACKAGE_OPENSSL
help
 Manpages for the tpm-tools package of TrouSerS.

 http://trousers.sourceforge.net/

5. package/tpm-tools/tpm-tools.mk
#############################################################
#
# tpm-tools
#
#############################################################

TPM_TOOLS_VERSION = 1.3.8
TPM_TOOLS_SOURCE = tpm-tools-$(TPM_TOOLS_VERSION).tar.gz
TPM_TOOLS_SITE = http://nchc.dl.sourceforge.net/project/trousers/tpm-tools/$(TPM_TOOLS_VERSION)
TPM_TOOLS_SUBDIR = tpm-tools-$(TPM_TOOLS_VERSION)
TPM_TOOLS_AUTORECONF = NO
TPM_TOOLS_INSTALL_STAGING = YES
TPM_TOOLS_INSTALL_TARGET = YES

$(eval $(call AUTOTARGETS))

6. Add trousers/Config.in and tpm-tools/Config.in in package/Config.in
--- package/Config.in (revision 1310)
+++ package/Config.in (working copy)

@@ -557,4 +557,9 @@
 endif
 endmenu

+menu "TCG (Trusted Computing Group)"
+source "package/trousers/Config.in"
+source "package/tpm-tools/Config.in"

 endmenu
+
+endmenu

NOTE: Buildroot already rename XXXTARGETS to xxx-package in newer version, but I use the older version.

The Buildroot user manual