initial package import

This commit is contained in:
Jon Disnard 2013-04-28 12:31:51 -05:00
commit eec7c70bda
9 changed files with 308 additions and 0 deletions

1
.gitignore vendored
View file

@ -0,0 +1 @@
/vboot-utils-20130222gite6cf2c2.tar.xz

View file

@ -0,0 +1 @@
11df5e40246ad87ac4d6f8b1de2a8edd vboot-utils-20130222gite6cf2c2.tar.xz

View file

@ -0,0 +1,20 @@
--- Makefile.orig 2013-02-22 23:37:25.911542016 -0600
+++ Makefile 2013-02-22 23:37:49.286029980 -0600
@@ -642,7 +642,7 @@
.PHONY: cgpt
cgpt: ${CGPT}
-${CGPT}: LDFLAGS += -static
+#${CGPT}: LDFLAGS += -static
${CGPT}: LDLIBS += -luuid
${CGPT}: ${CGPT_OBJS} ${LIBS}
@@ -662,7 +662,7 @@
${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include
# Utilities for auto-update toolkits must be statically linked.
-${UTIL_BINS_STATIC}: LDFLAGS += -static
+#${UTIL_BINS_STATIC}: LDFLAGS += -static
.PHONY: utils
utils: ${UTIL_BINS} ${UTIL_SCRIPTS} ${UTIL_SBINS}

View file

@ -0,0 +1,43 @@
--- utility/orig.bmpblk_utility.cc 2013-01-29 14:12:00.560456478 -0600
+++ utility/bmpblk_utility.cc 2013-01-29 14:12:00.570456506 -0600
@@ -99,11 +99,11 @@
// The number of localizations should match the number of locale_index
if (debug_) {
- printf("%ld image_names\n", config_.image_names.size());
+ printf("%zu image_names\n", config_.image_names.size());
for (unsigned int i = 0; i < config_.image_names.size(); ++i) {
printf(" %d: \"%s\"\n", i, config_.image_names[i].c_str());
}
- printf("%ld images_map\n", config_.images_map.size());
+ printf("%zu images_map\n", config_.images_map.size());
for (StrImageConfigMap::iterator it = config_.images_map.begin();
it != config_.images_map.end();
++it) {
@@ -114,7 +114,7 @@
it->second.data.tag,
it->second.data.format);
}
- printf("%ld screens_map\n", config_.screens_map.size());
+ printf("%zu screens_map\n", config_.screens_map.size());
for (StrScreenConfigMap::iterator it = config_.screens_map.begin();
it != config_.screens_map.end();
++it) {
@@ -591,7 +591,7 @@
current_filled += sizeof(it->second.data);
current_offset += sizeof(it->second.data);
if (debug_)
- printf("I1: current offset is 0x%08x (len %ld)\n",
+ printf("I1: current offset is 0x%08x (len %zu)\n",
current_offset, it->second.compressed_content.length());
std::copy(it->second.compressed_content.begin(),
it->second.compressed_content.end(),
@@ -603,7 +603,7 @@
current_offset = config_.header.locale_string_offset;
current_filled = bmpblock_.begin() + current_offset;
if (debug_)
- printf("locale_names: offset 0x%08x (len %ld)\n",
+ printf("locale_names: offset 0x%08x (len %zu)\n",
current_offset, config_.locale_names.size());
std::copy(config_.locale_names.begin(),
config_.locale_names.end(),

12
vboot-utils-cflags.patch Normal file
View file

@ -0,0 +1,12 @@
diff -up vboot-utils-20130222gite6cf2c2/Makefile.cflags vboot-utils-20130222gite6cf2c2/Makefile
--- vboot-utils-20130222gite6cf2c2/Makefile.cflags 2013-03-07 13:11:00.697225786 -0500
+++ vboot-utils-20130222gite6cf2c2/Makefile 2013-03-07 13:11:49.488465926 -0500
@@ -124,7 +124,7 @@ CFLAGS ?= ${COMMON_FLAGS} \
else
# FIRMWARE_ARCH not defined; assuming local compile.
CC ?= gcc
-CFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror # HEY: always want last two?
+CFLAGS += $(COMMON_FLAGS) -DCHROMEOS_ENVIRONMENT -Wall -Werror # HEY: always want last two?
endif
ifneq (${DEBUG},)

12
vboot-utils-pthread.patch Normal file
View file

@ -0,0 +1,12 @@
diff -up vboot-utils-20130222gite6cf2c2/Makefile.pthread vboot-utils-20130222gite6cf2c2/Makefile
--- vboot-utils-20130222gite6cf2c2/Makefile.pthread 2013-03-07 17:55:02.920179806 -0500
+++ vboot-utils-20130222gite6cf2c2/Makefile 2013-03-07 17:55:06.360237213 -0500
@@ -861,7 +861,7 @@ ${BUILD}/tests/vboot_common2_tests: LDLI
${BUILD}/tests/vboot_common3_tests: LDLIBS += ${CRYPTO_LIBS}
${BUILD}/utility/bmpblk_utility: LD = ${CXX}
-${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml
+${BUILD}/utility/bmpblk_utility: LDLIBS = -llzma -lyaml -lpthread
BMPBLK_UTILITY_DEPS = \
${BUILD}/utility/bmpblk_util.o \

68
vboot-utils-strncat.patch Normal file
View file

@ -0,0 +1,68 @@
diff -up vboot-utils-20130222gite6cf2c2/cgpt/cgpt_add.c.werror vboot-utils-20130222gite6cf2c2/cgpt/cgpt_add.c
--- vboot-utils-20130222gite6cf2c2/cgpt/cgpt_add.c.werror 2013-03-07 15:57:45.797727161 -0500
+++ vboot-utils-20130222gite6cf2c2/cgpt/cgpt_add.c 2013-03-07 16:07:02.987337266 -0500
@@ -16,49 +16,49 @@ static const char* DumpCgptAddParams(con
buf[0] = 0;
snprintf(tmp, sizeof(tmp), "-i %d ", params->partition);
- strncat(buf, tmp, sizeof(buf));
+ strncat(buf, tmp, sizeof(tmp));
if (params->label) {
snprintf(tmp, sizeof(tmp), "-l %s ", params->label);
- strncat(buf, tmp, sizeof(buf));
+ strncat(buf, tmp, sizeof(tmp));
}
if (params->set_begin) {
snprintf(tmp, sizeof(tmp), "-b %llu ", (unsigned long long)params->begin);
- strncat(buf, tmp, sizeof(buf));
+ strncat(buf, tmp, sizeof(tmp));
}
if (params->set_size) {
snprintf(tmp, sizeof(tmp), "-s %llu ", (unsigned long long)params->size);
- strncat(buf, tmp, sizeof(buf));
+ strncat(buf, tmp, sizeof(tmp));
}
if (params->set_type) {
GuidToStr(&params->type_guid, tmp, sizeof(tmp));
- strncat(buf, "-t ", sizeof(buf));
- strncat(buf, tmp, sizeof(buf));
- strncat(buf, " ", sizeof(buf));
+ strncat(buf, "-t ", sizeof(tmp));
+ strncat(buf, tmp, sizeof(tmp));
+ strncat(buf, " ", sizeof(tmp));
}
if (params->set_unique) {
GuidToStr(&params->unique_guid, tmp, sizeof(tmp));
- strncat(buf, "-u ", sizeof(buf));
- strncat(buf, tmp, sizeof(buf));
- strncat(buf, " ", sizeof(buf));
+ strncat(buf, "-u ", sizeof(tmp));
+ strncat(buf, tmp, sizeof(tmp));
+ strncat(buf, " ", sizeof(tmp));
}
if (params->set_successful) {
snprintf(tmp, sizeof(tmp), "-S %d ", params->successful);
- strncat(buf, tmp, sizeof(buf));
+ strncat(buf, tmp, sizeof(tmp));
}
if (params->set_tries) {
snprintf(tmp, sizeof(tmp), "-T %d ", params->tries);
- strncat(buf, tmp, sizeof(buf));
+ strncat(buf, tmp, sizeof(tmp));
}
if (params->set_priority) {
snprintf(tmp, sizeof(tmp), "-P %d ", params->priority);
- strncat(buf, tmp, sizeof(buf));
+ strncat(buf, tmp, sizeof(tmp));
}
if (params->set_raw) {
snprintf(tmp, sizeof(tmp), "-A 0x%x ", params->raw_value);
- strncat(buf, tmp, sizeof(buf));
+ strncat(buf, tmp, sizeof(tmp));
}
- strncat(buf, "\n", sizeof(buf));
+ strncat(buf, "\n", sizeof(tmp));
return buf;
}

25
vboot-utils-unused.patch Normal file
View file

@ -0,0 +1,25 @@
diff -up vboot-utils-20130222gite6cf2c2/host/arch/arm/lib/crossystem_arch.c.unused vboot-utils-20130222gite6cf2c2/host/arch/arm/lib/crossystem_arch.c
--- vboot-utils-20130222gite6cf2c2/host/arch/arm/lib/crossystem_arch.c.unused 2012-12-19 11:37:24.000000000 -0500
+++ vboot-utils-20130222gite6cf2c2/host/arch/arm/lib/crossystem_arch.c 2013-03-07 16:55:13.899853426 -0500
@@ -81,6 +81,7 @@ static int ReadFdtValue(const char *prop
char filename[FNAME_SIZE];
FILE *file;
int data = 0;
+ size_t count;
snprintf(filename, sizeof(filename), FDT_BASE_PATH "/%s", property);
file = fopen(filename, "rb");
@@ -89,8 +90,12 @@ static int ReadFdtValue(const char *prop
return E_FILEOP;
}
- fread(&data, 1, sizeof(data), file);
+ count = fread(&data, 1, sizeof(data), file);
fclose(file);
+ if (count < 0) {
+ fprintf(stderr, "Unable to read FDT property %s\n", property);
+ return E_FILEOP;
+ }
if (value)
*value = ntohl(data); /* FDT is network byte order */

126
vboot-utils.spec Normal file
View file

@ -0,0 +1,126 @@
Name: vboot-utils
Version: 20130222gite6cf2c2
Release: 3%{?dist}
Summary: Verified Boot Utility from Chromium OS
ExclusiveArch: %{arm} %{ix86} x86_64
Group: Applications/System
License: BSD
# The source for this package was pulled from upstream's vcs. Use the
# following commands to generate the tarball:
# git clone https://git.chromium.org/git/chromiumos/platform/vboot_reference.git
# cd vboot_reference/
# git archive --format=tar --prefix=vboot-utils-20130222gite6cf2c2/ e6cf2c2 | xz > vboot-utils-20130222gite6c.tar.xz
URL: http://gitrw.chromium.org/gitweb/?p=chromiumos/platform/vboot_reference.git
Source0: %{name}-%{version}.tar.xz
## Patch0 disabled static building.
Patch0: vboot-utils-00-disable-static-linking.patch
## Patch1 fixes printf formating issues that break the build.
## http://code.google.com/p/chromium-os/issues/detail?id=37804
Patch1: vboot-utils-01-bmpblk_utility-fix-printf.patch
#make sure get the rpmbuild flags passed in
Patch2: vboot-utils-cflags.patch
# some fixes for picker compile
Patch3: vboot-utils-strncat.patch
Patch4: vboot-utils-unused.patch
Patch5: vboot-utils-pthread.patch
BuildRequires: openssl-devel
BuildRequires: trousers-devel
BuildRequires: libyaml-devel
BuildRequires: xz-devel
BuildRequires: libuuid-devel
# for the test scripts
BuildRequires: python
%description
Verified boot is a collection of utilities helpful for chromebook computer.
Pack and sign the kernel, manage gpt partitions.
%prep
%setup -q
%patch0 -p0 -b .nostatic
%patch1 -p0 -b .fixprintf
%patch2 -p1 -b .cflags
%patch3 -p1 -b .strncat
%patch4 -p1 -b .unused
%patch5 -p1 -b .pthread
%build
%ifarch %{arm}
%global ARCH arm
%endif
%ifarch x86_64
%global ARCH x86_64
%endif
%ifarch i686
%global ARCH i386
%endif
make V=1 ARCH=%{ARCH} COMMON_FLAGS="$RPM_OPT_FLAGS"
%install
make install V=1 DESTDIR=%{buildroot}%{_bindir} ARCH=%{ARCH} COMMON_FLAGS="$RPM_OPT_FLAGS"
## Tests are enabled but ignored (will not break the build).
## This is because tests fail in a chroot (mock) but work otherwise.
%check
make runtests || true
%files
%{_bindir}/*
%doc LICENSE README
%changelog
* Thu Apr 07 2013 Jon Disnard <jdisnard@gmail.com> 20130222gite6cf2c2-3
- Clean up spec file
- Honor rpmbuild CFLAGS
- Fix strncat arguments in cgpt/cgpt_add.c
* Sat Feb 23 2013 Jon Disnard <jdisnard@gmail.com> 20130222gite6cf2c2-2
- Put back wcohen's fixes for i686 builds.
- Put back the patch to fix bmpblk_utility.cc printf formating %ld -> %zu
- Put back BR for gcc-c++ & libstdc++
* Fri Feb 22 2013 Jon Disnard <jdisnard@gmail.com> 20130222gite6cf2c2-1
- Pull upstream git
- Adjust ifarch conditionals to follow upstream changes in Makefile.
- Use XZ instead of BZIP2 for source archive, smaller SRPM size.
- Upstream fixed bug, so removing CC printf formating patch.
- Refactor patch that disabled static building for new Makefile.
- Enable test scripts again, but ignore failures (for mock builds).
- Remove BuildRequires for gcc-c++ & libstdc++, removed upstream.
* Tue Feb 5 2013 William Cohen <wcohen@redhat.c> 20130129git68f54d4-4
- Correct logic for setting 32-bit/64-bit x86.
* Tue Feb 5 2013 William Cohen <wcohen@redhat.c> 20130129git68f54d4-3
- Disable smp build because of problem with make dependencies
* Mon Feb 4 2013 William Cohen <wcohen@redhat.c> 20130129git68f54d4-2
- spec file clean up.
* Sat Jan 5 2013 Jon Disnard <jdisnard@gmail.com> 20130129git68f54d4-1
- Inception
- Patch0 prevents static building.
- Patch1 fixes minor printf formating bug in c++ code.
- tests disabled as they do not work in mock chroot.