Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gen_initramfs.sh: always output cpio even without -o option

Currently, this script outputs a cpio file when -o option is
given, but otherwise a text file in the format recognized by
gen_init_cpio.

This behavior is unclear. Make it always output a cpio file.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+27 -31
+27 -31
usr/gen_initramfs.sh
··· 6 6 # 7 7 # Generate a cpio packed initramfs. It uses gen_init_cpio to generate 8 8 # the cpio archive, and then compresses it. 9 - # The script may also be used to generate the inputfile used for gen_init_cpio 10 9 # This script assumes that gen_init_cpio is located in usr/ directory 11 10 12 11 # error out on errors ··· 70 71 my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1) 71 72 fi 72 73 73 - echo "# Last modified: ${my_mtime}" >> ${output} 74 - echo "" >> ${output} 74 + echo "# Last modified: ${my_mtime}" >> $cpio_list 75 + echo "" >> $cpio_list 75 76 } 76 77 77 78 list_parse() { ··· 124 125 ;; 125 126 esac 126 127 127 - echo "${str}" >> ${output} 128 + echo "${str}" >> $cpio_list 128 129 129 130 return 0 130 131 } ··· 140 141 } 141 142 142 143 header() { 143 - printf "\n#####################\n# $1\n" >> ${output} 144 + printf "\n#####################\n# $1\n" >> $cpio_list 144 145 } 145 146 146 147 # process one directory (incl sub-directories) ··· 176 177 [ -n "$dep_list" ] && echo "$1" >> $dep_list 177 178 return 0 178 179 fi 179 - print_mtime "$1" >> ${output} 180 - cat "$1" >> ${output} 180 + print_mtime "$1" >> $cpio_list 181 + cat "$1" >> $cpio_list 181 182 if [ -n "$dep_list" ]; then 182 183 echo "$1 \\" >> $dep_list 183 184 cat "$1" | while read type dir file perm ; do ··· 199 200 root_gid=0 200 201 dep_list= 201 202 cpio_file= 202 - cpio_list= 203 + cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX) 203 204 output="/dev/stdout" 204 - output_file="" 205 + output_file="/dev/stdout" 205 206 is_cpio_compressed= 206 207 compr="gzip -n -9 -f" 207 208 ··· 216 217 ;; 217 218 "-o") # generate compressed cpio image named $1 218 219 output_file="$1" 219 - cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" 220 - output=${cpio_list} 220 + output=$cpio_list 221 221 echo "$output_file" | grep -q "\.gz$" \ 222 222 && [ -x "`which gzip 2> /dev/null`" ] \ 223 223 && compr="gzip -n -9 -f" ··· 267 269 268 270 # If output_file is set we will generate cpio archive and compress it 269 271 # we are careful to delete tmp files 270 - if [ ! -z ${output_file} ]; then 271 - if [ -z ${cpio_file} ]; then 272 - timestamp= 273 - if test -n "$KBUILD_BUILD_TIMESTAMP"; then 274 - timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" 275 - if test -n "$timestamp"; then 276 - timestamp="-t $timestamp" 277 - fi 272 + if [ -z ${cpio_file} ]; then 273 + timestamp= 274 + if test -n "$KBUILD_BUILD_TIMESTAMP"; then 275 + timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" 276 + if test -n "$timestamp"; then 277 + timestamp="-t $timestamp" 278 278 fi 279 - cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" 280 - usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} 281 - else 282 - cpio_tfile=${cpio_file} 283 279 fi 284 - rm ${cpio_list} 285 - if [ "${is_cpio_compressed}" = "compressed" ]; then 286 - cat ${cpio_tfile} > ${output_file} 287 - else 288 - (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ 289 - || (rm -f ${output_file} ; false) 290 - fi 291 - [ -z ${cpio_file} ] && rm ${cpio_tfile} 280 + cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" 281 + usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} 282 + else 283 + cpio_tfile=${cpio_file} 292 284 fi 285 + rm ${cpio_list} 286 + if [ "${is_cpio_compressed}" = "compressed" ]; then 287 + cat ${cpio_tfile} > ${output_file} 288 + else 289 + (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ 290 + || (rm -f ${output_file} ; false) 291 + fi 292 + [ -z ${cpio_file} ] && rm ${cpio_tfile} 293 293 exit 0