File 0001-better-kernel-integrated-build.diff of Package oss-linux

From 7baf4e578525770e8df18d74e6848e359224a98e Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 25 Jul 2008 10:07:24 +0200
Subject: [PATCH] better kernel integrated build

---
 Makefile.linux                         |   40 ++++++++++++++++++++++++++++++++
 kernel/framework/include/buildid.h     |    2 +
 kernel/framework/include/oss_version.h |    1 -
 mkdevs                                 |    8 ++++++
 prepare                                |   22 +++++++++++++++++
 setup/Linux/oss/build/module.inc       |    5 ++-
 setup/Linux/oss/build/osscore.c        |   10 ++++---
 7 files changed, 81 insertions(+), 7 deletions(-)
 create mode 100644 Makefile.linux
 create mode 100644 kernel/framework/include/buildid.h
 create mode 100755 mkdevs
 create mode 100755 prepare

diff --git a/Makefile.linux b/Makefile.linux
new file mode 100644
index 0000000..462a56f
--- /dev/null
+++ b/Makefile.linux
@@ -0,0 +1,40 @@
+TOPDIR = ../..
+KSRCDIR = $(TOPDIR)/kernel
+LSRCDIR = $(KSRCDIR)/OS/Linux
+DSRCDIR = $(KSRCDIR)/drv
+FSRCDIR = $(KSRCDIR)/framework
+OSSCDIR = $(TOPDIR)/setup/Linux/oss/build
+OSS_BUILD_ID = $(shell cat $(TOPDIR)/buildid.dat)
+
+EXTRA_CFLAGS := \
+	-I$(src)/$(FSRCDIR)/include \
+	-I$(src)/$(LSRCDIR)/wrapper \
+	-I$(src)/$(LSRCDIR) \
+	-I$(src)/$(TOPDIR) \
+	-I$(src)/$(OSSCDIR) \
+	-I$(src)/$(TOPDIR)/include \
+	-DOSS_BUILD_ID=\"$(OSS_BUILD_ID)\" \
+	-DOSS_COMPILE_DATE=\"???\" \
+	-DALLEGRO_DEBUG=0 \
+	-D_KERNEL
+
+
+FRAMEWORK_S := $(wildcard $(src)/$(FSRCDIR)/*/*.c)
+
+DRIVER_O = $(DRIVER_S:$(src)/%.c=%.o)
+
+FRAMEWORK_O := $(FRAMEWORK_S:$(src)/%.c=%.o)
+
+ifneq ($(KERNELRELEASE),)
+
+osscore-y := $(OSSCDIR)/osscore.o $(LSRCDIR)/os_linux.o $(FRAMEWORK_O)
+
+obj-m := osscore.o
+
+-include $(src)/Make.modules
+
+else
+KERNELDIR := /lib/modules/$(shell uname -r)/build
+%::
+	$(MAKE) -C $(KERNELDIR) M=$(shell pwd) $@
+endif
diff --git a/kernel/framework/include/buildid.h b/kernel/framework/include/buildid.h
new file mode 100644
index 0000000..ca5e3af
--- /dev/null
+++ b/kernel/framework/include/buildid.h
@@ -0,0 +1,2 @@
+#define __OPENOSS__
+#define OSS_LICENSE "GPL"
diff --git a/kernel/framework/include/oss_version.h b/kernel/framework/include/oss_version.h
index 319331e..c9a76dd 100644
--- a/kernel/framework/include/oss_version.h
+++ b/kernel/framework/include/oss_version.h
@@ -13,7 +13,6 @@
  *
  */
 #include <buildid.h>
-#include <timestamp.h>
 
 #ifndef OSS_LICENSE
 #define OSS_LICENSE "" /* Empty means commercial license */
diff --git a/mkdevs b/mkdevs
new file mode 100755
index 0000000..b87c5cd
--- /dev/null
+++ b/mkdevs
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+cat /proc/opensound/devfiles | while read name major minor; do
+	if [ "${name%/*}" != "$name" ]; then
+		mkdir -p /dev/"${name%/*}"
+	fi
+	mknod /dev/$name c $major $minor
+done
diff --git a/prepare b/prepare
new file mode 100755
index 0000000..21adea8
--- /dev/null
+++ b/prepare
@@ -0,0 +1,22 @@
+#!/bin/bash
+set -e
+rm -rf target
+mkdir -p target/{build,sbin,bin}
+find kernel -name .devices | xargs grep -hv '^#' > devices.list
+gcc -Wall -g -O2 -o target/build/srcconf setup/srcconf.c
+target/build/srcconf
+cp Makefile.linux target/build/Makefile
+ln -sf os_linux.h kernel/OS/Linux/os.h
+> target/build/Make.modules
+for i in target/build/*.c; do
+	i=${i##*/}
+	i=${i%.c}
+	case $i in
+		audioloop|fm801) continue ;;
+	esac
+	cat >> target/build/Make.modules <<-EOF
+	obj-m += oss-$i.o
+	cflags_oss-$i.o := -I\$(DSRCDIR)/$i
+	oss-$i-y := \$(DSRCDIR)/$i/$i.o $i.o
+	EOF
+done
diff --git a/setup/Linux/oss/build/module.inc b/setup/Linux/oss/build/module.inc
index 354b914..942426c 100644
--- a/setup/Linux/oss/build/module.inc
+++ b/setup/Linux/oss/build/module.inc
@@ -19,7 +19,6 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
-#include "../include/internals/timestamp.h"
 #include "ossddk/oss_exports.h"
 #include "wrap.h"
 #include "ossddk/ossddk.h"
@@ -44,7 +43,7 @@ extern int DRIVER_DETACH (oss_device_t * osdev);
 
 #include "pci_wrapper.inc"
 
-// MODULE_DEVICE_TABLE(pci, id_table);
+MODULE_DEVICE_TABLE(pci, id_table);
 static struct pci_driver osspci_driver = {
   .name = DRIVER_NICK,
   .id_table = id_table,
@@ -124,6 +123,8 @@ static int usb_major = 0;
 
 #include "usb_wrapper.inc"
 
+MODULE_DEVICE_TABLE(usb, udi_usb_table);
+
 static int
 usbdrv_init (void)
 {
diff --git a/setup/Linux/oss/build/osscore.c b/setup/Linux/oss/build/osscore.c
index 8ab5d7b..3a02f82 100644
--- a/setup/Linux/oss/build/osscore.c
+++ b/setup/Linux/oss/build/osscore.c
@@ -11,12 +11,14 @@
  */
 //#include <linux/config.h>
 typedef int *ioctl_arg;
+
+#undef _KERNEL
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <stdarg.h>
 #include <linux/vmalloc.h>
-#include "../include/internals/timestamp.h"
 #include "ossddk/oss_exports.h"
 #include "wrap.h"
 #include "ossdip.h"
@@ -36,9 +38,9 @@ typedef int *ioctl_arg;
 
 typedef struct _smap_t dmap_t;
 
-#include "../include/sys/soundcard.h"
-#include "../include/internals/audio_core.h"
-#include "../include/internals/mixer_core.h"
+#include "soundcard.h"
+#include "audio_core.h"
+#include "mixer_core.h"
 
 MODULE_LICENSE ("GPL v2");
 MODULE_DESCRIPTION ("Open Sound System core services");
-- 
1.5.6

openSUSE Build Service is sponsored by