diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 16:31:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 16:31:37 -0400 |
commit | 2bb732cdb48d271ff7a910260ffb851fb4bc8a28 (patch) | |
tree | 580bf68eb1e52b4e6915588d61423347ae09c318 /scripts/gen_initramfs_list.sh | |
parent | f50d1d9e8d964fdd3b4cedfbca8843d1bc5916c1 (diff) | |
parent | c4d5ee13984f57b2f881635c49045151679f5e8a (diff) |
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o
scripts/kallsyms.c: fix potential segfault
scripts/gen_initramfs_list.sh: Convert to a /bin/sh script
kbuild: Fix GNU make v3.80 compatibility
kbuild: Fix passing -Wno-* options to gcc 4.4+
kbuild: move scripts/basic/docproc.c to scripts/docproc.c
kbuild: Fix Makefile.asm-generic for um
kbuild: Allow to combine multiple W= levels
kbuild: Disable -Wunused-but-set-variable for gcc 4.6.0
Fix handling of backlash character in LINUX_COMPILE_BY name
kbuild: asm-generic support
kbuild: implement several W= levels
kbuild: Fix build with binutils <= 2.19
initramfs: Use KBUILD_BUILD_TIMESTAMP for generated entries
kbuild: Allow to override LINUX_COMPILE_BY and LINUX_COMPILE_HOST macros
kbuild: Drop unused LINUX_COMPILE_TIME and LINUX_COMPILE_DOMAIN macros
kbuild: Use the deterministic mode of ar
kbuild: Call gzip with -n
kbuild: move KALLSYMS_EXTRA_PASS from Kconfig to Makefile
Kconfig: improve KALLSYMS_ALL documentation
Fix up trivial conflict in Makefile
Diffstat (limited to 'scripts/gen_initramfs_list.sh')
-rw-r--r-- | scripts/gen_initramfs_list.sh | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index e12b1a7525cf..b482f162a18a 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/sh |
2 | # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> | 2 | # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> |
3 | # Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org> | 3 | # Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org> |
4 | # | 4 | # |
@@ -105,9 +105,9 @@ list_parse() { | |||
105 | # for links, devices etc the format differs. See gen_init_cpio for details | 105 | # for links, devices etc the format differs. See gen_init_cpio for details |
106 | parse() { | 106 | parse() { |
107 | local location="$1" | 107 | local location="$1" |
108 | local name="${location/${srcdir}//}" | 108 | local name="/${location#${srcdir}}" |
109 | # change '//' into '/' | 109 | # change '//' into '/' |
110 | name="${name//\/\///}" | 110 | name=$(echo "$name" | sed -e 's://*:/:g') |
111 | local mode="$2" | 111 | local mode="$2" |
112 | local uid="$3" | 112 | local uid="$3" |
113 | local gid="$4" | 113 | local gid="$4" |
@@ -117,8 +117,8 @@ parse() { | |||
117 | [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0 | 117 | [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0 |
118 | local str="${mode} ${uid} ${gid}" | 118 | local str="${mode} ${uid} ${gid}" |
119 | 119 | ||
120 | [ "${ftype}" == "invalid" ] && return 0 | 120 | [ "${ftype}" = "invalid" ] && return 0 |
121 | [ "${location}" == "${srcdir}" ] && return 0 | 121 | [ "${location}" = "${srcdir}" ] && return 0 |
122 | 122 | ||
123 | case "${ftype}" in | 123 | case "${ftype}" in |
124 | "file") | 124 | "file") |
@@ -192,7 +192,7 @@ input_file() { | |||
192 | if [ -f "$1" ]; then | 192 | if [ -f "$1" ]; then |
193 | ${dep_list}header "$1" | 193 | ${dep_list}header "$1" |
194 | is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')" | 194 | is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')" |
195 | if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then | 195 | if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then |
196 | cpio_file=$1 | 196 | cpio_file=$1 |
197 | echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" | 197 | echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" |
198 | [ ! -z ${dep_list} ] && echo "$1" | 198 | [ ! -z ${dep_list} ] && echo "$1" |
@@ -204,7 +204,7 @@ input_file() { | |||
204 | else | 204 | else |
205 | echo "$1 \\" | 205 | echo "$1 \\" |
206 | cat "$1" | while read type dir file perm ; do | 206 | cat "$1" | while read type dir file perm ; do |
207 | if [ "$type" == "file" ]; then | 207 | if [ "$type" = "file" ]; then |
208 | echo "$file \\"; | 208 | echo "$file \\"; |
209 | fi | 209 | fi |
210 | done | 210 | done |
@@ -226,7 +226,7 @@ cpio_list= | |||
226 | output="/dev/stdout" | 226 | output="/dev/stdout" |
227 | output_file="" | 227 | output_file="" |
228 | is_cpio_compressed= | 228 | is_cpio_compressed= |
229 | compr="gzip -9 -f" | 229 | compr="gzip -n -9 -f" |
230 | 230 | ||
231 | arg="$1" | 231 | arg="$1" |
232 | case "$arg" in | 232 | case "$arg" in |
@@ -240,7 +240,7 @@ case "$arg" in | |||
240 | output_file="$1" | 240 | output_file="$1" |
241 | cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" | 241 | cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" |
242 | output=${cpio_list} | 242 | output=${cpio_list} |
243 | echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f" | 243 | echo "$output_file" | grep -q "\.gz$" && compr="gzip -n -9 -f" |
244 | echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" | 244 | echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" |
245 | echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" | 245 | echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" |
246 | echo "$output_file" | grep -q "\.xz$" && \ | 246 | echo "$output_file" | grep -q "\.xz$" && \ |
@@ -287,8 +287,15 @@ done | |||
287 | # we are careful to delete tmp files | 287 | # we are careful to delete tmp files |
288 | if [ ! -z ${output_file} ]; then | 288 | if [ ! -z ${output_file} ]; then |
289 | if [ -z ${cpio_file} ]; then | 289 | if [ -z ${cpio_file} ]; then |
290 | timestamp= | ||
291 | if test -n "$KBUILD_BUILD_TIMESTAMP"; then | ||
292 | timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" | ||
293 | if test -n "$timestamp"; then | ||
294 | timestamp="-t $timestamp" | ||
295 | fi | ||
296 | fi | ||
290 | cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" | 297 | cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" |
291 | usr/gen_init_cpio ${cpio_list} > ${cpio_tfile} | 298 | usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} |
292 | else | 299 | else |
293 | cpio_tfile=${cpio_file} | 300 | cpio_tfile=${cpio_file} |
294 | fi | 301 | fi |