summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsha R <asha.r@arm.com>2019-09-25 21:21:53 +0530
committerArvind Chauhan <arvind.chauhan@arm.com>2019-10-08 11:36:47 +0530
commit5256d2683c16e277f6e5c56a7c4d08131dfc5db7 (patch)
treeb8e2ec1dad99c27f0d2ff1a63ea6517a75bd7da6
parentb57c098ca0561ff39aa70b3fe2c795b7a0108717 (diff)
ramdisk: Enable network/debug support19.10
Enable network interface and add debug support for busybox boot Signed-off-by: Asha R <asha.r@arm.com>
-rwxr-xr-xdefault.script52
-rw-r--r--files.txt10
-rwxr-xr-xinit.sh1
-rw-r--r--interfaces4
4 files changed, 67 insertions, 0 deletions
diff --git a/default.script b/default.script
new file mode 100755
index 0000000..2a917eb
--- /dev/null
+++ b/default.script
@@ -0,0 +1,52 @@
+#!/bin/sh
+# udhcpc script edited by Tim Riker <Tim@Rikers.org>
+
+RESOLV_CONF="/etc/resolv.conf"
+
+[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; }
+
+NETMASK=""
+[ -n "$subnet" ] && NETMASK="netmask $subnet"
+BROADCAST="broadcast +"
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+
+case "$1" in
+ deconfig)
+ echo "Setting IP address 0.0.0.0 on $interface"
+ ifconfig $interface 0.0.0.0
+ ;;
+
+ renew|bound)
+ echo "Setting IP address $ip on $interface"
+ ifconfig $interface $ip $NETMASK $BROADCAST
+
+ if [ -n "$router" ] ; then
+ echo "Deleting routers"
+ while route del default gw 0.0.0.0 dev $interface ; do
+ :
+ done
+
+ metric=0
+ for i in $router ; do
+ echo "Adding router $i"
+ route add default gw $i dev $interface metric $metric
+ : $(( metric += 1 ))
+ done
+ fi
+
+ echo "Recreating $RESOLV_CONF"
+ # If the file is a symlink somewhere (like /etc/resolv.conf
+ # pointing to /run/resolv.conf), make sure things work.
+ realconf=$(readlink -f "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF")
+ tmpfile="$realconf-$$"
+ > "$tmpfile"
+ [ -n "$domain" ] && echo "search $domain" >> "$tmpfile"
+ for i in $dns ; do
+ echo " Adding DNS server $i"
+ echo "nameserver $i" >> "$tmpfile"
+ done
+ mv "$tmpfile" "$realconf"
+ ;;
+esac
+
+exit 0
diff --git a/files.txt b/files.txt
index 997342e..3b4d93e 100644
--- a/files.txt
+++ b/files.txt
@@ -13,3 +13,13 @@ dir /sbin 755 0 0
dir /usr/bin 755 0 0
dir /usr/sbin 755 0 0
file /init ./init.sh 777 0 0
+dir /etc 755 0 0
+dir /etc/network 755 0 0
+dir /etc/network/if-up.d 755 0 0
+dir /etc/network/if-pre-up.d 755 0 0
+file /etc/network/interfaces ./interfaces 777 0 0
+dir /usr/share 755 0 0
+dir /usr/share/udhcpc 755 0 0
+file /usr/share/udhcpc/default.script ./default.script 777 0 0
+dir /var 755 0 0
+dir /var/run 755 0 0
diff --git a/init.sh b/init.sh
index c8c3887..53c21ac 100755
--- a/init.sh
+++ b/init.sh
@@ -31,6 +31,7 @@
#Mount things needed by this script
/bin/busybox mount -t proc proc /proc
/bin/busybox mount -t sysfs sysfs /sys
+/bin/busybox mount -t debugfs none /sys/kernel/debug
echo "init.sh"
#Create all the symlinks to /bin/busybox
diff --git a/interfaces b/interfaces
new file mode 100644
index 0000000..c6e625a
--- /dev/null
+++ b/interfaces
@@ -0,0 +1,4 @@
+auto lo
+iface lo inet loopback
+auto eth0
+iface eth0 inet dhcp