From 9e6e0d5f2a2713402cf9dce69b9f9b516e4185d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B8rn=20Forsman?= Date: Sat, 24 Jun 2017 16:48:10 +0200 Subject: [PATCH] kbuild: create deterministic initramfs directory listings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Masahiro Yamada --- scripts/gen_initramfs_list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 0055b07..72f0945 100755 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -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 -- 2.7.4