From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 24 Mar 2023 19:42:27 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pfmMs-00DS13-Hs for lore@lore.pengutronix.de; Fri, 24 Mar 2023 19:42:27 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pfmMs-0001db-IT; Fri, 24 Mar 2023 19:42:26 +0100 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pfmMq-0001Ra-Aw; Fri, 24 Mar 2023 19:42:24 +0100 Message-ID: Date: Fri, 24 Mar 2023 19:42:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Content-Language: en-US To: Johannes Zink , distrokit@pengutronix.de References: <20230324182845.500894-1-j.zink@pengutronix.de> <20230324182845.500894-2-j.zink@pengutronix.de> From: Ahmad Fatoum In-Reply-To: <20230324182845.500894-2-j.zink@pengutronix.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jzi@pengutronix.de Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Hello Johannes, On 24.03.23 19:28, Johannes Zink wrote: > This allows the board to be booted by supplying kernel, oftree and initramfs > over usb fastboot. This is particularly useful for board bringup and testing > in situations where network boot is not possible. Also, it may be used to flash > the SD card or eMMC (if fitted). While at, also improve the netboot target in > such that tftboot and nfsroot are used if available. > > While at it: also autostart the ACM USB Gadget, which exposes a serial > console over USB. > > Signed-off-by: Johannes Zink > --- > .../barebox-rock3a-defaultenv/boot/net | 28 +++++++++++++++++++ > .../barebox-rock3a-defaultenv/init/bootsource | 1 - > .../barebox-rock3a-defaultenv/nv/fastboot.bbu | 1 + > .../nv/fastboot.partitions | 1 + > .../nv/usbgadget.acm | 1 + > .../nv/usbgadget.autostart | 1 + > 6 files changed, 32 insertions(+), 1 deletion(-) > create mode 100644 configs/platform-v8a/barebox-rock3a-defaultenv/boot/net > create mode 100644 configs/platform-v8a/barebox-rock3a-defaultenv/nv/fastboot.bbu > create mode 100644 configs/platform-v8a/barebox-rock3a-defaultenv/nv/fastboot.partitions > create mode 100644 configs/platform-v8a/barebox-rock3a-defaultenv/nv/usbgadget.acm > create mode 100644 configs/platform-v8a/barebox-rock3a-defaultenv/nv/usbgadget.autostart > > diff --git a/configs/platform-v8a/barebox-rock3a-defaultenv/boot/net b/configs/platform-v8a/barebox-rock3a-defaultenv/boot/net > new file mode 100644 > index 000000000000..e79432eb277c > --- /dev/null > +++ b/configs/platform-v8a/barebox-rock3a-defaultenv/boot/net This is part of the default barebox environment. Why duplicate it? > @@ -0,0 +1,28 @@ > +#!/bin/sh > + > +path="/mnt/tftp" > + > +# global.net.server and global.hostname may be set by DHCP, so trigger it first > +ifup -a > + > +global.bootm.image="${path}/${global.user}-linux-${global.hostname}" > + > +oftree="${path}/${global.user}-oftree-${global.hostname}" > +if [ -f "${oftree}" ]; then > + global.bootm.oftree="$oftree" > +fi > + > +host ${global.net.server} nfsserver > +if [ $? != 0 ]; then > + echo "Cannot resolve \"${global.net.server}\"" > + exit 1 > +fi > + > +initramfs="${path}/${global.user}-initramfs-${global.hostname}" > +if [ -f "${initramfs}" ]; then > + global.bootm.initrd="$initramfs" > +else > + nfsroot="${nfsserver}:/home/${global.user}/nfsroot/${global.hostname}" > + ip_route_get -b ${global.net.server} global.linux.bootargs.dyn.ip > + global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,v3,tcp" > +fi > diff --git a/configs/platform-v8a/barebox-rock3a-defaultenv/init/bootsource b/configs/platform-v8a/barebox-rock3a-defaultenv/init/bootsource > index 6a3bb42ba3af..5a227bbf8927 100644 > --- a/configs/platform-v8a/barebox-rock3a-defaultenv/init/bootsource > +++ b/configs/platform-v8a/barebox-rock3a-defaultenv/init/bootsource > @@ -9,6 +9,5 @@ if [ "$bootsource" = mmc ]; then > global.boot.default="mmc$bootsource_instance net" > of_property -df mmc0 sd-uhs-sdr104 > elif [ "$bootsource" = "spi-nor" ]; then > - usbgadget -A '/dev/mmc0(sd)' > global.autoboot=abort > fi > diff --git a/configs/platform-v8a/barebox-rock3a-defaultenv/nv/fastboot.bbu b/configs/platform-v8a/barebox-rock3a-defaultenv/nv/fastboot.bbu > new file mode 100644 > index 000000000000..d00491fd7e5b > --- /dev/null > +++ b/configs/platform-v8a/barebox-rock3a-defaultenv/nv/fastboot.bbu > @@ -0,0 +1 @@ > +1 > diff --git a/configs/platform-v8a/barebox-rock3a-defaultenv/nv/fastboot.partitions b/configs/platform-v8a/barebox-rock3a-defaultenv/nv/fastboot.partitions > new file mode 100644 > index 000000000000..a67f90305dd6 > --- /dev/null > +++ b/configs/platform-v8a/barebox-rock3a-defaultenv/nv/fastboot.partitions > @@ -0,0 +1 @@ > +/dev/mmc0(sd)o,/dev/mmc1(emmc)o,/tmp/kernel(kernel)c,/tmp/initramfs(initramfs)c,/tmp/oftree(oftree)c > diff --git a/configs/platform-v8a/barebox-rock3a-defaultenv/nv/usbgadget.acm b/configs/platform-v8a/barebox-rock3a-defaultenv/nv/usbgadget.acm > new file mode 100644 > index 000000000000..d00491fd7e5b > --- /dev/null > +++ b/configs/platform-v8a/barebox-rock3a-defaultenv/nv/usbgadget.acm > @@ -0,0 +1 @@ > +1 > diff --git a/configs/platform-v8a/barebox-rock3a-defaultenv/nv/usbgadget.autostart b/configs/platform-v8a/barebox-rock3a-defaultenv/nv/usbgadget.autostart > new file mode 100644 > index 000000000000..d00491fd7e5b > --- /dev/null > +++ b/configs/platform-v8a/barebox-rock3a-defaultenv/nv/usbgadget.autostart > @@ -0,0 +1 @@ > +1 -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |