gadget-init: Add network-gadget services and other fixes
PATCH 1/1 gadget-init: Add network-gadget services and other fixes
* Add rule to start network-gadget when mass storage is ejected
* Add network-gadget-init service and scripts to switch to g_ether
* Add DHCP service / conf
* Update to storage-gadget: rmmod on stop
--- recipes-ti/beagleboard/gadget-init.bb | 10 ++++++++-- .../beagleboard/gadget-init/bone-gmass-eject.rules | 1 + .../beagleboard/gadget-init/g-ether-insert.sh | 11 +++++++++++ .../beagleboard/gadget-init/g-storage-reinsert.sh | 4 ++++ .../gadget-init/network-gadget-init.service | 9 +++++++++ .../gadget-init/storage-gadget-init.service | 2 ++ recipes-ti/beagleboard/gadget-init/udhcpd.conf | 5 +++++ recipes-ti/beagleboard/gadget-init/udhcpd.service | 11 +++++++++++ 8 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules create mode 100755 recipes-ti/beagleboard/gadget-init/g-ether-insert.sh create mode 100755 recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh create mode 100644 recipes-ti/beagleboard/gadget-init/network-gadget-init.service create mode 100644 recipes-ti/beagleboard/gadget-init/udhcpd.conf create mode 100644 recipes-ti/beagleboard/gadget-init/udhcpd.service
recipes-ti/beagleboard/gadget-init.bb +8 -2
@@ -1,6 +1,6 @@ DESCRIPTION = "Units to initialize usb gadgets" -PR = "r3" +PR = "r4" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
@@ -9,8 +9,14 @@ COMPATIBLE_MACHINE = "(ti33x)" PACKAGE_ARCH = "${MACHINE_ARCH}" SRC_URI = "file://storage-gadget-init.service \ + file://network-gadget-init.service \ + file://udhcpd.service \ + file://udhcpd.conf \ file://99-hokey-pokey.rules \ file://hokey-pokey.sh \ + file://bone-gmass-eject.rules \ + file://g-storage-reinsert.sh \ + file://g-ether-insert.sh \ " do_install() {
@@ -23,10 +29,10 @@ do_install() { install -d ${D}${sysconfdir}/udev/rules.d install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir} install -d ${D}${bindir} install -m 0755 ${WORKDIR}/*.sh ${D}${bindir} - } FILES_${PN} = "${base_libdir}/systemd ${sysconfdir} ${bindir}"
recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file +1 -0
@@ -0,0 +1 @@ +SUBSYSTEM=="block",ACTION=="change",KERNEL=="mmcblk0p1",RUN+="/usr/sbin/g-ether-insert.sh"
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +11 -0
@@ -0,0 +1,11 @@ +#!/bin/sh +if [ -a /sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file ] +then + x=`cat /sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file` + if [ "$x" == "" ] + then + /bin/systemctl stop storage-gadget-init.service + /bin/systemctl start network-gadget-init.service + /bin/systemctl start udhcpd.service + fi +fi
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/bash +/bin/systemctl stop storage-gadget-init.service +/bin/systemctl stop network-gadget-init.service +/bin/systemctl start storage-gadget-init.service
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +9 -0
@@ -0,0 +1,9 @@ +[Unit] +Description=Start USB Ethernet gadget +Conflicts=storage-gadget-init.service + +[Service] +RemainAfterExit=yes +ExecStart=/sbin/modprobe g_ether host_addr=00:dc:c8:f7:75:05 dev_addr=00:dd:dc:eb:6d:f1 +ExecStartPost=/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252 +ExecStop=/sbin/rmmod g_ether
recipes-ti/beagleboard/gadget-init/storage-gadget-init.service +2 -0
@@ -3,7 +3,9 @@ Description=Start usb mass storage gadget After=dev-mmcblk0p1.device [Service] +RemainAfterExit=yes ExecStart=/sbin/modprobe g_mass_storage file=/dev/mmcblk0p1 cdrom=0 stall=0 removable=1 nofua=1 +ExecStop=/sbin/rmmod g_mass_storage [Install] WantedBy=basic.target
recipes-ti/beagleboard/gadget-init/udhcpd.conf new file +5 -0
@@ -0,0 +1,5 @@ +start 192.168.7.1 +end 192.168.7.1 +interface usb0 +max_leases 1 +option subnet 255.255.255.252
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=DHCP server for USB0 network gadget +After=sys-devices-platform-omap-ti81xx\x2dusbss-musb\x2dhdrc.0-gadget-net-usb0.device + +[Service] +ExecStart=/usr/sbin/udhcpd -f -S /etc/udhcpd.conf +ExecStop=/bin/kill -TERM $MAINPID +KillSignal=SIGINT + +[Install] +WantedBy=basic.target
Signature · 1 line
1.7.0.4
Op 9 nov. 2011, om 17:02 heeft Joel A Fernandes het volgende geschreven:
Quoted 39 lines
* Add rule to start network-gadget when mass storage is ejected
* Add network-gadget-init service and scripts to switch tog_ether
* Add DHCP service / conf
* Update to storage-gadget: rmmod on stopSigned-off-by Joel A Fernandes <[email protected]>---
recipes-ti/beagleboard/gadget-init.bb | 10 ++++++++-- .../beagleboard/gadget-init/bone-gmass-eject.rules | 1 + .../beagleboard/gadget-init/g-ether-insert.sh | 11 +++++++++++ .../beagleboard/gadget-init/g-storage-reinsert.sh | 4 ++++ .../gadget-init/network-gadget-init.service | 9 +++++++++ .../gadget-init/storage-gadget-init.service | 2 ++ recipes-ti/beagleboard/gadget-init/udhcpd.conf | 5 +++++ recipes-ti/beagleboard/gadget-init/udhcpd.service | 11 +++++++++++ 8 files changed, 51 insertions(+), 2 deletions(-)create mode 100644 recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules create mode 100755
recipes-ti/beagleboard/gadget-init/g-ether-insert.shcreate mode 100755recipes-ti/beagleboard/gadget-init/g-storage-reinsert.shcreate mode 100644 recipes-ti/beagleboard/gadget-init/network-gadget-init.service create mode 100644recipes-ti/beagleboard/gadget-init/udhcpd.confcreate mode 100644 recipes-ti/beagleboard/gadget-init/udhcpd.servicerecipes-ti/beagleboard/gadget-init.bb +0
-0@@ -1,6 +1,6 @@DESCRIPTION = "Units to initialize usb gadgets"
recipes-ti/beagleboard/gadget-init.bb +1
-1-PR = "r3" +PR = "r4"LICENSE = "MIT"
LIC_FILES_CHKSUM= "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -9,8 +9,14 @@ COMPATIBLE_MACHINE = "(ti33x)"
PACKAGE_ARCH= "${MACHINE_ARCH}"
SRC_URI= "file://storage-gadget-init.service \
recipes-ti/beagleboard/gadget-init.bb COMPATIBLE_MACHINE = "(ti33x)" · line 14
Quoted 3 lines
recipes-ti/beagleboard/gadget-init.bb +3
-0+ file://network-gadget-init.service \ + file://udhcpd.service \ + file://udhcpd.conf \
Please put those in a separe udhcpd-conf (or similarly named) recipe
Quoted 33 lines
file://99-hokey-pokey.rules \ file://hokey-pokey.sh \recipes-ti/beagleboard/gadget-init.bb +3
-0+ file://bone-gmass-eject.rules \ + file://g-storage-reinsert.sh \ + file://g-ether-insert.sh \ "
do_install(){recipes-ti/beagleboard/gadget-init.bb +1
-1@@ -23,10 +29,10 @@ do_install() { install -d ${D}${sysconfdir}/udev/rules.d install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir} install -d ${D}${bindir} install -m 0755 ${WORKDIR}/*.sh ${D}${bindir} - }FILES_${PN} = "${base_libdir}/systemd ${sysconfdir} ${bindir}"
recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file +1
-0@@ -0,0 +1 @@ +SUBSYSTEM=="block",ACTION=="change",KERNEL=="mmcblk0p1",RUN+="/usr/sbin/g-ether-insert.sh"recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +0
-0
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 4
Quoted 4 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +4
-0@@ -0,0 +1,11 @@ +#!/bin/sh +if [ -a /sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file ] +then + x=`cat /sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file`
please use $() instead of ``
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 5
Quoted 1 line
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +1
-0+ if [ "$x" == "" ]
use -z ?
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh line 1
Quoted 13 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +6
-0+ then + /bin/systemctl stop storage-gadget-init.service + /bin/systemctl start network-gadget-init.service + /bin/systemctl start udhcpd.service + fi +firecipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +1
-0@@ -0,0 +1,4 @@ +#!/bin/bash
/bin/sh please
Quoted 9 lines
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +3
-0+/bin/systemctl stop storage-gadget-init.service +/bin/systemctl stop network-gadget-init.service +/bin/systemctl start storage-gadget-init.servicerecipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +0
-0
recipes-ti/beagleboard/gadget-init/network-gadget-init.service line 7
Quoted 7 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +7
-0@@ -0,0 +1,9 @@ +[Unit] +Description=Start USB Ethernet gadget +Conflicts=storage-gadget-init.service + +[Service] +RemainAfterExit=yes +ExecStart=/sbin/modprobe g_ether host_addr=00:dc:c8:f7:75:05 dev_addr=00:dd:dc:eb:6d:f1
This is going to break with >1 bone connect, please remove the addresses
Quoted 33 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +2
-0+ExecStartPost=/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252 +ExecStop=/sbin/rmmod g_etherrecipes-ti/beagleboard/gadget-init/storage-gadget-init.service +0
-0@@ -3,7 +3,9 @@ Description=Start usb mass storage gadgetAfter=dev-mmcblk0p1.device
[Service]
+RemainAfterExit=yes
ExecStart=/sbin/modprobeg_mass_storagefile=/dev/mmcblk0p1 cdrom=0 stall=0 removable=1 nofua=1 +ExecStop=/sbin/rmmodg_mass_storage[Install]
WantedBy=basic.targetrecipes-ti/beagleboard/gadget-init/udhcpd.conf new file +5
-0@@ -0,0 +1,5 @@ +start 192.168.7.1 +end 192.168.7.1 +interface usb0 +max_leases 1 +option subnet 255.255.255.252recipes-ti/beagleboard/gadget-init/udhcpd.service new file +0
-0
recipes-ti/beagleboard/gadget-init/udhcpd.service line 3
Quoted 3 lines
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +3
-0@@ -0,0 +1,11 @@ +[Unit] +Description=DHCP server for USB0 network gadget +After=sys-devices-platform-omap-ti81xx\x2dusbss-musb\x2dhdrc.0-gadget-net-usb0.device
Please don't hardcode bone specific stuff in this generic udhcp recipe. The script seems to take care of ordering anyway
regards,
Koen
Quoted 55 lines
-----Original Message-----
From: Koen Kooi [mailto:[email protected]]
Sent: Wednesday, November 09, 2011 10:07 AM
To: Fernandes, Joel A
Cc: [email protected]
Subject: Re: [meta-ti] [PATCH] gadget-init: Add network-gadget services and other fixesOp 9 nov. 2011, om 17:02 heeft Joel A Fernandes het volgende geschreven:
Quoted 37 lines
* Add rule to start network-gadget when mass storage is ejected
* Add network-gadget-init service and scripts to switch tog_ether
* Add DHCP service / conf
* Update to storage-gadget: rmmod on stopSigned-off-by Joel A Fernandes <[email protected]>---
recipes-ti/beagleboard/gadget-init.bb | 10 ++++++++-- .../beagleboard/gadget-init/bone-gmass-eject.rules | 1 + .../beagleboard/gadget-init/g-ether-insert.sh | 11 +++++++++++ .../beagleboard/gadget-init/g-storage-reinsert.sh | 4 ++++ .../gadget-init/network-gadget-init.service | 9 +++++++++ .../gadget-init/storage-gadget-init.service | 2 ++ recipes-ti/beagleboard/gadget-init/udhcpd.conf | 5 +++++ recipes-ti/beagleboard/gadget-init/udhcpd.service | 11 +++++++++++ 8 files changed, 51 insertions(+), 2 deletions(-) create mode 100644recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules create mode 100755
recipes-ti/beagleboard/gadget-init/g-ether-insert.shcreate mode 100755recipes-ti/beagleboard/gadget-init/g-storage-reinsert.shcreate mode 100644 recipes-ti/beagleboard/gadget-init/network-gadget-init.service create mode 100644recipes-ti/beagleboard/gadget-init/udhcpd.confcreate mode 100644 recipes-ti/beagleboard/gadget-init/udhcpd.servicerecipes-ti/beagleboard/gadget-init.bb +0
-0@@ -1,6 +1,6 @@DESCRIPTION = "Units to initialize usb gadgets"
recipes-ti/beagleboard/gadget-init.bb +1
-1-PR = "r3" +PR = "r4"Quoted 2 lines
LICENSE = "MIT"
LIC_FILES_CHKSUM="file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
Quoted 3 lines
recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -9,8 +9,14 @@ COMPATIBLE_MACHINE = "(ti33x)"
PACKAGE_ARCH= "${MACHINE_ARCH}"
Quoted 6 lines
recipes-ti/beagleboard/gadget-init.bb COMPATIBLE_MACHINE = "(ti33x)" · line 14
Quoted 4 lines
SRC_URI= "file://storage-gadget-init.service \recipes-ti/beagleboard/gadget-init.bb +3
-0+ file://network-gadget-init.service \ + file://udhcpd.service \ + file://udhcpd.conf \Please put those in a separe udhcpd-conf (or similarly named) recipe
[Joel]. I feel this service and conf should be here as it is specific to the the g-ether gadget configuration.
If you strongly believe otherwise, can you suggest a location for this recipe? recipes-ti/beagleboard? recipes-misc?
Quoted 43 lines
Quoted 21 lines
file://99-hokey-pokey.rules \ file://hokey-pokey.sh \recipes-ti/beagleboard/gadget-init.bb +3
-0+ file://bone-gmass-eject.rules \ + file://g-storage-reinsert.sh \ + file://g-ether-insert.sh \ "
do_install(){recipes-ti/beagleboard/gadget-init.bb +1
-1@@ -23,10 +29,10 @@ do_install() { install -d ${D}${sysconfdir}/udev/rules.d install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir} install -d ${D}${bindir} install -m 0755 ${WORKDIR}/*.sh ${D}${bindir} - }FILES_${PN} = "${base_libdir}/systemd ${sysconfdir} ${bindir}"
Review
Quoted 1 line
(quoted diff) +0
-0eject.rules
recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules
Quoted 7 lines
b/recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file mode 100644
index 0000000..fa5d627recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file +0
-0@@ -0,0 +1 @@+SUBSYSTEM=="block",ACTION=="change",KERNEL=="mmcblk0p1",RUN+="/usr/sbi
n/g-ether-insert.sh"recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 3
Quoted 10 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +3
-0@@ -0,0 +1,11 @@ +#!/bin/sh +if [ -a +/sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file] then
Quoted 5 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 5
Quoted 2 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +2
-0+ x=`cat +/sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file`
please use $() instead of ``
[Joel] OK.
Quoted 4 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 5
Quoted 2 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +1
-0+ if [ "$x" == "" ]use -z ?
[Joel] OK.
Quoted 17 lines
Quoted 14 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +6
-0+ then + /bin/systemctl stop storage-gadget-init.service + /bin/systemctl start network-gadget-init.service + /bin/systemctl start udhcpd.service + fi +firecipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +0
-0recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh line 1
Quoted 1 line
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +1
-0@@ -0,0 +1,4 @@ +#!/bin/bash
/bin/shplease
[Joel] OK.
Quoted 15 lines
Quoted 15 lines
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +3
-0+/bin/systemctl stop storage-gadget-init.service /bin/systemctl stop +network-gadget-init.service /bin/systemctl start +storage-gadget-init.servicediff --git a/recipes-ti/beagleboard/gadget-init/network-gadget-init.service b/recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file mode 100644
index 0000000..0a03898recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +3
-0@@ -0,0 +1,9 @@ +[Unit] +Description=Start USB Ethernet gadget +Conflicts=storage-gadget-init.service
Quoted 8 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service
Quoted 5 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +5
-0+ +[Service] +RemainAfterExit=yes +ExecStart=/sbin/modprobe g_ether host_addr=00:dc:c8:f7:75:05 +dev_addr=00:dd:dc:eb:6d:f1This is going to break with >1 bone connect, please remove the addresses
[Joel] Could explain a little more about ">1 bone" connect?
Quoted 43 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service line 9
Quoted 1 line
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +1
-0+ExecStartPost=/sbin/ifconfig usb0 192.168.7.2 netmask255.255.255.252
Quoted 37 lines
+ExecStop=/sbin/rmmod
g_ether
diff --git a/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service b/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service index 2fe48e1..9a8513e 100644recipes-ti/beagleboard/gadget-init/storage-gadget-init.service +0
-0@@ -3,7 +3,9 @@ Description=Start usb mass storage gadgetAfter=dev-mmcblk0p1.device
[Service]
+RemainAfterExit=yes
ExecStart=/sbin/modprobeg_mass_storagefile=/dev/mmcblk0p1 cdrom=0 stall=0 removable=1 nofua=1
+ExecStop=/sbin/rmmodg_mass_storage[Install]
WantedBy=basic.targetrecipes-ti/beagleboard/gadget-init/udhcpd.conf new file +5
-0@@ -0,0 +1,5 @@ +start 192.168.7.1 +end 192.168.7.1 +interface usb0 +max_leases 1 +option subnet 255.255.255.252recipes-ti/beagleboard/gadget-init/udhcpd.service new file +0
-0recipes-ti/beagleboard/gadget-init/udhcpd.service line 3
Quoted 3 lines
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +3
-0@@ -0,0 +1,11 @@ +[Unit] +Description=DHCP server for USB0 network gadget +After=sys-devices-platform-omap-ti81xx\x2dusbss-musb\x2dhdrc.0-gadget
Quoted 4 lines
recipes-ti/beagleboard/gadget-init/udhcpd.service line 4
Quoted 1 line
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +1
-0+-net-usb0.devicePlease don't hardcode bone specific stuff in this generic udhcp recipe. The script seems to take care of ordering anyway
[Joel] OK.
Jason though of asking your opinion as your wrote this ervice, is there any other reason you hardcoded this? Will removing it above have any affect that you were seeing?
Thanks,
Joel
Quoted 213 lines · Joel A
Quoted 55 lines
-----Original Message-----
From: Koen Kooi [mailto:[email protected]]
Sent: Wednesday, November 09, 2011 10:07 AM
To: Fernandes, Joel A
Cc: [email protected]
Subject: Re: [meta-ti] [PATCH] gadget-init: Add network-gadget services and other fixesOp 9 nov. 2011, om 17:02 heeft Joel A Fernandes het volgende geschreven:
Quoted 37 lines
* Add rule to start network-gadget when mass storage is ejected
* Add network-gadget-init service and scripts to switch tog_ether
* Add DHCP service / conf
* Update to storage-gadget: rmmod on stopSigned-off-by Joel A Fernandes <[email protected]>---
recipes-ti/beagleboard/gadget-init.bb | 10 ++++++++-- .../beagleboard/gadget-init/bone-gmass-eject.rules | 1 +.../beagleboard/gadget-init/g-ether-insert.sh| 11 +++++++++++.../beagleboard/gadget-init/g-storage-reinsert.sh| 4 ++++ .../gadget-init/network-gadget-init.service | 9 +++++++++ .../gadget-init/storage-gadget-init.service | 2 ++recipes-ti/beagleboard/gadget-init/udhcpd.conf| 5 +++++ recipes-ti/beagleboard/gadget-init/udhcpd.service | 11 +++++++++++8 files changed, 51 insertions(+), 2 deletions(-) create mode 100644recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules create mode 100755
recipes-ti/beagleboard/gadget-init/g-ether-insert.shcreate mode 100755recipes-ti/beagleboard/gadget-init/g-storage-reinsert.shcreate mode 100644 recipes-ti/beagleboard/gadget-init/network-gadget-init.service create mode 100644recipes-ti/beagleboard/gadget-init/udhcpd.confcreate mode 100644 recipes-ti/beagleboard/gadget-init/udhcpd.servicerecipes-ti/beagleboard/gadget-init.bb +0
-0@@ -1,6 +1,6 @@DESCRIPTION = "Units to initialize usb gadgets"
recipes-ti/beagleboard/gadget-init.bb +1
-1-PR = "r3" +PR = "r4"Quoted 2 lines
LICENSE = "MIT"
LIC_FILES_CHKSUM="file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
Quoted 3 lines
recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -9,8 +9,14 @@ COMPATIBLE_MACHINE = "(ti33x)"
PACKAGE_ARCH= "${MACHINE_ARCH}"Quoted 6 lines
Quoted 4 lines
SRC_URI= "file://storage-gadget-init.service \
+ file://network-gadget-init.service \
+ file://udhcpd.service \
+ file://udhcpd.conf \Please put those in a separe udhcpd-conf (or similarly named) recipe
[Joel]. I feel this service and conf should be here as it is specific to the the g-ether gadget configuration.
If you strongly believe otherwise, can you suggest a location for this recipe? recipes-ti/beagleboard? recipes-misc?
Quoted 43 lines
Quoted 15 lines
file://99-hokey-pokey.rules \
file://hokey-pokey.sh \
+ file://bone-gmass-eject.rules \
+ file://g-storage-reinsert.sh \
+ file://g-ether-insert.sh \
"
do_install(){recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -23,10 +29,10 @@ do_install() {install -d ${D}${sysconfdir}/udev/rules.d
install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d
+ install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir}Review
Quoted 7 lines
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/*.sh ${D}${bindir}
-
}FILES_${PN} = "${base_libdir}/systemd ${sysconfdir} ${bindir}"
(quoted diff) +0
-0eject.rules
recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules
Quoted 7 lines
b/recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file mode 100644
index 0000000..fa5d627recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file +0
-0@@ -0,0 +1 @@+SUBSYSTEM=="block",ACTION=="change",KERNEL=="mmcblk0p1",RUN+="/usr/sbi
n/g-ether-insert.sh"recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 3
Quoted 10 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +3
-0@@ -0,0 +1,11 @@ +#!/bin/sh +if [ -a +/sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file] then
Quoted 5 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 5
Quoted 2 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +2
-0+ x=`cat +/sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file`
please use $() instead of ``
[Joel] OK.
Quoted 4 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 5
Quoted 2 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +1
-0+ if [ "$x" == "" ]use -z ?
[Joel] OK.
Quoted 17 lines
Quoted 14 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +6
-0+ then + /bin/systemctl stop storage-gadget-init.service + /bin/systemctl start network-gadget-init.service + /bin/systemctl start udhcpd.service + fi +firecipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +0
-0recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh line 1
Quoted 1 line
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +1
-0@@ -0,0 +1,4 @@ +#!/bin/bash
/bin/shplease[Joel] OK.
Quoted 15 lines
Quoted 15 lines
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +3
-0+/bin/systemctl stop storage-gadget-init.service /bin/systemctl stop +network-gadget-init.service /bin/systemctl start +storage-gadget-init.servicediff --git a/recipes-ti/beagleboard/gadget-init/network-gadget-init.service b/recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file mode 100644
index 0000000..0a03898recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +3
-0@@ -0,0 +1,9 @@ +[Unit] +Description=Start USB Ethernet gadget +Conflicts=storage-gadget-init.serviceQuoted 8 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service
Quoted 5 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +5
-0+ +[Service] +RemainAfterExit=yes +ExecStart=/sbin/modprobe g_ether host_addr=00:dc:c8:f7:75:05 +dev_addr=00:dd:dc:eb:6d:f1This is going to break with >1 bone connect, please remove the addresses
[Joel] Could explain a little more about ">1 bone" connect?
Quoted 43 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service line 9
Quoted 1 line
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +1
-0+ExecStartPost=/sbin/ifconfig usb0 192.168.7.2 netmask255.255.255.252
Quoted 37 lines
+ExecStop=/sbin/rmmod
g_ether
diff --git a/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service b/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service index 2fe48e1..9a8513e 100644recipes-ti/beagleboard/gadget-init/storage-gadget-init.service +0
-0@@ -3,7 +3,9 @@ Description=Start usb mass storage gadgetAfter=dev-mmcblk0p1.device
[Service]
+RemainAfterExit=yes
ExecStart=/sbin/modprobeg_mass_storagefile=/dev/mmcblk0p1 cdrom=0 stall=0 removable=1 nofua=1
+ExecStop=/sbin/rmmodg_mass_storage[Install]
WantedBy=basic.targetrecipes-ti/beagleboard/gadget-init/udhcpd.conf new file +5
-0@@ -0,0 +1,5 @@ +start 192.168.7.1 +end 192.168.7.1 +interface usb0 +max_leases 1 +option subnet 255.255.255.252recipes-ti/beagleboard/gadget-init/udhcpd.service new file +0
-0recipes-ti/beagleboard/gadget-init/udhcpd.service line 3
Quoted 3 lines
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +3
-0@@ -0,0 +1,11 @@ +[Unit] +Description=DHCP server for USB0 network gadget +After=sys-devices-platform-omap-ti81xx\x2dusbss-musb\x2dhdrc.0-gadget
Quoted 7 lines
Quoted 4 lines
recipes-ti/beagleboard/gadget-init/udhcpd.service line 4
Quoted 1 line
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +1
-0+-net-usb0.devicePlease don't hardcode bone specific stuff in this generic udhcp recipe. The script seems to take care of ordering anyway
[Joel] OK.
Jason though of asking your opinion as your wrote this ervice, is there any other reason you hardcoded this? Will removing it above have any affect that you were seeing?
This isn't a generic udhcp recipe. It should probably just be renamed. It is specifically for the point of providing addresses to the other end of the USB network gadget.
I haven't tried without it. Please remove it and see if it has an impact.
Quoted 8 lines
Thanks,
Joel
_______________________________________________
meta-ti mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-ti
Quoted 249 lines
-----Original Message-----
From: Jason Kridner [mailto:[email protected]]
Sent: Wednesday, November 09, 2011 10:29 AM
To: Fernandes, Joel A
Cc: Koen Kooi; [email protected]
Subject: Re: [meta-ti] [PATCH] gadget-init: Add network-gadget services and other fixesQuoted 6 lines · Joel A
Quoted 6 lines
-----Original Message-----
From: Koen Kooi [mailto:[email protected]]
Sent: Wednesday, November 09, 2011 10:07 AM
To: Fernandes, Joel A
Cc: [email protected]
Subject: Re: [meta-ti] [PATCH] gadget-init: Add network-gadgetservices
Quoted 6 lines
Quoted 6 lines
and other fixes
Op 9 nov. 2011, om 17:02 heeft Joel A Fernandes het volgende geschreven:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
* Add rule to start network-gadget when mass storage is ejected
* Add network-gadget-init service and scripts to switch tog_ether
* Add DHCP service / conf
* Update to storage-gadget: rmmod on stopSigned-off-by Joel A Fernandes <[email protected]>---
recipes-ti/beagleboard/gadget-init.bb | 10++++++++--
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.../beagleboard/gadget-init/bone-gmass-eject.rules | 1 +
.../beagleboard/gadget-init/g-ether-insert.sh| 11+++++++++++
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
.../beagleboard/gadget-init/g-storage-reinsert.sh| 4 ++++ .../gadget-init/network-gadget-init.service | 9+++++++++
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
.../gadget-init/storage-gadget-init.service | 2 ++
recipes-ti/beagleboard/gadget-init/udhcpd.conf| 5 +++++ recipes-ti/beagleboard/gadget-init/udhcpd.service | 11+++++++++++
Quoted 1 line
Quoted 1 line
Quoted 1 line
8 files changed, 51 insertions(+), 2 deletions(-) create mode100644
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules create mode 100755
recipes-ti/beagleboard/gadget-init/g-ether-insert.shcreate mode 100755recipes-ti/beagleboard/gadget-init/g-storage-reinsert.shcreate mode 100644 recipes-ti/beagleboard/gadget-init/network-gadget-init.service create mode 100644recipes-ti/beagleboard/gadget-init/udhcpd.confcreate mode 100644 recipes-ti/beagleboard/gadget-
init/udhcpd.serviceQuoted 18 lines
Quoted 18 lines
Quoted 12 lines
recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -1,6 +1,6 @@DESCRIPTION = "Units to initialize usb gadgets"
recipes-ti/beagleboard/gadget-init.bb +1
-1-PR = "r3" +PR = "r4"Quoted 2 lines
LICENSE = "MIT"
LIC_FILES_CHKSUM="file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
Quoted 3 lines
recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -9,8 +9,14 @@ COMPATIBLE_MACHINE = "(ti33x)"
PACKAGE_ARCH= "${MACHINE_ARCH}"Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
SRC_URI= "file://storage-gadget-init.service \
+ file://network-gadget-init.service \
+ file://udhcpd.service \
+ file://udhcpd.conf \Please put those in a separe udhcpd-conf (or similarly named) recipe
[Joel]. I feel this service and conf should be here as it is specific
to the the g-ether gadget configuration.
Quoted 2 lines
If you strongly believe otherwise, can you suggest a location for
this recipe? recipes-ti/beagleboard? recipes-misc?
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
file://99-hokey-pokey.rules \
file://hokey-pokey.sh \
+ file://bone-gmass-eject.rules \
+ file://g-storage-reinsert.sh \
+ file://g-ether-insert.sh \
"Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
do_install(){recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -23,10 +29,10 @@ do_install() {install -d ${D}${sysconfdir}/udev/rules.d
install -m 0644 ${WORKDIR}/*.rules${D}${sysconfdir}/udev/rules.d
Quoted 10 lines
Quoted 10 lines
Review
Quoted 9 lines
+ install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir}
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/*.sh ${D}${bindir}
-
}FILES_${PN} = "${base_libdir}/systemd ${sysconfdir} ${bindir}"
(quoted diff) +0
-0eject.rules
Quoted 8 lines
Quoted 8 lines
recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules
Quoted 7 lines
b/recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file mode 100644
index 0000000..fa5d627recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file +0
-0@@ -0,0 +1 @@+SUBSYSTEM=="block",ACTION=="change",KERNEL=="mmcblk0p1",RUN+="/usr/sbi
Quoted 11 lines
Quoted 11 lines
n/g-ether-insert.sh"recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 3
Quoted 10 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +3
-0@@ -0,0 +1,11 @@ +#!/bin/sh +if [ -a +/sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file
Quoted 17 lines
Quoted 6 lines
] then
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 5
Quoted 2 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +2
-0+ x=`cat +/sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file`
please use $() instead of ``
[Joel] OK.
Quoted 4 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 5
Quoted 2 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +1
-0+ if [ "$x" == "" ]use -z ?
[Joel] OK.
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Review
Quoted 7 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +6
-0+ then + /bin/systemctl stop storage-gadget-init.service + /bin/systemctl start network-gadget-init.service + /bin/systemctl start udhcpd.service + fi +fi(quoted diff) +0
-0
reinsert.shQuoted 10 lines
Quoted 9 lines
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh line 1
Quoted 7 lines
b/recipes-ti/beagleboard/gadget-init/g-storage-reinsert.shnew file mode 100755
index 0000000..546b438recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +1
-0@@ -0,0 +1,4 @@ +#!/bin/bash
/bin/shpleaseQuoted 4 lines
[Joel] OK.
Quoted 2 lines
Quoted 2 lines
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +1
-0+/bin/systemctl stop storage-gadget-init.service /bin/systemctlstop
Quoted 9 lines
Quoted 9 lines
recipes-ti/beagleboard/gadget-init/network-gadget-
Quoted 9 lines
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +2
-0+network-gadget-init.service /bin/systemctl start +storage-gadget-init.servicediff --git a/recipes-ti/beagleboard/gadget-init/network-gadget-init.service b/recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file mode 100644
index 0000000..0a03898recipes-ti/beagleboard/gadget-init/network-gadget- new file +0
-0init.service
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
recipes-ti/beagleboard/gadget-init/network-gadget- new file +3
-0@@ -0,0 +1,9 @@ +[Unit] +Description=Start USB Ethernet gadget +Conflicts=storage-gadget-init.serviceQuoted 8 lines
recipes-ti/beagleboard/gadget-init/network-gadget- line 8
Quoted 5 lines
recipes-ti/beagleboard/gadget-init/network-gadget- new file +5
-0+ +[Service] +RemainAfterExit=yes +ExecStart=/sbin/modprobe g_ether host_addr=00:dc:c8:f7:75:05 +dev_addr=00:dd:dc:eb:6d:f1This is going to break with >1 bone connect, please remove the addresses
[Joel] Could explain a little more about ">1 bone" connect?
Quoted 8 lines
Quoted 8 lines
recipes-ti/beagleboard/gadget-init/network-gadget- line 9
Quoted 1 line
recipes-ti/beagleboard/gadget-init/network-gadget- new file +1
-0+ExecStartPost=/sbin/ifconfig usb0 192.168.7.2 netmask255.255.255.252
Quoted 6 lines
+ExecStop=/sbin/rmmod
g_ether
diff --git a/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service b/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service index 2fe48e1..9a8513e 100644
--- a/recipes-ti/beagleboard/gadget-init/storage-gadget-init.service
Quoted 1 line
Quoted 1 line
Quoted 1 line
+++ b/recipes-ti/beagleboard/gadget-init/storage-gadget-
init.service
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
recipes-ti/beagleboard/gadget-init/network-gadget- new file +0
-0@@ -3,7 +3,9 @@ Description=Start usb mass storage gadgetAfter=dev-mmcblk0p1.device
[Service]
+RemainAfterExit=yes
ExecStart=/sbin/modprobeg_mass_storagefile=/dev/mmcblk0p1cdrom=0
Quoted 28 lines
Quoted 28 lines
Quoted 24 lines
stall=0 removable=1 nofua=1
+ExecStop=/sbin/rmmodg_mass_storage[Install]
WantedBy=basic.targetrecipes-ti/beagleboard/gadget-init/udhcpd.conf new file +5
-0@@ -0,0 +1,5 @@ +start 192.168.7.1 +end 192.168.7.1 +interface usb0 +max_leases 1 +option subnet 255.255.255.252recipes-ti/beagleboard/gadget-init/udhcpd.service new file +0
-0recipes-ti/beagleboard/gadget-init/udhcpd.service line 3
Quoted 3 lines
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +3
-0@@ -0,0 +1,11 @@ +[Unit] +Description=DHCP server for USB0 network gadget +After=sys-devices-platform-omap-ti81xx\x2dusbss-musb\x2dhdrc.0-gadget
Quoted 3 lines
Quoted 3 lines
recipes-ti/beagleboard/gadget-init/udhcpd.service line 4
Quoted 1 line
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +1
-0+-net-usb0.devicePlease don't hardcode bone specific stuff in this generic udhcp
recipe.
Quoted 2 lines
Quoted 1 line
The script seems to take care of ordering anyway
Quoted 8 lines
Quoted 2 lines
[Joel] OK.
Jason though of asking your opinion as your wrote this ervice, isthere any other reason you hardcoded this? Will removing it above have any affect that you were seeing?
This isn't a generic udhcp recipe. It should probably just be renamed. It is specifically for the point of providing addresses to the other end of the USB network gadget.
Can we avoid making a new create for udhcpc then? I just feel it is overkill and this simple service/conf can go in this same recipe. I am ok with renaming the config and service files to gether-dhcp or the like. Let us know your opinion so we can collectively take a call on how to go about doing it.
Thanks,
Joel
Op 9 nov. 2011, om 17:32 heeft Fernandes, Joel A het volgende geschreven:
Quoted 6 lines
Quoted 4 lines
This isn't a generic udhcp recipe. It should probably just be renamed. It is specifically for the point of providing addresses to the other end of the USB network gadget.
Can we avoid making a new create for udhcpc then? I just feel it is overkill and this simple service/conf can go in this same recipe. I am ok with renaming the config and service files to gether-dhcp or the like. Let us know your opinion so we can collectively take a call on how to go about doing it.
Think of what happens when you want to install a package with another udhcpc config, do you want to wipe out the gstorage setting as well in that case? All this needs to be modularized so people can mix&match, having a single big blob is not going to give a nice user experience. And as you might have guessed, I'm not too sold on including both the g_ether and gstorage in on package (they can share the same recipe, though).
In the end it's Jasons call how nice things need to be before we apply the patch. I must warn that anytime we said "we'll fix it after the deadline" for beagle stuff we never managed to fix it, the most recent example being uLCD support.
regards,
Koen
Quoted 7 lines · Koen Kooi
Op 9 nov. 2011, om 17:32 heeft Fernandes, Joel A het volgende geschreven:
Quoted 5 lines
Quoted 4 lines
This isn't a generic udhcp recipe. It should probably just be renamed. It is specifically for the point of providing addresses to the other end of the USB network gadget.
Quoted 5 lines
Quoted 1 line
Can we avoid making a new create for udhcpc then? I just feel it is overkill and this simple service/conf can go in this same recipe. I am ok with renaming the config and service files to gether-dhcp or the like. Let us know your opinion so we can collectively take a call on how to go about doing it.
Think of what happens when you want to install a package with another udhcpc config, do you want to wipe out the gstorage setting as well in that case? All this needs to be modularized so people can mix&match, having a single big blob is not going to give a nice user experience. And as you might have guessed, I'm not too sold on including both the
g_etherand gstorage in on package (they can share the same recipe, though).In the end it's Jasons call how nice things need to be before we apply the patch. I must warn that anytime we said "we'll fix it after the deadline" for beagle stuff we never managed to fix it, the most recent example being uLCD support.
I'll call Gerald and try to buy more time, but we need some more concrete suggestions on how to make it clean. I think this whole g_ether --> g_storage experience is rather Bone specific and rather integrated. The best thing from my perspective is to be able to easily replace it with more generic parts by disabling this whole experience easily.
I'm DOA on Cloud9 right now anyway. The one guy who was responding has now stopped responding, so I'm going to e-mail a couple of contacts there.
Quoted 12 lines
regards,
Koen
-----BEGIN PGP SIGNATURE-----iEYEARECAAYFAk66rcsACgkQMkyGM64RGpF2NQCfRVbFeUrFPGaJmaVVC/W/GQvh 9w0An0JpZmO4e0dQjOjeCJqvK5Q5deAh
=aYbJ
-----END PGP SIGNATURE-----
Quoted 118 lines · Koen Kooi
Op 9 nov. 2011, om 17:02 heeft Joel A Fernandes het volgende geschreven:
Quoted 38 lines
* Add rule to start network-gadget when mass storage is ejected
* Add network-gadget-init service and scripts to switch tog_ether
* Add DHCP service / conf
* Update to storage-gadget: rmmod on stopSigned-off-by Joel A Fernandes <[email protected]>---
recipes-ti/beagleboard/gadget-init.bb | 10 ++++++++-- .../beagleboard/gadget-init/bone-gmass-eject.rules | 1 +.../beagleboard/gadget-init/g-ether-insert.sh| 11 +++++++++++.../beagleboard/gadget-init/g-storage-reinsert.sh| 4 ++++ .../gadget-init/network-gadget-init.service | 9 +++++++++ .../gadget-init/storage-gadget-init.service | 2 ++recipes-ti/beagleboard/gadget-init/udhcpd.conf| 5 +++++ recipes-ti/beagleboard/gadget-init/udhcpd.service | 11 +++++++++++8 files changed, 51 insertions(+), 2 deletions(-)create mode 100644 recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules create mode 100755
recipes-ti/beagleboard/gadget-init/g-ether-insert.shcreate mode 100755recipes-ti/beagleboard/gadget-init/g-storage-reinsert.shcreate mode 100644 recipes-ti/beagleboard/gadget-init/network-gadget-init.service create mode 100644recipes-ti/beagleboard/gadget-init/udhcpd.confcreate mode 100644 recipes-ti/beagleboard/gadget-init/udhcpd.servicerecipes-ti/beagleboard/gadget-init.bb +0
-0@@ -1,6 +1,6 @@DESCRIPTION = "Units to initialize usb gadgets"
recipes-ti/beagleboard/gadget-init.bb +1
-1-PR = "r3" +PR = "r4"LICENSE = "MIT"
LIC_FILES_CHKSUM= "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -9,8 +9,14 @@ COMPATIBLE_MACHINE = "(ti33x)"
PACKAGE_ARCH= "${MACHINE_ARCH}"Quoted 4 lines
SRC_URI= "file://storage-gadget-init.service \
+ file://network-gadget-init.service \
+ file://udhcpd.service \
+ file://udhcpd.conf \Please put those in a separe udhcpd-conf (or similarly named) recipe
Quoted 33 lines
file://99-hokey-pokey.rules \
file://hokey-pokey.sh \
+ file://bone-gmass-eject.rules \
+ file://g-storage-reinsert.sh \
+ file://g-ether-insert.sh \
"
do_install(){recipes-ti/beagleboard/gadget-init.bb +0
-0@@ -23,10 +29,10 @@ do_install() {install -d ${D}${sysconfdir}/udev/rules.d
install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d
+ install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir}install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/*.sh ${D}${bindir} -
}FILES_${PN} = "${base_libdir}/systemd ${sysconfdir} ${bindir}"
recipes-ti/beagleboard/gadget-init/bone-gmass-eject.rules new file +1
-0@@ -0,0 +1 @@ +SUBSYSTEM=="block",ACTION=="change",KERNEL=="mmcblk0p1",RUN+="/usr/sbin/g-ether-insert.sh"recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +0
-0recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 4
Quoted 4 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +4
-0@@ -0,0 +1,11 @@ +#!/bin/sh +if [ -a /sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file ] +then + x=`cat /sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.0/gadget/lun0/file`please use $() instead of ``
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh line 5
Quoted 1 line
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +1
-0+ if [ "$x" == "" ]use -z ?
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh line 1
Quoted 13 lines
recipes-ti/beagleboard/gadget-init/g-ether-insert.sh new file +6
-0+ then + /bin/systemctl stop storage-gadget-init.service + /bin/systemctl start network-gadget-init.service + /bin/systemctl start udhcpd.service + fi +firecipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +1
-0@@ -0,0 +1,4 @@ +#!/bin/bash
/bin/shpleaseQuoted 10 lines
recipes-ti/beagleboard/gadget-init/g-storage-reinsert.sh new file +3
-0+/bin/systemctl stop storage-gadget-init.service +/bin/systemctl stop network-gadget-init.service +/bin/systemctl start storage-gadget-init.servicerecipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +1
-0@@ -0,0 +1,9 @@ +[Unit]
Quoted 8 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service line 7
Quoted 6 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +6
-0+Description=Start USB Ethernet gadget +Conflicts=storage-gadget-init.service + +[Service] +RemainAfterExit=yes +ExecStart=/sbin/modprobe g_ether host_addr=00:dc:c8:f7:75:05 dev_addr=00:dd:dc:eb:6d:f1This is going to break with >1 bone connect, please remove the addresses
I would prefer to not have it coming up with a new MAC address every time. How hard would it be to pull the MAC address from the EEPROM or from the 2nd port of the switch? Not much time on this, so we need a quick solution.
There is also the solution that went into the BeagleBoard/-xM based on the die-ID.
All of these approaches sound time consuming. Given that the same MAC address is only one of our problems, since these boards will also be providing the same DHCP addresses, is it worth trying to fix today?
Quoted 56 lines
Quoted 34 lines
recipes-ti/beagleboard/gadget-init/network-gadget-init.service new file +2
-0+ExecStartPost=/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252 +ExecStop=/sbin/rmmod g_etherrecipes-ti/beagleboard/gadget-init/storage-gadget-init.service +0
-0@@ -3,7 +3,9 @@ Description=Start usb mass storage gadgetAfter=dev-mmcblk0p1.device
[Service]
+RemainAfterExit=yes
ExecStart=/sbin/modprobeg_mass_storagefile=/dev/mmcblk0p1 cdrom=0 stall=0 removable=1 nofua=1 +ExecStop=/sbin/rmmodg_mass_storage[Install]
WantedBy=basic.targetrecipes-ti/beagleboard/gadget-init/udhcpd.conf new file +5
-0@@ -0,0 +1,5 @@ +start 192.168.7.1 +end 192.168.7.1 +interface usb0 +max_leases 1 +option subnet 255.255.255.252recipes-ti/beagleboard/gadget-init/udhcpd.service new file +0
-0recipes-ti/beagleboard/gadget-init/udhcpd.service line 3
Quoted 3 lines
recipes-ti/beagleboard/gadget-init/udhcpd.service new file +3
-0@@ -0,0 +1,11 @@ +[Unit] +Description=DHCP server for USB0 network gadget +After=sys-devices-platform-omap-ti81xx\x2dusbss-musb\x2dhdrc.0-gadget-net-usb0.devicePlease don't hardcode bone specific stuff in this generic udhcp recipe. The script seems to take care of ordering anyway
regards,
Koen
-----BEGIN PGP SIGNATURE-----iEYEARECAAYFAk66pS0ACgkQMkyGM64RGpGDpACgjdEv4CKi6yWiMQBLhY9ubtRr nOMAn1YI92KWpivo38dBN5t/WxL7QNok
=lUEv
-----END PGP SIGNATURE-----_______________________________________________
meta-ti mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-ti