From 6ae9ecb86188cc8419024cdb299f18d4ae4f5713 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 31 Mar 2011 15:47:55 +0200 Subject: kbuild: Call gzip with -n The timestamps recorded in the .gz files add no value. Signed-off-by: Michal Marek --- scripts/gen_initramfs_list.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/gen_initramfs_list.sh') diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 55caecdad99..4a43fe12d17 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -226,7 +226,7 @@ cpio_list= output="/dev/stdout" output_file="" is_cpio_compressed= -compr="gzip -9 -f" +compr="gzip -n -9 -f" arg="$1" case "$arg" in @@ -240,7 +240,7 @@ case "$arg" in 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 "\.gz$" && compr="gzip -n -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 "\.xz$" && \ -- cgit v1.2.3 From a8b8017c34fefcb763d8b06c294b58d1c480b2e4 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 31 Mar 2011 23:16:42 +0200 Subject: initramfs: Use KBUILD_BUILD_TIMESTAMP for generated entries gen_init_cpio gets the current time and uses it for each symlink, special file, and directory. Grab the current time once and make it possible to override it with the KBUILD_BUILD_TIMESTAMP variable for reproducible builds. Signed-off-by: Michal Marek --- scripts/gen_initramfs_list.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'scripts/gen_initramfs_list.sh') diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 4a43fe12d17..d44cf675bc2 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -287,8 +287,15 @@ done # we are carefull to delete tmp files if [ ! -z ${output_file} ]; then if [ -z ${cpio_file} ]; then + timestamp= + if test -n "$KBUILD_BUILD_TIMESTAMP"; then + timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" + if test -n "$timestamp"; then + timestamp="-t $timestamp" + fi + fi cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" - usr/gen_init_cpio ${cpio_list} > ${cpio_tfile} + usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} else cpio_tfile=${cpio_file} fi -- cgit v1.2.3 From 153f01147065cb3628493dcb79417bc4474320c7 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Thu, 5 May 2011 12:03:47 -0700 Subject: scripts/gen_initramfs_list.sh: Convert to a /bin/sh script Replace bashisms with POSIX-compatible shell scripting. Notably, de-duplicate '/' using a sed command from elsewhere in the same script rather than "${name//\/\///}". Commit by Jamey Sharp and Josh Triplett. Signed-off-by: Jamey Sharp Signed-off-by: Josh Triplett Cc: Andrew Morton Signed-off-by: Michal Marek --- scripts/gen_initramfs_list.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'scripts/gen_initramfs_list.sh') diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index d44cf675bc2..8da7890310d 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Copyright (C) Martin Schlemmer # Copyright (C) 2006 Sam Ravnborg # @@ -105,9 +105,9 @@ list_parse() { # for links, devices etc the format differs. See gen_init_cpio for details parse() { local location="$1" - local name="${location/${srcdir}//}" + local name="/${location#${srcdir}}" # change '//' into '/' - name="${name//\/\///}" + name=$(echo "$name" | sed -e 's://*:/:g') local mode="$2" local uid="$3" local gid="$4" @@ -117,8 +117,8 @@ parse() { [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0 local str="${mode} ${uid} ${gid}" - [ "${ftype}" == "invalid" ] && return 0 - [ "${location}" == "${srcdir}" ] && return 0 + [ "${ftype}" = "invalid" ] && return 0 + [ "${location}" = "${srcdir}" ] && return 0 case "${ftype}" in "file") @@ -192,7 +192,7 @@ input_file() { if [ -f "$1" ]; then ${dep_list}header "$1" 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 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" [ ! -z ${dep_list} ] && echo "$1" @@ -204,7 +204,7 @@ input_file() { else echo "$1 \\" cat "$1" | while read type dir file perm ; do - if [ "$type" == "file" ]; then + if [ "$type" = "file" ]; then echo "$file \\"; fi done -- cgit v1.2.3