Commit c299ec2d authored by Alex Landau's avatar Alex Landau Committed by Sam Ravnborg

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: default avatarAlex Landau <landau.alex@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent b4d5171a
...@@ -191,9 +191,10 @@ input_file() { ...@@ -191,9 +191,10 @@ input_file() {
source="$1" source="$1"
if [ -f "$1" ]; then if [ -f "$1" ]; then
${dep_list}header "$1" ${dep_list}header "$1"
is_cpio="$(echo "$1" | sed 's/^.*\.cpio/cpio/')" is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')"
if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then
cpio_file=$1 cpio_file=$1
echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
[ ! -z ${dep_list} ] && echo "$1" [ ! -z ${dep_list} ] && echo "$1"
return 0 return 0
fi fi
...@@ -223,6 +224,7 @@ cpio_file= ...@@ -223,6 +224,7 @@ cpio_file=
cpio_list= cpio_list=
output="/dev/stdout" output="/dev/stdout"
output_file="" output_file=""
is_cpio_compressed=
arg="$1" arg="$1"
case "$arg" in case "$arg" in
...@@ -282,7 +284,11 @@ if [ ! -z ${output_file} ]; then ...@@ -282,7 +284,11 @@ if [ ! -z ${output_file} ]; then
cpio_tfile=${cpio_file} cpio_tfile=${cpio_file}
fi fi
rm ${cpio_list} rm ${cpio_list}
if [ "${is_cpio_compressed}" = "compressed" ]; then
cat ${cpio_tfile} > ${output_file}
else
cat ${cpio_tfile} | gzip -f -9 - > ${output_file} cat ${cpio_tfile} | gzip -f -9 - > ${output_file}
fi
[ -z ${cpio_file} ] && rm ${cpio_tfile} [ -z ${cpio_file} ] && rm ${cpio_tfile}
fi fi
exit 0 exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment