+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: $
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=hmc5843
+PKG_VERSION:=0.1
+PKG_RELEASE:=2
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+MAKEFLAGS_KMOD:= -C "$(LINUX_DIR)" \
+ CROSS_COMPILE="$(TARGET_CROSS)" \
+ ARCH="$(LINUX_KARCH)" \
+ PATH="$(TARGET_PATH)" \
+ SUBDIRS="$(PKG_BUILD_DIR)"
+
+define KernelPackage/hmc5843
+ SUBMENU:=Other modules
+ DEPENDS:=+kmod-i2c-core +kmod-input-core
+ TITLE:=Kernel driver for HMC5843 3-axis magnetometer
+ URL:=
+ FILES:=$(PKG_BUILD_DIR)/hmc5843.$(LINUX_KMOD_SUFFIX)
+ VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(PKG_RELEASE)
+ AUTOLOAD:=$(call AutoLoad,80,hmc5843)
+ $(call AddDepends/hwmon,+kmod-i2c-core,+kmod-input-core)
+endef
+
+define KernelPackage/hmc5843/description
+ Kernel driver for HMC5843 i2c 3-axis magnetometers family
+endef
+
+
+define Build/Prepare
+ mkdir -p $(PKG_BUILD_DIR)
+ $(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+ $(MAKE) $(MAKEFLAGS_KMOD) \
+ modules
+ $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/single-event ./src/single-event.c
+endef
+
+$(eval $(call KernelPackage,hmc5843))