* [DistroKit] [PATCH 0/5] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A
@ 2023-06-06 14:31 Johannes Zink
2023-06-06 14:31 ` [DistroKit] [PATCH 1/5] v8a: enable initrd generation Johannes Zink
` (4 more replies)
0 siblings, 5 replies; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:31 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 kernel platform-v8a/images/kernel-sparse.img
fastboot flash dtb platform-v8a/images/dtb-rock3a-sparse.img
fastboot flash initramfs platform-v8a/images/initramfs-sparse.img
then for booting either use the barebox command
boot fastboot
or pass the bootcommand over fastboot from the host via
fastboot oem exec boot fastboot
Best regards
Johannes
To: distrokit@pengutronix.de
Cc: patchwork-jzi@pengutronix.de
Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
Johannes Zink (5):
v8a: enable initrd generation
v8a: kernel: enable initramfs in kernel config
v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
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/fastboot | 7 +++++++
.../barebox-common-defaultenv/nv/fastboot.acm | 1 +
.../barebox-common-defaultenv/nv/fastboot.bbu | 1 +
.../nv/fastboot.partitions | 1 +
.../nv/usbgadget.autostart | 1 +
configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
configs/platform-v8a/kernelconfig | 16 +++++++++++++---
configs/platform-v8a/platformconfig | 10 +++++++++-
8 files changed, 54 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] 31+ messages in thread
* [DistroKit] [PATCH 1/5] v8a: enable initrd generation
2023-06-06 14:31 [DistroKit] [PATCH 0/5] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
@ 2023-06-06 14:31 ` Johannes Zink
2023-06-06 14:37 ` Ahmad Fatoum
2023-06-06 14:31 ` [DistroKit] [PATCH 2/5] v8a: kernel: enable initramfs in kernel config Johannes Zink
` (3 subsequent siblings)
4 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:31 UTC (permalink / raw)
To: distrokit; +Cc: Johannes Zink, patchwork-jzi
also generate rootfs as cpio.gz, as this allows loading it as initramfs.
Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
configs/platform-v8a/platformconfig | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
index 4e479660f6b7..4d7dfeae9d66 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=y
+# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD is not set
+# 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=".gz"
+PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_UTIL="gzip"
PTXCONF_IMAGE_ROOT_EXT=y
PTXCONF_IMAGE_ROOT_EXT_SIZE="125%"
# PTXCONF_IMAGE_ROOT_EXT_EXT2 is not set
--
2.39.2
^ permalink raw reply [flat|nested] 31+ messages in thread
* [DistroKit] [PATCH 2/5] v8a: kernel: enable initramfs in kernel config
2023-06-06 14:31 [DistroKit] [PATCH 0/5] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
2023-06-06 14:31 ` [DistroKit] [PATCH 1/5] v8a: enable initrd generation Johannes Zink
@ 2023-06-06 14:31 ` Johannes Zink
2023-06-06 14:37 ` Ahmad Fatoum
2023-06-06 14:31 ` [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb Johannes Zink
` (2 subsequent siblings)
4 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:31 UTC (permalink / raw)
To: distrokit; +Cc: Johannes Zink, patchwork-jzi
Enable gzip and 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>
---
configs/platform-v8a/kernelconfig | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/configs/platform-v8a/kernelconfig b/configs/platform-v8a/kernelconfig
index 3c0fed78de15..4ebbb1ed7cd7 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=y
+# 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,8 @@ 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_GZIP=y
+CONFIG_DECOMPRESS_ZSTD=y
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_INTERVAL_TREE=y
CONFIG_XARRAY_MULTI=y
--
2.39.2
^ permalink raw reply [flat|nested] 31+ messages in thread
* [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 14:31 [DistroKit] [PATCH 0/5] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
2023-06-06 14:31 ` [DistroKit] [PATCH 1/5] v8a: enable initrd generation Johannes Zink
2023-06-06 14:31 ` [DistroKit] [PATCH 2/5] v8a: kernel: enable initramfs in kernel config Johannes Zink
@ 2023-06-06 14:31 ` Johannes Zink
2023-06-06 14:41 ` Ahmad Fatoum
2023-06-06 14:31 ` [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot Johannes Zink
2023-06-06 14:31 ` [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files Johannes Zink
4 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:31 UTC (permalink / raw)
To: distrokit; +Cc: Johannes Zink, patchwork-jzi
This allows to load the images to barebox using android fastboot, since
otherwise the sparse header is missing and the image size is not
properly aligned as required by fastboot.
Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
index 522d82cdc9c9..cb0c7c4e575d 100644
--- a/configs/platform-v8a/config/images/rock3a.config
+++ b/configs/platform-v8a/config/images/rock3a.config
@@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
image = "barebox-rock3a.img"
}
}
+
+image initramfs-sparse.img {
+ android-sparse {
+ image = "root.cpio.gz"
+ block-size = 4k
+ }
+}
+
+image kernel-sparse.img {
+ android-sparse {
+ image = "linuximage"
+ block-size = 4k
+ }
+}
+
+image dtb-rock3a-sparse.img {
+ android-sparse {
+ image = "rk3568-rock-3a.dtb"
+ block-size = 4k
+ }
+}
--
2.39.2
^ permalink raw reply [flat|nested] 31+ messages in thread
* [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
2023-06-06 14:31 [DistroKit] [PATCH 0/5] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
` (2 preceding siblings ...)
2023-06-06 14:31 ` [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb Johannes Zink
@ 2023-06-06 14:31 ` Johannes Zink
2023-06-06 14:44 ` Ahmad Fatoum
2023-06-06 14:31 ` [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files Johannes Zink
4 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:31 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.
Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
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 +
4 files changed, 4 insertions(+)
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..a67f90305dd6
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-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-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] 31+ messages in thread
* [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files
2023-06-06 14:31 [DistroKit] [PATCH 0/5] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
` (3 preceding siblings ...)
2023-06-06 14:31 ` [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot Johannes Zink
@ 2023-06-06 14:31 ` Johannes Zink
2023-06-06 14:47 ` Ahmad Fatoum
4 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:31 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 fastboot'.
Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
---
configs/platform-v8a/barebox-common-defaultenv/boot/fastboot | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
new file mode 100755
index 000000000000..a06414d582bf
--- /dev/null
+++ b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+global.bootm.image=/tmp/kernel
+global.bootm.initrd=/tmp/initramfs
+global.bootm.oftree=/tmp/oftree
+
+global.linux.bootargs.dyn.root="rdinit=/sbin/init root=/dev/ram"
--
2.39.2
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [DistroKit] [PATCH 1/5] v8a: enable initrd generation
2023-06-06 14:31 ` [DistroKit] [PATCH 1/5] v8a: enable initrd generation Johannes Zink
@ 2023-06-06 14:37 ` Ahmad Fatoum
2023-06-06 14:44 ` Johannes Zink
0 siblings, 1 reply; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 14:37 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 16:31, Johannes Zink wrote:
> also generate rootfs as cpio.gz, as this allows loading it as initramfs.
You enable both CONFIG_RD_GZIP and CONFIG_RD_ZSTD (which I am fine with),
but you decide here for cpio.gz. Any particular reason?
>
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> ---
> configs/platform-v8a/platformconfig | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
> index 4e479660f6b7..4d7dfeae9d66 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=y
> +# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD is not set
> +# 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=".gz"
> +PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_UTIL="gzip"
> PTXCONF_IMAGE_ROOT_EXT=y
> PTXCONF_IMAGE_ROOT_EXT_SIZE="125%"
> # PTXCONF_IMAGE_ROOT_EXT_EXT2 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] 31+ messages in thread
* Re: [DistroKit] [PATCH 2/5] v8a: kernel: enable initramfs in kernel config
2023-06-06 14:31 ` [DistroKit] [PATCH 2/5] v8a: kernel: enable initramfs in kernel config Johannes Zink
@ 2023-06-06 14:37 ` Ahmad Fatoum
0 siblings, 0 replies; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 14:37 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 16:31, Johannes Zink wrote:
> Enable gzip and 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>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> configs/platform-v8a/kernelconfig | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/configs/platform-v8a/kernelconfig b/configs/platform-v8a/kernelconfig
> index 3c0fed78de15..4ebbb1ed7cd7 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=y
> +# 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,8 @@ 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_GZIP=y
> +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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 14:31 ` [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb Johannes Zink
@ 2023-06-06 14:41 ` Ahmad Fatoum
2023-06-06 14:42 ` Ahmad Fatoum
2023-06-06 14:47 ` Johannes Zink
0 siblings, 2 replies; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 14:41 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 16:31, Johannes Zink wrote:
> This allows to load the images to barebox using android fastboot, since
> otherwise the sparse header is missing and the image size is not
> properly aligned as required by fastboot.
IME fastboot just complains and transfers the files anyway. In that
case building sparse images just adds complication. Did your fastboot
command fail without this change?
>
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> ---
> configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
> index 522d82cdc9c9..cb0c7c4e575d 100644
> --- a/configs/platform-v8a/config/images/rock3a.config
> +++ b/configs/platform-v8a/config/images/rock3a.config
> @@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
> image = "barebox-rock3a.img"
> }
> }
> +
> +image initramfs-sparse.img {
> + android-sparse {
> + image = "root.cpio.gz"
> + block-size = 4k
> + }
> +}
> +
> +image kernel-sparse.img {
> + android-sparse {
> + image = "linuximage"
> + block-size = 4k
> + }
> +}
> +
> +image dtb-rock3a-sparse.img {
> + android-sparse {
> + image = "rk3568-rock-3a.dtb"
> + block-size = 4k
> + }
> +}
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 14:41 ` Ahmad Fatoum
@ 2023-06-06 14:42 ` Ahmad Fatoum
2023-06-06 14:49 ` Johannes Zink
2023-06-06 14:47 ` Johannes Zink
1 sibling, 1 reply; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 14:42 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 16:41, Ahmad Fatoum wrote:
> On 06.06.23 16:31, Johannes Zink wrote:
>> This allows to load the images to barebox using android fastboot, since
>> otherwise the sparse header is missing and the image size is not
>> properly aligned as required by fastboot.
>
> IME fastboot just complains and transfers the files anyway. In that
> case building sparse images just adds complication. Did your fastboot
> command fail without this change?
>
>>
>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>> ---
>> configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
>> 1 file changed, 21 insertions(+)
>>
>> diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
>> index 522d82cdc9c9..cb0c7c4e575d 100644
>> --- a/configs/platform-v8a/config/images/rock3a.config
>> +++ b/configs/platform-v8a/config/images/rock3a.config
>> @@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
>> image = "barebox-rock3a.img"
>> }
>> }
>> +
>> +image initramfs-sparse.img {
>> + android-sparse {
>> + image = "root.cpio.gz"
>> + block-size = 4k
>> + }
>> +}
>> +
>> +image kernel-sparse.img {
>> + android-sparse {
>> + image = "linuximage"
>> + block-size = 4k
>> + }
>> +}
Also, these two aren't rock3a specific, so they shouldn't be here
especially not with such generic sounding names.
>> +
>> +image dtb-rock3a-sparse.img {
>> + android-sparse {
>> + image = "rk3568-rock-3a.dtb"
>> + block-size = 4k
>> + }
>> +}
>>
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
2023-06-06 14:31 ` [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot Johannes Zink
@ 2023-06-06 14:44 ` Ahmad Fatoum
2023-06-06 14:54 ` Johannes Zink
2023-06-06 15:04 ` Jan Lübbe
0 siblings, 2 replies; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 14:44 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 16:31, 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.
>
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> ---
> 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 +
> 4 files changed, 4 insertions(+)
>
> 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..a67f90305dd6
> --- /dev/null
> +++ b/configs/platform-v8a/barebox-common-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
1) Why not export the barebox update handler?
2) Is sd also mmc0 and emmc mmc1 on the i.MX8M boards? Because those use the
same environment
> 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] 31+ messages in thread
* Re: [DistroKit] [PATCH 1/5] v8a: enable initrd generation
2023-06-06 14:37 ` Ahmad Fatoum
@ 2023-06-06 14:44 ` Johannes Zink
2023-06-06 14:59 ` Jan Lübbe
0 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:44 UTC (permalink / raw)
To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
Hi Ahmad,
On 6/6/23 16:37, Ahmad Fatoum wrote:
> On 06.06.23 16:31, Johannes Zink wrote:
>> also generate rootfs as cpio.gz, as this allows loading it as initramfs.
>
> You enable both CONFIG_RD_GZIP and CONFIG_RD_ZSTD (which I am fine with),
> but you decide here for cpio.gz. Any particular reason?
afaik ZSTD support is rather new and I wanted to have maximum flexibility when
reusing the initramfs, even with older kernels - i.e. being able to mix a
ptxdist-built initramfs with older kernels. I opted to also support zstd, to
allow booting future initramfs' on current kernels, should gzip support ever be
dropped in the future.
However, I think we could probably drop the zstd support, if you are concerned
about image size.
Johannes
>
>>
>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>> ---
>> configs/platform-v8a/platformconfig | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
>> index 4e479660f6b7..4d7dfeae9d66 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=y
>> +# PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD is not set
>> +# 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=".gz"
>> +PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_UTIL="gzip"
>> PTXCONF_IMAGE_ROOT_EXT=y
>> PTXCONF_IMAGE_ROOT_EXT_SIZE="125%"
>> # PTXCONF_IMAGE_ROOT_EXT_EXT2 is not set
>>
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files
2023-06-06 14:31 ` [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files Johannes Zink
@ 2023-06-06 14:47 ` Ahmad Fatoum
2023-06-06 15:07 ` Jan Lübbe
0 siblings, 1 reply; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 14:47 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 16:31, 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 fastboot'.
>
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> ---
> configs/platform-v8a/barebox-common-defaultenv/boot/fastboot | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
> new file mode 100755
> index 000000000000..a06414d582bf
> --- /dev/null
> +++ b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
> @@ -0,0 +1,7 @@
> +#!/bin/sh
> +
> +global.bootm.image=/tmp/kernel
> +global.bootm.initrd=/tmp/initramfs
> +global.bootm.oftree=/tmp/oftree
> +
> +global.linux.bootargs.dyn.root="rdinit=/sbin/init root=/dev/ram"
Isn't rdinit=/sbin/init the default?
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 14:41 ` Ahmad Fatoum
2023-06-06 14:42 ` Ahmad Fatoum
@ 2023-06-06 14:47 ` Johannes Zink
2023-06-06 14:51 ` Ahmad Fatoum
1 sibling, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:47 UTC (permalink / raw)
To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
On 6/6/23 16:41, Ahmad Fatoum wrote:
> On 06.06.23 16:31, Johannes Zink wrote:
>> This allows to load the images to barebox using android fastboot, since
>> otherwise the sparse header is missing and the image size is not
>> properly aligned as required by fastboot.
>
> IME fastboot just complains and transfers the files anyway. In that
> case building sparse images just adds complication. Did your fastboot
> command fail without this change?
>
Uploading non-sparse images failed with an error
Invalid sparse file format at header magic
error: write_sparse_skip_chunk: don't care size 45251584 is not a multiple of
the block size 4096
at the host tool, which is why I decided to use sparse images. It saves upload
time anyway, at least for the initramfs, so it's a good idea to use sparse
images, anyway.
Johannes
>>
>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>> ---
>> configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
>> 1 file changed, 21 insertions(+)
>>
>> diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
>> index 522d82cdc9c9..cb0c7c4e575d 100644
>> --- a/configs/platform-v8a/config/images/rock3a.config
>> +++ b/configs/platform-v8a/config/images/rock3a.config
>> @@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
>> image = "barebox-rock3a.img"
>> }
>> }
>> +
>> +image initramfs-sparse.img {
>> + android-sparse {
>> + image = "root.cpio.gz"
>> + block-size = 4k
>> + }
>> +}
>> +
>> +image kernel-sparse.img {
>> + android-sparse {
>> + image = "linuximage"
>> + block-size = 4k
>> + }
>> +}
>> +
>> +image dtb-rock3a-sparse.img {
>> + android-sparse {
>> + image = "rk3568-rock-3a.dtb"
>> + block-size = 4k
>> + }
>> +}
>>
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 14:42 ` Ahmad Fatoum
@ 2023-06-06 14:49 ` Johannes Zink
2023-06-06 14:54 ` Ahmad Fatoum
0 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:49 UTC (permalink / raw)
To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
On 6/6/23 16:42, Ahmad Fatoum wrote:
> On 06.06.23 16:41, Ahmad Fatoum wrote:
>> On 06.06.23 16:31, Johannes Zink wrote:
>>> This allows to load the images to barebox using android fastboot, since
>>> otherwise the sparse header is missing and the image size is not
>>> properly aligned as required by fastboot.
>>
>> IME fastboot just complains and transfers the files anyway. In that
>> case building sparse images just adds complication. Did your fastboot
>> command fail without this change?
>>
>>>
>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>> ---
>>> configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
>>> 1 file changed, 21 insertions(+)
>>>
>>> diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
>>> index 522d82cdc9c9..cb0c7c4e575d 100644
>>> --- a/configs/platform-v8a/config/images/rock3a.config
>>> +++ b/configs/platform-v8a/config/images/rock3a.config
>>> @@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
>>> image = "barebox-rock3a.img"
>>> }
>>> }
>>> +
>>> +image initramfs-sparse.img {
>>> + android-sparse {
>>> + image = "root.cpio.gz"
>>> + block-size = 4k
>>> + }
>>> +}
>>> +
>>> +image kernel-sparse.img {
>>> + android-sparse {
>>> + image = "linuximage"
>>> + block-size = 4k
>>> + }
>>> +}
>
> Also, these two aren't rock3a specific, so they shouldn't be here
> especially not with such generic sounding names.
ack, gonna move them to a separate config for v2 of this series. Though, I
think they should keep their generic names, as they can be used across all
other v8a targets.
Johannes
>
>>> +
>>> +image dtb-rock3a-sparse.img {
>>> + android-sparse {
>>> + image = "rk3568-rock-3a.dtb"
>>> + block-size = 4k
>>> + }
>>> +}
>>>
>>
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 14:47 ` Johannes Zink
@ 2023-06-06 14:51 ` Ahmad Fatoum
2023-06-06 15:04 ` Johannes Zink
0 siblings, 1 reply; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 14:51 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
Hello Johannes,
On 06.06.23 16:47, Johannes Zink wrote:
> On 6/6/23 16:41, Ahmad Fatoum wrote:
>> On 06.06.23 16:31, Johannes Zink wrote:
>>> This allows to load the images to barebox using android fastboot, since
>>> otherwise the sparse header is missing and the image size is not
>>> properly aligned as required by fastboot.
>>
>> IME fastboot just complains and transfers the files anyway. In that
>> case building sparse images just adds complication. Did your fastboot
>> command fail without this change?
>>
>
> Uploading non-sparse images failed with an error
>
> Invalid sparse file format at header magic
> error: write_sparse_skip_chunk: don't care size 45251584 is not a multiple of the block size 4096
>
> at the host tool, which is why I decided to use sparse images.
Can you describe how to reproduce this with a normal DistroKit build?
> It saves upload time anyway, at least for the initramfs, so it's a good idea to use sparse images, anyway.
Sparse is a compression algorithm, albeit a very primitive one. Your kernel and
initrd should already be compressed, so if you have savings from compressing
them again with sparse, there's something wrong IMO.
The device tree is small enough that it shouldn't matter.
Cheers,
Ahmad
>
> Johannes
>
>
>>>
>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>> ---
>>> configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
>>> 1 file changed, 21 insertions(+)
>>>
>>> diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
>>> index 522d82cdc9c9..cb0c7c4e575d 100644
>>> --- a/configs/platform-v8a/config/images/rock3a.config
>>> +++ b/configs/platform-v8a/config/images/rock3a.config
>>> @@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
>>> image = "barebox-rock3a.img"
>>> }
>>> }
>>> +
>>> +image initramfs-sparse.img {
>>> + android-sparse {
>>> + image = "root.cpio.gz"
>>> + block-size = 4k
>>> + }
>>> +}
>>> +
>>> +image kernel-sparse.img {
>>> + android-sparse {
>>> + image = "linuximage"
>>> + block-size = 4k
>>> + }
>>> +}
>>> +
>>> +image dtb-rock3a-sparse.img {
>>> + android-sparse {
>>> + image = "rk3568-rock-3a.dtb"
>>> + block-size = 4k
>>> + }
>>> +}
>>>
>>
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 14:49 ` Johannes Zink
@ 2023-06-06 14:54 ` Ahmad Fatoum
0 siblings, 0 replies; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 14:54 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 16:49, Johannes Zink wrote:
> On 6/6/23 16:42, Ahmad Fatoum wrote:
>> On 06.06.23 16:41, Ahmad Fatoum wrote:
>>> On 06.06.23 16:31, Johannes Zink wrote:
>>>> This allows to load the images to barebox using android fastboot, since
>>>> otherwise the sparse header is missing and the image size is not
>>>> properly aligned as required by fastboot.
>>>
>>> IME fastboot just complains and transfers the files anyway. In that
>>> case building sparse images just adds complication. Did your fastboot
>>> command fail without this change?
>>>
>>>>
>>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>>> ---
>>>> configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
>>>> 1 file changed, 21 insertions(+)
>>>>
>>>> diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
>>>> index 522d82cdc9c9..cb0c7c4e575d 100644
>>>> --- a/configs/platform-v8a/config/images/rock3a.config
>>>> +++ b/configs/platform-v8a/config/images/rock3a.config
>>>> @@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
>>>> image = "barebox-rock3a.img"
>>>> }
>>>> }
>>>> +
>>>> +image initramfs-sparse.img {
>>>> + android-sparse {
>>>> + image = "root.cpio.gz"
>>>> + block-size = 4k
>>>> + }
>>>> +}
>>>> +
>>>> +image kernel-sparse.img {
>>>> + android-sparse {
>>>> + image = "linuximage"
>>>> + block-size = 4k
>>>> + }
>>>> +}
>>
>> Also, these two aren't rock3a specific, so they shouldn't be here
>> especially not with such generic sounding names.
>
> ack, gonna move them to a separate config for v2 of this series. Though, I think they should keep their generic names, as they can be used across all other v8a targets.
Their name should be aligned with the file they are in unless
they are removed.
>
> Johannes
>
>>
>>>> +
>>>> +image dtb-rock3a-sparse.img {
>>>> + android-sparse {
>>>> + image = "rk3568-rock-3a.dtb"
>>>> + block-size = 4k
>>>> + }
>>>> +}
>>>>
>>>
>>
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
2023-06-06 14:44 ` Ahmad Fatoum
@ 2023-06-06 14:54 ` Johannes Zink
2023-06-08 7:36 ` Ahmad Fatoum
2023-06-06 15:04 ` Jan Lübbe
1 sibling, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 14:54 UTC (permalink / raw)
To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
Hi Ahmad,
On 6/6/23 16:44, Ahmad Fatoum wrote:
> On 06.06.23 16:31, 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.
>>
>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>> ---
>> 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 +
>> 4 files changed, 4 insertions(+)
>>
>> 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..a67f90305dd6
>> --- /dev/null
>> +++ b/configs/platform-v8a/barebox-common-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
>
> 1) Why not export the barebox update handler?
simple: I forgot to add it... will add it in v2.
> 2) Is sd also mmc0 and emmc mmc1 on the i.MX8M boards? Because those use the
> same environment
not in general, no. Maybe use
/dev/mmc0(mmc0)o,/dev/mmc1(mmc1)o,/dev/mmc2(mmc2)o instead?
Johannes
>
>> 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] 31+ messages in thread
* Re: [DistroKit] [PATCH 1/5] v8a: enable initrd generation
2023-06-06 14:44 ` Johannes Zink
@ 2023-06-06 14:59 ` Jan Lübbe
2023-06-06 15:02 ` Johannes Zink
0 siblings, 1 reply; 31+ messages in thread
From: Jan Lübbe @ 2023-06-06 14:59 UTC (permalink / raw)
To: Johannes Zink, Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
On Tue, 2023-06-06 at 16:44 +0200, Johannes Zink wrote:
> Hi Ahmad,
>
> On 6/6/23 16:37, Ahmad Fatoum wrote:
> > On 06.06.23 16:31, Johannes Zink wrote:
> > > also generate rootfs as cpio.gz, as this allows loading it as initramfs.
> >
> > You enable both CONFIG_RD_GZIP and CONFIG_RD_ZSTD (which I am fine with),
> > but you decide here for cpio.gz. Any particular reason?
>
> afaik ZSTD support is rather new and I wanted to have maximum flexibility when
> reusing the initramfs, even with older kernels - i.e. being able to mix a
> ptxdist-built initramfs with older kernels. I opted to also support zstd, to
> allow booting future initramfs' on current kernels, should gzip support ever be
> dropped in the future.
>
> However, I think we could probably drop the zstd support, if you are concerned
> about image size.
CONFIG_KERNEL_ZSTD is supported since 5.9:
https://cateee.net/lkddb/web-lkddb/KERNEL_ZSTD.html
In cases where an old kernel should be booted with this new initramfs, you can
just recompress it with gz on the host (which is trivial compared to building it
in the first place).
I'd suggest just going with zstd only.
Jan
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 1/5] v8a: enable initrd generation
2023-06-06 14:59 ` Jan Lübbe
@ 2023-06-06 15:02 ` Johannes Zink
0 siblings, 0 replies; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 15:02 UTC (permalink / raw)
To: Jan Lübbe, Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
Hi Jan,
On 6/6/23 16:59, Jan Lübbe wrote:
> On Tue, 2023-06-06 at 16:44 +0200, Johannes Zink wrote:
>> Hi Ahmad,
>>
>> On 6/6/23 16:37, Ahmad Fatoum wrote:
>>> On 06.06.23 16:31, Johannes Zink wrote:
>>>> also generate rootfs as cpio.gz, as this allows loading it as initramfs.
>>>
>>> You enable both CONFIG_RD_GZIP and CONFIG_RD_ZSTD (which I am fine with),
>>> but you decide here for cpio.gz. Any particular reason?
>>
>> afaik ZSTD support is rather new and I wanted to have maximum flexibility when
>> reusing the initramfs, even with older kernels - i.e. being able to mix a
>> ptxdist-built initramfs with older kernels. I opted to also support zstd, to
>> allow booting future initramfs' on current kernels, should gzip support ever be
>> dropped in the future.
>>
>> However, I think we could probably drop the zstd support, if you are concerned
>> about image size.
>
> CONFIG_KERNEL_ZSTD is supported since 5.9:
> https://cateee.net/lkddb/web-lkddb/KERNEL_ZSTD.html
>
> In cases where an old kernel should be booted with this new initramfs, you can
> just recompress it with gz on the host (which is trivial compared to building it
> in the first place).
>
> I'd suggest just going with zstd only.
>
> Jan
ack, gonna change support to zstd and drop gz in v2 of this series.
Johannes
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 14:51 ` Ahmad Fatoum
@ 2023-06-06 15:04 ` Johannes Zink
2023-06-06 15:26 ` Ahmad Fatoum
0 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 15:04 UTC (permalink / raw)
To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
On 6/6/23 16:51, Ahmad Fatoum wrote:
> Hello Johannes,
>
> On 06.06.23 16:47, Johannes Zink wrote:
>> On 6/6/23 16:41, Ahmad Fatoum wrote:
>>> On 06.06.23 16:31, Johannes Zink wrote:
>>>> This allows to load the images to barebox using android fastboot, since
>>>> otherwise the sparse header is missing and the image size is not
>>>> properly aligned as required by fastboot.
>>>
>>> IME fastboot just complains and transfers the files anyway. In that
>>> case building sparse images just adds complication. Did your fastboot
>>> command fail without this change?
>>>
>>
>> Uploading non-sparse images failed with an error
>>
>> Invalid sparse file format at header magic
>> error: write_sparse_skip_chunk: don't care size 45251584 is not a multiple of the block size 4096
>>
>> at the host tool, which is why I decided to use sparse images.
>
> Can you describe how to reproduce this with a normal DistroKit build?
sure, just apply this series (or at least patch 1/5 for initrd generation), run
ptxdist images and expose a fastboot partition on the DUT by calling
usbgadget -A /tmp/initramfs(initramfs)c
then use fastboot to upload the cpio.gz from your distrokit build dir
fastboot flash initramfs platform-v8a/images/initramfs-sparse.img
Johannes
>
>> It saves upload time anyway, at least for the initramfs, so it's a good idea to use sparse images, anyway.
>
> Sparse is a compression algorithm, albeit a very primitive one. Your kernel and
> initrd should already be compressed, so if you have savings from compressing
> them again with sparse, there's something wrong IMO.
>
> The device tree is small enough that it shouldn't matter.
>
> Cheers,
> Ahmad
>
>
>>
>> Johannes
>>
>>
>>>>
>>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>>> ---
>>>> configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
>>>> 1 file changed, 21 insertions(+)
>>>>
>>>> diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
>>>> index 522d82cdc9c9..cb0c7c4e575d 100644
>>>> --- a/configs/platform-v8a/config/images/rock3a.config
>>>> +++ b/configs/platform-v8a/config/images/rock3a.config
>>>> @@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
>>>> image = "barebox-rock3a.img"
>>>> }
>>>> }
>>>> +
>>>> +image initramfs-sparse.img {
>>>> + android-sparse {
>>>> + image = "root.cpio.gz"
>>>> + block-size = 4k
>>>> + }
>>>> +}
>>>> +
>>>> +image kernel-sparse.img {
>>>> + android-sparse {
>>>> + image = "linuximage"
>>>> + block-size = 4k
>>>> + }
>>>> +}
>>>> +
>>>> +image dtb-rock3a-sparse.img {
>>>> + android-sparse {
>>>> + image = "rk3568-rock-3a.dtb"
>>>> + block-size = 4k
>>>> + }
>>>> +}
>>>>
>>>
>>
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
2023-06-06 14:44 ` Ahmad Fatoum
2023-06-06 14:54 ` Johannes Zink
@ 2023-06-06 15:04 ` Jan Lübbe
2023-06-06 15:14 ` Johannes Zink
1 sibling, 1 reply; 31+ messages in thread
From: Jan Lübbe @ 2023-06-06 15:04 UTC (permalink / raw)
To: Ahmad Fatoum, Johannes Zink, distrokit; +Cc: patchwork-jzi
On Tue, 2023-06-06 at 16:44 +0200, Ahmad Fatoum wrote:
> > +/dev/mmc0(sd)o,/dev/mmc1(emmc)o,/tmp/kernel(kernel)c,/tmp/initramfs(initramfs)c,/tmp/oftree(oftree)c
Perhaps use ram-kernel, ram-initramfs and ram-oftree to make it obvious that
these are not written to persistent storage?
Jan
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files
2023-06-06 14:47 ` Ahmad Fatoum
@ 2023-06-06 15:07 ` Jan Lübbe
2023-06-06 15:13 ` Johannes Zink
2023-06-09 9:53 ` Johannes Zink
0 siblings, 2 replies; 31+ messages in thread
From: Jan Lübbe @ 2023-06-06 15:07 UTC (permalink / raw)
To: Ahmad Fatoum, Johannes Zink, distrokit; +Cc: patchwork-jzi
On Tue, 2023-06-06 at 16:47 +0200, Ahmad Fatoum wrote:
> On 06.06.23 16:31, 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 fastboot'.
> >
> > Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
> > ---
> > configs/platform-v8a/barebox-common-defaultenv/boot/fastboot | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
> > new file mode 100755
> > index 000000000000..a06414d582bf
> > --- /dev/null
> > +++ b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
> > @@ -0,0 +1,7 @@
> > +#!/bin/sh
> > +
> > +global.bootm.image=/tmp/kernel
> > +global.bootm.initrd=/tmp/initramfs
> > +global.bootm.oftree=/tmp/oftree
> > +
> > +global.linux.bootargs.dyn.root="rdinit=/sbin/init root=/dev/ram"
>
> Isn't rdinit=/sbin/init the default?
rd=/init is the defaut. root=/dev/ram is not needed, AFAIR, it's for initrd, not
initramfs.
Also, we could add a symlink /init -> /sbin/init, which would simplify using
this initramfs with a bootloaders not passing the correct cmdline.
Jan
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files
2023-06-06 15:07 ` Jan Lübbe
@ 2023-06-06 15:13 ` Johannes Zink
2023-06-09 9:53 ` Johannes Zink
1 sibling, 0 replies; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 15:13 UTC (permalink / raw)
To: Jan Lübbe, Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
Hi Jan,
On 6/6/23 17:07, Jan Lübbe wrote:
> On Tue, 2023-06-06 at 16:47 +0200, Ahmad Fatoum wrote:
>> On 06.06.23 16:31, 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 fastboot'.
>>>
>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>> ---
>>> configs/platform-v8a/barebox-common-defaultenv/boot/fastboot | 7 +++++++
>>> 1 file changed, 7 insertions(+)
>>>
>>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
>>> new file mode 100755
>>> index 000000000000..a06414d582bf
>>> --- /dev/null
>>> +++ b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
>>> @@ -0,0 +1,7 @@
>>> +#!/bin/sh
>>> +
>>> +global.bootm.image=/tmp/kernel
>>> +global.bootm.initrd=/tmp/initramfs
>>> +global.bootm.oftree=/tmp/oftree
>>> +
>>> +global.linux.bootargs.dyn.root="rdinit=/sbin/init root=/dev/ram"
>>
>> Isn't rdinit=/sbin/init the default?
>
> rd=/init is the defaut. root=/dev/ram is not needed, AFAIR, it's for initrd, not
> initramfs.
actually root=/dev/ram is needed, I found out the hard way, if it is missing
the kernel complains it cannot mount a rootfs and will panic (though there
might be a kernel config option to avoid this, I have not looked _too_ deep
into it). Also, it is slightly different for v7a, where root=/dev/ram0 needs to
be set instead of root=/dev/ram, so if there is a way to avoid this, I'd be
happy to generalize things...
Johannes
>
> Also, we could add a symlink /init -> /sbin/init, which would simplify using
> this initramfs with a bootloaders not passing the correct cmdline.
>
> Jan
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
2023-06-06 15:04 ` Jan Lübbe
@ 2023-06-06 15:14 ` Johannes Zink
2023-06-06 15:16 ` Jan Lübbe
0 siblings, 1 reply; 31+ messages in thread
From: Johannes Zink @ 2023-06-06 15:14 UTC (permalink / raw)
To: Jan Lübbe, Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
Hi Jan,
On 6/6/23 17:04, Jan Lübbe wrote:
> On Tue, 2023-06-06 at 16:44 +0200, Ahmad Fatoum wrote:
>>> +/dev/mmc0(sd)o,/dev/mmc1(emmc)o,/tmp/kernel(kernel)c,/tmp/initramfs(initramfs)c,/tmp/oftree(oftree)c
>
> Perhaps use ram-kernel, ram-initramfs and ram-oftree to make it obvious that
> these are not written to persistent storage?
>
> Jan
sounds sensibel to me, gonna add it in v2. Maybe I should change the boot name
target as well, e.g. to fastboot-ram instead of fastboot?
Johannes
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
2023-06-06 15:14 ` Johannes Zink
@ 2023-06-06 15:16 ` Jan Lübbe
0 siblings, 0 replies; 31+ messages in thread
From: Jan Lübbe @ 2023-06-06 15:16 UTC (permalink / raw)
To: Johannes Zink, Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
On Tue, 2023-06-06 at 17:14 +0200, Johannes Zink wrote:
> Hi Jan,
>
> On 6/6/23 17:04, Jan Lübbe wrote:
> > On Tue, 2023-06-06 at 16:44 +0200, Ahmad Fatoum wrote:
> > > > +/dev/mmc0(sd)o,/dev/mmc1(emmc)o,/tmp/kernel(kernel)c,/tmp/initramfs(initramfs)c,/tmp/oftree(oftree)c
> >
> > Perhaps use ram-kernel, ram-initramfs and ram-oftree to make it obvious that
> > these are not written to persistent storage?
> >
> > Jan
>
> sounds sensibel to me, gonna add it in v2. Maybe I should change the boot name
> target as well, e.g. to fastboot-ram instead of fastboot?
Sounds good.
Jan
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 15:04 ` Johannes Zink
@ 2023-06-06 15:26 ` Ahmad Fatoum
2023-06-08 7:28 ` Ahmad Fatoum
0 siblings, 1 reply; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-06 15:26 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 17:04, Johannes Zink wrote:
> On 6/6/23 16:51, Ahmad Fatoum wrote:
>> Hello Johannes,
>>
>> On 06.06.23 16:47, Johannes Zink wrote:
>>> On 6/6/23 16:41, Ahmad Fatoum wrote:
>>>> On 06.06.23 16:31, Johannes Zink wrote:
>>>>> This allows to load the images to barebox using android fastboot, since
>>>>> otherwise the sparse header is missing and the image size is not
>>>>> properly aligned as required by fastboot.
>>>>
>>>> IME fastboot just complains and transfers the files anyway. In that
>>>> case building sparse images just adds complication. Did your fastboot
>>>> command fail without this change?
>>>>
>>>
>>> Uploading non-sparse images failed with an error
>>>
>>> Invalid sparse file format at header magic
>>> error: write_sparse_skip_chunk: don't care size 45251584 is not a multiple of the block size 4096
>>>
>>> at the host tool, which is why I decided to use sparse images.
>>
>> Can you describe how to reproduce this with a normal DistroKit build?
>
> sure, just apply this series (or at least patch 1/5 for initrd generation), run ptxdist images and expose a fastboot partition on the DUT by calling
>
> usbgadget -A /tmp/initramfs(initramfs)c
>
> then use fastboot to upload the cpio.gz from your distrokit build dir
>
> fastboot flash initramfs platform-v8a/images/initramfs-sparse.img
I can reproduce this with fastboot version 28.0.2-debian.
It wasn't always like that. I assume -S 0 wasn't always the
default, but I haven't checked the code. I think it's worth a bug
report.
>>> It saves upload time anyway, at least for the initramfs, so it's a good idea to use sparse images, anyway.
>>
>> Sparse is a compression algorithm, albeit a very primitive one. Your kernel and
>> initrd should already be compressed, so if you have savings from compressing
>> them again with sparse, there's something wrong IMO.
>>
>> The device tree is small enough that it shouldn't matter.
As mentioned, I don't think double compression is useful.
On our side, we can likely just use -S 1 to restore the old behavior.
Cheers,
Ahmad
>>
>> Cheers,
>> Ahmad
>>
>>
>>>
>>> Johannes
>>>
>>>
>>>>>
>>>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>>>> ---
>>>>> configs/platform-v8a/config/images/rock3a.config | 21 +++++++++++++++++++++
>>>>> 1 file changed, 21 insertions(+)
>>>>>
>>>>> diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
>>>>> index 522d82cdc9c9..cb0c7c4e575d 100644
>>>>> --- a/configs/platform-v8a/config/images/rock3a.config
>>>>> +++ b/configs/platform-v8a/config/images/rock3a.config
>>>>> @@ -44,3 +44,24 @@ image barebox-rock3a.norimg {
>>>>> image = "barebox-rock3a.img"
>>>>> }
>>>>> }
>>>>> +
>>>>> +image initramfs-sparse.img {
>>>>> + android-sparse {
>>>>> + image = "root.cpio.gz"
>>>>> + block-size = 4k
>>>>> + }
>>>>> +}
>>>>> +
>>>>> +image kernel-sparse.img {
>>>>> + android-sparse {
>>>>> + image = "linuximage"
>>>>> + block-size = 4k
>>>>> + }
>>>>> +}
>>>>> +
>>>>> +image dtb-rock3a-sparse.img {
>>>>> + android-sparse {
>>>>> + image = "rk3568-rock-3a.dtb"
>>>>> + block-size = 4k
>>>>> + }
>>>>> +}
>>>>>
>>>>
>>>
>>
>
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb
2023-06-06 15:26 ` Ahmad Fatoum
@ 2023-06-08 7:28 ` Ahmad Fatoum
0 siblings, 0 replies; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-08 7:28 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 17:26, Ahmad Fatoum wrote:
> On 06.06.23 17:04, Johannes Zink wrote:
>> On 6/6/23 16:51, Ahmad Fatoum wrote:
>>> On 06.06.23 16:47, Johannes Zink wrote:
>>> Can you describe how to reproduce this with a normal DistroKit build?
>>
>> sure, just apply this series (or at least patch 1/5 for initrd generation), run ptxdist images and expose a fastboot partition on the DUT by calling
>>
>> usbgadget -A /tmp/initramfs(initramfs)c
>>
>> then use fastboot to upload the cpio.gz from your distrokit build dir
>>
>> fastboot flash initramfs platform-v8a/images/initramfs-sparse.img
>
> I can reproduce this with fastboot version 28.0.2-debian.
> It wasn't always like that. I assume -S 0 wasn't always the
> default, but I haven't checked the code. I think it's worth a bug
> report.
I gave this a try and I am not so sure anymore this is a bug. Small images
are uploaded without problem. This cut off seems to be 8M.
Above 8M, transferred file size is rounded up to be a multiple of 4096 bytes.
Files that are not aligned and bigger than 8M trigger the issue.
I assume we had not noticed this before because we either flash disk images
which are 4K aligned or we flash small images which were < 8M.
I haven't looked into the fastboot client code, but a look would be worthwhile
to decide how to proceed.
>>>> It saves upload time anyway, at least for the initramfs, so it's a good idea to use sparse images, anyway.
>>>
>>> Sparse is a compression algorithm, albeit a very primitive one. Your kernel and
>>> initrd should already be compressed, so if you have savings from compressing
>>> them again with sparse, there's something wrong IMO.
>>>
>>> The device tree is small enough that it shouldn't matter.
>
> As mentioned, I don't think double compression is useful.
> On our side, we can likely just use -S 1 to restore the old behavior.
--
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] 31+ messages in thread
* Re: [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
2023-06-06 14:54 ` Johannes Zink
@ 2023-06-08 7:36 ` Ahmad Fatoum
2023-06-09 6:26 ` Johannes Zink
0 siblings, 1 reply; 31+ messages in thread
From: Ahmad Fatoum @ 2023-06-08 7:36 UTC (permalink / raw)
To: Johannes Zink, distrokit; +Cc: patchwork-jzi
On 06.06.23 16:54, Johannes Zink wrote:
> Hi Ahmad,
>
> On 6/6/23 16:44, Ahmad Fatoum wrote:
>> On 06.06.23 16:31, 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.
>>>
>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>> ---
>>> 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 +
>>> 4 files changed, 4 insertions(+)
>>>
>>> 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..a67f90305dd6
>>> --- /dev/null
>>> +++ b/configs/platform-v8a/barebox-common-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
>>
>> 1) Why not export the barebox update handler?
>
> simple: I forgot to add it... will add it in v2.
You didn't. I now see fastboot.bbu above, which I missed the first time.
>
>> 2) Is sd also mmc0 and emmc mmc1 on the i.MX8M boards? Because those use the
>> same environment
>
> not in general, no. Maybe use /dev/mmc0(mmc0)o,/dev/mmc1(mmc1)o,/dev/mmc2(mmc2)o instead?
Yes, this should do for now. Generally, I think barebox should just support exporting all
devices a user might be interested in. I submitted a patch for that:
https://lore.barebox.org/barebox/20230608072418.3275633-2-a.fatoum@pengutronix.de/T/#u
We could switch over to using this, once the patch is accepted and DistroKit is
updated to a release that has it (unless you want to pick it earlier).
Keep in mind that with either approach, only devices are functional
that barebox has detected. If you boot from SD, barebox might
not need to eMMC at all and thus it would not be detected unless you
(i.e. some init script) do
detect mmc0 mmc1 mmc2
Cheers,
Ahmad
>
> Johannes
>
>>
>>> 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] 31+ messages in thread
* Re: [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot
2023-06-08 7:36 ` Ahmad Fatoum
@ 2023-06-09 6:26 ` Johannes Zink
0 siblings, 0 replies; 31+ messages in thread
From: Johannes Zink @ 2023-06-09 6:26 UTC (permalink / raw)
To: Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
On 6/8/23 09:36, Ahmad Fatoum wrote:
> On 06.06.23 16:54, Johannes Zink wrote:
>> Hi Ahmad,
>>
>> On 6/6/23 16:44, Ahmad Fatoum wrote:
>>> On 06.06.23 16:31, 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.
>>>>
>>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>>> ---
>>>> 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 +
>>>> 4 files changed, 4 insertions(+)
>>>>
>>>> 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..a67f90305dd6
>>>> --- /dev/null
>>>> +++ b/configs/platform-v8a/barebox-common-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
>>>
>>> 1) Why not export the barebox update handler?
>>
>> simple: I forgot to add it... will add it in v2.
>
> You didn't. I now see fastboot.bbu above, which I missed the first time.
ack
>
>>
>>> 2) Is sd also mmc0 and emmc mmc1 on the i.MX8M boards? Because those use the
>>> same environment
>>
>> not in general, no. Maybe use /dev/mmc0(mmc0)o,/dev/mmc1(mmc1)o,/dev/mmc2(mmc2)o instead?
>
> Yes, this should do for now. Generally, I think barebox should just support exporting all
> devices a user might be interested in. I submitted a patch for that:
>
> https://lore.barebox.org/barebox/20230608072418.3275633-2-a.fatoum@pengutronix.de/T/#u
>
> We could switch over to using this, once the patch is accepted and DistroKit is
> updated to a release that has it (unless you want to pick it earlier).
>
>
> Keep in mind that with either approach, only devices are functional
> that barebox has detected. If you boot from SD, barebox might
> not need to eMMC at all and thus it would not be detected unless you
> (i.e. some init script) do
>
> detect mmc0 mmc1 mmc2
ack, gonna add that for v2.
Johannes
>
> Cheers,
> Ahmad
>
>>
>> Johannes
>>
>>>
>>>> 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] 31+ messages in thread
* Re: [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files
2023-06-06 15:07 ` Jan Lübbe
2023-06-06 15:13 ` Johannes Zink
@ 2023-06-09 9:53 ` Johannes Zink
1 sibling, 0 replies; 31+ messages in thread
From: Johannes Zink @ 2023-06-09 9:53 UTC (permalink / raw)
To: Jan Lübbe, Ahmad Fatoum, distrokit; +Cc: patchwork-jzi
Hi Jan,
On 6/6/23 17:07, Jan Lübbe wrote:
> On Tue, 2023-06-06 at 16:47 +0200, Ahmad Fatoum wrote:
>> On 06.06.23 16:31, 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 fastboot'.
>>>
>>> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>>> ---
>>> configs/platform-v8a/barebox-common-defaultenv/boot/fastboot | 7 +++++++
>>> 1 file changed, 7 insertions(+)
>>>
>>> diff --git a/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
>>> new file mode 100755
>>> index 000000000000..a06414d582bf
>>> --- /dev/null
>>> +++ b/configs/platform-v8a/barebox-common-defaultenv/boot/fastboot
>>> @@ -0,0 +1,7 @@
>>> +#!/bin/sh
>>> +
>>> +global.bootm.image=/tmp/kernel
>>> +global.bootm.initrd=/tmp/initramfs
>>> +global.bootm.oftree=/tmp/oftree
>>> +
>>> +global.linux.bootargs.dyn.root="rdinit=/sbin/init root=/dev/ram"
>>
>> Isn't rdinit=/sbin/init the default?
>
> rd=/init is the defaut. root=/dev/ram is not needed, AFAIR, it's for initrd, not
> initramfs.
>
> Also, we could add a symlink /init -> /sbin/init, which would simplify using
> this initramfs with a bootloaders not passing the correct cmdline.
>
> Jan
I have tested the different permutations:
+-------------------+---------------+-----------+
| rdinit=/sbin/init | root=/dev/ram | result |
+===================+===============+===========+
| set | set | boots |
+-------------------+---------------+-----------+
| set | not set | boots |
+-------------------+---------------+-----------+
| not set | set | fails [1] |
+-------------------+---------------+-----------+
| not set | not set | fails [1] |
+-------------------+---------------+-----------+
[1] kernel panic after
[ 2.545914] /dev/root: Can't open blockdev
[ 2.546279] VFS: Cannot open root device "ram" or unknown-block(1,0): error -6
Thus, we can drop the root=/dev/ram, as you suggested. Gonna change it in v2.
Johannes
--
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] 31+ messages in thread
end of thread, other threads:[~2023-06-09 9:53 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 14:31 [DistroKit] [PATCH 0/5] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A Johannes Zink
2023-06-06 14:31 ` [DistroKit] [PATCH 1/5] v8a: enable initrd generation Johannes Zink
2023-06-06 14:37 ` Ahmad Fatoum
2023-06-06 14:44 ` Johannes Zink
2023-06-06 14:59 ` Jan Lübbe
2023-06-06 15:02 ` Johannes Zink
2023-06-06 14:31 ` [DistroKit] [PATCH 2/5] v8a: kernel: enable initramfs in kernel config Johannes Zink
2023-06-06 14:37 ` Ahmad Fatoum
2023-06-06 14:31 ` [DistroKit] [PATCH 3/5] v8a: images: generate sparse images from rock3a initramfs, kernel and dtb Johannes Zink
2023-06-06 14:41 ` Ahmad Fatoum
2023-06-06 14:42 ` Ahmad Fatoum
2023-06-06 14:49 ` Johannes Zink
2023-06-06 14:54 ` Ahmad Fatoum
2023-06-06 14:47 ` Johannes Zink
2023-06-06 14:51 ` Ahmad Fatoum
2023-06-06 15:04 ` Johannes Zink
2023-06-06 15:26 ` Ahmad Fatoum
2023-06-08 7:28 ` Ahmad Fatoum
2023-06-06 14:31 ` [DistroKit] [PATCH 4/5] v8a: barebox: enable loading kernel, dtb and initrd via fastboot Johannes Zink
2023-06-06 14:44 ` Ahmad Fatoum
2023-06-06 14:54 ` Johannes Zink
2023-06-08 7:36 ` Ahmad Fatoum
2023-06-09 6:26 ` Johannes Zink
2023-06-06 15:04 ` Jan Lübbe
2023-06-06 15:14 ` Johannes Zink
2023-06-06 15:16 ` Jan Lübbe
2023-06-06 14:31 ` [DistroKit] [PATCH 5/5] v8a: barebox: add a boot target for fastboot loaded image files Johannes Zink
2023-06-06 14:47 ` Ahmad Fatoum
2023-06-06 15:07 ` Jan Lübbe
2023-06-06 15:13 ` Johannes Zink
2023-06-09 9:53 ` Johannes Zink
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox