unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45517: Failed boot on arm32 with u-boot due to missing requirements with the distro boot protocol
@ 2020-12-29  2:34 Denis 'GNUtoo' Carikli
  2020-12-30 14:35 ` Mathieu Othacehe
  0 siblings, 1 reply; 5+ messages in thread
From: Denis 'GNUtoo' Carikli @ 2020-12-29  2:34 UTC (permalink / raw)
  To: 45517

[-- Attachment #1: Type: text/plain, Size: 3172 bytes --]

Hi,

I've generated an image for the Lime2 with this (lime2.scm) file:
> ;; Based on Guix's beaglebone-black.tmpl
> (use-modules (gnu) (gnu bootloader u-boot))
> (use-package-modules bootloaders)
> (operating-system
>   (host-name "lime2")
>   (timezone "Europe/Paris")
>   (locale "en_US.utf8")
>   ;; We use a microSD
>   (bootloader (bootloader-configuration
>                (bootloader u-boot-a20-olinuxino-lime2-bootloader)
>                (target "/dev/mmcblk0")))
>   (kernel-arguments '("console=ttyS0,115200" "ignore_loglevel"))
>   ;; This module is required to mount the SD card.
>   (initrd-modules (cons "sunxi-mmc" %base-initrd-modules))
>   (file-systems (cons (file-system
>                         (device (file-system-label "my-root"))
>                         (mount-point "/")
>                         (needed-for-boot? #t)
>                         (type "ext4"))
>                       %base-file-systems))
>   (packages %base-packages)
>   (services (append (list
>                      (agetty-service
>                       (agetty-configuration
>                        (extra-options '("-L"))
>                        (baud-rate "115200")
>                        (term "xterm-256color")
>                        (tty "ttyS0"))))
>                     %base-services)))

I then built it with:
> cp `guix system disk-image --target=arm-linux-gnueabihf lime2.scm` \
>     guix.img

However when booting the image, u-boot doesn't find
/boot/extlinux/extlinux.conf.

However running the following command in u-boot makes the board boot:
> sysboot mmc 0:2 any $scriptaddr /boot/extlinux/extlinux.conf

When we look at the resulting image with fdisk -l we have:
> Device     Boot Start     End Sectors  Size Id Type
> guix.img1        2048   83967   81920   40M ef EFI (FAT-12/16/32)
> guix.img2       83968 3301783 3217816  1.5G 83 Linux

The second partition (which has /boot/extlinux/extlinux.conf) doesn't
have the boot flag.

Adding the boot flag with the following command results in a booting
image:
> sfdisk guix.img -A 2

This is because the distro boot protocol (documented in
doc/README.distro in u-boot source code[1]) expects the partition that
holds the extlinux.conf config file to be "explicitly marked bootable".
else "U-Boot falls back to searching the first valid partition of a
disk for boot configuration files."

So we either need to remove the first partition or to mark the second
partition as bootable or both.

I've tried looking in the partitioning code to understand how flags are
set but I'm a complete newbie in scheme so I failed. Being able to set
the bootable flag could probably help in some situations where a first
partition has to be used for some reasons.

In addition, the first partition it only contains the
/EFI/BOOT/BOOTIA32.EFI file which is of the following type:
> PE32 executable (EFI application) Intel 80386 (stripped to external
> PDB), for MS Windows
So it could also be removed and/or replaced with ARM code.

References:
-----------
[1]https://gitlab.denx.de/u-boot/u-boot/-/raw/master/doc/README.distro

Denis.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-03 22:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29  2:34 bug#45517: Failed boot on arm32 with u-boot due to missing requirements with the distro boot protocol Denis 'GNUtoo' Carikli
2020-12-30 14:35 ` Mathieu Othacehe
2021-01-02  2:54   ` Denis 'GNUtoo' Carikli
2021-01-02 10:23     ` Mathieu Othacehe
2021-01-03 22:15       ` Danny Milosavljevic

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).