ESP partition uses 1024 byte sectors

  • Open
  • quality assurance status badge
Details
One participant
  • Efraim Flashner
Owner
unassigned
Submitted by
Efraim Flashner
Severity
normal
E
E
Efraim Flashner wrote on 29 Nov 2022 21:51
(address . bug-guix@gnu.org)
Y4Zw3gQWuqtEQ7Py@3900XT
I was working on using a grub-efi system image for aarch64 and I got the
following error:
'Error: FAT sector size mismatch (fs=1024, dev=512)'
I traced it back to u-boot¹. u-boot wouldn't chainload grub if the
device block size and the filesystem sector size doesn't line up. I
changed the line in (gnu build image) in make-vfat-image to use '-S 512'
for esp partitions and was able to load the grub menu from u-boot.

I spent some time looking through the git history but I wasn't able to
find anything to suggest why we have 1024 byte sectors there
specifically.


--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmOGcN4ACgkQQarn3Mo9
g1F/Ug/+Ph4oxQW1WEELiufrOwqvmr0GVNNBheXmFrzF1r/vTyN4zJjqjr2ugzod
BUPnby9kTAeBzoFP8n38aTM3F+msczZWNPeX9nq5o8NnyG0VP/63Yemkzpr9ANJY
ixaRuNP3YAy9K4rz7Auu+MXDPm9wm9V6+uxopVKwLJZuiDmEkAwHgFJxSEhq3JQo
i+EFLO1S2ncDQAok6bqfIbphrWOglZDAPocSSNzC/e1wX/MuwkbY0prOPB45BpcE
kA4b+erQtb9vkuqSrMy0DPkXd1A7JhG+dIOaxhcKKyxDyt3xnK+SUqVR/6vCBv9E
A/SQ6zy9WTGw4xJx9W8sVaaJE9evkCORC903/9aXA+5pjOFu0K6/1Kw7T7A1Irkk
yWukV7qygvSm66WKu2u9wCMWsK01DYdJtwX2oUUuQCmxdwe1f8AKnip/L5FMcqWi
4Twi5O2S8YcAivlRnGmHwWTvkCgANsKXAEeMp5iJjhYqWI7PSgIwqDt9PBsc/6yD
AdRCtUwWqh9LlR6qj7ZN6Xl7eEOTUh1FLjEEBRSTezhDbbPrALvgxsYkusO0hieq
K6bdQOywEc+xhPo/6nnx15Y2WOVrbWZ0/oSg79gqViOwSqRPxOL2vOdqFQdkMsU9
8/mrK4976dbvBPQhkNKx+vRB5wR0NTf4GxrEldWerbqWgnWMA10=
=duo/
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 1 Dec 2022 09:24
(address . 59695@debbugs.gnu.org)
Y4hksd7ae7PPiZUd@3900XT
On Tue, Nov 29, 2022 at 10:51:42PM +0200, Efraim Flashner wrote:
Toggle quote (14 lines)
> I was working on using a grub-efi system image for aarch64 and I got the
> following error:
> 'Error: FAT sector size mismatch (fs=1024, dev=512)'
> I traced it back to u-boot¹. u-boot wouldn't chainload grub if the
> device block size and the filesystem sector size doesn't line up. I
> changed the line in (gnu build image) in make-vfat-image to use '-S 512'
> for esp partitions and was able to load the grub menu from u-boot.
>
> I spent some time looking through the git history but I wasn't able to
> find anything to suggest why we have 1024 byte sectors there
> specifically.
>
> ¹ https://source.denx.de/u-boot/u-boot/-/blob/master/fs/fat/fat.c#L589

Normally I'd be ok with hardcoding 512 for the sector size to fix this,
but then I remembered that there are 4k block size disks which actually
declare themselves as having 4k blocks and not emulating 512 byte
blocks.

What do you think? I suppose one option would be to patch u-boot to not
demand they be equal, but that only works with guix build u-boot. We
could force 512, u-boot is the only thing I've come across so far that
cares and most people² use µSD cards which advertise 512 byte blocks.

Maybe change it to 512 and add a TODO to revisit it later as needed?

² citation needed

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmOIZK4ACgkQQarn3Mo9
g1E4yA//QTuJeKP1GOhF8ZiHWqWAvh3Ka+KWFWK14k6+3eHNA3QXdSiXosps75H8
8aRyE59319aY6szkDFbkFfuc0PvoYU5kYgRaeqqo1Pm0us8Zn3RdEwMSm1ZgkOSv
oBGOJv3hGiEyqDKXWm59EZuri+KPxaQrOFmk7KrkAZO7G7NWEUrhtoywaMqKb04F
r4PGp9DhHR+TFwjYnTriNr4N8NJXAj+KVzm+x4YogH2MdfXYsMBUFwkjr1LXqEgy
89ogUfKPN9NWRg3wWxI6vtF1JgDXqB2lpQrQgAnFPiOc4ZxW5T7Rcn49V0fK7F45
BVH8Zsre/7+3A3adrs7FHjYiCrL8IM+welcbodQO/TVn5teG5NEqFPTn9wygRgVG
zyzUscmqFlj57z34kbf3zEVxsbB8Orrgf/zha/+YudKndoDEXbmi8DvEF1F28f7z
TUSLOvV7ROUb/MeQIdZ+Knnoip3HqBfIPwPxz5/+XPYi56SVy/7iL9OiT4S+M1uO
k4jBs0Xv0Zp460qj9s6ySi3ZH4hafW5FZDzIvzMg3zNoc/vP1tBAb2y9I5B9FO9W
FcKitxPijYsxLcOyUFDIs83g61H9RB2oMg/6Q80oazXSR2OF99qf2PMxLyeaIhpt
Nb1xzHkWTGKjnB1yJjgeuuLxEWgDVnsdbPChQgbIvUH24B5AX3E=
=HJNi
-----END PGP SIGNATURE-----


?