DistroKit Mailinglist
 help / color / mirror / Atom feed
* [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A
@ 2023-06-09 10:28 Johannes Zink
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 1/4] v8a: enable initrd generation Johannes Zink
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Johannes Zink @ 2023-06-09 10:28 UTC (permalink / raw)
  To: distrokit; +Cc: Johannes Zink, patchwork-jzi

This series enables building Android sparse images of kernel, dtb and
initramfs for the Radxa Rock3A, enables mounting corresponding ram-files
as fastboot partitions in the barebox fastboot gadget, and adds support
for booting the image uploaded via fastboot.

This can be useful in situations, where booting a Linux system is
required on such target without touching the nonvolatile storage, e.g.
for debugging purposes.

For uploading kernel, dtb and initramfs use

fastboot flash ram-kernel    platform-v8a/images/linuximage -S 1
fastboot flash ram-oftree    platform-v8a/images/rk3568-rock-3a.dtb -S 1
fastboot flash ram-initramfs platform-v8a/images/initramfs-sparse.img -S 1

then for booting either use the barebox command

boot ram-fastboot

or pass the bootcommand over fastboot from the host via

fastboot oem exec boot ram-fastboot

Best regards
Johannes

To: distrokit@pengutronix.de
Cc: patchwork-jzi@pengutronix.de

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
Changes in v2:
- worked in feedback from Ahmad, Jan and Robert (off-list). Thanks for
  your review and feedback!
  - only support zstd compressed initramfs, drop support for gzip (image
    generation and kernel config)
  - drop generation of android-sparse images. Use -S 1 parameter on
    fastboot command instead to avoid cut-off issues
  - export mmc{0,1,2} as optional partitions with generic names now,
    add init script to detect these partitions on boot
  - rename fastboot partitions {kernel,initramfs,oftree} to
    ram-{kernel,initramfs,oftree} to make their non-permanent state more
    obvious
  - change name of fastboot boot script to ram-fastboot for the same
    reason
  - remove unneeded root=/dev/ram from kernel cmdline for the
    ram-fastboot target
  - update commit messages and cover-letter accordingly
- Link to v1: https://lore.distrokit.org/20230606-default_enable_fastboot_rock3a-v1-0-42195d538df2@pengutronix.de

---
Johannes Zink (4):
      v8a: enable initrd generation
      v8a: kernel: enable initramfs in kernel config
      v8a: barebox: enable loading kernel, dtb and initrd via fastboot
      v8a: barebox: add a boot target for fastboot loaded image files

 .../barebox-common-defaultenv/boot/ram-fastboot           |  7 +++++++
 .../barebox-common-defaultenv/init/detect-mmcs            |  3 +++
 .../barebox-common-defaultenv/nv/fastboot.acm             |  1 +
 .../barebox-common-defaultenv/nv/fastboot.bbu             |  1 +
 .../barebox-common-defaultenv/nv/fastboot.partitions      |  1 +
 .../barebox-common-defaultenv/nv/usbgadget.autostart      |  1 +
 configs/platform-v8a/kernelconfig                         | 15 ++++++++++++---
 configs/platform-v8a/platformconfig                       | 12 +++++++++++-
 8 files changed, 37 insertions(+), 4 deletions(-)
---
base-commit: 282b5aff9aecf141de5040f896a9a10081596350
change-id: 20230606-default_enable_fastboot_rock3a-3223c6b01647

Best regards,
-- 
Johannes Zink <j.zink@pengutronix.de>




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

* [DistroKit] [PATCH v2 1/4] v8a: enable initrd generation
  2023-06-09 10:28 [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
@ 2023-06-09 10:28 ` Johannes Zink
  2023-06-09 13:30   ` Ahmad Fatoum
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 2/4] v8a: kernel: enable initramfs in kernel config Johannes Zink
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Johannes Zink @ 2023-06-09 10:28 UTC (permalink / raw)
  To: distrokit; +Cc: Johannes Zink, patchwork-jzi

also generate rootfs as root.cpio.zstd, as this allows loading it as initramfs.

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>

---

Changes:

v1 -> v2:

 - worked in review feedback from Ahmad and Jan, thanks for your review:
   - dropped gzip generation, only generating zstd compressed cpio now
---
 configs/platform-v8a/platformconfig | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
index 4e479660f6b7..f7101139ee63 100644
--- a/configs/platform-v8a/platformconfig
+++ b/configs/platform-v8a/platformconfig
@@ -261,7 +261,15 @@ PTXCONF_IMAGE_KERNEL_INSTALL_EARLY=y
 
 # PTXCONF_IMAGE_RAUC is not set
 PTXCONF_IMAGE_ROCK3A=y
-# PTXCONF_IMAGE_ROOT_CPIO is not set
+PTXCONF_IMAGE_ROOT_CPIO=y
+# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_NONE is not set
+# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_GZ is not set
+PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD=y
+# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_XZ is not set
+# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_LZOP is not set
+# PTXCONF_IMAGE_ROOT_CPIO_CUSTOM_COMPRESSION is not set
+PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_SUFFIX=".zst"
+PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_UTIL="zstd -T0 -19"
 PTXCONF_IMAGE_ROOT_EXT=y
 PTXCONF_IMAGE_ROOT_EXT_SIZE="125%"
 # PTXCONF_IMAGE_ROOT_EXT_EXT2 is not set
@@ -287,6 +295,7 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
 # end of image creation options        
 
 # PTXCONF_CODE_SIGNING is not set
+PTXCONF_HOST_CMAKE=y
 PTXCONF_HOST_E2FSPROGS=y
 PTXCONF_HOST_FLEX=y
 PTXCONF_HOST_GENEXT2FS=y
@@ -301,6 +310,7 @@ PTXCONF_HOST_M4=y
 PTXCONF_HOST_OPENSSL=y
 PTXCONF_HOST_SYSTEM_BC=y
 PTXCONF_HOST_UTIL_LINUX=y
+PTXCONF_HOST_ZSTD=y
 PTXCONF_FIRMWARE_IMX=y
 # PTXCONF_FIRMWARE_IMX_VPU_IMX27 is not set
 # PTXCONF_FIRMWARE_IMX_VPU_IMX51 is not set

-- 
2.39.2




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

* [DistroKit] [PATCH v2 2/4] v8a: kernel: enable initramfs in kernel config
  2023-06-09 10:28 [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 1/4] v8a: enable initrd generation Johannes Zink
@ 2023-06-09 10:28 ` Johannes Zink
  2023-06-09 13:32   ` Ahmad Fatoum
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot Johannes Zink
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Johannes Zink @ 2023-06-09 10:28 UTC (permalink / raw)
  To: distrokit; +Cc: Johannes Zink, patchwork-jzi

Enable zstd compressed initramfs images for all v8a boards.
This allows to boot an initrd passed to the bootloader without touching
the rootfs on a blockdevice.

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>

---

Changes:

v1 -> v2:
 - as gzip generation was dropped in the previous patch, also drop it in
   the kernel initramfs config. Only zstd is supported for compressed
   initramfs now.
---
 configs/platform-v8a/kernelconfig | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/configs/platform-v8a/kernelconfig b/configs/platform-v8a/kernelconfig
index 3c0fed78de15..090c50b1dc50 100644
--- a/configs/platform-v8a/kernelconfig
+++ b/configs/platform-v8a/kernelconfig
@@ -205,7 +205,15 @@ CONFIG_NET_NS=y
 CONFIG_SCHED_AUTOGROUP=y
 # CONFIG_SYSFS_DEPRECATED is not set
 # CONFIG_RELAY is not set
-# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_RD_GZIP is not set
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+# CONFIG_RD_LZ4 is not set
+CONFIG_RD_ZSTD=y
 # CONFIG_BOOT_CONFIG is not set
 # CONFIG_INITRAMFS_PRESERVE_MTIME is not set
 CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
@@ -6163,9 +6171,9 @@ CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
 CONFIG_LZO_COMPRESS=m
 CONFIG_LZO_DECOMPRESS=m
-CONFIG_ZSTD_COMMON=m
+CONFIG_ZSTD_COMMON=y
 CONFIG_ZSTD_COMPRESS=m
-CONFIG_ZSTD_DECOMPRESS=m
+CONFIG_ZSTD_DECOMPRESS=y
 CONFIG_XZ_DEC=y
 CONFIG_XZ_DEC_X86=y
 CONFIG_XZ_DEC_POWERPC=y
@@ -6176,6 +6184,7 @@ CONFIG_XZ_DEC_SPARC=y
 # CONFIG_XZ_DEC_MICROLZMA is not set
 CONFIG_XZ_DEC_BCJ=y
 # CONFIG_XZ_DEC_TEST is not set
+CONFIG_DECOMPRESS_ZSTD=y
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_INTERVAL_TREE=y
 CONFIG_XARRAY_MULTI=y

-- 
2.39.2




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

* [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
  2023-06-09 10:28 [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 1/4] v8a: enable initrd generation Johannes Zink
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 2/4] v8a: kernel: enable initramfs in kernel config Johannes Zink
@ 2023-06-09 10:28 ` Johannes Zink
  2023-06-09 13:35   ` Ahmad Fatoum
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 4/4] v8a: barebox: add a boot target for fastboot loaded image files Johannes Zink
  2023-06-09 13:29 ` [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Ahmad Fatoum
  4 siblings, 1 reply; 16+ messages in thread
From: Johannes Zink @ 2023-06-09 10:28 UTC (permalink / raw)
  To: distrokit; +Cc: Johannes Zink, patchwork-jzi

This allows to load kernel, dtb and initrd as sparse images to
RAM-files.

While at it, also enable the acm gadget, which exposes the barebox shell
as an USB gadget and autostart the usb gadgets.

Also expose mmc{0,1,2} as fastboot partitions and add init script to
force barebox to detect these devices and have them available for
fastboot.

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>

---

Changes:

v1 -> v2:
 - worked in Ahmad's and Jan's review findings, thanks for your review:
   - use generic names mmc{0,1,2} instead of {sd,emmc, } to allow
     generic reuse of the fastboot partitions across multiple boards
   - use more obvious partition names ram-{kernel,initramfs,oftree} to
   - add init script for detecting /dev/mmc{0,1,2}
---
 configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs       | 3 +++
 configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm        | 1 +
 configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu        | 1 +
 configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions | 1 +
 configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart | 1 +
 5 files changed, 7 insertions(+)

diff --git a/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs b/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs
new file mode 100755
index 000000000000..e3433f6da09f
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+detect mmc0 mmc1 mmc2
diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm
@@ -0,0 +1 @@
+1
diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu
@@ -0,0 +1 @@
+1
diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions
new file mode 100644
index 000000000000..527925e1c58b
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions
@@ -0,0 +1 @@
+/dev/mmc0(mmc0)o,/dev/mmc1(mmc1)o,/dev/mmc2(mmc2)o,/tmp/ram-kernel(ram-kernel)c,/tmp/ram-initramfs(ram-initramfs)c,/tmp/ram-oftree(ram-oftree)c
diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart b/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart
@@ -0,0 +1 @@
+1

-- 
2.39.2




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

* [DistroKit] [PATCH v2 4/4] v8a: barebox: add a boot target for fastboot loaded image files
  2023-06-09 10:28 [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
                   ` (2 preceding siblings ...)
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot Johannes Zink
@ 2023-06-09 10:28 ` Johannes Zink
  2023-06-09 13:36   ` Ahmad Fatoum
  2023-06-09 13:29 ` [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Ahmad Fatoum
  4 siblings, 1 reply; 16+ messages in thread
From: Johannes Zink @ 2023-06-09 10:28 UTC (permalink / raw)
  To: distrokit; +Cc: Johannes Zink, patchwork-jzi

This allows to boot a kernel with dtb and initrd entirely from RAM after
loading it via Android Fastboot by simply calling 'boot ram-fastboot'.

Signed-off-by: Johannes Zink <j.zink@pengutronix.de>

---

Changes:

v1 -> v2:
  - rename boot target fastboot to ram-fastboot to make it more obvious
    that this boots the ram-{kernel,oftree,initrd}.
---
 configs/platform-v8a/barebox-common-defaultenv/boot/ram-fastboot | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/configs/platform-v8a/barebox-common-defaultenv/boot/ram-fastboot b/configs/platform-v8a/barebox-common-defaultenv/boot/ram-fastboot
new file mode 100755
index 000000000000..ff17b2627823
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-defaultenv/boot/ram-fastboot
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+global.bootm.image=/tmp/ram-kernel
+global.bootm.initrd=/tmp/ram-initramfs
+global.bootm.oftree=/tmp/ram-oftree
+
+global.linux.bootargs.dyn.root="rdinit=/sbin/init"

-- 
2.39.2




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

* Re: [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A
  2023-06-09 10:28 [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
                   ` (3 preceding siblings ...)
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 4/4] v8a: barebox: add a boot target for fastboot loaded image files Johannes Zink
@ 2023-06-09 13:29 ` Ahmad Fatoum
  2023-06-09 15:05   ` Johannes Zink
  4 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2023-06-09 13:29 UTC (permalink / raw)
  To: Johannes Zink, distrokit; +Cc: patchwork-jzi

On 09.06.23 12:28, Johannes Zink wrote:
> This series enables building Android sparse images of kernel, dtb and
> initramfs for the Radxa Rock3A, enables mounting corresponding ram-files
> as fastboot partitions in the barebox fastboot gadget, and adds support
> for booting the image uploaded via fastboot.
> 
> This can be useful in situations, where booting a Linux system is
> required on such target without touching the nonvolatile storage, e.g.
> for debugging purposes.
> 
> For uploading kernel, dtb and initramfs use
> 
> fastboot flash ram-kernel    platform-v8a/images/linuximage -S 1
> fastboot flash ram-oftree    platform-v8a/images/rk3568-rock-3a.dtb -S 1
> fastboot flash ram-initramfs platform-v8a/images/initramfs-sparse.img -S 1

Did you find out why -S 1 is needed instead of relying on automatic sparsing?

> then for booting either use the barebox command
> 
> boot ram-fastboot
> 
> or pass the bootcommand over fastboot from the host via
> 
> fastboot oem exec boot ram-fastboot
> 
> Best regards
> Johannes
> 
> To: distrokit@pengutronix.de
> Cc: patchwork-jzi@pengutronix.de
> 
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> ---
> Changes in v2:
> - worked in feedback from Ahmad, Jan and Robert (off-list). Thanks for
>   your review and feedback!
>   - only support zstd compressed initramfs, drop support for gzip (image
>     generation and kernel config)
>   - drop generation of android-sparse images. Use -S 1 parameter on
>     fastboot command instead to avoid cut-off issues
>   - export mmc{0,1,2} as optional partitions with generic names now,
>     add init script to detect these partitions on boot
>   - rename fastboot partitions {kernel,initramfs,oftree} to
>     ram-{kernel,initramfs,oftree} to make their non-permanent state more
>     obvious
>   - change name of fastboot boot script to ram-fastboot for the same
>     reason
>   - remove unneeded root=/dev/ram from kernel cmdline for the
>     ram-fastboot target
>   - update commit messages and cover-letter accordingly
> - Link to v1: https://lore.distrokit.org/20230606-default_enable_fastboot_rock3a-v1-0-42195d538df2@pengutronix.de
> 
> ---
> Johannes Zink (4):
>       v8a: enable initrd generation
>       v8a: kernel: enable initramfs in kernel config
>       v8a: barebox: enable loading kernel, dtb and initrd via fastboot
>       v8a: barebox: add a boot target for fastboot loaded image files
> 
>  .../barebox-common-defaultenv/boot/ram-fastboot           |  7 +++++++
>  .../barebox-common-defaultenv/init/detect-mmcs            |  3 +++
>  .../barebox-common-defaultenv/nv/fastboot.acm             |  1 +
>  .../barebox-common-defaultenv/nv/fastboot.bbu             |  1 +
>  .../barebox-common-defaultenv/nv/fastboot.partitions      |  1 +
>  .../barebox-common-defaultenv/nv/usbgadget.autostart      |  1 +
>  configs/platform-v8a/kernelconfig                         | 15 ++++++++++++---
>  configs/platform-v8a/platformconfig                       | 12 +++++++++++-
>  8 files changed, 37 insertions(+), 4 deletions(-)
> ---
> base-commit: 282b5aff9aecf141de5040f896a9a10081596350
> change-id: 20230606-default_enable_fastboot_rock3a-3223c6b01647
> 
> Best regards,

-- 
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] 16+ messages in thread

* Re: [DistroKit] [PATCH v2 1/4] v8a: enable initrd generation
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 1/4] v8a: enable initrd generation Johannes Zink
@ 2023-06-09 13:30   ` Ahmad Fatoum
  0 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2023-06-09 13:30 UTC (permalink / raw)
  To: Johannes Zink, distrokit; +Cc: patchwork-jzi

On 09.06.23 12:28, Johannes Zink wrote:
> also generate rootfs as root.cpio.zstd, as this allows loading it as initramfs.
> 
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> 
> ---
> 
> Changes:
> 
> v1 -> v2:
> 
>  - worked in review feedback from Ahmad and Jan, thanks for your review:
>    - dropped gzip generation, only generating zstd compressed cpio now
> ---
>  configs/platform-v8a/platformconfig | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
> index 4e479660f6b7..f7101139ee63 100644
> --- a/configs/platform-v8a/platformconfig
> +++ b/configs/platform-v8a/platformconfig
> @@ -261,7 +261,15 @@ PTXCONF_IMAGE_KERNEL_INSTALL_EARLY=y
>  
>  # PTXCONF_IMAGE_RAUC is not set
>  PTXCONF_IMAGE_ROCK3A=y
> -# PTXCONF_IMAGE_ROOT_CPIO is not set
> +PTXCONF_IMAGE_ROOT_CPIO=y
> +# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_NONE is not set
> +# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_GZ is not set
> +PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD=y
> +# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_XZ is not set
> +# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_LZOP is not set
> +# PTXCONF_IMAGE_ROOT_CPIO_CUSTOM_COMPRESSION is not set
> +PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_SUFFIX=".zst"
> +PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_UTIL="zstd -T0 -19"
>  PTXCONF_IMAGE_ROOT_EXT=y
>  PTXCONF_IMAGE_ROOT_EXT_SIZE="125%"
>  # PTXCONF_IMAGE_ROOT_EXT_EXT2 is not set
> @@ -287,6 +295,7 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
>  # end of image creation options        
>  
>  # PTXCONF_CODE_SIGNING is not set
> +PTXCONF_HOST_CMAKE=y
>  PTXCONF_HOST_E2FSPROGS=y
>  PTXCONF_HOST_FLEX=y
>  PTXCONF_HOST_GENEXT2FS=y
> @@ -301,6 +310,7 @@ PTXCONF_HOST_M4=y
>  PTXCONF_HOST_OPENSSL=y
>  PTXCONF_HOST_SYSTEM_BC=y
>  PTXCONF_HOST_UTIL_LINUX=y
> +PTXCONF_HOST_ZSTD=y
>  PTXCONF_FIRMWARE_IMX=y
>  # PTXCONF_FIRMWARE_IMX_VPU_IMX27 is not set
>  # PTXCONF_FIRMWARE_IMX_VPU_IMX51 is not set
> 

-- 
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] 16+ messages in thread

* Re: [DistroKit] [PATCH v2 2/4] v8a: kernel: enable initramfs in kernel config
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 2/4] v8a: kernel: enable initramfs in kernel config Johannes Zink
@ 2023-06-09 13:32   ` Ahmad Fatoum
  2023-06-09 14:35     ` Johannes Zink
  0 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2023-06-09 13:32 UTC (permalink / raw)
  To: Johannes Zink, distrokit; +Cc: patchwork-jzi

On 09.06.23 12:28, Johannes Zink wrote:
> Enable zstd compressed initramfs images for all v8a boards.
> This allows to boot an initrd passed to the bootloader without touching
> the rootfs on a blockdevice.
> 
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> 
> ---
> 
> Changes:
> 
> v1 -> v2:
>  - as gzip generation was dropped in the previous patch, also drop it in
>    the kernel initramfs config. Only zstd is supported for compressed
>    initramfs now.
> ---
>  configs/platform-v8a/kernelconfig | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/configs/platform-v8a/kernelconfig b/configs/platform-v8a/kernelconfig
> index 3c0fed78de15..090c50b1dc50 100644
> --- a/configs/platform-v8a/kernelconfig
> +++ b/configs/platform-v8a/kernelconfig
> @@ -205,7 +205,15 @@ CONFIG_NET_NS=y
>  CONFIG_SCHED_AUTOGROUP=y
>  # CONFIG_SYSFS_DEPRECATED is not set
>  # CONFIG_RELAY is not set
> -# CONFIG_BLK_DEV_INITRD is not set
> +CONFIG_BLK_DEV_INITRD=y

Will probably need exception in configs/bsp.ref.

> +CONFIG_INITRAMFS_SOURCE=""
> +# CONFIG_RD_GZIP is not set
> +# CONFIG_RD_BZIP2 is not set
> +# CONFIG_RD_LZMA is not set
> +# CONFIG_RD_XZ is not set
> +# CONFIG_RD_LZO is not set
> +# CONFIG_RD_LZ4 is not set
> +CONFIG_RD_ZSTD=y
>  # CONFIG_BOOT_CONFIG is not set
>  # CONFIG_INITRAMFS_PRESERVE_MTIME is not set
>  CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
> @@ -6163,9 +6171,9 @@ CONFIG_ZLIB_INFLATE=y
>  CONFIG_ZLIB_DEFLATE=y
>  CONFIG_LZO_COMPRESS=m
>  CONFIG_LZO_DECOMPRESS=m
> -CONFIG_ZSTD_COMMON=m
> +CONFIG_ZSTD_COMMON=y
>  CONFIG_ZSTD_COMPRESS=m
> -CONFIG_ZSTD_DECOMPRESS=m
> +CONFIG_ZSTD_DECOMPRESS=y
>  CONFIG_XZ_DEC=y
>  CONFIG_XZ_DEC_X86=y
>  CONFIG_XZ_DEC_POWERPC=y
> @@ -6176,6 +6184,7 @@ CONFIG_XZ_DEC_SPARC=y
>  # CONFIG_XZ_DEC_MICROLZMA is not set
>  CONFIG_XZ_DEC_BCJ=y
>  # CONFIG_XZ_DEC_TEST is not set
> +CONFIG_DECOMPRESS_ZSTD=y
>  CONFIG_GENERIC_ALLOCATOR=y
>  CONFIG_INTERVAL_TREE=y
>  CONFIG_XARRAY_MULTI=y
> 

-- 
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] 16+ messages in thread

* Re: [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot Johannes Zink
@ 2023-06-09 13:35   ` Ahmad Fatoum
  2023-06-09 14:38     ` Johannes Zink
  0 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2023-06-09 13:35 UTC (permalink / raw)
  To: Johannes Zink, distrokit; +Cc: patchwork-jzi

On 09.06.23 12:28, Johannes Zink wrote:
> This allows to load kernel, dtb and initrd as sparse images to
> RAM-files.
> 
> While at it, also enable the acm gadget, which exposes the barebox shell
> as an USB gadget and autostart the usb gadgets.
> 
> Also expose mmc{0,1,2} as fastboot partitions and add init script to
> force barebox to detect these devices and have them available for
> fastboot.
> 
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> 
> ---
> 
> Changes:
> 
> v1 -> v2:
>  - worked in Ahmad's and Jan's review findings, thanks for your review:
>    - use generic names mmc{0,1,2} instead of {sd,emmc, } to allow
>      generic reuse of the fastboot partitions across multiple boards
>    - use more obvious partition names ram-{kernel,initramfs,oftree} to
>    - add init script for detecting /dev/mmc{0,1,2}
> ---
>  configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs       | 3 +++
>  configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm        | 1 +
>  configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu        | 1 +
>  configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions | 1 +
>  configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart | 1 +
>  5 files changed, 7 insertions(+)
> 
> diff --git a/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs b/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs
> new file mode 100755
> index 000000000000..e3433f6da09f
> --- /dev/null
> +++ b/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs
> @@ -0,0 +1,3 @@
> +#!/bin/sh
> +
> +detect mmc0 mmc1 mmc2

We have a CI test that checks that barebox doesn't print errors. The Rock-3A
in the Pengutronix remote lab has no eMMC fitted, so detecting the MMC host
would throw an error and fail the test, I think. Did you check this?


> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm
> new file mode 100644
> index 000000000000..d00491fd7e5b
> --- /dev/null
> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm
> @@ -0,0 +1 @@
> +1
> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu
> new file mode 100644
> index 000000000000..d00491fd7e5b
> --- /dev/null
> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu
> @@ -0,0 +1 @@
> +1
> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions
> new file mode 100644
> index 000000000000..527925e1c58b
> --- /dev/null
> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions
> @@ -0,0 +1 @@
> +/dev/mmc0(mmc0)o,/dev/mmc1(mmc1)o,/dev/mmc2(mmc2)o,/tmp/ram-kernel(ram-kernel)c,/tmp/ram-initramfs(ram-initramfs)c,/tmp/ram-oftree(ram-oftree)c
> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart b/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart
> new file mode 100644
> index 000000000000..d00491fd7e5b
> --- /dev/null
> +++ b/configs/platform-v8a/barebox-common-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] 16+ messages in thread

* Re: [DistroKit] [PATCH v2 4/4] v8a: barebox: add a boot target for fastboot loaded image files
  2023-06-09 10:28 ` [DistroKit] [PATCH v2 4/4] v8a: barebox: add a boot target for fastboot loaded image files Johannes Zink
@ 2023-06-09 13:36   ` Ahmad Fatoum
  0 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2023-06-09 13:36 UTC (permalink / raw)
  To: Johannes Zink, distrokit; +Cc: patchwork-jzi

On 09.06.23 12:28, Johannes Zink wrote:
> This allows to boot a kernel with dtb and initrd entirely from RAM after
> loading it via Android Fastboot by simply calling 'boot ram-fastboot'.
> 
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> 
> ---
> 
> Changes:
> 
> v1 -> v2:
>   - rename boot target fastboot to ram-fastboot to make it more obvious
>     that this boots the ram-{kernel,oftree,initrd}.
> ---
>  configs/platform-v8a/barebox-common-defaultenv/boot/ram-fastboot | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/configs/platform-v8a/barebox-common-defaultenv/boot/ram-fastboot b/configs/platform-v8a/barebox-common-defaultenv/boot/ram-fastboot
> new file mode 100755
> index 000000000000..ff17b2627823
> --- /dev/null
> +++ b/configs/platform-v8a/barebox-common-defaultenv/boot/ram-fastboot
> @@ -0,0 +1,7 @@
> +#!/bin/sh
> +
> +global.bootm.image=/tmp/ram-kernel
> +global.bootm.initrd=/tmp/ram-initramfs
> +global.bootm.oftree=/tmp/ram-oftree
> +
> +global.linux.bootargs.dyn.root="rdinit=/sbin/init"
> 

-- 
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] 16+ messages in thread

* Re: [DistroKit] [PATCH v2 2/4] v8a: kernel: enable initramfs in kernel config
  2023-06-09 13:32   ` Ahmad Fatoum
@ 2023-06-09 14:35     ` Johannes Zink
  2023-06-09 14:48       ` Robert Schwebel
  0 siblings, 1 reply; 16+ messages in thread
From: Johannes Zink @ 2023-06-09 14:35 UTC (permalink / raw)
  To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi

Hi Ahmad,

On 6/9/23 15:32, Ahmad Fatoum wrote:
> On 09.06.23 12:28, Johannes Zink wrote:
>> Enable zstd compressed initramfs images for all v8a boards.
>> This allows to boot an initrd passed to the bootloader without touching
>> the rootfs on a blockdevice.
>>
>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>
>> ---
>>
>> Changes:
>>
>> v1 -> v2:
>>   - as gzip generation was dropped in the previous patch, also drop it in
>>     the kernel initramfs config. Only zstd is supported for compressed
>>     initramfs now.
>> ---
>>   configs/platform-v8a/kernelconfig | 15 ++++++++++++---
>>   1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/configs/platform-v8a/kernelconfig b/configs/platform-v8a/kernelconfig
>> index 3c0fed78de15..090c50b1dc50 100644
>> --- a/configs/platform-v8a/kernelconfig
>> +++ b/configs/platform-v8a/kernelconfig
>> @@ -205,7 +205,15 @@ CONFIG_NET_NS=y
>>   CONFIG_SCHED_AUTOGROUP=y
>>   # CONFIG_SYSFS_DEPRECATED is not set
>>   # CONFIG_RELAY is not set
>> -# CONFIG_BLK_DEV_INITRD is not set
>> +CONFIG_BLK_DEV_INITRD=y
> 
> Will probably need exception in configs/bsp.ref.

good catch, gonna add it in v3.

Johannes

> 
>> +CONFIG_INITRAMFS_SOURCE=""
>> +# CONFIG_RD_GZIP is not set
>> +# CONFIG_RD_BZIP2 is not set
>> +# CONFIG_RD_LZMA is not set
>> +# CONFIG_RD_XZ is not set
>> +# CONFIG_RD_LZO is not set
>> +# CONFIG_RD_LZ4 is not set
>> +CONFIG_RD_ZSTD=y
>>   # CONFIG_BOOT_CONFIG is not set
>>   # CONFIG_INITRAMFS_PRESERVE_MTIME is not set
>>   CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
>> @@ -6163,9 +6171,9 @@ CONFIG_ZLIB_INFLATE=y
>>   CONFIG_ZLIB_DEFLATE=y
>>   CONFIG_LZO_COMPRESS=m
>>   CONFIG_LZO_DECOMPRESS=m
>> -CONFIG_ZSTD_COMMON=m
>> +CONFIG_ZSTD_COMMON=y
>>   CONFIG_ZSTD_COMPRESS=m
>> -CONFIG_ZSTD_DECOMPRESS=m
>> +CONFIG_ZSTD_DECOMPRESS=y
>>   CONFIG_XZ_DEC=y
>>   CONFIG_XZ_DEC_X86=y
>>   CONFIG_XZ_DEC_POWERPC=y
>> @@ -6176,6 +6184,7 @@ CONFIG_XZ_DEC_SPARC=y
>>   # CONFIG_XZ_DEC_MICROLZMA is not set
>>   CONFIG_XZ_DEC_BCJ=y
>>   # CONFIG_XZ_DEC_TEST is not set
>> +CONFIG_DECOMPRESS_ZSTD=y
>>   CONFIG_GENERIC_ALLOCATOR=y
>>   CONFIG_INTERVAL_TREE=y
>>   CONFIG_XARRAY_MULTI=y
>>
> 

-- 
Pengutronix e.K.                | Johannes Zink                  |
Steuerwalder Str. 21            | https://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] 16+ messages in thread

* Re: [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
  2023-06-09 13:35   ` Ahmad Fatoum
@ 2023-06-09 14:38     ` Johannes Zink
  2023-06-09 14:49       ` Robert Schwebel
  2023-06-09 14:49       ` Ahmad Fatoum
  0 siblings, 2 replies; 16+ messages in thread
From: Johannes Zink @ 2023-06-09 14:38 UTC (permalink / raw)
  To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi

On 6/9/23 15:35, Ahmad Fatoum wrote:
> On 09.06.23 12:28, Johannes Zink wrote:
>> This allows to load kernel, dtb and initrd as sparse images to
>> RAM-files.
>>
>> While at it, also enable the acm gadget, which exposes the barebox shell
>> as an USB gadget and autostart the usb gadgets.
>>
>> Also expose mmc{0,1,2} as fastboot partitions and add init script to
>> force barebox to detect these devices and have them available for
>> fastboot.
>>
>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>
>> ---
>>
>> Changes:
>>
>> v1 -> v2:
>>   - worked in Ahmad's and Jan's review findings, thanks for your review:
>>     - use generic names mmc{0,1,2} instead of {sd,emmc, } to allow
>>       generic reuse of the fastboot partitions across multiple boards
>>     - use more obvious partition names ram-{kernel,initramfs,oftree} to
>>     - add init script for detecting /dev/mmc{0,1,2}
>> ---
>>   configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs       | 3 +++
>>   configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm        | 1 +
>>   configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu        | 1 +
>>   configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions | 1 +
>>   configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart | 1 +
>>   5 files changed, 7 insertions(+)
>>
>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs b/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs
>> new file mode 100755
>> index 000000000000..e3433f6da09f
>> --- /dev/null
>> +++ b/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs
>> @@ -0,0 +1,3 @@
>> +#!/bin/sh
>> +
>> +detect mmc0 mmc1 mmc2
> 
> We have a CI test that checks that barebox doesn't print errors. The Rock-3A
> in the Pengutronix remote lab has no eMMC fitted, so detecting the MMC host
> would throw an error and fail the test, I think. Did you check this?

I did not explicitly check with the CI test. But the barebox error dmesg buffer 
is empty, so I'd assume there should be no problem with this. tbh, I am also 
not quite sure how this could be circumvented - either we abstain from 
detecting the mmcs (which would then cause the fastboot to fail if they have 
not been detected for any other reason), or we have to somehow deal with it, 
maybe by adding a filter in the CI tests.

Johannes

> 
> 
>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm
>> new file mode 100644
>> index 000000000000..d00491fd7e5b
>> --- /dev/null
>> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm
>> @@ -0,0 +1 @@
>> +1
>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu
>> new file mode 100644
>> index 000000000000..d00491fd7e5b
>> --- /dev/null
>> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu
>> @@ -0,0 +1 @@
>> +1
>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions
>> new file mode 100644
>> index 000000000000..527925e1c58b
>> --- /dev/null
>> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions
>> @@ -0,0 +1 @@
>> +/dev/mmc0(mmc0)o,/dev/mmc1(mmc1)o,/dev/mmc2(mmc2)o,/tmp/ram-kernel(ram-kernel)c,/tmp/ram-initramfs(ram-initramfs)c,/tmp/ram-oftree(ram-oftree)c
>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart b/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart
>> new file mode 100644
>> index 000000000000..d00491fd7e5b
>> --- /dev/null
>> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart
>> @@ -0,0 +1 @@
>> +1
>>
> 

-- 
Pengutronix e.K.                | Johannes Zink                  |
Steuerwalder Str. 21            | https://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] 16+ messages in thread

* Re: [DistroKit] [PATCH v2 2/4] v8a: kernel: enable initramfs in kernel config
  2023-06-09 14:35     ` Johannes Zink
@ 2023-06-09 14:48       ` Robert Schwebel
  0 siblings, 0 replies; 16+ messages in thread
From: Robert Schwebel @ 2023-06-09 14:48 UTC (permalink / raw)
  To: Johannes Zink; +Cc: distrokit, Ahmad Fatoum, patchwork-jzi

On Fri, Jun 09, 2023 at 04:35:33PM +0200, Johannes Zink wrote:
> > > +CONFIG_BLK_DEV_INITRD=y
> > 
> > Will probably need exception in configs/bsp.ref.
> 
> good catch, gonna add it in v3.

I'm already testing with a fix on next.

rsc
-- 
Pengutronix e.K.                           | Dipl.-Ing. Robert Schwebel  |
Steuerwalder Str. 21                       | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |



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

* Re: [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
  2023-06-09 14:38     ` Johannes Zink
@ 2023-06-09 14:49       ` Robert Schwebel
  2023-06-09 14:49       ` Ahmad Fatoum
  1 sibling, 0 replies; 16+ messages in thread
From: Robert Schwebel @ 2023-06-09 14:49 UTC (permalink / raw)
  To: Johannes Zink; +Cc: distrokit, Ahmad Fatoum, patchwork-jzi

On Fri, Jun 09, 2023 at 04:38:22PM +0200, Johannes Zink wrote:
> > We have a CI test that checks that barebox doesn't print errors. The Rock-3A
> > in the Pengutronix remote lab has no eMMC fitted, so detecting the MMC host
> > would throw an error and fail the test, I think. Did you check this?
>
> I did not explicitly check with the CI test. But the barebox error dmesg
> buffer is empty, so I'd assume there should be no problem with this. tbh, I
> am also not quite sure how this could be circumvented - either we abstain
> from detecting the mmcs (which would then cause the fastboot to fail if they
> have not been detected for any other reason), or we have to somehow deal
> with it, maybe by adding a filter in the CI tests.

It's building on the jenkins server right now, let's see what happens.

rsc
-- 
Pengutronix e.K.                           | Dipl.-Ing. Robert Schwebel  |
Steuerwalder Str. 21                       | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |



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

* Re: [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
  2023-06-09 14:38     ` Johannes Zink
  2023-06-09 14:49       ` Robert Schwebel
@ 2023-06-09 14:49       ` Ahmad Fatoum
  1 sibling, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2023-06-09 14:49 UTC (permalink / raw)
  To: Johannes Zink, distrokit; +Cc: patchwork-jzi

On 09.06.23 16:38, Johannes Zink wrote:
> On 6/9/23 15:35, Ahmad Fatoum wrote:
>> On 09.06.23 12:28, Johannes Zink wrote:
>>> This allows to load kernel, dtb and initrd as sparse images to
>>> RAM-files.
>>>
>>> While at it, also enable the acm gadget, which exposes the barebox shell
>>> as an USB gadget and autostart the usb gadgets.
>>>
>>> Also expose mmc{0,1,2} as fastboot partitions and add init script to
>>> force barebox to detect these devices and have them available for
>>> fastboot.
>>>
>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>>
>>> ---
>>>
>>> Changes:
>>>
>>> v1 -> v2:
>>>   - worked in Ahmad's and Jan's review findings, thanks for your review:
>>>     - use generic names mmc{0,1,2} instead of {sd,emmc, } to allow
>>>       generic reuse of the fastboot partitions across multiple boards
>>>     - use more obvious partition names ram-{kernel,initramfs,oftree} to
>>>     - add init script for detecting /dev/mmc{0,1,2}
>>> ---
>>>   configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs       | 3 +++
>>>   configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm        | 1 +
>>>   configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu        | 1 +
>>>   configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions | 1 +
>>>   configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart | 1 +
>>>   5 files changed, 7 insertions(+)
>>>
>>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs b/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs
>>> new file mode 100755
>>> index 000000000000..e3433f6da09f
>>> --- /dev/null
>>> +++ b/configs/platform-v8a/barebox-common-defaultenv/init/detect-mmcs
>>> @@ -0,0 +1,3 @@
>>> +#!/bin/sh
>>> +
>>> +detect mmc0 mmc1 mmc2
>>
>> We have a CI test that checks that barebox doesn't print errors. The Rock-3A
>> in the Pengutronix remote lab has no eMMC fitted, so detecting the MMC host
>> would throw an error and fail the test, I think. Did you check this?
> 
> I did not explicitly check with the CI test. But the barebox error dmesg buffer is empty, so I'd assume there should be no problem with this. tbh, I am also not quite sure how this could be circumvented - either we abstain from detecting the mmcs (which would then cause the fastboot to fail if they have not been detected for any other reason), or we have to somehow deal with it, maybe by adding a filter in the CI tests.

If CI is fine with it, I am too. If not, we can revisit.

> 
> Johannes
> 
>>
>>
>>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm
>>> new file mode 100644
>>> index 000000000000..d00491fd7e5b
>>> --- /dev/null
>>> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.acm
>>> @@ -0,0 +1 @@
>>> +1
>>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu
>>> new file mode 100644
>>> index 000000000000..d00491fd7e5b
>>> --- /dev/null
>>> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.bbu
>>> @@ -0,0 +1 @@
>>> +1
>>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions
>>> new file mode 100644
>>> index 000000000000..527925e1c58b
>>> --- /dev/null
>>> +++ b/configs/platform-v8a/barebox-common-defaultenv/nv/fastboot.partitions
>>> @@ -0,0 +1 @@
>>> +/dev/mmc0(mmc0)o,/dev/mmc1(mmc1)o,/dev/mmc2(mmc2)o,/tmp/ram-kernel(ram-kernel)c,/tmp/ram-initramfs(ram-initramfs)c,/tmp/ram-oftree(ram-oftree)c
>>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart b/configs/platform-v8a/barebox-common-defaultenv/nv/usbgadget.autostart
>>> new file mode 100644
>>> index 000000000000..d00491fd7e5b
>>> --- /dev/null
>>> +++ b/configs/platform-v8a/barebox-common-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] 16+ messages in thread

* Re: [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A
  2023-06-09 13:29 ` [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Ahmad Fatoum
@ 2023-06-09 15:05   ` Johannes Zink
  0 siblings, 0 replies; 16+ messages in thread
From: Johannes Zink @ 2023-06-09 15:05 UTC (permalink / raw)
  To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi

On 6/9/23 15:29, Ahmad Fatoum wrote:
> On 09.06.23 12:28, Johannes Zink wrote:
>> This series enables building Android sparse images of kernel, dtb and
>> initramfs for the Radxa Rock3A, enables mounting corresponding ram-files
>> as fastboot partitions in the barebox fastboot gadget, and adds support
>> for booting the image uploaded via fastboot.
>>
>> This can be useful in situations, where booting a Linux system is
>> required on such target without touching the nonvolatile storage, e.g.
>> for debugging purposes.
>>
>> For uploading kernel, dtb and initramfs use
>>
>> fastboot flash ram-kernel    platform-v8a/images/linuximage -S 1
>> fastboot flash ram-oftree    platform-v8a/images/rk3568-rock-3a.dtb -S 1
>> fastboot flash ram-initramfs platform-v8a/images/initramfs-sparse.img -S 1
> 
> Did you find out why -S 1 is needed instead of relying on automatic sparsing?

If I understand it correctly, rather than resparsing we force uploading a 
non-sparse image, as 1 byte is smaller than the sparse chunk header, which 
disables the use of sparse images entirely here. No resparsing - no errors on 
resparsing... Though, I did not walk the entire codepath, I might be wrong with 
this assumption.

I think the original behaviour (failing to resparse the image) is due to the 
handling of the chunks in sparse_file_resparse in libsparse/sparse.cpp, which 
gets the max_len passed from the fastboot's -S parameter or due to the rounding 
functions on block_write or heuristics on how to break up chunks when reading 
the file initially. The libsparse code is, however, not very trivial and I did 
not want to spend too much time on it, as we have a workaround for now.

Johannes

> 
>> then for booting either use the barebox command
>>
>> boot ram-fastboot
>>
>> or pass the bootcommand over fastboot from the host via
>>
>> fastboot oem exec boot ram-fastboot
>>
>> Best regards
>> Johannes
>>
>> To: distrokit@pengutronix.de
>> Cc: patchwork-jzi@pengutronix.de
>>
>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>> ---
>> Changes in v2:
>> - worked in feedback from Ahmad, Jan and Robert (off-list). Thanks for
>>    your review and feedback!
>>    - only support zstd compressed initramfs, drop support for gzip (image
>>      generation and kernel config)
>>    - drop generation of android-sparse images. Use -S 1 parameter on
>>      fastboot command instead to avoid cut-off issues
>>    - export mmc{0,1,2} as optional partitions with generic names now,
>>      add init script to detect these partitions on boot
>>    - rename fastboot partitions {kernel,initramfs,oftree} to
>>      ram-{kernel,initramfs,oftree} to make their non-permanent state more
>>      obvious
>>    - change name of fastboot boot script to ram-fastboot for the same
>>      reason
>>    - remove unneeded root=/dev/ram from kernel cmdline for the
>>      ram-fastboot target
>>    - update commit messages and cover-letter accordingly
>> - Link to v1: https://lore.distrokit.org/20230606-default_enable_fastboot_rock3a-v1-0-42195d538df2@pengutronix.de
>>
>> ---
>> Johannes Zink (4):
>>        v8a: enable initrd generation
>>        v8a: kernel: enable initramfs in kernel config
>>        v8a: barebox: enable loading kernel, dtb and initrd via fastboot
>>        v8a: barebox: add a boot target for fastboot loaded image files
>>
>>   .../barebox-common-defaultenv/boot/ram-fastboot           |  7 +++++++
>>   .../barebox-common-defaultenv/init/detect-mmcs            |  3 +++
>>   .../barebox-common-defaultenv/nv/fastboot.acm             |  1 +
>>   .../barebox-common-defaultenv/nv/fastboot.bbu             |  1 +
>>   .../barebox-common-defaultenv/nv/fastboot.partitions      |  1 +
>>   .../barebox-common-defaultenv/nv/usbgadget.autostart      |  1 +
>>   configs/platform-v8a/kernelconfig                         | 15 ++++++++++++---
>>   configs/platform-v8a/platformconfig                       | 12 +++++++++++-
>>   8 files changed, 37 insertions(+), 4 deletions(-)
>> ---
>> base-commit: 282b5aff9aecf141de5040f896a9a10081596350
>> change-id: 20230606-default_enable_fastboot_rock3a-3223c6b01647
>>
>> Best regards,
> 

-- 
Pengutronix e.K.                | Johannes Zink                  |
Steuerwalder Str. 21            | https://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] 16+ messages in thread

end of thread, other threads:[~2023-06-09 15:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09 10:28 [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
2023-06-09 10:28 ` [DistroKit] [PATCH v2 1/4] v8a: enable initrd generation Johannes Zink
2023-06-09 13:30   ` Ahmad Fatoum
2023-06-09 10:28 ` [DistroKit] [PATCH v2 2/4] v8a: kernel: enable initramfs in kernel config Johannes Zink
2023-06-09 13:32   ` Ahmad Fatoum
2023-06-09 14:35     ` Johannes Zink
2023-06-09 14:48       ` Robert Schwebel
2023-06-09 10:28 ` [DistroKit] [PATCH v2 3/4] v8a: barebox: enable loading kernel, dtb and initrd via fastboot Johannes Zink
2023-06-09 13:35   ` Ahmad Fatoum
2023-06-09 14:38     ` Johannes Zink
2023-06-09 14:49       ` Robert Schwebel
2023-06-09 14:49       ` Ahmad Fatoum
2023-06-09 10:28 ` [DistroKit] [PATCH v2 4/4] v8a: barebox: add a boot target for fastboot loaded image files Johannes Zink
2023-06-09 13:36   ` Ahmad Fatoum
2023-06-09 13:29 ` [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Ahmad Fatoum
2023-06-09 15:05   ` Johannes Zink

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