Commit c299ec2d8e8d2f1a99d5c993fca485257b950d40

Authored by Alex Landau
Committed by Sam Ravnborg
1 parent b4d5171ac7

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>

Showing 1 changed file with 8 additions and 2 deletions Side-by-side Diff

scripts/gen_initramfs_list.sh
... ... @@ -191,9 +191,10 @@
191 191 source="$1"
192 192 if [ -f "$1" ]; then
193 193 ${dep_list}header "$1"
194   - is_cpio="$(echo "$1" | sed 's/^.*\.cpio/cpio/')"
  194 + is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')"
195 195 if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then
196 196 cpio_file=$1
  197 + echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
197 198 [ ! -z ${dep_list} ] && echo "$1"
198 199 return 0
199 200 fi
... ... @@ -223,6 +224,7 @@
223 224 cpio_list=
224 225 output="/dev/stdout"
225 226 output_file=""
  227 +is_cpio_compressed=
226 228  
227 229 arg="$1"
228 230 case "$arg" in
... ... @@ -282,7 +284,11 @@
282 284 cpio_tfile=${cpio_file}
283 285 fi
284 286 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
286 292 [ -z ${cpio_file} ] && rm ${cpio_tfile}
287 293 fi
288 294 exit 0