Skip to content

Commit

Permalink
kbuild: make sorting initramfs contents independent of locale
Browse files Browse the repository at this point in the history
Some LANG values (e.g. pl_PL.UTF-8) cause the sort command to output
files before their parent directories, which makes them inaccessible for
the kernel. In other words, when the kernel populates the rootfs, it is
unable to create files whose parent directories have not been yet created.

This patch makes sorting use the default (LANG=C) locale, which results in
correctly laid out initramfs images (parent directories before files).

Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
Andrzej Pietrasiewicz authored and masahir0y committed Aug 22, 2018
1 parent dd5806e commit f55f232
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/gen_initramfs_list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" | sort)
dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort)

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

0 comments on commit f55f232

Please sign in to comment.