From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 5050370BA6; Mon, 26 Sep 2022 15:06:30 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 735FA70B7C; Mon, 26 Sep 2022 15:06:26 +0000 (UTC) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by atuin.qyliss.net (Postfix) with ESMTPS id 8EA0170B6C for ; Mon, 26 Sep 2022 15:06:20 +0000 (UTC) Received: by mail-lf1-x12f.google.com with SMTP id bu25so9434414lfb.3 for ; Mon, 26 Sep 2022 08:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unikie.com; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=25+R0s9/Qr+krTlpjF0izaejPE2P5ZDJLlXXmUfhamQ=; b=IDso1PDCqFz5oo9XCsbwGHjH4XDbkNFrj45jPyLgH2NwH7YxoSpDBJWt9clNjyT0/F u6UYFXbOSkNHrfmo78HTxhYveDXR5zO7V8idJjxo6Kw/WBHJvwwznGjvf9FVGLVm3bPG xAbIUnz7YUeAMylIfmkITc67EJ7wZrLab0vFg6VPDmJk1pHhd7+7BDKCKs+7r0VJKEV8 QRSL+YrAgmK2klVTbi0gstrsWyc3ec/B2xAHnhqx9+rFhcRoT1+zfIA99PdVRvI5kaD9 wsXPpy3VJ8wjXIF+5UPHBueB8xgnco+0pD96qkPVeQ/RGLiPQA5+8HfAojZf0KGfCGln kKfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=25+R0s9/Qr+krTlpjF0izaejPE2P5ZDJLlXXmUfhamQ=; b=DaeFJZKNNDuO0amMoEiLsmi5QHgrcSaFLmvFjsVsjCU9QnMnw18xaXMfEFXZJyZUIS pTQeCJF09tYDw1+A/16ib92hJPP9kvAXEB7z1UfWYOQIGIBp3IoC+tEi79pWu36tNKZF h8kkVUPOHa/qVEmv00f6wSzEa1H00Lxaqyt7HaXVLkz0lXQ7jzZjMvuBHrc9eAHZPg4m qwxLAZwkt0qJgOeSlSM1FDEsGOd2XT3T1f33y8tlZKii0KAK7lo9e2so1hTXuZy7TQmx 9iqbnrrQ3PWKYEDUY/R9ZMhQkbLUTAUurK2syRcSo7d+8EMnA122NCqJa1NxNmd6PXDW eCqQ== X-Gm-Message-State: ACrzQf2dKMiZxQq54wTwQBBIvONrEC9AOrPUbrNtJTX9ubUxUf6Nw03t gacbo2KJgDf/yC1gVMFyEiYPpQ== X-Google-Smtp-Source: AMsMyM4QJL4uq/y1O8CJHvcR5wF34R1B2ub5XhsQmtHnF2qEHkltckuWQbTF5OUlJDdzyK3XW2/npA== X-Received: by 2002:a05:6512:6ce:b0:49c:27a1:f94a with SMTP id u14-20020a05651206ce00b0049c27a1f94amr9603912lff.559.1664204778409; Mon, 26 Sep 2022 08:06:18 -0700 (PDT) Received: from [192.168.1.26] (mobile-access-6df023-175.dhcp.inet.fi. [109.240.35.175]) by smtp.gmail.com with ESMTPSA id a3-20020a056512200300b0049485e2cb91sm2547964lfb.231.2022.09.26.08.06.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Sep 2022 08:06:18 -0700 (PDT) Message-ID: Date: Mon, 26 Sep 2022 18:06:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] scripts/make-gpt.sh: reserve 8 MiB at start of GPT Content-Language: en-US To: Alyssa Ross , devel@spectrum-os.org References: <20220826130923.1840670-1-hi@alyssa.is> From: Ville Ilvonen In-Reply-To: <20220826130923.1840670-1-hi@alyssa.is> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: RSLAO7T7BYMVFYLVYRRGO5XCOTIJ7W2U X-Message-ID-Hash: RSLAO7T7BYMVFYLVYRRGO5XCOTIJ7W2U X-MailFrom: ville.ilvonen@unikie.com X-Mailman-Rule-Hits: header-match-devel.spectrum-os.org-0 X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1 CC: Yuriy Nesterov X-Mailman-Version: 3.3.5 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 8/26/22 16:09, Alyssa Ross wrote: > In some cases (e.g. a product built on Spectrum where updates to both > firmware and OS are delivered by the same vendor), it makes sense to > include firmware in the same image as the OS. This firmware tends to > live in the start of the image, after the GPT header. (The exact > location varies by board.) > > The 1 MiB reserved by sfdisk by default is not enough for this. The > conventional value seems to be 8 MiB. On NixOS, this is configurable > with the sdImage.firmwarePartitionOffset option, but this defaults to > 8 MiB and I wasn't able to find any examples in searches on DuckDuckGo > and GitHub of anybody using any other value, so it looks like 8 MiB is > broadly acceptable. > > Signed-off-by: Alyssa Ross > --- Thanks, this is an enabler for cross-compilation build configs for imx8 boards. Works as intended to enable the image building using https://github.com/tiiuae/spectrum-config-imx8 for imx8qxp but requires more patch(es) to Spectrum img/live/Makefile (pending). Testing Without: 1527808 bytes (1.5 MB, 1.5 MiB) copied, 0.00650894 s, 235 MB/s init: sector size too big Cannot initialize '::' Bad target ::/ With: 1527808 bytes (1.5 MB, 1.5 MiB) copied, 0.00981576 s, 156 MB/s /nix/store/609b8cnks906dkpcq8hn6v0b1farbis2-spectrum-live-imx8qxp.img-0.1 Tested-by: Ville Ilvonen -Ville > Yuriy, if you'd like to test this patch, here's some documentation > about how to do that. :) > > https://spectrum-os.org/doc/testing-patches.html > > scripts/make-gpt.sh | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/scripts/make-gpt.sh b/scripts/make-gpt.sh > index 56076d3..55f38d6 100755 > --- a/scripts/make-gpt.sh > +++ b/scripts/make-gpt.sh > @@ -1,12 +1,13 @@ > #!/bin/sh -eu > # > # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross > +# SPDX-FileCopyrightText: 2022 Unikie > # SPDX-License-Identifier: EUPL-1.2+ > # > # usage: make-gpt.sh GPT_PATH PATH:PARTTYPE[:PARTUUID]... > > ONE_MiB=1048576 > -TWO_MiB=2097152 > +NINE_MiB=9437184 > > # Prints the number of 1MiB blocks required to store the file named > # $1. We use 1MiB blocks because that's what sfdisk uses for > @@ -41,8 +42,9 @@ shift > nl=$'\n' > table="label: gpt" > > -# Keep 1MiB free at the start, and 1MiB free at the end. > -gptBytes=$TWO_MiB > +# Keep 8MiB free at the start (to provide space for firmware if > +# required), and 1MiB free at the end. > +gptBytes=$NINE_MiB > for partition; do > sizeMiB="$(sizeMiB "$(partitionPath "$partition")")" > table="$table${nl}size=${sizeMiB}MiB,$(awk -f "$scriptsDir/sfdisk-field.awk" -v partition="$partition")" > @@ -52,6 +54,7 @@ done > rm -f "$out" > truncate -s "$gptBytes" "$out" > sfdisk "$out" < +first-lba: 16384 > $table > EOF >