From: Johannes Zink <j.zink@pengutronix.de>
To: distrokit@pengutronix.de
Cc: Johannes Zink <j.zink@pengutronix.de>, jzi@pengutronix.de
Subject: [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A
Date: Fri, 24 Mar 2023 19:28:43 +0100 [thread overview]
Message-ID: <20230324182845.500894-2-j.zink@pengutronix.de> (raw)
In-Reply-To: <20230324182845.500894-1-j.zink@pengutronix.de>
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 <j.zink@pengutronix.de>
---
.../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
@@ -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
--
2.30.2
next prev parent reply other threads:[~2023-03-24 18:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 18:28 [DistroKit] [PATCH 0/3] Auto-Enable Android Fastboot Gadget for some boards Johannes Zink
2023-03-24 18:28 ` Johannes Zink [this message]
2023-03-24 18:42 ` [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A Ahmad Fatoum
2023-03-24 18:28 ` [DistroKit] [PATCH 2/3] v7a: am335x: autostart usb fastboot and ACM gadget on AM335x boards Johannes Zink
2023-03-24 18:28 ` [DistroKit] [PATCH 3/3] v7a: stm32mp1: " Johannes Zink
2023-03-24 18:42 ` Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230324182845.500894-2-j.zink@pengutronix.de \
--to=j.zink@pengutronix.de \
--cc=distrokit@pengutronix.de \
--cc=jzi@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox