diff mbox

[1/2,v3] vboot-utils: new package

Message ID 4c9ac9c66d52a2760002718d0827b1c146633aa1.1447714688.git.alex.suykov@gmail.com
State Changes Requested
Headers show

Commit Message

Alex Suykov Nov. 16, 2015, 11:42 p.m. UTC
Chromium OS verified boot utilities.

Needed for signing kernel images and manipulating bootable
partitions on media intended for Chromebooks.

Signed-off-by: Alex Suykov <alex.suykov@gmail.com>
---
v2: _LICENSE_FILES
    minor text fixes
v3: git snapshot over https instead of git checkout
    comments on unusual make targets
    proper license name
    minor text fixes

 package/Config.in.host               |  1 +
 package/vboot-utils/Config.in.host   |  6 ++++++
 package/vboot-utils/vboot-utils.hash |  2 ++
 package/vboot-utils/vboot-utils.mk   | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 44 insertions(+)
 create mode 100644 package/vboot-utils/Config.in.host
 create mode 100644 package/vboot-utils/vboot-utils.hash
 create mode 100644 package/vboot-utils/vboot-utils.mk

Comments

Thomas Petazzoni Dec. 24, 2015, 11:36 a.m. UTC | #1
Dear Alex Suykov,

On Tue, 17 Nov 2015 01:42:21 +0200, Alex Suykov wrote:
> Chromium OS verified boot utilities.
> 
> Needed for signing kernel images and manipulating bootable
> partitions on media intended for Chromebooks.
> 
> Signed-off-by: Alex Suykov <alex.suykov@gmail.com>

I wanted to apply this patch, but it fails to build. It forgets to link
with the OpenSSL library that has been built in $(HOST_DIR)/usr/lib.
Can you have a look? To reproduce, make sure you don't have the
openssl-dev package installed on your system.

    AR            libvboot_util21.a
    LD            futility/futility_s
    LD            futility/futility
    LDcgpt        cgpt/cgpt
/home/thomas/projets/buildroot/output/build/host-vboot-utils-bbdd62f9b030db7ad8eef789aaf58a7ff9a25656/build/futility/cmd_create.o: In function `do_create':
cmd_create.c:(.text+0x42a): undefined reference to `PEM_read_RSAPrivateKey'
cmd_create.c:(.text+0x5fa): undefined reference to `RSA_free'
cmd_create.c:(.text+0x65e): undefined reference to `PEM_read_RSAPrivateKey'
cmd_create.c:(.text+0x680): undefined reference to `PEM_read_RSA_PUBKEY'
cmd_create.c:(.text+0x962): undefined reference to `RSA_free'
/home/thomas/projets/buildroot/output/build/host-vboot-utils-bbdd62f9b030db7ad8eef789aaf58a7ff9a25656/build/futility/cmd_show.o: In function `ft_show_privkey':
cmd_show.c:(.text+0x875): undefined reference to `d2i_RSAPrivateKey'
cmd_show.c:(.text+0x901): undefined reference to `RSA_free'
/home/thomas/projets/buildroot/output/build/host-vboot-utils-bbdd62f9b030db7ad8eef789aaf58a7ff9a25656/build/futility/vb1_helper.o: In function `ft_recognize_vb1_key':
vb1_helper.c:(.text+0x1141): undefined reference to `d2i_RSAPrivateKey'
vb1_helper.c:(.text+0x1159): undefined reference to `RSA_free'
/home/thomas/projets/buildroot/output/build/host-vboot-utils-bbdd62f9b030db7ad8eef789aaf58a7ff9a25656/build/futility/vb2_helper.o: In function `rsa_from_buffer':
vb2_helper.c:(.text+0x4): undefined reference to `BIO_new_mem_buf'
vb2_helper.c:(.text+0x1a): undefined reference to `PEM_read_bio_RSAPrivateKey'
vb2_helper.c:(.text+0x33): undefined reference to `BIO_ctrl'
vb2_helper.c:(.text+0x45): undefined reference to `PEM_read_bio_RSA_PUBKEY'
vb2_helper.c:(.text+0x55): undefined reference to `BIO_free'
vb2_helper.c:(.text+0x61): undefined reference to `BIO_free'

Thanks,

Thomas
Alex Suykov Dec. 24, 2015, 6:42 p.m. UTC | #2
Thu, Dec 24, 2015 at 12:36:33PM +0100, Thomas Petazzoni wrote:

> I wanted to apply this patch, but it fails to build. It forgets to link
> with the OpenSSL library that has been built in $(HOST_DIR)/usr/lib.
> Can you have a look? To reproduce, make sure you don't have the
> openssl-dev package installed on your system.

Well it fails for me even with the system openssl installed.
That's because of pkg-config actually, and fixing pkg-config brought up
some more issues.

Sending v4, checked against current master.
diff mbox

Patch

diff --git a/package/Config.in.host b/package/Config.in.host
index ce1b6bc..7044a3b 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -29,5 +29,6 @@  menu "Host utilities"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/uboot-tools/Config.in.host"
 	source "package/util-linux/Config.in.host"
+	source "package/vboot-utils/Config.in.host"
 
 endmenu
diff --git a/package/vboot-utils/Config.in.host b/package/vboot-utils/Config.in.host
new file mode 100644
index 0000000..5cecef0
--- /dev/null
+++ b/package/vboot-utils/Config.in.host
@@ -0,0 +1,6 @@ 
+config BR2_PACKAGE_HOST_VBOOT_UTILS
+	bool "host vboot utils"
+	help
+	  ChromiumOS verified boot utilities: futility and cgpt.
+
+	  https://www.chromium.org/chromium-os/chromiumos-design-docs/verified-boot
diff --git a/package/vboot-utils/vboot-utils.hash b/package/vboot-utils/vboot-utils.hash
new file mode 100644
index 0000000..e161423
--- /dev/null
+++ b/package/vboot-utils/vboot-utils.hash
@@ -0,0 +1,2 @@ 
+# Git shapshot
+none	xxx	bbdd62f9b030db7ad8eef789aaf58a7ff9a25656.tar.gz
diff --git a/package/vboot-utils/vboot-utils.mk b/package/vboot-utils/vboot-utils.mk
new file mode 100644
index 0000000..7d83899
--- /dev/null
+++ b/package/vboot-utils/vboot-utils.mk
@@ -0,0 +1,35 @@ 
+################################################################################
+#
+# vboot-utils
+#
+################################################################################
+
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SOURCE = $(VBOOT_UTILS_VERSION).tar.gz
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+archive
+VBOOT_UTILS_STRIP_COMPONENTS = 0
+VBOOT_UTILS_LICENSE = BSD-3c
+VBOOT_UTILS_LICENSE_FILES = LICENSE
+
+HOST_VBOOT_UTILS_DEPENDENCIES = host-openssl
+
+# vboot_reference contains code that goes into bootloaders,
+# utilities intended for the target system, and a bunch of scripts
+# for Chromium OS build system. Most of that does not make sense
+# in a buildroot host-package.
+#
+# We only need futility for signing images, the keys, and cgpt for boot
+# media partitioning.
+#
+# make target for futility is "futil".
+
+define HOST_VBOOT_UTILS_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) futil cgpt
+endef
+
+define HOST_VBOOT_UTILS_INSTALL_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(HOST_DIR)/usr \
+		futil_install cgpt_install devkeys_install
+endef
+
+$(eval $(host-generic-package))