From nobody Sun Jul 10 20:48:59 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 61D2417FBB51 for ; Sun, 10 Jul 2022 20:49:11 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-21.consmr.mail.gq1.yahoo.com (sonic309-21.consmr.mail.gq1.yahoo.com [98.137.65.147]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lgzdd6C4tz3sbp for ; Sun, 10 Jul 2022 20:49:09 +0000 (UTC) (envelope-from marklmi@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1657486147; bh=qOURTfGhCSCiMrv4VehZUaWXzHwargUKEEPaCHLGf4E=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject:Reply-To; b=cMGHlrbmKTb4CtW2aUOBgznpqtyVLVdKZCQoxLlQCevaEW8Wt8JhUqIQ+M6shoWJ20NHrz8rfDNxq9TyQmvypyZZ2yfPI4S8H/JMWZHjv3quuJbSU1X9eD/S8yhVV4M5O8igm5EzyK8INF44I0ybC9lLV0tDlgAX5D9wBpR56rwXV1bTGkz5ALim7d1ImzPoBptCaWhW0NjqyoCLa/ryryxskc8fuc7CIWWH1vS7Gx0zACnhf5Yptt18T1vDBIVkw4qtSnQWDy0jVMYq0L+GcbAinhKRP3GJiXcOPVkw9CagXq6kCs0WeA4ptve9eIYVh79sOi3BX4DHSJvKKyq4Ow== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1657486147; bh=ebwCrPkOMyUfjgnkU55ovTgCz6La56wQdWSlL+cqzZP=; h=X-Sonic-M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oaTJida1MO2b1EkHJjwON.FUfYstn6J8i0ku3pyCetjoAjjDrVa5jr_vn6udT5skHezNb sDbmj0gxdTOACoimQucwmLCmxr8ZQHm9A6RYPjxAJTT1mFf11gk_LAlVuaEYkejasZgupkm1Hgkq bTXk065csQW5IkwKpFSlxNYdeviCb8uMlluHQn8jJ8exxhIyKZgYwGZlCwJtu8rEgXqrTmFaTak9 H3i6U6VaPSA6dTALNIRT9TZmf_w2O38sCCiSzFL2ntgXLHde3cCyC9kAJWm3wcbAHxW1plx6NTvh 900uCFrk35m5wPhbflVttOxLPPac9NZc9L5nwylBmuitbaGqPF3HLDo957T_34g0S1RhK.JztocR mYp9h7QwzTr988z2v7lI6rVt5Sb7IvM6SdTOIzuVOzMOslRljVnGEAupcJytyDUCPyuCwDDW8GBQ o_i9vB9F8nB8DdUhPWvVDmtbBM9hAJece8TV2DHGTmk5m76PdpZY1GrTvCb3RBsqflHrorPuf4BY _mRW.6oguyQJ25o7dcLJ_3eVThHJvOh_nTlJGaQGJia6vSMhxN30wcfpybcMggSLkrsbZKFvBx5M 0Gw-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Sun, 10 Jul 2022 20:49:07 +0000 Received: by hermes--production-bf1-58957fb66f-2wrgg (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID e16054982ca398ef5855650a70327d6b; Sun, 10 Jul 2022 20:49:01 +0000 (UTC) Content-Type: text/plain; charset=us-ascii List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: Partition layout of ARM SD card images From: Mark Millard In-Reply-To: <1F42EED0-B39F-4E33-986A-FB70A3AA4362@cyclaero.com> Date: Sun, 10 Jul 2022 13:48:59 -0700 Cc: freebsd-arm Content-Transfer-Encoding: quoted-printable Message-Id: References: <1F42EED0-B39F-4E33-986A-FB70A3AA4362@cyclaero.com> To: "Dr. Rolf Jansen" X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4Lgzdd6C4tz3sbp X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=cMGHlrbm; dmarc=pass (policy=reject) header.from=yahoo.com; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.65.147 as permitted sender) smtp.mailfrom=marklmi@yahoo.com X-Spamd-Result: default: False [-2.73 / 15.00]; NEURAL_HAM_SHORT(-1.00)[-0.999]; NEURAL_HAM_LONG(-0.75)[-0.749]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_MEDIUM(-0.48)[-0.479]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; RCVD_IN_DNSWL_NONE(0.00)[98.137.65.147:from]; TO_DN_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; DKIM_TRACE(0.00)[yahoo.com:+]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; MLMMJ_DEST(0.00)[freebsd-arm] X-ThisMailContainsUnwantedMimeParts: N On 2022-Jul-10, at 12:26, Dr. Rolf Jansen = wrote: > For example let's have a llok on the partition layout of, = FreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img (the others are similar): >=20 > # mdconfig -a -u 0 -t vnode -f = diskimg/FreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img > # gpart show md0 md0s2 >=20 > =3D> 63 6291393 md0 MBR (3.0G) > 63 2016 - free - (1.0M) > 2079 102312 1 fat32lba [active] (50M) > 104391 6187041 2 freebsd (3.0G) > 6291432 24 - free - (12K) >=20 > =3D> 0 6187041 md0s2 BSD (3.0G) > 0 57 - free - (29K) > 57 6186880 1 freebsd-ufs (2.9G) > 6186937 104 - free - (52K) >=20 > The start of the fat32 boot slice s1 (containing the u-boot) stuff is = neither aligned to 1M nor to 4k, it starts on an odd base. The start of = the BSD payload slice s2 and its size are odd as well. The padding of 57 = blocks within s2 lets the UFS partition start on a globally even base, = namely 104391+57 =3D 104448, which as a matter of fact is 4k aligned = (104448*512/4096 =3D 13056) and 1M aligned as well (104448*512/1024/1024 = =3D 51), however all this keeps looking strange. >=20 > Are there reasons for this partition layout besides making it look = more interesting? If yes, some insights would be good. The layout details are more specific to the aarch64 RPi* context than to general aarch64 SD card images. For example, the Rock64 image is different: # mdconfig -a -u 0 -t vnode -f = FreeBSD-14.0-CURRENT-arm64-aarch64-ROCK64-20220708-a0b956f5ac5-256605.img # gpart show md0 =3D> 40 6291376 md0 GPT (3.0G) 40 32728 - free - (16M) 32768 102400 1 efi (50M) 135168 6156160 2 freebsd-ufs (2.9G) 6291328 88 - free - (44K) The 32768 is associated with: # more /usr/local/share/u-boot/u-boot-rock64/README=20 U-Boot loader and related files for the Pine64 Rock64. To install this bootloader on an sdcard just do: dd if=3D/usr/local/share/u-boot/u-boot-rock64/idbloader.img = of=3D/path/to/sdcarddevice seek=3D64 bs=3D512 conv=3Dsync dd if=3D/usr/local/share/u-boot/u-boot-rock64/u-boot.itb = of=3D/path/to/sdcarddevice seek=3D16384 bs=3D512 conv=3Dsync where the sizes are: 103411 for idbloader.img 793560 for u-boot.itb In other words: assocaited with having room for the idbloader and U-Boot as required by the Rock64. [Most U-Boot's(/whatever's) are not placed inside a file system and the positions/sizes vary. The Rock64 is just an example that I happen to have access to.] [If I make my own partitioning, I tend to use the 32768 so U-Boot/whatever fairly generally have room to be replaced. But I've not checked if any u-boot/whatever ports require even more space up front. I tend to set up to also allow the RPi* to boot as well as the likes of the Rock64 (or whatever).] Looking at what the official raspios arm64 images look like, for example: = https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_a= rm64-2022-04-07/2022-04-04-raspios-bullseye-arm64-lite.img.xz # mdconfig -a -u 1 -t vnode -f = 2022-04-04-raspios-bullseye-arm64-lite.img=20 # gpart show md1 =3D> 33 3907551 md1 MBR (1.9G) 33 8159 - free - (4.0M) 8192 524288 1 fat32lba (256M) 532480 3375104 2 linux-data (1.6G) Note the 256M fat32lba instead of only 50M. This dates back to: QUOTE 2019-06-20: * Based on Debian Buster . . . * Boot partition size set to 256M * Linux kernel 4.19.50 * Raspberry Pi firmware 88ca9081f5e51cdedd16d5dbc85ed12a25123201 END QUOTE rpi-update has logic that can produce the following kind of message: QUOTE Partition size $(( $PARTSIZE >> 20 ))M may not be sufficient for new Pi4 = files This could result in a system that will not boot. 256M FAT partition is recommended. Ensure you have a backup if = continuing. END QUOTE It has had that since 2019-Jun-24, 882f5c1 in: https://github.com/raspberrypi/rpi-update/commits/master/rpi-update I do not know when the 8192 usage started. It is possible that the FreeBSD-13.1-RELEASE-arm64-aarch64-RPI.img structure just dates back to matching far earlier Raspberry Pi images. (I did not look that far back.) > For the time being, I created a second SD card from the initial one = for my RPi 4, and it's partition table is as follows: >=20 > # gpart show mmcsd0 mmcsd0s2 > =3D> 63 62410689 mmcsd0 MBR (30G) > 63 25 - free - (13K) > 88 102312 1 fat32lba [active] (50M) > 102400 62308352 2 freebsd (30G) >=20 > =3D> 0 62308352 mmcsd0s2 BSD (30G) > 0 56623104 1 freebsd-ufs (27G) > 56623104 5685248 2 freebsd-swap (2.7G) =3D=3D=3D Mark Millard marklmi at yahoo.com