GUIX Image API: wrong fs type and flag

  • Done
  • quality assurance status badge
Details
5 participants
  • Maxime Devos
  • Tobias Geerinckx-Rice
  • Mathieu Othacehe
  • Pavel Shlyak
  • Pavel Shlyak
Owner
unassigned
Submitted by
Pavel Shlyak
Severity
normal
Merged with
P
P
Pavel Shlyak wrote on 13 May 2022 23:46
(address . bug-guix@gnu.org)
3078A40B-22B0-4492-BFD2-72D725F31689@gmail.com
I have a scheme code like

(define rpi-boot-partition
(partition
(size (* 128 (expt 2 20)))
(label "BOOT")
(file-system "vfat")
(flags '())
(initializer (gexp initialize-efi-partition))))

(define rpi-root-partition
(partition
(size 'guess)
(label "RASPIROOT")
(file-system "ext4")
(flags '(boot))
(initializer (gexp initialize-root-partition))))

(define raspberry-pi-image
(image
(format 'disk-image)
(partitions (list rpi-boot-partition rpi-root-partition))))

The output is like that:
$ fdisk -l /gnu/store/hnsfs5a161f5hvymg7ar541qrml62yvv-raspberry-pi-barebones-raw-image
Device Boot Start End Sectors Size Id Type
/gnu/store/hnsfs5a161f5hvymg7ar541qrml62yvv-raspberry-pi-barebones-raw-image1 1 262144 262144 128M 83 Linux
/gnu/store/hnsfs5a161f5hvymg7ar541qrml62yvv-raspberry-pi-barebones-raw-image2 262145 3583688 3321544 1.6G 83 Linux

No boot flag is set on the first partition. The file system seems to be incorrect (ext* instead of vfat)
T
T
Tobias Geerinckx-Rice wrote on 14 May 2022 10:27
(no subject)
(address . control@debbugs.gnu.org)
47933e2c0cfb127ecbfb0cc1be7eba9b@tobias.gr
merge 55405 55406
M
M
Maxime Devos wrote on 14 May 2022 11:16
Re: bug#55405: Image API produces incorrect images
(address . control@debbugs.gnu.org)
d00ae27ced4aef7096ab1403a17dab563a6d7d4c.camel@telenet.be
merge 55405 55406
thanks

(duplicate)
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYn9zXBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7k93AQC0OBNW0Oa7RseBKpPWALNCRsn0
e19BMBlLuuxTm7WOqgD8DrBHiwhTsYHDV+i+XrwkDd3Yln8VbmFw79MWhSfbAgM=
=i/Sn
-----END PGP SIGNATURE-----


P
P
Pavel Shlyak wrote on 15 May 2022 19:11
GUIX Image API: wrong fs type and flag
(address . 55406@debbugs.gnu.org)
1219026A-541C-4689-9C3E-C35A8F39E30B@gmail.com
I found it. It blows my mind. Let me just cry out here.

(define (partition->dos-type partition)
;; Return the MBR partition type corresponding to the given PARTITION.
(let ((flags (partition-flags partition)))
(cond
((member 'esp flags) "0xEF")
(else "0x83"))))

(define (partition->gpt-type partition)
;; Return the genimage GPT partition type code corresponding to PARTITION.
(let ((flags (partition-flags partition)))
(cond
((member 'esp flags) "U")
(else "L"))))
Attachment: file
P
P
Pavel Shlyak wrote on 15 May 2022 19:00
(address . 55406@debbugs.gnu.org)
F42EB997-9753-4930-B9E1-B02645732929@pantherx.org
It looks like setting esp flag with (flags '(esp)) also sets file system to vfat. However,
1. I still cannot resolve boot flag issue
2. I do not need that flag and I’d be glad getting correct partition without it
P
P
Pavel Shlyak wrote on 20 May 2022 19:01
WIP: Image API support for fat16 partitions
(address . 55406@debbugs.gnu.org)
332533F2-B819-4EF4-9EAA-FBB55AAD13E5@pantherx.org
I have written a small patch to partially fix the issue. Flags are still not set. GPT is still not fixed. There’s no need to return file systems that are not supported in make-partition-image function in gnu/build/image.scm
P
P
Pavel Shlyak wrote on 20 May 2022 21:54
(address . 55406@debbugs.gnu.org)
B63F3183-7556-484F-97C3-3B18CBA354CD@pantherx.org
This patch fixes GPT support for fat partitions. Should be applied after gpt-support-vfat-partitions.patch
P
P
Pavel Shlyak wrote on 21 May 2022 15:09
Patch to handle boot flag in Image API
(address . 55406@debbugs.gnu.org)
37ECE4BB-C5C7-4C9E-A54A-03F12EA2464E@pantherx.org
Here’s the last patch in the set that adds support for the boot flag. It should be merged after mbr-support-vfat-partitions.patch and gpt-support-vfat-partitions.patch
The issue can be closed as soon as all three patches are merged.
Have a nice day!
M
M
Mathieu Othacehe wrote on 22 May 2022 15:33
Re: bug#55406: GUIX Image API: wrong fs type and flag
(name . Pavel Shlyak)(address . p.shlyak@pantherx.org)(address . 55406@debbugs.gnu.org)
87zgj91yl9.fsf_-_@gnu.org
Hello Pavel,

Toggle quote (5 lines)
> Here’s the last patch in the set that adds support for the boot
> flag. It should be merged after mbr-support-vfat-partitions.patch and
> gpt-support-vfat-partitions.patch The issue can be closed as soon as
> all three patches are merged. Have a nice day!

Thanks for those three patches. At first sight, they look fine :) It
would be great if you could resend them using "git format-patch",
following the guidelines available here:

Could you also add your copyright on top of the edited files?

Mathieu
P
M
M
Mathieu Othacehe wrote on 23 May 2022 10:30
Re: bug#55406: GUIX Image API: wrong fs type and flag
(name . Pavel Shlyak)(address . p.shlyak@pantherx.org)(address . 55406-done@debbugs.gnu.org)
878rqslkgw.fsf_-_@gnu.org
Hello Pavel,

Toggle quote (2 lines)
> Ok, I tried to format them :)

Thanks, I added commit messages following our guidelines, fixed the
indentation and a few other small details.

Pushed on master!

Mathieu
Closed
?