Skip to content

Commit

Permalink
ndas:
Browse files Browse the repository at this point in the history
 * use (a more recent) open-source driver for all boxes & kernel-versions
 * all kernel-versions have been compile-tested, versions 2.6.28 & 2.6.32 have also been tested at run-time (thanks to [http://www.ip-phone-forum.de/showthread.php?t=265339 RomMon] for that)
 * refs #465


git-svn-id: file:///var/svn/freetz/trunk@11464 149334a1-2f27-0410-a3b9-fc62619ac1e6
  • Loading branch information
er13 committed Dec 25, 2013
1 parent 927f78d commit fe02c9d
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 72 deletions.
4 changes: 0 additions & 4 deletions kernel/Config.in.modules
Expand Up @@ -30,21 +30,17 @@ config FREETZ_MODULE_xvmalloc
default n

menu "ndas"
depends on FREETZ_PACKAGE_NDAS_AVAILABLE

config FREETZ_MODULE_ndas_block
bool "ndas_block.ko"
depends on FREETZ_PACKAGE_NDAS_AVAILABLE
default n

config FREETZ_MODULE_ndas_core
bool "ndas_core.ko"
depends on FREETZ_PACKAGE_NDAS_AVAILABLE
default n

config FREETZ_MODULE_ndas_sal
bool "ndas_sal.ko"
depends on FREETZ_PACKAGE_NDAS_AVAILABLE
default n

endmenu
Expand Down
11 changes: 0 additions & 11 deletions make/ndas/Config.in
@@ -1,16 +1,5 @@
config FREETZ_PACKAGE_NDAS_OPEN_SOURCE_AVAILABLE
bool
default y if FREETZ_KERNEL_VERSION_2_6_28_MIN
default n

config FREETZ_PACKAGE_NDAS_AVAILABLE
bool
default y if FREETZ_TARGET_ARCH_LE || FREETZ_PACKAGE_NDAS_OPEN_SOURCE_AVAILABLE
default n

config FREETZ_PACKAGE_NDAS
bool "ndas (binary only)"
depends on FREETZ_PACKAGE_NDAS_AVAILABLE
select FREETZ_MODULE_ndas_block
select FREETZ_MODULE_ndas_core
select FREETZ_MODULE_ndas_sal
Expand Down
29 changes: 10 additions & 19 deletions make/ndas/ndas.mk
@@ -1,18 +1,11 @@
ifeq ($(strip $(FREETZ_PACKAGE_NDAS_OPEN_SOURCE_AVAILABLE)),y)
$(call PKG_INIT_BIN, 1aaf88acd0)
$(PKG)_SOURCE:=$(pkg)-$($(PKG)_VERSION).tar.xz
$(PKG)_SITE:=git@https://github.com/iocellnetworks/ndas4linux.git
$(PKG)_CONDITIONAL_PATCHES+=open_source
$(PKG)_PRELIMINARY_BUILD_DIR:=$($(PKG)_DIR)/$(KERNEL_VERSION)
$(PKG)_BUILD_DIR:=$($(PKG)_PRELIMINARY_BUILD_DIR)/build_freetz/ndas-$(KERNEL_VERSION)
else
$(call PKG_INIT_BIN, 1.1-22)
$(PKG)_SOURCE:=$(pkg)-$($(PKG)_VERSION).mipsel.tar.bz2
$(PKG)_SOURCE_MD5:=f6b5d28b638ac074f54d404e4c136d5e
$(PKG)_SITE:=http://freetz.magenbrot.net
$(PKG)_CONDITIONAL_PATCHES+=closed_source
$(PKG)_BUILD_DIR:=$($(PKG)_DIR)
endif

$(PKG)_KERNEL_VERSION:=$(call GET_MAJOR_VERSION,$(KERNEL_VERSION),3)

$(PKG)_PRELIMINARY_BUILD_DIR:=$($(PKG)_DIR)/2.6.32
$(PKG)_BUILD_DIR:=$($(PKG)_PRELIMINARY_BUILD_DIR)/build_freetz/ndas-$($(PKG)_KERNEL_VERSION)

$(PKG)_BINARY_BUILD_DIR:=$($(PKG)_BUILD_DIR)/ndasadmin
$(PKG)_BINARY_TARGET_DIR:=$($(PKG)_DEST_DIR)/usr/bin/ndasadmin
Expand All @@ -25,11 +18,11 @@ $(PKG)_DEPENDS_ON := kernel

$(PKG)_REBUILD_SUBOPTS += FREETZ_KERNEL_VERSION

NDAS_OPTIONS:= \
$(PKG)_OPTIONS := \
NDAS_KERNEL_PATH="$(FREETZ_BASE_DIR)/$(KERNEL_SOURCE_DIR)" \
NDAS_KERNEL_VERSION=$(strip $(FREETZ_KERNEL_VERSION)) \
NDAS_KERNEL_VERSION="$(NDAS_KERNEL_VERSION)" \
NDAS_KERNEL_ARCH=$(call qstrip,$(FREETZ_TARGET_ARCH)) \
NDAS_VER_BUILD=$(word 3,$(subst .,$(_space),$(KERNEL_VERSION))) \
NDAS_VER_BUILD=$(word 3,$(subst .,$(_space),$(NDAS_KERNEL_VERSION))) \
NDAS_CROSS_COMPILE=$(TARGET_CROSS) \
NDAS_CROSS_COMPILE_UM=$(TARGET_CROSS) \
NDAS_EXTRA_CFLAGS="-mlong-calls -Wno-unused-but-set-variable -Wno-unused-function" \
Expand All @@ -42,8 +35,7 @@ $(PKG_UNPACKED)
$(PKG_CONFIGURED_NOP)

$($(PKG)_DIR)/.exported: $($(PKG)_DIR)/.configured
ifeq ($(strip $(FREETZ_PACKAGE_NDAS_OPEN_SOURCE_AVAILABLE)),y)
ln -sfT 2.6.32 $(NDAS_DIR)/2.6.28
$(RM) -r $(NDAS_PRELIMINARY_BUILD_DIR)/platform/linux/tarball-{linux,trunk}
touch $(NDAS_PRELIMINARY_BUILD_DIR)/arch/vendor/freetz.mk
$(SUBMAKE) -C $(NDAS_PRELIMINARY_BUILD_DIR) \
$(NDAS_OPTIONS) \
Expand All @@ -63,7 +55,6 @@ ifeq ($(strip $(FREETZ_PACKAGE_NDAS_OPEN_SOURCE_AVAILABLE)),y)
nxpo-sio=y \
nxpo-uni=y \
all
endif
touch $@

$($(PKG)_BINARY_BUILD_DIR): $($(PKG)_DIR)/.configured | $($(PKG)_DIR)/.exported
Expand Down Expand Up @@ -92,7 +83,7 @@ $(pkg)-precompiled: $($(PKG)_BINARY_TARGET_DIR) $($(PKG)_MODULES_TARGET_DIR)

$(pkg)-clean:
-$(SUBMAKE) -C $(NDAS_BUILD_DIR) $(NDAS_OPTIONS) clean
$(RM) $(NDAS_DIR)/.exported $(NDAS_DIR)/2.6.28
$(RM) $(NDAS_DIR)/.exported

$(pkg)-uninstall:
$(RM) $(NDAS_BINARY_TARGET_DIR) $(NDAS_MODULES_TARGET_DIR)
Expand Down
@@ -1,39 +1,49 @@
--- 2.6.32/platform/linux/tarball-tag/sal/io.c
+++ 2.6.32/platform/linux/tarball-tag/sal/io.c
@@ -41,7 +41,8 @@
@@ -41,7 +41,11 @@
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/ide.h>
-#include <linux/smp_lock.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16))
+#include <linux/mutex.h>
+
+#else
#include <linux/smp_lock.h>
+#endif
#include <linux/time.h>

#include "sal/sync.h"
@@ -54,6 +55,8 @@
@@ -54,6 +58,10 @@

#include "linux_ver.h" // SAL_HZ

+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16))
+DEFINE_MUTEX(fs_mutex);
+#endif
+
NDAS_SAL_API sal_file sal_file_open(const char * filename, int flags, int mode)
{
int linux_flags = 0;
@@ -95,7 +98,7 @@
@@ -95,7 +103,11 @@
int size32;
#endif

- lock_kernel();
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16))
+ mutex_lock(&fs_mutex);
+#else
lock_kernel();
+#endif

if (filp->f_dentry &&
filp->f_dentry->d_inode &&
@@ -158,7 +161,7 @@
@@ -158,7 +170,11 @@
} else {
ret = FALSE;
}
- unlock_kernel();
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16))
+ mutex_unlock(&fs_mutex);
+#else
unlock_kernel();
+#endif
return ret;
}

File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions make/ndas/patches/150-class_device_create.patch
@@ -0,0 +1,38 @@
--- 2.6.32/platform/linux/tarball-tag/inc/linux_ver.h
+++ 2.6.32/platform/linux/tarball-tag/inc/linux_ver.h
@@ -199,6 +199,13 @@
sock_create(family, type, protocol, res)
#endif

+/* In 2.6.13 and 2.6.14 kernels class_device_create() had different prototype. */
+#if (KERNEL_VERSION(2,6,12) < LINUX_VERSION_CODE) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
+#define ndas_class_device_create(cls, parent, devt, device, fmt) class_device_create(cls, devt, device, fmt)
+#else
+#define ndas_class_device_create(cls, parent, devt, device, fmt) class_device_create(cls, parent, devt, device, fmt)
+#endif
+
#if LINUX_VERSION_25_ABOVE
#define GENDISK_MAX_DISKNAME sizeof(((struct gendisk*)0)->disk_name)
#define GENDISK_MAX_DDEVFSNAME sizeof(((struct gendisk*)0)->devfs_name)
--- 2.6.32/platform/linux/tarball-tag/block/ctrldev.c
+++ 2.6.32/platform/linux/tarball-tag/block/ctrldev.c
@@ -1151,7 +1151,7 @@
MKDEV(NDAS_CHR_DEV_MAJOR, NDAS_CHR_DEV_MINOR),
NULL, "ndas");
#else
- class_device_create(ndas_ctrldev_class, NULL,
+ ndas_class_device_create(ndas_ctrldev_class, NULL,
MKDEV(NDAS_CHR_DEV_MAJOR, NDAS_CHR_DEV_MINOR),
NULL, "ndas");
#endif //#if LINUX_VERSION_HAS_DEVICE_CREATE
--- 2.6.32/platform/linux/tarball-tag/scsi/ctrldev.c
+++ 2.6.32/platform/linux/tarball-tag/scsi/ctrldev.c
@@ -1025,7 +1025,7 @@
MKDEV(NDAS_CHR_DEV_MAJOR, NDAS_CHR_DEV_MINOR),
NULL, "ndas");
#else
- class_device_create(ndas_ctrldev_class, NULL,
+ ndas_class_device_create(ndas_ctrldev_class, NULL,
MKDEV(NDAS_CHR_DEV_MAJOR, NDAS_CHR_DEV_MINOR),
NULL, "ndas");
#endif //#if LINUX_VERSION_HAS_DEVICE_CREATE
30 changes: 0 additions & 30 deletions make/ndas/patches/closed_source/010-class_device_create.patch

This file was deleted.

0 comments on commit fe02c9d

Please sign in to comment.