From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id yBvdAkg7QGZBVAEAe85BDQ:P1 (envelope-from ) for ; Sun, 12 May 2024 05:45:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id yBvdAkg7QGZBVAEAe85BDQ (envelope-from ) for ; Sun, 12 May 2024 05:45:12 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=MJJ8wUVd; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715485512; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=pmjyqV8L40vXC/BbCVDRl/qg+3NLiInzPyxO3RaZY6M=; b=nG3UumAQctb+nSvNjOof5mdOW8p7w0gEceIiZ7oAKbPHgcMFUrhZCe+syFdlji9TG/2shm 07yhfK+2PMI6gtUJ66J5MtEbl5py0ScbRobXY7JOQSAPB2WE4Z70fG4FsShFeGoF36OGXJ JlElqt0TDB9t9ODq3Rwmkym1PhbPxw26DfIzhz3PZKUM8AHOO2yihVJiVOSSv+hsnM7kKu Ivw0SQ7jIHYYg21GofNsh4uFda+EMq6RcDLolw+m9JqfeagclojtRJ6spfmLR8KudcZMba Zh9Qv/LlMAHck8aiXth8AdzjYDUtP2+COY5snAeBUlVo2uCHTMbVMAXJjzbUpA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=MJJ8wUVd; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715485512; a=rsa-sha256; cv=none; b=bjbzJqB3ZTXAu4X93/ve91shgBLwpbiYqNU+fpLeILqWTJ9++rg4+s7Kj7LXblZLwwkImD 2PSf/9jlkVEmYnM+1Ml2456yYo+o9fKowNbTmOdr3/MuE7ZrvjZbdVp7alumBOaA8ToXio /VGvIMgyb/jCh8cTxGl1SPrkDtxcGK+0ImJpIZThp3a8GjpyBP6lyoYvQwvDliK25YlBF1 RpLtV1aW/9lzsYmPH6DBINGhKJRl8mx0X4i6bvc4jLwfLxgBVDGoiqc5OfWMud9fON8+vz pRf8xFkyXGMm60XXcXH8krWzBsC2i7am6zHP9qY6xEY992y6uVDjf+/diezF9g== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8FD8855E29 for ; Sun, 12 May 2024 05:45:11 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s608Z-00046Z-5R; Sat, 11 May 2024 23:44:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s608U-00046C-BL for help-guix@gnu.org; Sat, 11 May 2024 23:44:30 -0400 Received: from mail-108-mta42.mxroute.com ([136.175.108.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s608Q-0004dM-ND for help-guix@gnu.org; Sat, 11 May 2024 23:44:29 -0400 Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta42.mxroute.com (ZoneMTA) with ESMTPSA id 18f6ae6bc130008ca2.002 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 12 May 2024 03:44:17 +0000 X-Zone-Loop: d8077c44641cbebf8576eed5c74281d8620b8c028672 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pmjyqV8L40vXC/BbCVDRl/qg+3NLiInzPyxO3RaZY6M=; b=MJJ8wUVd71RLMGl1jAdJq0YX4d iGHmKwFbv3hd5WseEwk8VAcXCI88mWwt77efbCMpjEby5OkC++5JqRTrZDAJfF2058R+hhT4DcubO f89X1dLIKSMnut1rdnxpaR3fj56MVkZWc5DvCd96Ic2UUnc2d8eieV1bJ106qDVGf+9FMaLkDfNWc x1fRngv+FzAu7K6tBuXqWUY6VUFq4Jvd0ptM551EU+kQtrFCETYsNjtzVvfPZ0wrgUmZCBMXb58QN zg70yl6SL9MAxWW9hSCm49TzccV0FHP05ThHFfnm5LLWwDT8XCWXEkvTjNbX7Uvi41EUkfvvIrVPA 2xXTCLfQ==; From: Richard Sent To: Vagrant Cascadian Cc: help-guix@gnu.org Subject: Re: How does system-disk-image work with embedded-style boot loaders? In-Reply-To: <87v83jsya8.fsf@wireframe> (Vagrant Cascadian's message of "Sat, 11 May 2024 16:51:11 -0700") References: <87ikzkgie2.fsf@freakingpenguin.com> <87v83jsya8.fsf@wireframe> Date: Sat, 11 May 2024 23:44:09 -0400 Message-ID: <875xvjheye.fsf@freakingpenguin.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.42; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta42.mxroute.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -5.38 X-Spam-Score: -5.38 X-Migadu-Queue-Id: 8FD8855E29 X-Migadu-Scanner: mx13.migadu.com X-TUID: NJjG2MltPXFy >> 2) install-rockpro64-rk3399-u-boot writes u-boot.itb at (* 16384 512), >> or 8,388,608, past the 2^20 offset in the image type. (Likely not >> coincidentally 8,388,608 / 8 =3D 1,048,576. I don't know what to make of= this >> because it feels weird that bytes are used in one situation while >> another uses bits.) > > Hopefully this is just a bit of confusion, or some of the images are > broken and nobody noticed! > > I would suggest to inspect the partition table of a generated image to > confirm if there is an empty space or blank/reserved partition(s) > falling in that range... Hi Vagrant! Thanks for the response! I looked at the code again and I did realize I missed one thing regarding point 2. pinebook-pro-image-type isn't using a 1,048,576 offset, but a 9,437,184 offset. There's a *9 I missed, oopsie. Alas, there's still some confusion. We place the u-boot.itb image at an offset of 16384*512, or 8,388,608. When building the u-boot image=E2=80=94p= art of the output from the u-boot-pinebook-pro-rk3399-2024.01 derivation built as part of $ guix system image gnu/system/images/pinebook-pro.scm --system=3Daarch64-linux=E2=80=94the u-boot.itb file is 1,089,024 bytes lon= g. Our raw image offset is system offset is 9 * 2^20, or 9,437,184 (AKA 9 MiB). So that means writing a 1,089,024 byte image to 8,388,608 spills over to 9,477,632. This is beyond the 9 MiB offset, so our u-boot image should be overwriting the root FS. Running fdisk on the image produces (emulated build due to cross-compilation failures): --8<---------------cut here---------------start------------->8--- gibraltar :( guix$ fdisk -l $(guix system image gnu/system/images/pinebook-= pro.scm --system=3Daarch64-linux) Disk /gnu/store/832w3d7dh2vdfdm2qdv5025w8sfm8zrl-pinebook-pro-barebones-raw= -image: 1.62 GiB, 1741840384 bytes, 3402032 sectors Units: sectors of 1 * 512 =3D 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device = Boot Start End Sectors Size Id Type /gnu/store/832w3d7dh2vdfdm2qdv5025w8sfm8zrl-pinebook-pro-barebones-raw-imag= e1 * 18432 3402031 3383600 1.6G 83 Linux --8<---------------cut here---------------end--------------->8--- I can't figure out where that 18432 offset is coming from. Also, based on the genimage configuration used to create this image, I'd expect at least two partitions: --8<---------------cut here---------------start------------->8--- ;; /gnu/store/2ah9p62crpar2iq2jcni85i4fz4yx9x4-genimage.cfg image image { hdimage { partition-table-type =3D "mbr" } partition GNU-ESP { partition-type =3D 0xEF image =3D "/gnu/store/d8irqwcay0w1wm54l1ydrs3kp6vcdd1a-partition.img" offset =3D "1048576" bootable =3D "false" } partition Guix_image { partition-type =3D 0x83 image =3D "/gnu/store/823mxbjirpcqgjkybkq60vc34p6nc218-partition.img" offset =3D "0" bootable =3D "true" } } --8<---------------cut here---------------end--------------->8--- I do find it surprisingly we split "generate base image with genimage" and "copy bootloader into base image" into different steps. From what I see at https://github.com/pengutronix/genimage genimage is entirely capable of placing the bootloader itself. Perhaps there is some value in reworking the direct bootloader installers (mostly u-boot I think?) to use genimage. --8<---------------cut here---------------start------------->8--- ;; example from README partition bootloader { in-partition-table =3D false offset =3D 0 image =3D "/path/to/bootloader.img" } --8<---------------cut here---------------end--------------->8--- If we are indeed deleting part of our Linux partition due to an overly large u-boot image (perhaps the image grew over time?), having genimage be in charge of copying both the partition images AND the bootloader file would presumably catch that error. At least, I assume genimage performs those kinds of sanity checks. I may very well be missing something here, particularly with interpreting the fdisk output. Sorry if I didn't make sense. This stuff is hard! :) I haven't even started looking into what, if any, logic is done on the Guix side for u-boot to find the Linux kernel. Spooky. =F0=9F=91=BB --=20 Take it easy, Richard Sent Making my computer weirder one commit at a time.