Revert "When building blobs with subcomponents, prefix them with an index structure."
This reverts commit 86739dc097db9aa7ede99eb2040027702a8ad661.
The said commit causes ARM images bricking Snow.
BUG=chrome-os-partner:16412
TEST=manual
with the change reverted Snow boots again
Change-Id: Id9a213bf79b1821a97f0a5bfbd21c518d80b28a3
Reviewed-on: https://gerrit.chromium.org/gerrit/41066
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Brian Harring <ferringb@chromium.org>
diff --git a/host/lib/pack_firmware.py b/host/lib/pack_firmware.py
index 0cb7196..91faad0 100644
--- a/host/lib/pack_firmware.py
+++ b/host/lib/pack_firmware.py
@@ -316,8 +316,7 @@
self.compress = None
def GetData(self):
- return self.pack.tools.ReadFileAndConcat(
- self.value, self.compress, len(self.value) > 1)[0]
+ return self.pack.tools.ReadFileAndConcat(self.value, self.compress)[0]
class EntryKeyBlock(EntryFmapArea):
@@ -345,8 +344,7 @@
prefix = self.pack.props['keydir'] + '/'
# Join up the data files to be signed
- data = self.pack.tools.ReadFileAndConcat(
- self.value, self.compress, len(self.value) > 1)[0]
+ data = self.pack.tools.ReadFileAndConcat(self.value, self.compress)[0]
tools.WriteFile(input_data, data)
args = [
'--vblock', self.path,
@@ -735,8 +733,7 @@
Returns:
Tuple:
- Contents of the files (as a string), optionally with an index
- prepended (see ReadFileAndConcat for details)
+ Contents of the files (as a string)
Directory of the position of the contents, as a dictionary:
key: Name of the property
value: List containing:
@@ -744,9 +741,7 @@
size of this property's data
"""
filenames = [self.props[prop] for prop in prop_list]
- with_index = len(filenames) > 1
- data, offset, length = \
- self.tools.ReadFileAndConcat(filenames, with_index=with_index)
+ data, offset, length = self.tools.ReadFileAndConcat(filenames)
directory = {}
for i in xrange(len(prop_list)):
directory[prop_list[i]] = [offset[i], length[i]]
diff --git a/host/lib/tools.py b/host/lib/tools.py
index 3a80302..1a5047e 100755
--- a/host/lib/tools.py
+++ b/host/lib/tools.py
@@ -21,7 +21,6 @@
import os
import re
import shutil
-import struct
import sys
import tempfile
import unittest
@@ -226,12 +225,11 @@
fd.write(data)
fd.close()
- def ReadFileAndConcat(self, filenames, compress=None, with_index=False):
+ def ReadFileAndConcat(self, filenames, compress=None):
"""Read several files and concat them.
Args:
filenames: a list containing name of the files to read.
- with_index: If true, an index structure is prepended to the data.
Returns:
A tuple of a string and two list. The string is the concated data read
@@ -239,28 +237,16 @@
first list contains the offset of each file in the data string and
the second one contains the actual (non-padded) length of each file,
both in the same order.
-
- The optional index structure is a 32 bit integer set to the number of
- entries in the index, followed by that many pairs of integers which
- describe the offset and length of each chunk.
"""
data = ''
- offsets = []
- lengths = []
+ offset = []
+ length = []
for fname in filenames:
- offsets.append(len(data))
+ offset.append(len(data))
content = self.ReadFile(fname)
pad_len = ((len(content) + 3) & ~3) - len(content)
data += content + chr(0xff) * pad_len
- lengths.append(len(content))
-
- if with_index:
- index_size = 4 + len(filenames) * 8
- index = struct.pack("<I", len(filenames))
- offsets = tuple(offset + index_size for offset in offsets)
- for filename, offset, length in zip(filenames, offsets, lengths):
- index += struct.pack("<II", offset, length)
- data = index + data
+ length.append(len(content))
if compress:
if compress == 'lzo':
@@ -275,7 +261,7 @@
data = self.ReadFile(outname)
else:
raise ValueError("Unknown compression method '%s'" % compress)
- return data, offsets, lengths
+ return data, offset, length
def GetChromeosVersion(self):
"""Returns the ChromeOS version string.