meta-gsj: Add USB-NIC systemd configuration for GSJ board.
Tested: Build Quanta GSJ board image and load on the EVB.
Ensure that BMC boots to console, and the USB network interface is working.
Fix typo.
Change-Id: I633f6914e3ba0d8c86b6abb32685d554fd9510eb
Signed-off-by: FranHsu <Fran.Hsu@quantatw.com>
diff --git a/meta-gsj/recipes-phosphor/usb-network/files/00-bmc-usb0.network b/meta-gsj/recipes-phosphor/usb-network/files/00-bmc-usb0.network
new file mode 100644
index 0000000..9483963
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/usb-network/files/00-bmc-usb0.network
@@ -0,0 +1,7 @@
+[Match]
+Name=usb0
+[Address]
+Address=169.254.95.118/16
+[Network]
+LinkLocalAddressing=yes
+IPv6AcceptRA=no
diff --git a/meta-gsj/recipes-phosphor/usb-network/files/usb_network.service b/meta-gsj/recipes-phosphor/usb-network/files/usb_network.service
new file mode 100644
index 0000000..913f5fb
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/usb-network/files/usb_network.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=enable usb network
+
+[Service]
+Type=oneshot
+ExecStart=/bin/bash -c '/usr/sbin/usb_network.sh'
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-gsj/recipes-phosphor/usb-network/files/usb_network.sh b/meta-gsj/recipes-phosphor/usb-network/files/usb_network.sh
new file mode 100644
index 0000000..45fa888
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/usb-network/files/usb_network.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+cd /sys/kernel/config/usb_gadget
+
+if [ ! -f "g1" ]; then
+ mkdir g1
+ cd g1
+
+ echo 0x1d6b > idVendor # Linux foundation
+ echo 0x0104 > idProduct # Multifunction composite gadget
+ mkdir -p strings/0x409
+ echo "Linux" > strings/0x409/manufacturer
+ echo "Ethernet/RNDIS gadget" > strings/0x409/product
+
+ mkdir -p configs/c.1
+ echo 100 > configs/c.1/MaxPower
+ mkdir -p configs/c.1/strings/0x409
+ echo "RNDIS" > configs/c.1/strings/0x409/configuration
+
+ mkdir -p functions/rndis.usb0
+
+ ln -s functions/rndis.usb0 configs/c.1
+
+ echo f0839000.udc > UDC
+
+fi
+exit 0