Remove user-level ip configuration 14/196614/1 accepted/tizen/unified/20190104.061230 submit/tizen/20190102.221308 submit/tizen/20190103.040758 submit/tizen_5.0/20190103.041413 submit/tizen_5.0/20190110.063209
authorDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 27 Dec 2018 04:25:26 +0000 (13:25 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 3 Jan 2019 03:13:34 +0000 (12:13 +0900)
Since rpi u-boot can support ip configuration thorugh kernel itself,
user-level configuration is no more needed. Since this patch, just
prints out to inform IP address to user which is configured by kernel.

Change-Id: I92cff85c050119af4b3706b802a1df956967a80f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
scripts/41-flash.list
scripts/flash-init.sh

index 12d4aeb..2dc7ccf 100755 (executable)
@@ -11,8 +11,8 @@ WITHLIBS="
 /bin/mount
 /bin/sync
 /bin/umount
+/sbin/ip
 /usr/sbin/ifconfig
-/usr/sbin/route
 "
 
 # LinkFileName:Target
index 1b9a241..40a656b 100755 (executable)
@@ -7,8 +7,12 @@ BLKID="/usr/sbin/blkid"
 FLASH_MANAGER="/usr/bin/flash-manager"
 MOUNT="/usr/bin/mount"
 UMOUNT="/usr/bin/umount"
-IFCONFIG="/usr/sbin/ifconfig"
 REBOOT="/usr/sbin/reboot"
+IP="/usr/sbin/ip"
+IFCONFIG="/usr/sbin/ifconfig"
+GREP="/usr/bin/grep"
+
+NETIF="eth0"
 
 #------------------------------------------------
 #      clear_bootmode
@@ -18,11 +22,17 @@ clear_bootmode() {
 }
 
 #------------------------------------------------
-#      setup_network
+#      print_ip
 #------------------------------------------------
-setup_network() {
-       "$IFCONFIG" eth0 192.168.0.1 up
-       echo "IP address is set to 192.168.0.1"
+print_ip() {
+       IPADDR=`"$IP" -4 addr show $NETIF | "$GREP" -oP '(?<=inet\s)\d+(\.\d+){3}'`
+       if [ "z$IPADDR" == "z" ]; then
+               echo "IP address is not set, using default (192.168.0.100)"
+               IPADDR="192.168.0.100"
+
+               "$IFCONFIG" $NETIF $IPADDR up
+       fi
+       echo "IP address is set to ${IPADDR}"
 }
 
 #------------------------------------------------
@@ -42,5 +52,5 @@ do_flash() {
 #      Main Routine Start
 #------------------------------------------------
 clear_bootmode
-setup_network
+print_ip
 do_flash