Skip to content

Commit c299ec2

Browse files
alandausravnborg
authored andcommitted
kbuild: handle compressed cpio initramfs-es
Make kbuild handle compressed cpio initramfs-es. An already compressed cpio is copied directly to usr/, while a non-compressed cpio is filtered through gzip (no changes here) on its way to usr/. If the user has created a compressed cpio by other means, this saves him from uncompressing it, just to be compressed again by kbuild. Signed-off-by: Alex Landau <landau.alex@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent b4d5171 commit c299ec2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎scripts/gen_initramfs_list.sh‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ input_file() {
191191
source="$1"
192192
if [ -f "$1" ]; then
193193
${dep_list}header "$1"
194-
is_cpio="$(echo "$1" | sed 's/^.*\.cpio/cpio/')"
194+
is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')"
195195
if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then
196196
cpio_file=$1
197+
echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
197198
[ ! -z ${dep_list} ] && echo "$1"
198199
return 0
199200
fi
@@ -223,6 +224,7 @@ cpio_file=
223224
cpio_list=
224225
output="/dev/stdout"
225226
output_file=""
227+
is_cpio_compressed=
226228

227229
arg="$1"
228230
case "$arg" in
@@ -282,7 +284,11 @@ if [ ! -z ${output_file} ]; then
282284
cpio_tfile=${cpio_file}
283285
fi
284286
rm ${cpio_list}
285-
cat ${cpio_tfile} | gzip -f -9 - > ${output_file}
287+
if [ "${is_cpio_compressed}" = "compressed" ]; then
288+
cat ${cpio_tfile} > ${output_file}
289+
else
290+
cat ${cpio_tfile} | gzip -f -9 - > ${output_file}
291+
fi
286292
[ -z ${cpio_file} ] && rm ${cpio_tfile}
287293
fi
288294
exit 0

0 commit comments

Comments
 (0)