DistroKit Mailinglist
 help / color / mirror / Atom feed
* [DistroKit] [PATCH 0/3] Auto-Enable Android Fastboot Gadget for some boards
@ 2023-03-24 18:28 Johannes Zink
  2023-03-24 18:28 ` [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A Johannes Zink
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Johannes Zink @ 2023-03-24 18:28 UTC (permalink / raw)
  To: distrokit; +Cc: jzi

Hi,

this series configures the barebox default environment for the Radxa ROCK 3A,
AM335x Boards and STM32MP1 Boards for automatically starting an Android
Fastboot [1] and ACM USB gadget.

Android Fastboot can be used to flash the SD-Card or eMMC of the
respective boards or to load kernel, dtb and initramfs to RAM over USB.

Android Fastboot is particularly useful for loading images and development
in situations, where network boot is not a viable option.
The ACM gadget mirrors the barebox serial console over USB, which is
useful when no serial port over UART is available.

Best regards
Johannes

Johannes Zink (3):
  v8a: rock3a: autostart usb fastboot and ACM gadget on rock3a
  v7a: am335x: autostart usb fastboot and ACM gadget on AM335x boards
  v7a: stm32mp1: autostart usb fastboot and ACM gadget on AM335x boards

 .../barebox-am335x-defaultenv/nv/fastboot.bbu |  1 +
 .../nv/fastboot.partitions                    |  1 +
 .../nv/usbgadget.acm                          |  1 +
 .../nv/usbgadget.autostart                    |  1 +
 .../nv/fastboot.bbu                           |  1 +
 .../nv/fastboot.partitions                    |  1 +
 .../nv/global.usbgadget.autostart             |  1 +
 configs/platform-v7a/barebox-stm32mp.config   |  2 +-
 .../platform-v7a/barebox-stm32mp.config.diff  |  1 -
 .../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 +
 15 files changed, 40 insertions(+), 3 deletions(-)
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.bbu
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.partitions
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.acm
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.autostart
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart
 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

--
2.30.2




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A
  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
  2023-03-24 18:42   ` 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
  2 siblings, 1 reply; 6+ messages in thread
From: Johannes Zink @ 2023-03-24 18:28 UTC (permalink / raw)
  To: distrokit; +Cc: Johannes Zink, jzi

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [DistroKit] [PATCH 2/3] v7a: am335x: autostart usb fastboot and ACM gadget on AM335x boards
  2023-03-24 18:28 [DistroKit] [PATCH 0/3] Auto-Enable Android Fastboot Gadget for some boards Johannes Zink
  2023-03-24 18:28 ` [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A Johannes Zink
@ 2023-03-24 18:28 ` Johannes Zink
  2023-03-24 18:28 ` [DistroKit] [PATCH 3/3] v7a: stm32mp1: " Johannes Zink
  2 siblings, 0 replies; 6+ messages in thread
From: Johannes Zink @ 2023-03-24 18:28 UTC (permalink / raw)
  To: distrokit; +Cc: Johannes Zink, jzi

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.

While at it: also enable the ACM USB Gadget, which exposes a serial console
over USB.

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
 configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.bbu   | 1 +
 .../barebox-am335x-defaultenv/nv/fastboot.partitions             | 1 +
 configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.acm  | 1 +
 .../barebox-am335x-defaultenv/nv/usbgadget.autostart             | 1 +
 4 files changed, 4 insertions(+)
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.bbu
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.partitions
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.acm
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.autostart

diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.bbu b/configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.bbu
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.bbu
@@ -0,0 +1 @@
+1
diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.partitions b/configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.partitions
new file mode 100644
index 000000000000..9171adf1e984
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/fastboot.partitions
@@ -0,0 +1 @@
+/dev/mmc0(sd)o,dev/mmc1(emmc),/kernel(kernel)c,/initramfs(initramfs)c,/oftree(oftree)c
diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.acm b/configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.acm
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.acm
@@ -0,0 +1 @@
+1
diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.autostart b/configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.autostart
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/usbgadget.autostart
@@ -0,0 +1 @@
+1
-- 
2.30.2




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [DistroKit] [PATCH 3/3] v7a: stm32mp1: autostart usb fastboot and ACM gadget on AM335x boards
  2023-03-24 18:28 [DistroKit] [PATCH 0/3] Auto-Enable Android Fastboot Gadget for some boards Johannes Zink
  2023-03-24 18:28 ` [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A Johannes Zink
  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 ` Johannes Zink
  2023-03-24 18:42   ` Ahmad Fatoum
  2 siblings, 1 reply; 6+ messages in thread
From: Johannes Zink @ 2023-03-24 18:28 UTC (permalink / raw)
  To: distrokit; +Cc: Johannes Zink, jzi

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.

While at it: also enable the ACM USB Gadget, which exposes a serial
console over USB and enable OEM commands.

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu | 1 +
 .../barebox-stm32mp-defaultenv/nv/fastboot.partitions           | 1 +
 .../barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart    | 1 +
 configs/platform-v7a/barebox-stm32mp.config                     | 2 +-
 configs/platform-v7a/barebox-stm32mp.config.diff                | 1 -
 5 files changed, 4 insertions(+), 2 deletions(-)
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart

diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu
@@ -0,0 +1 @@
+1
diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions
new file mode 100644
index 000000000000..6f45b2161843
--- /dev/null
+++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions
@@ -0,0 +1 @@
+/dev/mmc0(sd)o,/dev/mmc1(mmc),/kernel(kernel)c,/initramfs(initramfs)c,/oftree(oftree)c
diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart
@@ -0,0 +1 @@
+1
diff --git a/configs/platform-v7a/barebox-stm32mp.config b/configs/platform-v7a/barebox-stm32mp.config
index 8a6f6d9474d2..1366849a85a2 100644
--- a/configs/platform-v7a/barebox-stm32mp.config
+++ b/configs/platform-v7a/barebox-stm32mp.config
@@ -219,7 +219,7 @@ CONFIG_EXTERNAL_DTS_FRAGMENTS=""
 # Android Fastboot
 #
 # CONFIG_FASTBOOT_SPARSE is not set
-# CONFIG_FASTBOOT_CMD_OEM is not set
+CONFIG_FASTBOOT_CMD_OEM=y
 # end of Android Fastboot
 # end of General Settings
 
diff --git a/configs/platform-v7a/barebox-stm32mp.config.diff b/configs/platform-v7a/barebox-stm32mp.config.diff
index 42950765f911..1ec6300e636d 100644
--- a/configs/platform-v7a/barebox-stm32mp.config.diff
+++ b/configs/platform-v7a/barebox-stm32mp.config.diff
@@ -49,7 +49,6 @@ CONFIG_DRIVER_SERIAL_STM32=y
 # CONFIG_DRIVER_SPI_LITEX_SPIFLASH is undefined
 CONFIG_EEPROM_AT24=y
 # CONFIG_EEPROM_AT25 is undefined
-# CONFIG_FASTBOOT_CMD_OEM is not set
 # CONFIG_FASTBOOT_SPARSE is not set
 # CONFIG_FIRMWARE_ALTERA_SERIAL is undefined
 # CONFIG_FS_JFFS2 is undefined
-- 
2.30.2




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [DistroKit] [PATCH 3/3] v7a: stm32mp1: autostart usb fastboot and ACM gadget on AM335x boards
  2023-03-24 18:28 ` [DistroKit] [PATCH 3/3] v7a: stm32mp1: " Johannes Zink
@ 2023-03-24 18:42   ` Ahmad Fatoum
  0 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2023-03-24 18:42 UTC (permalink / raw)
  To: Johannes Zink, distrokit; +Cc: jzi

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.
> 
> While at it: also enable the ACM USB Gadget, which exposes a serial
> console over USB and enable OEM commands.
> 
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> ---
>  configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu | 1 +
>  .../barebox-stm32mp-defaultenv/nv/fastboot.partitions           | 1 +
>  .../barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart    | 1 +
>  configs/platform-v7a/barebox-stm32mp.config                     | 2 +-
>  configs/platform-v7a/barebox-stm32mp.config.diff                | 1 -
>  5 files changed, 4 insertions(+), 2 deletions(-)
>  create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu
>  create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions
>  create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart
> 
> diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu
> new file mode 100644
> index 000000000000..d00491fd7e5b
> --- /dev/null
> +++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.bbu
> @@ -0,0 +1 @@
> +1
> diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions
> new file mode 100644
> index 000000000000..6f45b2161843
> --- /dev/null
> +++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/fastboot.partitions
> @@ -0,0 +1 @@
> +/dev/mmc0(sd)o,/dev/mmc1(mmc),/kernel(kernel)c,/initramfs(initramfs)c,/oftree(oftree)c

The MC1 and EV1 have an eMMC, but the DK1/DK2 doesn't. Should we make mmc optional?

Nitpick: I'd have preferred emmc instead of mmc, because mmc is sometimes used
to refer to both (e.g. in the names of the barebox /dev files).

> diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart
> new file mode 100644
> index 000000000000..d00491fd7e5b
> --- /dev/null
> +++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/global.usbgadget.autostart
> @@ -0,0 +1 @@
> +1
> diff --git a/configs/platform-v7a/barebox-stm32mp.config b/configs/platform-v7a/barebox-stm32mp.config
> index 8a6f6d9474d2..1366849a85a2 100644
> --- a/configs/platform-v7a/barebox-stm32mp.config
> +++ b/configs/platform-v7a/barebox-stm32mp.config
> @@ -219,7 +219,7 @@ CONFIG_EXTERNAL_DTS_FRAGMENTS=""
>  # Android Fastboot
>  #
>  # CONFIG_FASTBOOT_SPARSE is not set

Can you enable sparse support? Flashing without it can be quite slow.

> -# CONFIG_FASTBOOT_CMD_OEM is not set
> +CONFIG_FASTBOOT_CMD_OEM=y
>  # end of Android Fastboot
>  # end of General Settings
>  
> diff --git a/configs/platform-v7a/barebox-stm32mp.config.diff b/configs/platform-v7a/barebox-stm32mp.config.diff
> index 42950765f911..1ec6300e636d 100644
> --- a/configs/platform-v7a/barebox-stm32mp.config.diff
> +++ b/configs/platform-v7a/barebox-stm32mp.config.diff
> @@ -49,7 +49,6 @@ CONFIG_DRIVER_SERIAL_STM32=y
>  # CONFIG_DRIVER_SPI_LITEX_SPIFLASH is undefined
>  CONFIG_EEPROM_AT24=y
>  # CONFIG_EEPROM_AT25 is undefined
> -# CONFIG_FASTBOOT_CMD_OEM is not set
>  # CONFIG_FASTBOOT_SPARSE is not set
>  # CONFIG_FIRMWARE_ALTERA_SERIAL is undefined
>  # CONFIG_FS_JFFS2 is undefined

-- 
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 |




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A
  2023-03-24 18:28 ` [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A Johannes Zink
@ 2023-03-24 18:42   ` Ahmad Fatoum
  0 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2023-03-24 18:42 UTC (permalink / raw)
  To: Johannes Zink, distrokit; +Cc: jzi

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 <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

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 |




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-24 18:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 18:28 [DistroKit] [PATCH 0/3] Auto-Enable Android Fastboot Gadget for some boards Johannes Zink
2023-03-24 18:28 ` [DistroKit] [PATCH 1/3] v8a: rock3a: autostart usb fastboot and ACM gadget on ROCK 3A Johannes Zink
2023-03-24 18:42   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox