From owner-svn-src-head@freebsd.org Tue Jun 12 16:45:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C248B1005A0E; Tue, 12 Jun 2018 16:45:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 67D056DBD0; Tue, 12 Jun 2018 16:45:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45B0154BF; Tue, 12 Jun 2018 16:45:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5CGjru7099366; Tue, 12 Jun 2018 16:45:53 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5CGjrMM099365; Tue, 12 Jun 2018 16:45:53 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201806121645.w5CGjrMM099365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 12 Jun 2018 16:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335004 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 335004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2018 16:45:54 -0000 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