DistroKit Mailinglist
 help / color / mirror / Atom feed
From: Johannes Zink <j.zink@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, distrokit@pengutronix.de
Cc: patchwork-jzi@pengutronix.de
Subject: Re: [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A
Date: Fri, 9 Jun 2023 17:05:55 +0200	[thread overview]
Message-ID: <0102c80a-5c90-3ca2-3bc5-d68211d812ea@pengutronix.de> (raw)
In-Reply-To: <d449a1bf-0353-6215-b12c-c2dddeda33d3@pengutronix.de>

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    |




      reply	other threads:[~2023-06-09 15:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 10:28 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0102c80a-5c90-3ca2-3bc5-d68211d812ea@pengutronix.de \
    --to=j.zink@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=distrokit@pengutronix.de \
    --cc=patchwork-jzi@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox