diff --git a/package/gdb/Makefile b/package/gdb/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a2d5c85348eb7bcd25ede760de3f2d867950bc0b
--- /dev/null
+++ b/package/gdb/Makefile
@@ -0,0 +1,66 @@
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=gdb
+PKG_VERSION:=6.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=05b928f41fa5b482e49ca2c24762a0ae
+PKG_SOURCE_URL:=http://ftp.gnu.org/gnu/gdb
+PKG_CAT:=bzcat
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/gdb
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libreadline +libncurses
+  TITLE:=GNU Debugger
+endef
+
+define Package/gdbserver
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Remote server for GNU Debugger
+endef
+
+define Package/gdb/description
+ GNU debugger
+endef
+
+define Package/gdbserver/description
+ GDBSERVER is a program that allows you to run GDB on a different machine 
+ than the one which is running the program being debugged.
+endef
+
+TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include
+TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib
+
+export ac_cv_search_tgetent=$(TARGET_LDFLAGS) -lncurses -lreadline
+
+define Build/Compile
+	$(MAKE) -C $(PKG_BUILD_DIR) \
+		DESTDIR="$(PKG_INSTALL_DIR)" \
+		all install-gdb
+endef
+
+define Package/gdb/install	
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdb $(1)/usr/bin/
+endef
+
+define Package/gdbserver/install	
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdb $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,gdb))
+$(eval $(call BuildPackage,gdbserver))
+
diff --git a/package/gdb/patches/100-native_readline.patch b/package/gdb/patches/100-native_readline.patch
new file mode 100644
index 0000000000000000000000000000000000000000..cbd9022c9b307ef0c962835263c7201084c9a132
--- /dev/null
+++ b/package/gdb/patches/100-native_readline.patch
@@ -0,0 +1,322 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -15590,236 +15590,40 @@ maintainer-clean-rcs: 
+ 
+ 
+ .PHONY: configure-readline maybe-configure-readline
+-maybe-configure-readline:
+-@if readline
+-maybe-configure-readline: configure-readline
+-configure-readline:
+-	@test ! -f readline/Makefile || exit 0; \
+-	[ -d readline ] || mkdir readline; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(HOST_EXPORTS) \
+-	echo Configuring in readline; \
+-	cd readline || exit 1; \
+-	case $(srcdir) in \
+-	  \.) \
+-	    srcdiroption="--srcdir=."; \
+-	    libsrcdir=".";; \
+-	  /* | [A-Za-z]:[\\/]*) \
+-	    srcdiroption="--srcdir=$(srcdir)/readline"; \
+-	    libsrcdir="$$s/readline";; \
+-	  *) \
+-	    srcdiroption="--srcdir=../$(srcdir)/readline"; \
+-	    libsrcdir="$$s/readline";; \
+-	esac; \
+-	$(SHELL) $${libsrcdir}/configure \
+-	  $(HOST_CONFIGARGS) $${srcdiroption}  \
+-	  || exit 1
+-@endif readline
++maybe-configure-readline: ;
+ 
+ .PHONY: all-readline maybe-all-readline
+-maybe-all-readline:
+-@if readline
+-TARGET-readline=all
+-maybe-all-readline: all-readline
+-all-readline: configure-readline
+-	@r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	(cd readline && $(MAKE) $(FLAGS_TO_PASS)  \
+-	  $(TARGET-readline))
+-@endif readline
++maybe-all-readline: ;
+ 
+ .PHONY: check-readline maybe-check-readline
+-maybe-check-readline:
+-@if readline
+-maybe-check-readline: check-readline
+-
+-check-readline:
+-	@r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	(cd readline && $(MAKE) $(FLAGS_TO_PASS) check)
+-
+-@endif readline
++maybe-check-readline: ;
+ 
+ .PHONY: install-readline maybe-install-readline
+-maybe-install-readline:
+-@if readline
+-maybe-install-readline: install-readline
+-
+-install-readline: installdirs
+-	@r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	(cd readline && $(MAKE) $(FLAGS_TO_PASS) install)
+-
+-@endif readline
++maybe-install-readline: ;
+ 
+ # Other targets (info, dvi, etc.)
+ 
+ .PHONY: maybe-info-readline info-readline
+-maybe-info-readline:
+-@if readline
+-maybe-info-readline: info-readline
+-
+-info-readline: \
+-    configure-readline 
+-	@[ -f ./readline/Makefile ] || exit 0; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+-	done; \
+-	echo "Doing info in readline" ; \
+-	(cd readline && \
+-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+-	          "RANLIB=$${RANLIB}" \
+-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+-	          info) \
+-	  || exit 1
+-
+-@endif readline
++maybe-info-readline: ;
+ 
+ .PHONY: maybe-dvi-readline dvi-readline
+-maybe-dvi-readline:
+-@if readline
+-maybe-dvi-readline: dvi-readline
+-
+-dvi-readline: \
+-    configure-readline 
+-	@[ -f ./readline/Makefile ] || exit 0; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+-	done; \
+-	echo "Doing dvi in readline" ; \
+-	(cd readline && \
+-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+-	          "RANLIB=$${RANLIB}" \
+-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+-	          dvi) \
+-	  || exit 1
+-
+-@endif readline
++maybe-dvi-readline: ;
+ 
+ .PHONY: maybe-TAGS-readline TAGS-readline
+-maybe-TAGS-readline:
+-@if readline
+-maybe-TAGS-readline: TAGS-readline
+-
+-TAGS-readline: \
+-    configure-readline 
+-	@[ -f ./readline/Makefile ] || exit 0; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+-	done; \
+-	echo "Doing TAGS in readline" ; \
+-	(cd readline && \
+-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+-	          "RANLIB=$${RANLIB}" \
+-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+-	          TAGS) \
+-	  || exit 1
+-
+-@endif readline
++maybe-TAGS-readline: ;
+ 
+ .PHONY: maybe-install-info-readline install-info-readline
+-maybe-install-info-readline:
+-@if readline
+-maybe-install-info-readline: install-info-readline
+-
+-install-info-readline: \
+-    configure-readline \
+-    info-readline 
+-	@[ -f ./readline/Makefile ] || exit 0; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+-	done; \
+-	echo "Doing install-info in readline" ; \
+-	(cd readline && \
+-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+-	          "RANLIB=$${RANLIB}" \
+-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+-	          install-info) \
+-	  || exit 1
+-
+-@endif readline
++maybe-install-info-readline: ;
+ 
+ .PHONY: maybe-installcheck-readline installcheck-readline
+-maybe-installcheck-readline:
+-@if readline
+-maybe-installcheck-readline: installcheck-readline
+-
+-installcheck-readline: \
+-    configure-readline 
+-	@[ -f ./readline/Makefile ] || exit 0; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+-	done; \
+-	echo "Doing installcheck in readline" ; \
+-	(cd readline && \
+-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+-	          "RANLIB=$${RANLIB}" \
+-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+-	          installcheck) \
+-	  || exit 1
+-
+-@endif readline
++maybe-installcheck-readline: ;
+ 
+ .PHONY: maybe-mostlyclean-readline mostlyclean-readline
+-maybe-mostlyclean-readline:
+-@if readline
+-maybe-mostlyclean-readline: mostlyclean-readline
+-
+-mostlyclean-readline: 
+-	@[ -f ./readline/Makefile ] || exit 0; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+-	done; \
+-	echo "Doing mostlyclean in readline" ; \
+-	(cd readline && \
+-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+-	          "RANLIB=$${RANLIB}" \
+-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+-	          mostlyclean) \
+-	  || exit 1
+-
+-@endif readline
++maybe-mostlyclean-readline: ;
+ 
+ .PHONY: maybe-clean-readline clean-readline
+-maybe-clean-readline:
+-@if readline
++maybe-clean-readline: ;
++@if readline-disabled
+ maybe-clean-readline: clean-readline
+ 
+ clean-readline: 
+@@ -15844,53 +15648,9 @@ clean-readline: 
+ 
+ .PHONY: maybe-distclean-readline distclean-readline
+ maybe-distclean-readline:
+-@if readline
+-maybe-distclean-readline: distclean-readline
+-
+-distclean-readline: 
+-	@[ -f ./readline/Makefile ] || exit 0; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+-	done; \
+-	echo "Doing distclean in readline" ; \
+-	(cd readline && \
+-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+-	          "RANLIB=$${RANLIB}" \
+-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+-	          distclean) \
+-	  || exit 1
+-
+-@endif readline
+ 
+ .PHONY: maybe-maintainer-clean-readline maintainer-clean-readline
+-maybe-maintainer-clean-readline:
+-@if readline
+-maybe-maintainer-clean-readline: maintainer-clean-readline
+-
+-maintainer-clean-readline: 
+-	@[ -f ./readline/Makefile ] || exit 0; \
+-	r=`${PWD_COMMAND}`; export r; \
+-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+-	$(SET_LIB_PATH) \
+-	$(HOST_EXPORTS) \
+-	for flag in $(EXTRA_HOST_FLAGS) ; do \
+-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+-	done; \
+-	echo "Doing maintainer-clean in readline" ; \
+-	(cd readline && \
+-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+-	          "RANLIB=$${RANLIB}" \
+-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \
+-	          maintainer-clean) \
+-	  || exit 1
+-
+-@endif readline
++maybe-maintainer-clean-readline: ;
+ 
+ 
+ .PHONY: configure-release maybe-configure-release
+--- a/gdb/Makefile.in
++++ b/gdb/Makefile.in
+@@ -121,10 +121,10 @@ BFD_SRC = $(srcdir)/$(BFD_DIR)
+ BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC)
+ 
+ # Where is the READLINE library?  Typically in ../readline.
+-READLINE_DIR = ../readline
+-READLINE = $(READLINE_DIR)/libreadline.a
++READLINE =
+ READLINE_SRC = $(srcdir)/$(READLINE_DIR)
+-READLINE_CFLAGS = -I$(READLINE_SRC)/..
++READLINE_CFLAGS =
++READLINE_LDFLAGS = -lreadline
+ 
+ WARN_CFLAGS = @WARN_CFLAGS@
+ WERROR_CFLAGS = @WERROR_CFLAGS@
diff --git a/package/gdbserver/Makefile b/package/gdbserver/Makefile
deleted file mode 100644
index e8fb2ee94f8827fc35c1999980fc746bbcc3b553..0000000000000000000000000000000000000000
--- a/package/gdbserver/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright (C) 2006 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-# $Id$
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=gdbserver
-PKG_VERSION:=6.3
-PKG_RELEASE:=1
-
-GDB_DIR:=$(BUILD_DIR_TOOLCHAIN)/gdb-$(PKG_VERSION)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/gdbserver
-  SECTION:=utils
-  CATEGORY:=Utilities
-  DEPENDS:=@GDB
-  TITLE:=Remote Server for the GNU Debugger
-endef
-
-define Package/gdbserver/description
- GDBSERVER is a program that allows you to run GDB on a different machine 
- than the one which is running the program being debugged.
-endef
-
-define Build/Configure
-	(cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
-		$(TARGET_CONFIGURE_OPTS) \
-		CFLAGS="$(TARGET_CFLAGS)" \
-		$(GDB_DIR)/gdb/gdbserver/configure \
-		  --target=$(GNU_TARGET_NAME) \
-		  --host=$(GNU_TARGET_NAME) \
-		  --build=$(GNU_HOST_NAME) \
-		  --program-prefix="" \
-		  --program-suffix="" \
-		  --prefix=/usr \
-		  --exec-prefix=/usr \
-		  --bindir=/usr/bin \
-		  --sbindir=/usr/sbin \
-		  --libexecdir=/usr/lib \
-		  --sysconfdir=/etc \
-		  --datadir=/usr/share \
-		  --localstatedir=/var \
-		  --mandir=/usr/man \
-		  --infodir=/usr/info \
-		  $(DISABLE_NLS) \
-		  $(DISABLE_LARGEFILE) \
-	);
-endef
-
-define Build/Compile
-	rm -rf $(PKG_INSTALL_DIR)
-	mkdir -p $(PKG_INSTALL_DIR)
-	$(MAKE) -C $(PKG_BUILD_DIR) \
-		DESTDIR="$(PKG_INSTALL_DIR)" \
-		install
-endef
-
-define Package/gdbserver/install	
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gdbserver $(1)/usr/bin/
-endef
-
-$(eval $(call BuildPackage,gdbserver))
-