From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 09 Jun 2023 17:06:05 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q7dgl-00HMAM-99 for lore@lore.pengutronix.de; Fri, 09 Jun 2023 17:06:05 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1q7dgj-00060H-3i; Fri, 09 Jun 2023 17:06:05 +0200 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1q7dgf-0005zi-CN; Fri, 09 Jun 2023 17:06:01 +0200 Message-ID: <0102c80a-5c90-3ca2-3bc5-d68211d812ea@pengutronix.de> Date: Fri, 9 Jun 2023 17:05:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US, de-DE To: Ahmad Fatoum , distrokit@pengutronix.de References: <20230606-default_enable_fastboot_rock3a-v2-0-92606c4de9a9@pengutronix.de> From: Johannes Zink In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [DistroKit] [PATCH v2 0/4] enable uploading kernel, dtb and initramfs over fastboot and boot it on Rock3A X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patchwork-jzi@pengutronix.de Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false 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 >> --- >> 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 |