Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jul 2022 23:45:41 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Glen Barber <gjb@freebsd.org>
Cc:        Warner Losh <imp@bsdimp.com>, dev-commits-src-main@freebsd.org, "Rodney W. Grimes" <freebsd-rwg@gndrsh.dnsmgr.net>, "Dr. Rolf Jansen" <freebsd-rj@cyclaero.com>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: git: 1dfcff294e44 - main - release: increase IMAGE_SIZE for arm, arm64, riscv [odd alignment for SBC images]
Message-ID:  <16906DFD-286B-4D59-9438-CA9CD9026C55@yahoo.com>
In-Reply-To: <DBED097F-00BD-467C-8CA3-49857DA35456@yahoo.com>
References:  <84410D65-6F86-44E5-8B14-8A523C9919C7.ref@yahoo.com> <84410D65-6F86-44E5-8B14-8A523C9919C7@yahoo.com> <20220713201327.GY30607@FreeBSD.org> <7F4F9683-B4DE-4F65-BBD7-027039A0C270@yahoo.com> <20220713204227.GA30607@FreeBSD.org> <8A02A4A4-9F3A-47F2-9985-EA2151043BB7@yahoo.com> <4D903E5A-58FB-4516-AC53-AEDFF48564A7@yahoo.com> <20220714152125.GB30607@FreeBSD.org> <3E2DCFBD-CC8F-4C13-B18C-B7DA26ED8E84@yahoo.com> <AE47C47B-33F7-4236-8A23-688C40340EA7@yahoo.com> <DBED097F-00BD-467C-8CA3-49857DA35456@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2022-Jul-16, at 23:24, Mark Millard <marklmi@yahoo.com> wrote:

> On 2022-Jul-15, at 17:41, Mark Millard <marklmi@yahoo.com> wrote:
>=20
>> FYI for the new snapshot build of 13.1-STABLE:
>>=20
>> # mdconfig -u0 -f =
FreeBSD-13.1-STABLE-arm64-aarch64-RPI-20220715-831c6b8edda-251792.img=20
>> # gpart show md0
>> =3D>      63  10485697  md0  MBR  (5.0G)
>>       63      2016       - free -  (1.0M)
>>     2079    102312    1  fat32lba  [active]  (50M)
>>   104391  10381329    2  freebsd  (5.0G)
>> 10485720        40       - free -  (20K)
>>=20
>> So: still has the 2016 and 2079 that do not seem to match
>> what /usr/src/release/ materials would indicate --and the
>> 2079 leads to poor alignment for a microsd cards, for
>> example.
>>=20
>> But, at least something was produced this time. There is
>> now a 13.1-STABLE snapshot to test the handling related
>> to the new UFS/FFS superblock validations.
>=20
> In the live build environment that makes the images,
> what is:
>=20
> # sysctl kern.geom.part.mbr.enforce_chs
> kern.geom.part.mbr.enforce_chs: 0
>=20
> I ask because of the description:
>=20
> QUOTE
>     kern.geom.part.mbr.enforce_chs: 0
>             Specify how the Master Boot Record (MBR) module does =
alignment.
>             If this variable is set to a non-zero value, the module =
will
>             automatically recalculate the user-specified offset and =
size for
>             alignment with the CHS geometry.  Otherwise the values =
will be
>             left unchanged.
> END QUOTE
>=20
> In particular, the text about non-zero values leading to:
>=20
> QUOTE
> the module will
>             automatically recalculate the user-specified offset and =
size for
>             alignment with the CHS geometry
> END QUOTE
>=20
> This sounds like a potential way to not end up with the
> what the /usr/src/release handling requests for the
> small board computer images. It might explain the
> mismatched alignment that I've been reporting.

I tried it locally and it reproduced the problem alignment:

# sysctl kern.geom.part.mbr.enforce_chs=3D1
kern.geom.part.mbr.enforce_chs: 0 -> 1
# truncate -s3072m mmjnk.test
# mdconfig -u0 -fmmjnk.test -x63 -y255
# gpart create -sMBR md0
md0 created
# gpart show md0
=3D>     63  6291393  md0  MBR  (3.0G)
       63  6291393       - free -  (3.0G)

CA72_16Gp_ZFS aarch64  1400063 1400063 # gpart add -t'!12' -a512k -s50m =
-b1m md0
md0s1 added
CA72_16Gp_ZFS aarch64  1400063 1400063 # gpart show md0
=3D>     63  6291393  md0  MBR  (3.0G)
       63     2016       - free -  (1.0M)
     2079   102312    1  fat32lba  (50M)
   104391  6187065       - free -  (3.0G)

Note the 2016 and 2079 (instead of 1985 and 2048).

Reminder of the old result, reported before, that
implicitly had:

# sysctl kern.geom.part.mbr.enforce_chs
kern.geom.part.mbr.enforce_chs: 0

as its context:

QUOTE
# truncate -s3072m mmjnk.test
# mdconfig -u0 -fmmjnk.test -x63 -y255
# gpart create -sMBR md0
md0 created
# gpart show md0
=3D>     63  6291393  md0  MBR  (3.0G)
     63  6291393       - free -  (3.0G)
# gpart add -t'!12' -a512k -s50m -b1m md0
md0s1 added
# gpart show md0
=3D>     63  6291393  md0  MBR  (3.0G)
     63     1985       - free -  (993K)
   2048   102400    1  fat32lba  (50M)
 104448  6187008       - free -  (3.0G)
END QUOTE

Looks to me like the environment that uses
/usr/src/release to produce Small Board Computer
images has:

# sysctl kern.geom.part.mbr.enforce_chs
kern.geom.part.mbr.enforce_chs: 1

and this is leading to the misalignments for the MBR images.


=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16906DFD-286B-4D59-9438-CA9CD9026C55>