Oh and right. What D.R.Polstra outlines seems to work with systemd. What I
explained will work with sysv for sure, but not so sure for systemd. Even
though systemd is supposed to be backwards compatible with sysv blah blah
blah . . .

On Fri, Jul 10, 2015 at 1:25 PM, William Hermans <[email protected]> wrote:

> heh ! No worries Phil I was mostly just giving you a hard time. As I've
> seen some vids you've done( reverse engineering, friend had vids ), and
> they were pretty good :)
>
> On Fri, Jul 10, 2015 at 10:12 AM, Philip Polstra <[email protected]>
> wrote:
>
>> Sorry, I just pasted in my script that does way more so you could see the
>> syntax for creating mass storage device.  Shows how to keep other devices
>> from going away.  Part of my BBB based writeblocker for defcon.
>>
>> On Fri, Jul 10, 2015, 12:45 PM William Hermans <[email protected]> wrote:
>>
>>> wow Phil, way to over complicate g_multi heh.
>>>
>>> nano /etc/modules -> add 'g_multi file=/path/to/sdcard'
>>>
>>> No quotes.
>>>
>>> The above is persistent, and by its self requires a system restart in
>>> order to become 'active' However you can also use modprobe to load the
>>> module without a restart. Using the exact same parameters. Like this:
>>>
>>> $ sudo modprobe g_multi file=/path/to/sdcard
>>>
>>> So for the inexperienced. g_multi will load all three USB gadget
>>> drivers. Equivalents to g_mass_storage, g_ether, and g_serial. In order to
>>> use the other gadgets, they must be configured. Also, for what it is worth,
>>> only one gadget driver can be loaded / used at a time. Hence the need for
>>> g_multi.
>>>
>>>
>>> On Fri, Jul 10, 2015 at 6:44 AM, Philip Polstra <[email protected]>
>>> wrote:
>>>
>>>> You want to use the USB gadget to export the SD Card filesystem.  This
>>>> is similar to something I'm doing for an upcoming DEFCON talk.  Here is the
>>>> script for that talk:
>>>>
>>>> #!/bin/bash
>>>> # stop the GETTY service if needed
>>>> if which 'systemctl' ; then
>>>>   systemctl stop [email protected] >/dev/null
>>>> fi
>>>> # unload current composite gadget
>>>> modprobe -r g_multi
>>>> # these variables are used to export all partitions
>>>> fstr=""
>>>> rostr=""
>>>> # unmount the USB drive
>>>> for d in $(ls /dev/sd*) ; do
>>>>   if  echo "$d" | egrep '[1-9]$' >/dev/null ; then
>>>>     umount $d
>>>>     fstr+=",$d"
>>>>     rostr+=",1"
>>>>   fi
>>>> done
>>>> fstr=${fstr:1} # strip leading comma
>>>> rostr=${rostr:1} # strip leading comma
>>>> echo "$fstr" >/tmp/usbexports # save for later r/w export
>>>>
>>>> # now export it
>>>> vend=$(( 0x1337 )) # pick your favorite vid/pid
>>>> prod=$(( 0x1337 ))
>>>> echo "$vend" >/tmp/usbvend # save vid/pid for r/w export
>>>> echo "$prod" >/tmp/usbprod
>>>> modprobe g_multi file=$fstr cdrom=0 stall=0 ro=$rostr \
>>>>   removable=1 nofua=1 idVendor=$vend idProduct=$prod
>>>>
>>>>
>>>> On Fri, Jul 10, 2015 at 9:26 AM <[email protected]> wrote:
>>>>
>>>>> I have a new BBB with Debian. I want the SD Card to appear on the USB
>>>>> port (to Host) rather than the internal memory. I find references to
>>>>> uDev.txt and modifying other files related to boot but it seems like it;s
>>>>> more for the pre Debain stuff.  I have the card formatted and when I ssh
>>>>> in, I can see it mounted in /media so I am that far. I put a iDev.txt on
>>>>> that card. What else do I change?
>>>>>
>>>>> Thanks
>>>>>
>>>>> -Jim
>>>>>
>>>>> --
>>>>> For more options, visit http://beagleboard.org/discuss
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "BeagleBoard" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>  --
>>>> For more options, visit http://beagleboard.org/discuss
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "BeagleBoard" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>> For more options, visit http://beagleboard.org/discuss
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "BeagleBoard" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to