Hi folks

I hacked ppc64 support into l-k-h, it uses the same hack than sparc.

Bastian

-- 
You canna change the laws of physics, Captain; I've got to have thirty minutes!
=== debian/generate-asm.sh
==================================================================
--- debian/generate-asm.sh   (/linux-kernel-headers/debian/current)   (revision 
44)
+++ debian/generate-asm.sh   (/linux-kernel-headers/trunk)   (revision 44)
@@ -2,67 +2,87 @@
 
 # Idea borrowed from RedHat's kernel package
 
-if [ -n "$1" ]; then
-       if [ ! -d "$1" ]; then
-               echo "$1" does not exist, or is not a directory
-               exit 1
-       fi
-       cd $1
-else
-       cd /usr/include
+arch="$1"
+dir_in="$2"
+dir_out="$3"
+
+if [ ! -d "$dir_in" ]; then
+       echo "$dir_in" does not exist, or is not a directory
+       exit 1
 fi
 
-if [ ! -d asm-sparc ] || [ ! -d asm-sparc64 ] ; then
-       echo E: asm-sparc and asm-sparc64 must exist, or you will have problems
+case "$arch" in
+       powerpc)
+               define_biarch="__powerpc64__"
+               kernel_arch="ppc"
+               kernel_arch_biarch="ppc64"
+               ;;
+       sparc)
+               define_biarch="__arch64__"
+               kernel_arch="sparc"
+               kernel_arch_biarch="sparc64"
+               ;;
+       *)
+               echo Invalid architeture >&2
+               exit 1
+esac
+
+asm_dir="asm-$kernel_arch"
+asm_dir_biarch="asm-$kernel_arch_biarch"
+
+if [ ! -d "$dir_in/$asm_dir" ] || [ ! -d "$dir_in/$asm_dir_biarch" ] ; then
+       echo E: $asm_dir and $asm_dir_biarch must exist, or you will have 
problems
        exit 1
 fi
 
-rm -rf asm
-mkdir asm
+mkdir -p $dir_out/asm
+cp -a $dir_in/$asm_dir $dir_out/$asm_dir
+cp -a $dir_in/$asm_dir_biarch $dir_out/$asm_dir_biarch
 
-for h in `( ls asm-sparc; ls asm-sparc64 ) | grep '\.h$' | sort -u`; do
-       name=`echo $h | tr a-z. A-Z_`
+dirs=$((( cd "$dir_in/$asm_dir"; find . -type d ); ( cd 
"$dir_in/$asm_dir_biarch"; find . -type d )) | sort -u )
+files=$((( cd "$dir_in/$asm_dir"; find . -name "*.h" -type f ); ( cd 
"$dir_in/$asm_dir_biarch"; find . -name "*.h" -type f )) | sort -u )
+
+for h in $dirs; do
+       mkdir -p "$dir_out/asm/$h"
+done
+
+for h in $files; do
+       name=$(echo $h | tr a-z. A-Z_)
+       file_out="$dir_out/asm/$h"
        # common header
-       cat > asm/$h << EOF
+       cat > $file_out << EOF
 /* All asm/ files are generated and point to the corresponding
- * file in asm-sparc or asm-sparc64. To regenerate, run "generate-asm"
+ * file in $asm_dir or $asm_dir_biarch.
  */
 
-#ifndef __SPARCSTUB__${name}__
-#define __SPARCSTUB__${name}__
-
 EOF
 
        # common for sparc and sparc64
-       if [ -f asm-sparc/$h ] && [ -f asm-sparc64/$h ]; then
-               cat >> asm/$h <<EOF
-#ifdef __arch64__
-#include <asm-sparc64/$h>
+       if [ -f $dir_in/$asm_dir/$h ] && [ -f $dir_in/$asm_dir_biarch/$h ]; then
+               cat >> $file_out <<EOF
+#ifdef $define_biarch
+# include <$asm_dir_biarch/$h>
 #else
-#include <asm-sparc/$h>
+# include <$asm_dir/$h>
 #endif
 EOF
 
-       # sparc only
-       elif [ -f asm-sparc/$h ]; then
-               cat >> asm/$h <<EOF
-#ifndef __arch64__
-#include <asm-sparc/$h>
+       elif [ -f $dir_in/$asm_dir/$h ]; then
+               cat >> $file_out <<EOF
+#ifdef $define_biarch
+# error This header is not available for $kernel_arch_biarch
+#else
+# include <$asm_dir/$h>
 #endif
 EOF
-       # sparc64 only
        else
-               cat >> asm/$h <<EOF
-#ifdef __arch64__
-#include <asm-sparc64/$h>
+               cat >> $file_out <<EOF
+#ifdef $define_biarch
+# include <$asm_dir_biarch/$h>
+#else
+# error This header is not available for $kernel_arch
 #endif
 EOF
        fi
 
-       # common footer
-       cat >> asm/$h <<EOF
-
-#endif /* !__SPARCSTUB__${name}__ */
-EOF
-
 done
=== debian/changelog
==================================================================
--- debian/changelog   (/linux-kernel-headers/debian/current)   (revision 44)
+++ debian/changelog   (/linux-kernel-headers/trunk)   (revision 44)
@@ -1,3 +1,9 @@
+linux-kernel-headers (2.5.999-test7-bk-17.0powerpc64.1) local; urgency=low
+
+  * Add powerpc64 support.
+
+ -- Bastian Blank <[EMAIL PROTECTED]>  Tue, 15 Mar 2005 15:29:28 +0000
+
 linux-kernel-headers (2.5.999-test7-bk-17) unstable; urgency=low
 
   * GOTO Masanori <[EMAIL PROTECTED]>
=== debian/rules
==================================================================
--- debian/rules   (/linux-kernel-headers/debian/current)   (revision 44)
+++ debian/rules   (/linux-kernel-headers/trunk)   (revision 44)
@@ -27,17 +27,13 @@
 
 lkh-install: stamp-lkh-install
 stamp-lkh-install: build
+       rm -rf $(includedir)
        install -d $(includedir)
        install -d $(includedir)/linux
 
-ifeq ($(kernel_arch),sparc)
-       # Sparc and Sparc64 have separate headers.  Generate wrappers.
-       cp -a include/asm-sparc $(includedir)/asm-sparc
-       cp -a include/asm-sparc64 $(includedir)/asm-sparc64
-       mkdir include/asm
-       sh debian/generate-asm.sh $(includedir)
+ifneq (,$(findstring $(DEB_HOST_ARCH), powerpc sparc))
+       sh debian/generate-asm.sh $(DEB_HOST_ARCH) include $(includedir)
 else
-       rm -rf $(includedir)/asm
        cp -a include/asm-$(kernel_arch) $(includedir)/asm
 endif
 

Attachment: signature.asc
Description: Digital signature

Reply via email to