diff options
author | Erick Reyes <erickreyes@google.com> | 2018-08-20 18:42:35 -0700 |
---|---|---|
committer | Erick Reyes <erickreyes@google.com> | 2018-08-20 18:42:35 -0700 |
commit | 2a89d5bdefc11aea3d2f992bd06b459ab62675d2 (patch) | |
tree | 726e42e51203a3aa844990a89eb99770e7ebf340 | |
parent | ab56927bf163cbd728b06161dd335da608369c6e (diff) | |
download | adeb-2a89d5bdefc11aea3d2f992bd06b459ab62675d2.tar.gz |
Add utility script to build kernel headers tar/zip file
Signed-off-by: Erick Reyes <erickreyes@google.com>
-rwxr-xr-x | utils/packheaders.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/utils/packheaders.sh b/utils/packheaders.sh new file mode 100755 index 0000000..d10b81b --- /dev/null +++ b/utils/packheaders.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Utility to build kernel headers tar/zip file +# must be run from the top level of a kernel source directory +# and supplied an output file name + +MKTEMP=0; if [[ -z ${TDIR+x} ]] || [[ ! -d "${TDIR}" ]]; then + TDIR=`mktemp -d`; MKTEMP=1; fi +rm -rf $TDIR/* +TDIR_ABS=$( cd "$TDIR" ; pwd -P ) + + +if [ $# -ne 1 ]; then + echo "usage: makeheaders.sh <output file name>" + exit 0 +fi + +mkdir -p $TDIR_ABS/kernel-headers + +find arch -name include -type d -print | xargs -n1 -i: find : -type f -exec cp --parents {} $TDIR_ABS/kernel-headers/ \; +find include -exec cp --parents {} $TDIR_ABS/kernel-headers/ 2> /dev/null \; +tar -zcf $1 --directory=$TDIR_ABS kernel-headers + +zip -r $1.zip $1 +rm -rf $TDIR/*; if [ $MKTEMP -eq 1 ]; then rm -rf $TDIR; fi |