Browse Source

add workaround for rpi2 eth0

Waldemar Brodkorb 9 years ago
parent
commit
570955a0b3
3 changed files with 40 additions and 2 deletions
  1. 6 2
      package/busybox/Makefile
  2. 29 0
      package/busybox/files/network.wait
  3. 5 0
      target/config/Config.in.runtime

+ 6 - 2
package/busybox/Makefile

@@ -5,7 +5,7 @@ include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		busybox
 PKG_VERSION:=		1.23.2
-PKG_RELEASE:=		1
+PKG_RELEASE:=		2
 PKG_HASH:=		05a6f9e21aad8c098e388ae77de7b2361941afa7157ef74216703395b14e319a
 PKG_DESCR:=		core utilities for embedded systems
 PKG_SECTION:=		base/apps
@@ -54,7 +54,11 @@ do-install:
 	$(CP) $(WRKINST)/* $(IDIR_BUSYBOX)/
 ifeq ($(BUSYBOX_IFUPDOWN),y)
 	$(INSTALL_DIR) $(IDIR_BUSYBOX)/etc/init.d
-	$(INSTALL_BIN) ./files/network $(IDIR_BUSYBOX)/etc/init.d
+ifeq ($(ADK_RUNTIME_WAIT_FOR_ETHERNET),y)
+	$(INSTALL_BIN) ./files/network.wait $(IDIR_BUSYBOX)/etc/init.d/network
+else
+	$(INSTALL_BIN) ./files/network $(IDIR_BUSYBOX)/etc/init.d/network
+endif
 endif
 ifeq ($(ADK_DEBUG),y)
 	${INSTALL_BIN} $(WRKBUILD)/busybox_unstripped \

+ 29 - 0
package/busybox/files/network.wait

@@ -0,0 +1,29 @@
+#!/bin/sh
+#PKG busybox
+#INIT 40
+. /etc/rc.conf
+case $1 in
+autostart)
+	test x"${network:-NO}" = x"NO" && exit 0
+	exec sh $0 start
+	;;
+start)
+	[ -f /etc/network/interfaces ] || exit 1
+	echo "Waiting for eth0 ... "
+	while [ ! -d /sys/class/net/eth0 ]; do sleep 1; done
+	ifup -a > /dev/null
+	;;
+autostop|stop)
+	[ -f /etc/network/interfaces ] || exit 1
+	ifdown -a > /dev/null
+	;;
+restart)
+	sh $0 stop
+	exec sh $0 start
+	;;
+*)
+	echo "Usage: $0 {start | stop | restart}"
+	exit 1
+	;;
+esac
+exit $?

+ 5 - 0
target/config/Config.in.runtime

@@ -332,6 +332,11 @@ config ADK_BINSH_ZSH
 
 endchoice
 
+# workaround for USB ethernet f.e. Raspberry Pi2
+config ADK_RUNTIME_WAIT_FOR_ETHERNET
+	bool
+	default y if ADK_TARGET_SYSTEM_RASPBERRY_PI2
+
 config ADK_SIMPLE_NETWORK_CONFIG
 	bool "simple network configuration"
 	help