Skip to content

Commit 9e6e0d5

Browse files
bjornformasahir0y
authored andcommitted
kbuild: create deterministic initramfs directory listings
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>
1 parent adcc3f7 commit 9e6e0d5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎scripts/gen_initramfs_list.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ dir_filelist() {
174174
${dep_list}header "$1"
175175

176176
srcdir=$(echo "$1" | sed -e 's://*:/:g')
177-
dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n")
177+
dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | sort)
178178

179179
# If $dirlist is only one line, then the directory is empty
180180
if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then

0 commit comments

Comments
 (0)