--- a/devtools/bin/Build
+++ b/devtools/bin/Build
@@ -320,6 +320,16 @@ then
 	rel=`/usr/apollo/bin/bldt | grep Domain | awk '{ print $4 }' | sed -e 's/,//g'`
 fi
 
+#
+# LEDE/OpenWrt build system
+#
+if [ -n "$STAGING_DIR" -a -n "$OPENWRT_BUILD" ]
+then
+	os="OpenWrt"
+	rel="any"
+	arch="any"
+fi
+
 if [ ! "$arch" -a ! "$os" -a ! "$rel" ]
 then
 	arch=`uname -m | sed -e 's/ //g' -e 's/\//-/g'`
--- a/include/sm/conf.h
+++ b/include/sm/conf.h
@@ -57,7 +57,7 @@
 # endif
 
 # ifndef HASRRESVPORT
-#  define HASRRESVPORT	1	/* has rrsevport(3) call */
+#  define HASRRESVPORT	0	/* has rrsevport(3) call */
 # endif
 
 /**********************************************************************
@@ -1484,7 +1484,9 @@ extern void		*malloc();
 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
 #  define HASUNAME	1	/* use System V uname(2) system call */
 #  define HASUNSETENV	1	/* has unsetenv(3) call */
-#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
+#  ifdef __GLIBC__
+#   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
+#  endif
 #  define GIDSET_T	gid_t	/* from <linux/types.h> */
 #  ifndef HASGETUSERSHELL
 #   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
@@ -1522,6 +1524,7 @@ extern void		*malloc();
 #  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
 #   define HASSTRERROR	1	/* has strerror(3) */
 #  endif
+#  define HASSTRERROR  1	/* Patch for LEDE/OpenWRT: has strerror(3) */
 #  ifndef TZ_TYPE
 #   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
 #  endif
