git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kbuild: Include gen_initramfs_list.sh and the file list in the .d file
[safe/jmp/linux-2.6]
/
scripts
/
gen_initramfs_list.sh
diff --git
a/scripts/gen_initramfs_list.sh
b/scripts/gen_initramfs_list.sh
index
3111f4a
..
f3b5c05
100644
(file)
--- a/
scripts/gen_initramfs_list.sh
+++ b/
scripts/gen_initramfs_list.sh
@@
-5,7
+5,7
@@
# Released under the terms of the GNU GPL
#
# Generate a cpio packed initramfs. It uses gen_init_cpio to generate
# Released under the terms of the GNU GPL
#
# Generate a cpio packed initramfs. It uses gen_init_cpio to generate
-# the cpio archive, and
gzip to pack
it.
+# the cpio archive, and
then compresses
it.
# The script may also be used to generate the inputfile used for gen_init_cpio
# This script assumes that gen_init_cpio is located in usr/ directory
# The script may also be used to generate the inputfile used for gen_init_cpio
# This script assumes that gen_init_cpio is located in usr/ directory
@@
-16,14
+16,14
@@
usage() {
cat << EOF
Usage:
$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
cat << EOF
Usage:
$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
- -o <file> Create
gzipp
ed initramfs file named <file> using
- gen_init_cpio and
gzip
+ -o <file> Create
compress
ed initramfs file named <file> using
+ gen_init_cpio and
compressor depending on the extension
-u <uid> User ID to map to user ID 0 (root).
-u <uid> User ID to map to user ID 0 (root).
- <uid> is only meaningful if <cpio_source>
-
is a directory
.
+ <uid> is only meaningful if <cpio_source>
is a
+
directory. "squash" forces all files to uid 0
.
-g <gid> Group ID to map to group ID 0 (root).
-g <gid> Group ID to map to group ID 0 (root).
- <gid> is only meaningful if <cpio_source>
-
is a directory
.
+ <gid> is only meaningful if <cpio_source>
is a
+
directory. "squash" forces all files to gid 0
.
<cpio_source> File list or directory for cpio archive.
If <cpio_source> is a .cpio file it will be used
as direct input to initramfs.
<cpio_source> File list or directory for cpio archive.
If <cpio_source> is a .cpio file it will be used
as direct input to initramfs.
@@
-97,7
+97,7
@@
print_mtime() {
}
list_parse() {
}
list_parse() {
- echo "$1 \\"
+ [ ! -L "$1" ] && echo "$1 \\" || :
}
# for each file print a line in following format
}
# for each file print a line in following format
@@
-113,8
+113,8
@@
parse() {
local gid="$4"
local ftype=$(filetype "${location}")
# remap uid/gid to 0 if necessary
local gid="$4"
local ftype=$(filetype "${location}")
# remap uid/gid to 0 if necessary
- [ "$uid" -eq "$root_uid" ] && uid=0
- [ "$gid" -eq "$root_gid" ] && gid=0
+ [ "$
root_uid" = "squash" ] && uid=0 || [ "$
uid" -eq "$root_uid" ] && uid=0
+ [ "$
root_gid" = "squash" ] && gid=0 || [ "$
gid" -eq "$root_gid" ] && gid=0
local str="${mode} ${uid} ${gid}"
[ "${ftype}" == "invalid" ] && return 0
local str="${mode} ${uid} ${gid}"
[ "${ftype}" == "invalid" ] && return 0
@@
-135,7
+135,7
@@
parse() {
str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
;;
"slink")
str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
;;
"slink")
- local target=`
field 11 $(LC_ALL=C ls -l "${location}")
`
+ local target=`
readlink "${location}"
`
str="${ftype} ${name} ${target} ${str}"
;;
*)
str="${ftype} ${name} ${target} ${str}"
;;
*)
@@
-171,7
+171,7
@@
dir_filelist() {
${dep_list}header "$1"
srcdir=$(echo "$1" | sed -e 's://*:/:g')
${dep_list}header "$1"
srcdir=$(echo "$1" | sed -e 's://*:/:g')
- dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n"
2>/dev/null
)
+ dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n")
# If $dirlist is only one line, then the directory is empty
if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
# If $dirlist is only one line, then the directory is empty
if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
@@
-202,6
+202,7
@@
input_file() {
print_mtime "$1" >> ${output}
cat "$1" >> ${output}
else
print_mtime "$1" >> ${output}
cat "$1" >> ${output}
else
+ echo "$1 \\"
cat "$1" | while read type dir file perm ; do
if [ "$type" == "file" ]; then
echo "$file \\";
cat "$1" | while read type dir file perm ; do
if [ "$type" == "file" ]; then
echo "$file \\";
@@
-225,19
+226,24
@@
cpio_list=
output="/dev/stdout"
output_file=""
is_cpio_compressed=
output="/dev/stdout"
output_file=""
is_cpio_compressed=
+compr="gzip -9 -f"
arg="$1"
case "$arg" in
"-l") # files included in initramfs - used by kbuild
dep_list="list_"
arg="$1"
case "$arg" in
"-l") # files included in initramfs - used by kbuild
dep_list="list_"
- echo "deps_initramfs := \\"
+ echo "deps_initramfs :=
$0
\\"
shift
;;
shift
;;
- "-o") # generate
gzipp
ed cpio image named $1
+ "-o") # generate
compress
ed cpio image named $1
shift
output_file="$1"
cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
output=${cpio_list}
shift
output_file="$1"
cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
output=${cpio_list}
+ echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f"
+ echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f"
+ echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f"
+ echo "$output_file" | grep -q "\.cpio$" && compr="cat"
shift
;;
esac
shift
;;
esac
@@
-274,7
+280,7
@@
while [ $# -gt 0 ]; do
esac
done
esac
done
-# If output_file is set we will generate cpio archive and
gzip
it
+# If output_file is set we will generate cpio archive and
compress
it
# we are carefull to delete tmp files
if [ ! -z ${output_file} ]; then
if [ -z ${cpio_file} ]; then
# we are carefull to delete tmp files
if [ ! -z ${output_file} ]; then
if [ -z ${cpio_file} ]; then
@@
-287,7
+293,8
@@
if [ ! -z ${output_file} ]; then
if [ "${is_cpio_compressed}" = "compressed" ]; then
cat ${cpio_tfile} > ${output_file}
else
if [ "${is_cpio_compressed}" = "compressed" ]; then
cat ${cpio_tfile} > ${output_file}
else
- cat ${cpio_tfile} | gzip -f -9 - > ${output_file}
+ (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
+ || (rm -f ${output_file} ; false)
fi
[ -z ${cpio_file} ] && rm ${cpio_tfile}
fi
fi
[ -z ${cpio_file} ] && rm ${cpio_tfile}
fi