diff --git a/libs/tdb/Makefile b/libs/tdb/Makefile
new file mode 100644
index 000000000..2fce3dc60
--- /dev/null
+++ b/libs/tdb/Makefile
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2007-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tdb
+PKG_VERSION:=1.0.6
+PKG_RELEASE:=1
+PKG_LICENSE:=GPL-2.0
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/tdb
+PKG_MD5SUM:=6b643fdeb48304010dcd5f675e458b58
+
+PKG_INSTALL:=1
+PKG_BUILD_DEPENDS:=+libgdbm
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tdb
+  SUBMENU:=database
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Trivial Database
+  URL:=http://sourceforge.net/projects/tdb/
+  MAINTAINER:=Dmitry V. Zimin <pfzim@mail.ru>
+#  DEPENDS:=+libgdbm
+endef
+
+define Package/tdb/description
+  TDB is a Trivial Database. In concept, it is very much like GDBM,
+  and BSD's DB except that it allows multiple simultaneous writers
+  and uses locking internally to keep writers from trampling on
+  each other. TDB is also extremely small.
+endef
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/tdb.h $(1)/usr/include/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
+endef
+
+define Package/tdb/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,tdb))
+
diff --git a/libs/tdb/patches/001-printf-fix.patch b/libs/tdb/patches/001-printf-fix.patch
new file mode 100644
index 000000000..f88d942e0
--- /dev/null
+++ b/libs/tdb/patches/001-printf-fix.patch
@@ -0,0 +1,41 @@
+--- a/tdbtool.c	2001-12-11 06:45:47.000000000 +0300
++++ b/tdbtool.c	2014-11-14 15:14:00.401164300 +0300
+@@ -169,23 +169,21 @@ static void print_data(unsigned char *bu
+ 
+ static void help(void)
+ {
+-	printf("
+-tdbtool: 
+-  create    dbname     : create a database
+-  open      dbname     : open an existing database
+-  erase                : erase the database
+-  dump      dumpname   : dump the database as strings
+-  insert    key  data  : insert a record
+-  store     key  data  : store a record (replace)
+-  show      key        : show a record by key
+-  delete    key        : delete a record by key
+-  list                 : print the database hash table and freelist
+-  free                 : print the database freelist
+-  1 | first            : print the first record
+-  n | next             : print the next record
+-  q | quit             : terminate
+-  \\n                   : repeat 'next' command
+-");
++	printf("tdbtool:\n");
++	printf("  create    dbname     : create a database\n");
++	printf("  open      dbname     : open an existing database\n");
++	printf("  erase                : erase the database\n");
++	printf("  dump      dumpname   : dump the database as strings\n");
++	printf("  insert    key  data  : insert a record\n");
++	printf("  store     key  data  : store a record (replace)\n");
++	printf("  show      key        : show a record by key\n");
++	printf("  delete    key        : delete a record by key\n");
++	printf("  list                 : print the database hash table and freelist\n");
++	printf("  free                 : print the database freelist\n");
++	printf("  1 | first            : print the first record\n");
++	printf("  n | next             : print the next record\n");
++	printf("  q | quit             : terminate\n");
++	printf("  \\n                   : repeat 'next' command\n\n");
+ }
+ 
+ static void terror(char *why)