Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Feb 2017 15:56:00 -0600
From:      Karl Denninger <karl@denninger.net>
To:        Oleksandr Tymoshenko <gonzo@bluezbox.com>, Toomas Soome <tsoome@me.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Crochet build for Pi3 fails to boot on r313441 (and later), works on r313109
Message-ID:  <a586e0b9-375c-2676-9e74-ea4864ec06f3@denninger.net>
In-Reply-To: <20170209213916.GA40599@bluezbox.com>
References:  <517ab0d5-412a-35dd-7d0d-d8297af43b46@denninger.net> <4a6f872b-cee1-57e5-7a72-a1d445f9926f@denninger.net> <F4D44CDD-BEF6-4E21-848A-745B88440617@me.com> <5128b9a9-1186-8c6c-6227-e5e8a087cf89@denninger.net> <0B4B40AA-E654-4A71-92B0-D8E6CD234B63@me.com> <20170209213916.GA40599@bluezbox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format.

--------------ms000006090104000406080004
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 2/9/2017 15:39, Oleksandr Tymoshenko wrote:
> Toomas Soome (tsoome@me.com) wrote:
>>> On 9. veebr 2017, at 17:05, Karl Denninger <karl@denninger.net> wrote=
:
>>>
>>>
>>> On 2/9/2017 08:58, Toomas Soome wrote:
>>>>> On 9. veebr 2017, at 16:36, Karl Denninger <karl@denninger.net> <ma=
ilto:karl@denninger.net> wrote:
>>>>>
>>>>>
>>>>> On 2/8/2017 16:18, Karl Denninger wrote:
>>>>>> r313441 blows up on the Pi3 in /boot/loader.efi with:
>>>>>>
>>>>>> FreeBSD/arm64 EFI loader, Revision 1.1
>>>>>> (Tue Feb  7 15:15:52 CST 2017 freebsd@NewFS.denninger.net <mailto:=
freebsd@NewFS.denninger.net>)
>>>>>> Failed to start image provided by UFS (14)
>>>>>> "Synchronous Abort" handler, esr 0x96000004
>>>>>> ELR:     3af62cec
>>>>>> LR:      3af61d60
>>>>>> x0 : 0000000000000001 x1 : 0000000000000001
>>>>>> x2 : 000000003afeb000 x3 : 000000000000003f
>>>>>> x4 : 0000000000000020 x5 : 0000000000000010
>>>>>> x6 : 0000000000000000 x7 : 0000000039b260a4
>>>>>> x8 : 000000003af61d48 x9 : 000000000000000d
>>>>>> x10: 0000000000000030 x11: 0000000000000000
>>>>>> x12: 0000000000000000 x13: 0000000000000002
>>>>>> x14: 0000000000000000 x15: 0000000000000000
>>>>>> x16: 0000000000000000 x17: 0000000000000000
>>>>>> x18: 000000003ab30df8 x19: 0000000037a16008
>>>>>> x20: 0000000000000000 x21: 0000000000000000
>>>>>> x22: 0000000039b28000 x23: 0000000039b1d49c
>>>>>> x24: 0000000039b28850 x25: 000000003ab3d740
>>>>>> x26: 000000003af839a0 x27: 0000000039b2e3e8
>>>>>> x28: 0000000000000000 x29: 000000003ab2ef60
>>>>>>
>>>>>> Resetting CPU ...
>>>>>>
>>>>>> If you copy in a loader.efi from an earlier build (e.g. r313109) t=
hen the system boots but complains about SMP problems, fails to start any=
 of the other CPUs (although it sees them) and panics before it reaches a=
 login prompt with what appears to be a problem reading the SD card (I al=
so get a couple of lor's in here too..... not sure if those are "real" or=
 false positives)
>>>>>>
>>>>>> B
>>>>> This has been isolated to r313333 in sys/boot/efi; reverting the EF=
I
>>>>> loader to a previous revision stops the crash.
>>>>>
>>>>> Filed here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D216=
940 <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D216940>; <https:/=
/bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D216940> <https://bugs.freebs=
d.org/bugzilla/show_bug.cgi?id=3D216940>
>>>>>
>>>> Does it still crash with r313442? I think it does and this is why:
>>>>
>>>> From your log above, the hint is "Failed to start image provided by =
UFS (14)=E2=80=9D, so what we can guess here is that for some reason the =
loader.efi main() failed to detect the boot device, and did return back t=
o boot1.
>>>>
>>>> Boot1 did print out this error message and did call panic(). So, the=
 question is, why it is failing to detect the root fs handle. I=E2=80=99l=
l try to check if I can replicate the issue with x86 + ufs.
>>>>
>>>> BTW: sorry for trouble:)
>>>>
>>>> rgds,
>>>> toomas
>>>>
>>> Yes.
>>>
>>> It's isolated to that particular revision, which appears to have rewo=
rked the enumeration of the available devices to boot from.  Reverting on=
ly sys/boot/efi to anything before 313333 (e.g. "svn update -r 313332 ." =
in src/sys/boot/efi) and rebuilding results in a loader.efi that successf=
ully loads and starts the kernel.
>>>
>> Well, the x86 version does not appear to have problems with finding th=
e ufs devices. So this has to be some sort of corner case related to arm:=
( unfortunately I do not have much variants to test arm, except qemu=E2=80=
=A6 so some help would be needed there. Since the only crash is from boot=
1 call to panic, I am pretty sure the disk detection and setup was ok, so=
 we should get disk list if we insert something like:
>>
>> for (i =3D 0; devsw[i] !=3D NULL; i++) {
>>         if (devsw[i]->dv_print !=3D NULL){
>>             if (devsw[i]->dv_print(verbose))
>>                 break;
>>         }
>> }
>>
>> after dv_init() loop.
>>
>> If thats true, then it should not take too much to find why we fail to=
 get the handle for root fs in case of arm=E2=80=A6=20
>
> On RPi3 U-Boot EFI API provided by U-Boot and it's somewhat non-standar=
d
> comapring to x86 EFI or specialized EFI firmwares of ARM64. I did some
> debugging and found that U-Boot reports driver with subtype MEDIA_FILEP=
ATH_DP
> so it's not recognized by disk handler. Quick hack below fixed boot
> but it's not ideal and the device structure looks like this:
>
> disk devices:
>     disk0:    15564801 X 512 blocks (removable)
>       disk0s1: DOS/Windows         49MB
>       disk0s2: FreeBSD             1856MB
>         disk0s2a: FreeBSD UFS      1856MB
>     disk1:    102375 X 512 blocks (removable)
>     disk2:    3802112 X 512 blocks (removable)
>       disk2a: FreeBSD UFS          1856MB
> net devices:
>     net0:
>
>
> disk1 and disk2 are actuallypartitions from disk0.
> I can work on proper fix but not sure what should be
> considered proper in this case. So some guidelines are welcome
>
> Patch:
> Index: boot/efi/libefi/efipart.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- boot/efi/libefi/efipart.c   (revision 313477)
> +++ boot/efi/libefi/efipart.c   (working copy)
> @@ -467,6 +467,15 @@
>                         efipart_hdinfo_add(handle, efipart_handles[i]);=

>                         continue;
>                 }
> +
> +               /*
> +                * U-Boot case
> +                */
> +               if (DevicePathType(node) =3D=3D MEDIA_DEVICE_PATH &&
> +                   DevicePathSubType(node) =3D=3D MEDIA_FILEPATH_DP) {=

> +                       efipart_hdinfo_add(efipart_handles[i], efipart_=
handles[i]);
> +                       continue;
> +               }
>         }
>  }

After a lot of back and forth with Toomas I'm sorta in the same place
(slightly different code, but same effect)..... but while it enumerates
the storage it still doesn't load the kernel. (pardon all the debugging
printfs)

>> FreeBSD EFI boot block
   Loader path: /boot/loader.efi

   Initializing modules: ZFS UFS
   Probing 3 block devices.....* done
    ZFS found no pools
    UFS found 1 partition
Consoles: EFI console
Enter efipart_updatehd nin [3]
Nin 0 Type 4 subtype 4
Nin 0 name is NULL
Cannot add as no logical partition is valid
Nin 1 Type 4 subtype 4
Nin 1 name is NULL
Added for 1 based on non-HD path
Nin 2 Type 4 subtype 4
Nin 2 name is NULL
Added for 2 based on non-HD path
disk devices:
    disk0:    102375 X 512 blocks (removable)
    disk1:    62229504 X 512 blocks (removable)
      disk1a: FreeBSD UFS          29GB
net devices:
    net0:
Command line arguments: loader.efi
Image base: 0x379b8008
EFI version: 2.05
EFI Firmware: Das U-boot (rev 0.00)

FreeBSD/arm64 EFI loader, Revision 1.1
(Thu Feb  9 10:08:24 CST 2017 freebsd@NewFS.denninger.net)

can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.
OK lsdev -v
disk devices:
    disk0:    102375 X 512 blocks (removable)
    disk1:    62229504 X 512 blocks (removable)
      disk1a: FreeBSD UFS          29GB
net devices:
    net0:
OK

--=20
Karl Denninger
karl@denninger.net <mailto:karl@denninger.net>
/The Market Ticker/
/[S/MIME encrypted email preferred]/

--------------ms000006090104000406080004
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgMFADCABgkqhkiG9w0BBwEAAKCC
BlwwggZYMIIEQKADAgECAgE9MA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzEQMA4G
A1UECBMHRmxvcmlkYTESMBAGA1UEBxMJTmljZXZpbGxlMRkwFwYDVQQKExBDdWRhIFN5c3Rl
bXMgTExDMRwwGgYDVQQDExNDdWRhIFN5c3RlbXMgTExDIENBMSIwIAYJKoZIhvcNAQkBFhND
dWRhIFN5c3RlbXMgTExDIENBMB4XDTE2MTIxODE5NDUzNVoXDTIxMTIxNzE5NDUzNVowVzEL
MAkGA1UEBhMCVVMxEDAOBgNVBAgTB0Zsb3JpZGExGTAXBgNVBAoTEEN1ZGEgU3lzdGVtcyBM
TEMxGzAZBgNVBAMUEmthcmxAZGVubmluZ2VyLm5ldDCCAiIwDQYJKoZIhvcNAQEBBQADggIP
ADCCAgoCggIBAM2N5maxs7NkoY9g5NMxFWll0TYiO7gXrGZTo3q25ZJgNdPMwrntLz/5ewE9
07TEbwJ3ah/Ep9BfZm7JF9vTtE1HkgKtXNKi0pawNGm1Yn26Dz5AbUr1byby6dFtDJr14E07
trzDCtRRvTkOVSBj6PQPal0fAnDtkIYQBVcuMkXkuMCtyfE95pjm8g4K9l7lAcKii3T1/3rE
hCc1o2nBnb7EN1/XwBeCDGB+I2SN/ftZDbKQqGAF5q9dUn+iXU7Z/CVSfUWmhVh6cVZA4Ftv
TglUqj410OuPx+cUQch3h1kFgsuhQR63HiJc3HbRJllHsV0rihvL1CjeARQkhnA6uY9NLFST
p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: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a586e0b9-375c-2676-9e74-ea4864ec06f3>