clean all cpio files and ensure that they are all padded

This commit is contained in:
Trammell hudson 2018-03-15 11:46:42 -04:00
parent fadbc77fe8
commit ac537d0300
No known key found for this signature in database
GPG Key ID: 687A5005935B1533
2 changed files with 25 additions and 13 deletions

View File

@ -154,7 +154,9 @@ define do-cpio =
--quiet \ --quiet \
-H newc \ -H newc \
-o \ -o \
) > "$1.tmp" \ ) \
| ./bin/cpio-clean \
> "$1.tmp" \
) )
@if ! cmp --quiet "$1.tmp" "$1" ; then \ @if ! cmp --quiet "$1.tmp" "$1" ; then \
mv "$1.tmp" "$1" ; \ mv "$1.tmp" "$1" ; \
@ -384,11 +386,14 @@ $(COREBOOT_UTIL_DIR)/superiotool/superiotool: zlib.intermediate pciutils.interme
# The cpio-clean program is used ensure that the files # The cpio-clean program is used ensure that the files
# always have the same timestamp and appear in the same order. # always have the same timestamp and appear in the same order.
# #
# If there is no /dev/console, initrd can't startup. # The blobs/dev.cpio is also included in the Linux kernel
# We have to force it to be included into the cpio image. # and has a reproducible version of /dev/console.
# Since we are picking up the system's /dev/console, there #
# is a chance the build will not be reproducible (although # The xz parameters are copied from the Linux kernel build scripts.
# unlikely that their device file has a different major/minor) # Without them the kernel will not decompress the initrd.
#
# The padding is to ensure that if anyone wants to cat another
# file onto the initrd then the kernel will be able to find it.
# #
initrd-y += $(pwd)/blobs/dev.cpio initrd-y += $(pwd)/blobs/dev.cpio

View File

@ -138,13 +138,20 @@ for my $filename (sort keys %entries)
} }
# Print them in sorted order # Output them in sorted order
for my $filename (sort keys %entries) my $out = join '', map { $entries{$_} } sort keys %entries;
{ #for my $filename (sort keys %entries)
my $entry = $entries{$filename}; #{
print $entry; #$out .= $entries{$filename};
} #}
# Output the trailer to mark the end of the archive # Output the trailer to mark the end of the archive
print $trailer; $out .= $trailer;
# Pad to 512-bytes for kernel initrd reasons
my $unaligned = length($out) % 512;
$out .= chr(0x00) x (512 - $unaligned)
if $unaligned != 0;
print $out;
__END__ __END__