Re: svn commit: r335004 - head/release/tools

2018-06-13 Thread Edward Napierala
On 0613T0730, Warner Losh wrote:
> On Wed, Jun 13, 2018 at 6:39 AM, Edward Napierala  wrote:
> 
> > 2018-06-13 12:43 GMT+01:00 Emmanuel Vadot :
> >
> >> On 2018-06-12 18:45, Edward Tomasz Napierala wrote:

[..]

> >> +   echo '# USB OTG virtual serial port' \
> >>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
> >>> +   echo 'ttyU0 "/usr/libexec/getty 3wire"  vt100
> >>>  onifconsole  secure' \
> >>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
> >>> +   echo 'ttyU1 "/usr/libexec/getty 3wire"  vt100
> >>>  onifconsole  secure' \
> >>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
> >>>
> >>
> >>  If I have no OTG port and a usb<->uart plugged into my board that will
> >> give weird result no ?
> >>
> >
> > No, because that port won't be marked as console.  This only applies
> > to the "virtual" OTG serial ports.
> >
> 
> Right, and console is an overloaded term.  Here it just means 'tty marked
> by the kernel that gets a getty started on it automatically after it shows
> up' not 'the device that gets all the kernel I/O.'

Yup.  But again - this reuses the functionality that's already there
in init(8), while avoiding the renaming of device nodes.  And eventually,
those ports might become actual consoles, making things nicely aligned.

[..]

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335004 - head/release/tools

2018-06-13 Thread Warner Losh
On Wed, Jun 13, 2018 at 6:39 AM, Edward Napierala  wrote:

> 2018-06-13 12:43 GMT+01:00 Emmanuel Vadot :
>
>> On 2018-06-12 18:45, Edward Tomasz Napierala wrote:
>>
>>> Author: trasz
>>> Date: Tue Jun 12 16:45:52 2018
>>> New Revision: 335004
>>> URL: https://svnweb.freebsd.org/changeset/base/335004
>>>
>>> Log:
>>>   Enable USB OTG serial terminal on ARM SD card images.  This configures
>>>   the system to make use of USB device mode / USB OTG to provide a
>>> "virtual
>>>   serial port" on release images.
>>>
>>>   Reviewed by:  gjb@
>>>   MFC after:2 weeks
>>>   Relnotes: yes
>>>   Sponsored by: The FreeBSD Foundation
>>>   Differential Revision:https://reviews.freebsd.org/D15602
>>>
>>> Modified:
>>>   head/release/tools/arm.subr
>>>
>>> Modified: head/release/tools/arm.subr
>>> 
>>> ==
>>> --- head/release/tools/arm.subr Tue Jun 12 16:44:13 2018(r335003)
>>> +++ head/release/tools/arm.subr Tue Jun 12 16:45:52 2018(r335004)
>>> @@ -92,6 +92,41 @@ arm_create_user() {
>>> return 0
>>>  }
>>>
>>> +arm_setup_usb_otg() {
>>> +   # Set up virtual serial port over USB OTG / device mode.
>>> +   echo >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '# Required for USB OTG virtual serial port.' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo 'notify 100 {' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  match "system"  "DEVFS";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  match "subsystem"   "CDEV";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  match "type""CREATE";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  match "cdev""ttyU[0-9]+";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '  action "/sbin/init q";' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>> +   echo '};' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>>
>>
>>  This will be wiped after the first update, better create
>> /etc/devd/otg_serial.conf
>>
>
> Thanks, I'll look into that.
>
>
>> +   echo '# USB OTG virtual serial port' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>>> +   echo 'ttyU0 "/usr/libexec/getty 3wire"  vt100
>>>  onifconsole  secure' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>>> +   echo 'ttyU1 "/usr/libexec/getty 3wire"  vt100
>>>  onifconsole  secure' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>>>
>>
>>  If I have no OTG port and a usb<->uart plugged into my board that will
>> give weird result no ?
>>
>
> No, because that port won't be marked as console.  This only applies
> to the "virtual" OTG serial ports.
>

Right, and console is an overloaded term.  Here it just means 'tty marked
by the kernel that gets a getty started on it automatically after it shows
up' not 'the device that gets all the kernel I/O.'


> +   echo '# Configure USB OTG; see usb_template(4).' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>>> +   echo 'hw.usb.template=3' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>>> +   echo 'umodem_load="YES"' \
>>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>>>
>>
>>  I'm not a big fan of always enabling this functionality. Do you have a
>> board that have no uart but an otg port ?
>>
>
> I don't, but this makes it possible to use OTG-enabled boards without
> using the console cable - having to check the pinouts, making sure the
> voltage
> is right etc.  Do you see some problems this might cause?
>

I don't, but I still have the same reservations at the name overloading...

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335004 - head/release/tools

2018-06-13 Thread Edward Napierala
2018-06-13 12:43 GMT+01:00 Emmanuel Vadot :

> On 2018-06-12 18:45, Edward Tomasz Napierala wrote:
>
>> Author: trasz
>> Date: Tue Jun 12 16:45:52 2018
>> New Revision: 335004
>> URL: https://svnweb.freebsd.org/changeset/base/335004
>>
>> Log:
>>   Enable USB OTG serial terminal on ARM SD card images.  This configures
>>   the system to make use of USB device mode / USB OTG to provide a
>> "virtual
>>   serial port" on release images.
>>
>>   Reviewed by:  gjb@
>>   MFC after:2 weeks
>>   Relnotes: yes
>>   Sponsored by: The FreeBSD Foundation
>>   Differential Revision:https://reviews.freebsd.org/D15602
>>
>> Modified:
>>   head/release/tools/arm.subr
>>
>> Modified: head/release/tools/arm.subr
>> 
>> ==
>> --- head/release/tools/arm.subr Tue Jun 12 16:44:13 2018(r335003)
>> +++ head/release/tools/arm.subr Tue Jun 12 16:45:52 2018(r335004)
>> @@ -92,6 +92,41 @@ arm_create_user() {
>> return 0
>>  }
>>
>> +arm_setup_usb_otg() {
>> +   # Set up virtual serial port over USB OTG / device mode.
>> +   echo >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '# Required for USB OTG virtual serial port.' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo 'notify 100 {' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  match "system"  "DEVFS";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  match "subsystem"   "CDEV";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  match "type""CREATE";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  match "cdev""ttyU[0-9]+";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '  action "/sbin/init q";' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>> +   echo '};' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
>>
>
>  This will be wiped after the first update, better create
> /etc/devd/otg_serial.conf
>

Thanks, I'll look into that.


> +   echo '# USB OTG virtual serial port' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>> +   echo 'ttyU0 "/usr/libexec/getty 3wire"  vt100
>>  onifconsole  secure' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>> +   echo 'ttyU1 "/usr/libexec/getty 3wire"  vt100
>>  onifconsole  secure' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
>>
>
>  If I have no OTG port and a usb<->uart plugged into my board that will
> give weird result no ?
>

No, because that port won't be marked as console.  This only applies
to the "virtual" OTG serial ports.


> +   echo '# Configure USB OTG; see usb_template(4).' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>> +   echo 'hw.usb.template=3' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>> +   echo 'umodem_load="YES"' \
>> +   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
>>
>
>  I'm not a big fan of always enabling this functionality. Do you have a
> board that have no uart but an otg port ?
>

I don't, but this makes it possible to use OTG-enabled boards without
using the console cable - having to check the pinouts, making sure the
voltage
is right etc.  Do you see some problems this might cause?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335004 - head/release/tools

2018-06-13 Thread Emmanuel Vadot

On 2018-06-12 18:45, Edward Tomasz Napierala wrote:

Author: trasz
Date: Tue Jun 12 16:45:52 2018
New Revision: 335004
URL: https://svnweb.freebsd.org/changeset/base/335004

Log:
  Enable USB OTG serial terminal on ARM SD card images.  This 
configures
  the system to make use of USB device mode / USB OTG to provide a 
"virtual

  serial port" on release images.

  Reviewed by:  gjb@
  MFC after:2 weeks
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D15602

Modified:
  head/release/tools/arm.subr

Modified: head/release/tools/arm.subr
==
--- head/release/tools/arm.subr Tue Jun 12 16:44:13 2018(r335003)
+++ head/release/tools/arm.subr Tue Jun 12 16:45:52 2018(r335004)
@@ -92,6 +92,41 @@ arm_create_user() {
return 0
 }

+arm_setup_usb_otg() {
+   # Set up virtual serial port over USB OTG / device mode.
+   echo >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '# Required for USB OTG virtual serial port.' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo 'notify 100 {' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "system""DEVFS";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "subsystem" "CDEV";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "type"  "CREATE";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "cdev"  "ttyU[0-9]+";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  action "/sbin/init q";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '};' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf


 This will be wiped after the first update, better create 
/etc/devd/otg_serial.conf



+   echo '# USB OTG virtual serial port' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
+   echo 'ttyU0 "/usr/libexec/getty 3wire"vt100   onifconsole  
secure' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
+   echo 'ttyU1 "/usr/libexec/getty 3wire"vt100   onifconsole  
secure' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys


 If I have no OTG port and a usb<->uart plugged into my board that will 
give weird result no ?



+   echo '# Configure USB OTG; see usb_template(4).' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
+   echo 'hw.usb.template=3' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
+   echo 'umodem_load="YES"' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf


 I'm not a big fan of always enabling this functionality. Do you have a 
board that have no uart but an otg port ?



+}
+
 arm_install_base() {
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${DESTDIR}
eval chroot ${CHROOTDIR} make -C ${WORLDDIR} \
@@ -102,6 +137,7 @@ arm_install_base() {
chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos

arm_create_user
+   arm_setup_usb_otg

echo '# Custom /etc/fstab for FreeBSD embedded images' \
> ${CHROOTDIR}/${DESTDIR}/etc/fstab


--
Emmanuel Vadot  
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335004 - head/release/tools

2018-06-12 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Jun 12 16:45:52 2018
New Revision: 335004
URL: https://svnweb.freebsd.org/changeset/base/335004

Log:
  Enable USB OTG serial terminal on ARM SD card images.  This configures
  the system to make use of USB device mode / USB OTG to provide a "virtual
  serial port" on release images.
  
  Reviewed by:  gjb@
  MFC after:2 weeks
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D15602

Modified:
  head/release/tools/arm.subr

Modified: head/release/tools/arm.subr
==
--- head/release/tools/arm.subr Tue Jun 12 16:44:13 2018(r335003)
+++ head/release/tools/arm.subr Tue Jun 12 16:45:52 2018(r335004)
@@ -92,6 +92,41 @@ arm_create_user() {
return 0
 }
 
+arm_setup_usb_otg() {
+   # Set up virtual serial port over USB OTG / device mode.
+   echo >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '# Required for USB OTG virtual serial port.' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo 'notify 100 {' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "system"  "DEVFS";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "subsystem"   "CDEV";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "type""CREATE";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  match "cdev""ttyU[0-9]+";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '  action "/sbin/init q";' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+   echo '};' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/devd.conf
+
+   echo '# USB OTG virtual serial port' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
+   echo 'ttyU0 "/usr/libexec/getty 3wire"  vt100   onifconsole  
secure' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
+   echo 'ttyU1 "/usr/libexec/getty 3wire"  vt100   onifconsole  
secure' \
+   >> ${CHROOTDIR}/${DESTDIR}/etc/ttys
+
+   echo '# Configure USB OTG; see usb_template(4).' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
+   echo 'hw.usb.template=3' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
+   echo 'umodem_load="YES"' \
+   >> ${CHROOTDIR}/${DESTDIR}/boot/loader.conf
+}
+
 arm_install_base() {
chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${DESTDIR}
eval chroot ${CHROOTDIR} make -C ${WORLDDIR} \
@@ -102,6 +137,7 @@ arm_install_base() {
chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos
 
arm_create_user
+   arm_setup_usb_otg
 
echo '# Custom /etc/fstab for FreeBSD embedded images' \
> ${CHROOTDIR}/${DESTDIR}/etc/fstab
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"