]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
kbuild: create deterministic initramfs directory listings
authorBjørn Forsman <bjorn.forsman@gmail.com>
Sat, 24 Jun 2017 14:48:10 +0000 (16:48 +0200)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 2 Jul 2017 23:02:09 +0000 (08:02 +0900)
kbuild runs "find" on each entry in CONFIG_INITRAMFS_SOURCE that is a
directory. The order of the file listing output by "find" matter for
build reproducability, hence this patch applies "sort" to get
deterministic results.

Without this patch, two different machines with identical initramfs
directory input may produce differing initramfs cpio archives (different
hash) due to the different order of the files within the archive.

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/gen_initramfs_list.sh

index 0055b07b03b68cafd0bc3c400ee23b686632efbf..72f094585cca7a336e234516a5d2930a5a62a5ff 100755 (executable)
@@ -174,7 +174,7 @@ dir_filelist() {
        ${dep_list}header "$1"
 
        srcdir=$(echo "$1" | sed -e 's://*:/:g')
-       dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n")
+       dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | sort)
 
        # If $dirlist is only one line, then the directory is empty
        if [  "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then