diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-07 13:03:32 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-07 13:03:32 +0000 |
commit | aea115e9245fbe0bda6920a272fbfcd6316894f7 (patch) | |
tree | 72bc314838070c8f71bf3223d0e10a1045479b49 | |
parent | a0adf1fefe46e42ba41a86ada520871cf1e08464 (diff) |
Split kernel headers installation from "make install_headers".
It is "make install_kernel_headers" now.
-rw-r--r-- | Makefile.in | 5 | ||||
-rwxr-xr-x | extra/scripts/install_headers.sh | 39 | ||||
-rwxr-xr-x | extra/scripts/install_kernel_headers.sh | 70 |
3 files changed, 75 insertions, 39 deletions
diff --git a/Makefile.in b/Makefile.in index 68ed8c6d2..e39007b7b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -118,6 +118,11 @@ RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/rela $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c $(hcompile.u) +# Installs kernel header files (linux/*, asm/*, asm-generic/*). +install_kernel_headers: headers + top_builddir=$(top_builddir) \ + $(top_srcdir)extra/scripts/install_kernel_headers.sh include $(PREFIX)$(DEVEL_PREFIX)include + # Installs header files. install_headers: headers $(top_builddir)extra/scripts/unifdef $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include diff --git a/extra/scripts/install_headers.sh b/extra/scripts/install_headers.sh index 959e03fa0..0d58b200a 100755 --- a/extra/scripts/install_headers.sh +++ b/extra/scripts/install_headers.sh @@ -51,45 +51,6 @@ done ) -# Just copy (no sanitization) some kernel headers. -eval `grep ^KERNEL_HEADERS "$top_builddir/.config"` -if ! test "$KERNEL_HEADERS" \ -|| ! test -d "$KERNEL_HEADERS/asm" \ -|| ! test -d "$KERNEL_HEADERS/asm-generic" \ -|| ! test -d "$KERNEL_HEADERS/linux" \ -; then - echo "Error: '$KERNEL_HEADERS' is not a directory containing kernel headers." - echo "Check KERNEL_HEADERS= in your .config file." - exit 1 -fi -# Do the copying only if src and dst dirs are not the same. -# Be thorough: do not settle just for textual compare, -# and guard against "pwd" being handled as shell builtin. -# Double quoting looks weird, but it works (even bbox ash too). -if test "`(cd "$KERNEL_HEADERS"; env pwd)`" != "`(cd "$2"; env pwd)`"; then - # NB: source or target files and directories may be symlinks, - # and for all we know, good reasons. - # We must work correctly in these cases. This includes "do not replace - # target symlink with real directory" rule. So, no rm -rf here please. - mkdir -p "$2/asm" 2>/dev/null - mkdir -p "$2/asm-generic" 2>/dev/null - mkdir -p "$2/linux" 2>/dev/null - # Exists, but is not a dir? That's bad, bail out - die_if_not_dir "$2/asm" "$2/asm-generic" "$2/linux" - # cp -HL creates regular destination files even if sources are symlinks. - # This is intended. - # (NB: you need busybox 1.11.x for this. earlier ones are slightly buggy) - cp -RHL "$KERNEL_HEADERS/asm"/* "$2/asm" || exit 1 - cp -RHL "$KERNEL_HEADERS/asm-generic"/* "$2/asm-generic" || exit 1 - cp -RHL "$KERNEL_HEADERS/linux"/* "$2/linux" || exit 1 - if ! test -f "$2/linux/version.h"; then - echo "Warning: '$KERNEL_HEADERS/linux/version.h' is not found" - echo "in kernel headers directory specified in .config." - echo "Some programs won't like that. Consider fixing it by hand." - fi -fi - - # Fix mode/owner bits cd "$2" || exit 1 chmod -R u=rwX,go=rX . >/dev/null 2>&1 diff --git a/extra/scripts/install_kernel_headers.sh b/extra/scripts/install_kernel_headers.sh new file mode 100755 index 000000000..b529a4d72 --- /dev/null +++ b/extra/scripts/install_kernel_headers.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# Parameters: +# $1 = source dir +# $2 = dst dir +# $top_builddir = well you guessed it + +die_if_not_dir() +{ + for dir in "$@"; do + test -d "$dir" && continue + echo "Error: '$dir' is not a directory" + exit 1 + done +} + + +# Ensure that created dirs/files have 755/644 perms +umask 022 + + +# Sanity tests +die_if_not_dir "$1" +mkdir -p "$2" 2>/dev/null +die_if_not_dir "$2" +die_if_not_dir "$top_builddir" + + +# Just copy (no sanitization) some kernel headers. +eval `grep ^KERNEL_HEADERS "$top_builddir/.config"` +if ! test "$KERNEL_HEADERS" \ +|| ! test -d "$KERNEL_HEADERS/asm" \ +|| ! test -d "$KERNEL_HEADERS/asm-generic" \ +|| ! test -d "$KERNEL_HEADERS/linux" \ +; then + echo "Error: '$KERNEL_HEADERS' is not a directory containing kernel headers." + echo "Check KERNEL_HEADERS= in your .config file." + exit 1 +fi +# Do the copying only if src and dst dirs are not the same. +# Be thorough: do not settle just for textual compare, +# and guard against "pwd" being handled as shell builtin. +# Double quoting looks weird, but it works (even bbox ash too). +if test "`(cd "$KERNEL_HEADERS"; env pwd)`" != "`(cd "$2"; env pwd)`"; then + # NB: source or target files and directories may be symlinks, + # and for all we know, good reasons. + # We must work correctly in these cases. This includes "do not replace + # target symlink with real directory" rule. So, no rm -rf here please. + mkdir -p "$2/asm" 2>/dev/null + mkdir -p "$2/asm-generic" 2>/dev/null + mkdir -p "$2/linux" 2>/dev/null + # Exists, but is not a dir? That's bad, bail out + die_if_not_dir "$2/asm" "$2/asm-generic" "$2/linux" + # cp -HL creates regular destination files even if sources are symlinks. + # This is intended. + # (NB: you need busybox 1.11.x for this. earlier ones are slightly buggy) + cp -RHL "$KERNEL_HEADERS/asm"/* "$2/asm" || exit 1 + cp -RHL "$KERNEL_HEADERS/asm-generic"/* "$2/asm-generic" || exit 1 + cp -RHL "$KERNEL_HEADERS/linux"/* "$2/linux" || exit 1 + if ! test -f "$2/linux/version.h"; then + echo "Warning: '$KERNEL_HEADERS/linux/version.h' is not found" + echo "in kernel headers directory specified in .config." + echo "Some programs won't like that. Consider fixing it by hand." + fi +fi + + +# Fix mode/owner bits +cd "$2" || exit 1 +chmod -R u=rwX,go=rX . >/dev/null 2>&1 +chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$/\1:\2/'` . >/dev/null 2>&1 |