Re: [edk2] [PATCH v4 edk2-platforms 20/23] Platform/Raspberry/Pi3: Add platform readme

2019-01-31 Thread Pete Batard

On 2019.01.31 14:44, Ard Biesheuvel wrote:

On Thu, 31 Jan 2019 at 15:36, Ard Biesheuvel  wrote:


On Thu, 31 Jan 2019 at 15:13, Leif Lindholm  wrote:


On Thu, Jan 31, 2019 at 12:30:22PM +, Pete Batard wrote:

Hi Leif. Thanks for reviewing this patchset.

On 2019.01.30 21:50, Leif Lindholm wrote:

Hi Pete,

I will only have minor comments on this set, but I'll start with this
documentation.

On Tue, Jan 29, 2019 at 04:26:52PM +, Pete Batard wrote:

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
   Platform/Raspberry/Pi3/Readme.md | 259 
   Readme.md|   3 +
   2 files changed, 262 insertions(+)

diff --git a/Platform/Raspberry/Pi3/Readme.md b/Platform/Raspberry/Pi3/Readme.md
new file mode 100644
index ..7fb59ccdc321
--- /dev/null
+++ b/Platform/Raspberry/Pi3/Readme.md
@@ -0,0 +1,259 @@
+Raspberry Pi 3 EDK2 Platform Support
+
+
+# Summary
+
+This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 3/3B+ 
platforms,
+based on [Ard Bisheuvel's 
64-bit](http://www.workofard.com/2017/02/uefi-on-the-pi/)
+and [Microsoft's 
32-bit](https://github.com/ms-iot/RPi-UEFI/tree/ms-iot/Pi3BoardPkg)
+implementations, as maintained by [Andrei 
Warkentin](https://github.com/andreiw/RaspberryPiPkg).
+
+This is meant as a generally useful 64-bit ATF + UEFI implementation for the 
Raspberry
+Pi 3/3B+ which should be good enough for most kind of UEFI development, as 
well as for
+running consummer Operating Systems in such as Linux or Windows.
+
+Raspberry Pi is a trademark of the [Raspberry Pi 
Foundation](http://www.raspberrypi.org).
+
+# Status
+
+This firmware, that has been validated to compile against the current
+[edk2](https://github.com/tianocore/edk2)/[edk2-platforms](https://github.com/tianocore/edk2-platforms),
+should be able to boot Linux (SUSE, Ubuntu), NetBSD, FreeBSD as well as 
Windows 10 ARM64
+(full GUI version).
+
+It also provides support for ATF ([Arm Trusted 
Platform](https://github.com/ARM-software/arm-trusted-firmware)).
+
+HDMI and the mini-UART serial port can be used for output devices, with 
mirrored output.
+USB keyboards and the mini-UART serial port can be used as input.
+
+The boot order is currently hardcoded, first to the USB ports and then to the 
uSD card.
+If there no bootable media media is found, the UEFI Shell is launched.
+Esc enters platform setup. F1 boots the UEFI Shell.
+
+# Building
+
+(These instructions were validated against the latest edk2 / edk2-platforms /
+edk2-non-osi as of 2019.01.27, on a Debian 9.6 x64 system).
+
+You may need to install the relevant compilation tools. Especially you should 
have the
+ACPI Source Language (ASL) compiler, `nasm` as well as a native compiler 
installed.


nasm? The x86 assembler?


I'll remove that.


+On a Debian system, you can get these prerequisites installed with:
+```
+sudo apt-get install build-essential acpica-tools nasm uuid-dev
+```
+
+**IMPORTANT:** We recommend the use of the Linaro GCC for compilation instead 
of
+your system's native ARM64 GCC cross compiler.


This sounds like something written in the days of GCC 4.8. I doubt it
has any relevance today.


It very much had until circa one month ago, as we observed early Synchronous
Exceptions when trying to use the native Debian ARM64 compiler, which we did
not observe with Linaro's toolchain. We even had trouble (similar issue)
with recent Linaro toolchains at some stage, which is why, until v3, we
recommended an older version, but recent tests showed that the latest Linaro
GCC (2019.02) appeared to be okay, which is why I removed the previous
requirement to use exclusively Linaro's 2017.10 GCC 5.5.


Urgh. But that actually makes the above statement even more
misleading. What you have isn't an issue with non-Linaro toolchains,
you have an unidentified toolchain issue that you've triggered more
frequently



Could you please check whether the broken toolchain in question has
the workaround for Cortex-A53 erratum 843419 enabled? (gcc -v will
tell you)


It is.

On that subject, I have now ran a new series of tests, with the default 
AARCH64 Debian 9.7 compiler (gcc 6.3.0 20170516), and so far I have not 
been able to observe the Synchronous Exceptions that had us switch to 
the Linaro compiler.


It needs to be noted however that, since we ran into those, we did 
switch to using different ATF binaries, different VideoCore firmware, 
and removed some drivers (such as an HyperVisor) from the firmware. So 
there are quite a few elements that could have had an impact on the 
earlier issue.


I will continue to test with the default Debian compiler for now, and, 
if I don't see a resurgence of the issue, I'll remove the note about 
preferring a Linaro toolchain.



Also, given that Leif doesn't want the full hand-holding compilation 
instructions and that I have no intention to push back on that, I will 
remove that part 

Re: [edk2] [PATCH v4 edk2-platforms 20/23] Platform/Raspberry/Pi3: Add platform readme

2019-01-31 Thread Ard Biesheuvel
On Thu, 31 Jan 2019 at 15:36, Ard Biesheuvel  wrote:
>
> On Thu, 31 Jan 2019 at 15:13, Leif Lindholm  wrote:
> >
> > On Thu, Jan 31, 2019 at 12:30:22PM +, Pete Batard wrote:
> > > Hi Leif. Thanks for reviewing this patchset.
> > >
> > > On 2019.01.30 21:50, Leif Lindholm wrote:
> > > > Hi Pete,
> > > >
> > > > I will only have minor comments on this set, but I'll start with this
> > > > documentation.
> > > >
> > > > On Tue, Jan 29, 2019 at 04:26:52PM +, Pete Batard wrote:
> > > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > > Signed-off-by: Pete Batard 
> > > > > ---
> > > > >   Platform/Raspberry/Pi3/Readme.md | 259 
> > > > >   Readme.md|   3 +
> > > > >   2 files changed, 262 insertions(+)
> > > > >
> > > > > diff --git a/Platform/Raspberry/Pi3/Readme.md 
> > > > > b/Platform/Raspberry/Pi3/Readme.md
> > > > > new file mode 100644
> > > > > index ..7fb59ccdc321
> > > > > --- /dev/null
> > > > > +++ b/Platform/Raspberry/Pi3/Readme.md
> > > > > @@ -0,0 +1,259 @@
> > > > > +Raspberry Pi 3 EDK2 Platform Support
> > > > > +
> > > > > +
> > > > > +# Summary
> > > > > +
> > > > > +This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry 
> > > > > Pi 3/3B+ platforms,
> > > > > +based on [Ard Bisheuvel's 
> > > > > 64-bit](http://www.workofard.com/2017/02/uefi-on-the-pi/)
> > > > > +and [Microsoft's 
> > > > > 32-bit](https://github.com/ms-iot/RPi-UEFI/tree/ms-iot/Pi3BoardPkg)
> > > > > +implementations, as maintained by [Andrei 
> > > > > Warkentin](https://github.com/andreiw/RaspberryPiPkg).
> > > > > +
> > > > > +This is meant as a generally useful 64-bit ATF + UEFI implementation 
> > > > > for the Raspberry
> > > > > +Pi 3/3B+ which should be good enough for most kind of UEFI 
> > > > > development, as well as for
> > > > > +running consummer Operating Systems in such as Linux or Windows.
> > > > > +
> > > > > +Raspberry Pi is a trademark of the [Raspberry Pi 
> > > > > Foundation](http://www.raspberrypi.org).
> > > > > +
> > > > > +# Status
> > > > > +
> > > > > +This firmware, that has been validated to compile against the current
> > > > > +[edk2](https://github.com/tianocore/edk2)/[edk2-platforms](https://github.com/tianocore/edk2-platforms),
> > > > > +should be able to boot Linux (SUSE, Ubuntu), NetBSD, FreeBSD as well 
> > > > > as Windows 10 ARM64
> > > > > +(full GUI version).
> > > > > +
> > > > > +It also provides support for ATF ([Arm Trusted 
> > > > > Platform](https://github.com/ARM-software/arm-trusted-firmware)).
> > > > > +
> > > > > +HDMI and the mini-UART serial port can be used for output devices, 
> > > > > with mirrored output.
> > > > > +USB keyboards and the mini-UART serial port can be used as input.
> > > > > +
> > > > > +The boot order is currently hardcoded, first to the USB ports and 
> > > > > then to the uSD card.
> > > > > +If there no bootable media media is found, the UEFI Shell is 
> > > > > launched.
> > > > > +Esc enters platform setup. F1 boots the UEFI 
> > > > > Shell.
> > > > > +
> > > > > +# Building
> > > > > +
> > > > > +(These instructions were validated against the latest edk2 / 
> > > > > edk2-platforms /
> > > > > +edk2-non-osi as of 2019.01.27, on a Debian 9.6 x64 system).
> > > > > +
> > > > > +You may need to install the relevant compilation tools. Especially 
> > > > > you should have the
> > > > > +ACPI Source Language (ASL) compiler, `nasm` as well as a native 
> > > > > compiler installed.
> > > >
> > > > nasm? The x86 assembler?
> > >
> > > I'll remove that.
> > >
> > > > > +On a Debian system, you can get these prerequisites installed with:
> > > > > +```
> > > > > +sudo apt-get install build-essential acpica-tools nasm uuid-dev
> > > > > +```
> > > > > +
> > > > > +**IMPORTANT:** We recommend the use of the Linaro GCC for 
> > > > > compilation instead of
> > > > > +your system's native ARM64 GCC cross compiler.
> > > >
> > > > This sounds like something written in the days of GCC 4.8. I doubt it
> > > > has any relevance today.
> > >
> > > It very much had until circa one month ago, as we observed early 
> > > Synchronous
> > > Exceptions when trying to use the native Debian ARM64 compiler, which we 
> > > did
> > > not observe with Linaro's toolchain. We even had trouble (similar issue)
> > > with recent Linaro toolchains at some stage, which is why, until v3, we
> > > recommended an older version, but recent tests showed that the latest 
> > > Linaro
> > > GCC (2019.02) appeared to be okay, which is why I removed the previous
> > > requirement to use exclusively Linaro's 2017.10 GCC 5.5.
> >
> > Urgh. But that actually makes the above statement even more
> > misleading. What you have isn't an issue with non-Linaro toolchains,
> > you have an unidentified toolchain issue that you've triggered more
> > frequently
> >
>
> Could you please check whether the broken toolchain in question has
> the workaround for 

Re: [edk2] [PATCH v4 edk2-platforms 20/23] Platform/Raspberry/Pi3: Add platform readme

2019-01-31 Thread Ard Biesheuvel
On Thu, 31 Jan 2019 at 15:13, Leif Lindholm  wrote:
>
> On Thu, Jan 31, 2019 at 12:30:22PM +, Pete Batard wrote:
> > Hi Leif. Thanks for reviewing this patchset.
> >
> > On 2019.01.30 21:50, Leif Lindholm wrote:
> > > Hi Pete,
> > >
> > > I will only have minor comments on this set, but I'll start with this
> > > documentation.
> > >
> > > On Tue, Jan 29, 2019 at 04:26:52PM +, Pete Batard wrote:
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Pete Batard 
> > > > ---
> > > >   Platform/Raspberry/Pi3/Readme.md | 259 
> > > >   Readme.md|   3 +
> > > >   2 files changed, 262 insertions(+)
> > > >
> > > > diff --git a/Platform/Raspberry/Pi3/Readme.md 
> > > > b/Platform/Raspberry/Pi3/Readme.md
> > > > new file mode 100644
> > > > index ..7fb59ccdc321
> > > > --- /dev/null
> > > > +++ b/Platform/Raspberry/Pi3/Readme.md
> > > > @@ -0,0 +1,259 @@
> > > > +Raspberry Pi 3 EDK2 Platform Support
> > > > +
> > > > +
> > > > +# Summary
> > > > +
> > > > +This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 
> > > > 3/3B+ platforms,
> > > > +based on [Ard Bisheuvel's 
> > > > 64-bit](http://www.workofard.com/2017/02/uefi-on-the-pi/)
> > > > +and [Microsoft's 
> > > > 32-bit](https://github.com/ms-iot/RPi-UEFI/tree/ms-iot/Pi3BoardPkg)
> > > > +implementations, as maintained by [Andrei 
> > > > Warkentin](https://github.com/andreiw/RaspberryPiPkg).
> > > > +
> > > > +This is meant as a generally useful 64-bit ATF + UEFI implementation 
> > > > for the Raspberry
> > > > +Pi 3/3B+ which should be good enough for most kind of UEFI 
> > > > development, as well as for
> > > > +running consummer Operating Systems in such as Linux or Windows.
> > > > +
> > > > +Raspberry Pi is a trademark of the [Raspberry Pi 
> > > > Foundation](http://www.raspberrypi.org).
> > > > +
> > > > +# Status
> > > > +
> > > > +This firmware, that has been validated to compile against the current
> > > > +[edk2](https://github.com/tianocore/edk2)/[edk2-platforms](https://github.com/tianocore/edk2-platforms),
> > > > +should be able to boot Linux (SUSE, Ubuntu), NetBSD, FreeBSD as well 
> > > > as Windows 10 ARM64
> > > > +(full GUI version).
> > > > +
> > > > +It also provides support for ATF ([Arm Trusted 
> > > > Platform](https://github.com/ARM-software/arm-trusted-firmware)).
> > > > +
> > > > +HDMI and the mini-UART serial port can be used for output devices, 
> > > > with mirrored output.
> > > > +USB keyboards and the mini-UART serial port can be used as input.
> > > > +
> > > > +The boot order is currently hardcoded, first to the USB ports and then 
> > > > to the uSD card.
> > > > +If there no bootable media media is found, the UEFI Shell is launched.
> > > > +Esc enters platform setup. F1 boots the UEFI 
> > > > Shell.
> > > > +
> > > > +# Building
> > > > +
> > > > +(These instructions were validated against the latest edk2 / 
> > > > edk2-platforms /
> > > > +edk2-non-osi as of 2019.01.27, on a Debian 9.6 x64 system).
> > > > +
> > > > +You may need to install the relevant compilation tools. Especially you 
> > > > should have the
> > > > +ACPI Source Language (ASL) compiler, `nasm` as well as a native 
> > > > compiler installed.
> > >
> > > nasm? The x86 assembler?
> >
> > I'll remove that.
> >
> > > > +On a Debian system, you can get these prerequisites installed with:
> > > > +```
> > > > +sudo apt-get install build-essential acpica-tools nasm uuid-dev
> > > > +```
> > > > +
> > > > +**IMPORTANT:** We recommend the use of the Linaro GCC for compilation 
> > > > instead of
> > > > +your system's native ARM64 GCC cross compiler.
> > >
> > > This sounds like something written in the days of GCC 4.8. I doubt it
> > > has any relevance today.
> >
> > It very much had until circa one month ago, as we observed early Synchronous
> > Exceptions when trying to use the native Debian ARM64 compiler, which we did
> > not observe with Linaro's toolchain. We even had trouble (similar issue)
> > with recent Linaro toolchains at some stage, which is why, until v3, we
> > recommended an older version, but recent tests showed that the latest Linaro
> > GCC (2019.02) appeared to be okay, which is why I removed the previous
> > requirement to use exclusively Linaro's 2017.10 GCC 5.5.
>
> Urgh. But that actually makes the above statement even more
> misleading. What you have isn't an issue with non-Linaro toolchains,
> you have an unidentified toolchain issue that you've triggered more
> frequently
>

Could you please check whether the broken toolchain in question has
the workaround for Cortex-A53 erratum 843419 enabled? (gcc -v will
tell you)

While playing with this port the other day, I noticed that the RPi3 is
affected by this, and the Debian kernels don't enable mitigations for
it either.

> I mean, it's not like the
> (Also, Linaro no longer releases GCC toolchains - if you try to grab a
> GCC8 

Re: [edk2] [PATCH v4 edk2-platforms 20/23] Platform/Raspberry/Pi3: Add platform readme

2019-01-31 Thread Leif Lindholm
On Thu, Jan 31, 2019 at 12:30:22PM +, Pete Batard wrote:
> Hi Leif. Thanks for reviewing this patchset.
> 
> On 2019.01.30 21:50, Leif Lindholm wrote:
> > Hi Pete,
> > 
> > I will only have minor comments on this set, but I'll start with this
> > documentation.
> > 
> > On Tue, Jan 29, 2019 at 04:26:52PM +, Pete Batard wrote:
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Pete Batard 
> > > ---
> > >   Platform/Raspberry/Pi3/Readme.md | 259 
> > >   Readme.md|   3 +
> > >   2 files changed, 262 insertions(+)
> > > 
> > > diff --git a/Platform/Raspberry/Pi3/Readme.md 
> > > b/Platform/Raspberry/Pi3/Readme.md
> > > new file mode 100644
> > > index ..7fb59ccdc321
> > > --- /dev/null
> > > +++ b/Platform/Raspberry/Pi3/Readme.md
> > > @@ -0,0 +1,259 @@
> > > +Raspberry Pi 3 EDK2 Platform Support
> > > +
> > > +
> > > +# Summary
> > > +
> > > +This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 
> > > 3/3B+ platforms,
> > > +based on [Ard Bisheuvel's 
> > > 64-bit](http://www.workofard.com/2017/02/uefi-on-the-pi/)
> > > +and [Microsoft's 
> > > 32-bit](https://github.com/ms-iot/RPi-UEFI/tree/ms-iot/Pi3BoardPkg)
> > > +implementations, as maintained by [Andrei 
> > > Warkentin](https://github.com/andreiw/RaspberryPiPkg).
> > > +
> > > +This is meant as a generally useful 64-bit ATF + UEFI implementation for 
> > > the Raspberry
> > > +Pi 3/3B+ which should be good enough for most kind of UEFI development, 
> > > as well as for
> > > +running consummer Operating Systems in such as Linux or Windows.
> > > +
> > > +Raspberry Pi is a trademark of the [Raspberry Pi 
> > > Foundation](http://www.raspberrypi.org).
> > > +
> > > +# Status
> > > +
> > > +This firmware, that has been validated to compile against the current
> > > +[edk2](https://github.com/tianocore/edk2)/[edk2-platforms](https://github.com/tianocore/edk2-platforms),
> > > +should be able to boot Linux (SUSE, Ubuntu), NetBSD, FreeBSD as well as 
> > > Windows 10 ARM64
> > > +(full GUI version).
> > > +
> > > +It also provides support for ATF ([Arm Trusted 
> > > Platform](https://github.com/ARM-software/arm-trusted-firmware)).
> > > +
> > > +HDMI and the mini-UART serial port can be used for output devices, with 
> > > mirrored output.
> > > +USB keyboards and the mini-UART serial port can be used as input.
> > > +
> > > +The boot order is currently hardcoded, first to the USB ports and then 
> > > to the uSD card.
> > > +If there no bootable media media is found, the UEFI Shell is launched.
> > > +Esc enters platform setup. F1 boots the UEFI Shell.
> > > +
> > > +# Building
> > > +
> > > +(These instructions were validated against the latest edk2 / 
> > > edk2-platforms /
> > > +edk2-non-osi as of 2019.01.27, on a Debian 9.6 x64 system).
> > > +
> > > +You may need to install the relevant compilation tools. Especially you 
> > > should have the
> > > +ACPI Source Language (ASL) compiler, `nasm` as well as a native compiler 
> > > installed.
> > 
> > nasm? The x86 assembler?
> 
> I'll remove that.
> 
> > > +On a Debian system, you can get these prerequisites installed with:
> > > +```
> > > +sudo apt-get install build-essential acpica-tools nasm uuid-dev
> > > +```
> > > +
> > > +**IMPORTANT:** We recommend the use of the Linaro GCC for compilation 
> > > instead of
> > > +your system's native ARM64 GCC cross compiler.
> > 
> > This sounds like something written in the days of GCC 4.8. I doubt it
> > has any relevance today.
> 
> It very much had until circa one month ago, as we observed early Synchronous
> Exceptions when trying to use the native Debian ARM64 compiler, which we did
> not observe with Linaro's toolchain. We even had trouble (similar issue)
> with recent Linaro toolchains at some stage, which is why, until v3, we
> recommended an older version, but recent tests showed that the latest Linaro
> GCC (2019.02) appeared to be okay, which is why I removed the previous
> requirement to use exclusively Linaro's 2017.10 GCC 5.5.

Urgh. But that actually makes the above statement even more
misleading. What you have isn't an issue with non-Linaro toolchains,
you have an unidentified toolchain issue that you've triggered more
frequently

I mean, it's not like the
(Also, Linaro no longer releases GCC toolchains - if you try to grab a
GCC8 toolchain from releases.linaro.org, you get redirected to
https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads.)

> Besides, I think it's preferable when a project highlights precisely how
> they build their own binaries, and with which toolchain, so that, if anybody
> experiences an issue with their own build, they can compare their setup with
> the maintainer's "official" one.

Given what you say below, I think we actually understand each other
quite well So let's try to find a compromise we're both OK with.

My bottom line is that what I want in 

Re: [edk2] [PATCH v4 edk2-platforms 20/23] Platform/Raspberry/Pi3: Add platform readme

2019-01-31 Thread Pete Batard

Hi Leif. Thanks for reviewing this patchset.

On 2019.01.30 21:50, Leif Lindholm wrote:

Hi Pete,

I will only have minor comments on this set, but I'll start with this
documentation.

On Tue, Jan 29, 2019 at 04:26:52PM +, Pete Batard wrote:

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
  Platform/Raspberry/Pi3/Readme.md | 259 
  Readme.md|   3 +
  2 files changed, 262 insertions(+)

diff --git a/Platform/Raspberry/Pi3/Readme.md b/Platform/Raspberry/Pi3/Readme.md
new file mode 100644
index ..7fb59ccdc321
--- /dev/null
+++ b/Platform/Raspberry/Pi3/Readme.md
@@ -0,0 +1,259 @@
+Raspberry Pi 3 EDK2 Platform Support
+
+
+# Summary
+
+This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 3/3B+ 
platforms,
+based on [Ard Bisheuvel's 
64-bit](http://www.workofard.com/2017/02/uefi-on-the-pi/)
+and [Microsoft's 
32-bit](https://github.com/ms-iot/RPi-UEFI/tree/ms-iot/Pi3BoardPkg)
+implementations, as maintained by [Andrei 
Warkentin](https://github.com/andreiw/RaspberryPiPkg).
+
+This is meant as a generally useful 64-bit ATF + UEFI implementation for the 
Raspberry
+Pi 3/3B+ which should be good enough for most kind of UEFI development, as 
well as for
+running consummer Operating Systems in such as Linux or Windows.
+
+Raspberry Pi is a trademark of the [Raspberry Pi 
Foundation](http://www.raspberrypi.org).
+
+# Status
+
+This firmware, that has been validated to compile against the current
+[edk2](https://github.com/tianocore/edk2)/[edk2-platforms](https://github.com/tianocore/edk2-platforms),
+should be able to boot Linux (SUSE, Ubuntu), NetBSD, FreeBSD as well as 
Windows 10 ARM64
+(full GUI version).
+
+It also provides support for ATF ([Arm Trusted 
Platform](https://github.com/ARM-software/arm-trusted-firmware)).
+
+HDMI and the mini-UART serial port can be used for output devices, with 
mirrored output.
+USB keyboards and the mini-UART serial port can be used as input.
+
+The boot order is currently hardcoded, first to the USB ports and then to the 
uSD card.
+If there no bootable media media is found, the UEFI Shell is launched.
+Esc enters platform setup. F1 boots the UEFI Shell.
+
+# Building
+
+(These instructions were validated against the latest edk2 / edk2-platforms /
+edk2-non-osi as of 2019.01.27, on a Debian 9.6 x64 system).
+
+You may need to install the relevant compilation tools. Especially you should 
have the
+ACPI Source Language (ASL) compiler, `nasm` as well as a native compiler 
installed.


nasm? The x86 assembler?


I'll remove that.


+On a Debian system, you can get these prerequisites installed with:
+```
+sudo apt-get install build-essential acpica-tools nasm uuid-dev
+```
+
+**IMPORTANT:** We recommend the use of the Linaro GCC for compilation instead 
of
+your system's native ARM64 GCC cross compiler.


This sounds like something written in the days of GCC 4.8. I doubt it
has any relevance today.


It very much had until circa one month ago, as we observed early 
Synchronous Exceptions when trying to use the native Debian ARM64 
compiler, which we did not observe with Linaro's toolchain. We even had 
trouble (similar issue) with recent Linaro toolchains at some stage, 
which is why, until v3, we recommended an older version, but recent 
tests showed that the latest Linaro GCC (2019.02) appeared to be okay, 
which is why I removed the previous requirement to use exclusively 
Linaro's 2017.10 GCC 5.5.


Besides, I think it's preferable when a project highlights precisely how 
they build their own binaries, and with which toolchain, so that, if 
anybody experiences an issue with their own build, they can compare 
their setup with the maintainer's "official" one.



Also, and this applies both above and below: I am trying very hard to
get rid of (mostly unnecessary) platform-specific build instructions.
The top-level Readme.md in this repository contains basic build
instructions. I would much prefer if you can refer to that instead and
drop everything after the # Building header above...


Okay. This is a bit at odds with the goal I'm trying to achieve here, 
which is to save time and bewilderment from developers who might be 
trying to build this specific platform and encounter an issue where 
they'll want to eliminate the possibility that their setup/configuration 
is the problem.


I've ran in too many of "works on my machine" not top want to also 
provide "here is exactly how the official developer's machine was set up 
when they ran their built" from the get go, to try to alleviate the 
usual headaches of trying to solve environmental issues... Furthermore, 
given the popularity of the Raspberry Pi platform, my guess is that 
we're going to get quite a few people who aren't that familiar with the 
EDK2, or even building things, in general and who'll want a set of 
"copy/paste exactly this in your shell and you *should* end 

Re: [edk2] [PATCH v4 edk2-platforms 20/23] Platform/Raspberry/Pi3: Add platform readme

2019-01-30 Thread Leif Lindholm
Hi Pete,

I will only have minor comments on this set, but I'll start with this
documentation.

On Tue, Jan 29, 2019 at 04:26:52PM +, Pete Batard wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Pete Batard 
> ---
>  Platform/Raspberry/Pi3/Readme.md | 259 
>  Readme.md|   3 +
>  2 files changed, 262 insertions(+)
> 
> diff --git a/Platform/Raspberry/Pi3/Readme.md 
> b/Platform/Raspberry/Pi3/Readme.md
> new file mode 100644
> index ..7fb59ccdc321
> --- /dev/null
> +++ b/Platform/Raspberry/Pi3/Readme.md
> @@ -0,0 +1,259 @@
> +Raspberry Pi 3 EDK2 Platform Support
> +
> +
> +# Summary
> +
> +This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 3/3B+ 
> platforms,
> +based on [Ard Bisheuvel's 
> 64-bit](http://www.workofard.com/2017/02/uefi-on-the-pi/)
> +and [Microsoft's 
> 32-bit](https://github.com/ms-iot/RPi-UEFI/tree/ms-iot/Pi3BoardPkg)
> +implementations, as maintained by [Andrei 
> Warkentin](https://github.com/andreiw/RaspberryPiPkg).
> +
> +This is meant as a generally useful 64-bit ATF + UEFI implementation for the 
> Raspberry
> +Pi 3/3B+ which should be good enough for most kind of UEFI development, as 
> well as for
> +running consummer Operating Systems in such as Linux or Windows.
> +
> +Raspberry Pi is a trademark of the [Raspberry Pi 
> Foundation](http://www.raspberrypi.org).
> +
> +# Status
> +
> +This firmware, that has been validated to compile against the current
> +[edk2](https://github.com/tianocore/edk2)/[edk2-platforms](https://github.com/tianocore/edk2-platforms),
> +should be able to boot Linux (SUSE, Ubuntu), NetBSD, FreeBSD as well as 
> Windows 10 ARM64
> +(full GUI version).
> +
> +It also provides support for ATF ([Arm Trusted 
> Platform](https://github.com/ARM-software/arm-trusted-firmware)).
> +
> +HDMI and the mini-UART serial port can be used for output devices, with 
> mirrored output.
> +USB keyboards and the mini-UART serial port can be used as input.
> +
> +The boot order is currently hardcoded, first to the USB ports and then to 
> the uSD card.
> +If there no bootable media media is found, the UEFI Shell is launched.
> +Esc enters platform setup. F1 boots the UEFI Shell.
> +
> +# Building
> +
> +(These instructions were validated against the latest edk2 / edk2-platforms /
> +edk2-non-osi as of 2019.01.27, on a Debian 9.6 x64 system).
> +
> +You may need to install the relevant compilation tools. Especially you 
> should have the
> +ACPI Source Language (ASL) compiler, `nasm` as well as a native compiler 
> installed.

nasm? The x86 assembler?

> +On a Debian system, you can get these prerequisites installed with:
> +```
> +sudo apt-get install build-essential acpica-tools nasm uuid-dev
> +```
> +
> +**IMPORTANT:** We recommend the use of the Linaro GCC for compilation 
> instead of
> +your system's native ARM64 GCC cross compiler.

This sounds like something written in the days of GCC 4.8. I doubt it
has any relevance today.

Also, and this applies both above and below: I am trying very hard to
get rid of (mostly unnecessary) platform-specific build instructions.
The top-level Readme.md in this repository contains basic build
instructions. I would much prefer if you can refer to that instead and
drop everything after the # Building header above...

> +
> +You can then build the firmware as follows:
> +
> +* Standalone instructions
> +
> +```
> +mkdir ~/workspace
> +cd ~/workspace
> +git clone https://github.com/tianocore/edk2.git
> +# The following is only needed once, after you cloned edk2
> +make -C edk2/BaseTools
> +git clone https://github.com/tianocore/edk2-platforms.git
> +git clone https://github.com/tianocore/edk2-non-osi.git
> +wget 
> https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
> +tar -xJvf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
> +# If you have multiple AARCH64 toolchains, make sure the above one comes 
> first in your path
> +export PATH=$PWD/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin:$PATH
> +export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
> +export WORKSPACE=$PWD
> +export 
> PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms:$WORKSPACE/edk2-non-osi
> +. edk2/edksetup.sh

...down to here.
(I would certainly not object if you felt the need to improve on the
contents of the top-level Readme.md. For example with the explicit
prerequisite installation steps, rather than the brief list provided
under the Prerequisites section currently on that page.)

> +build -a AARCH64 -t GCC5 -p edk2-platforms/Platform/Raspberry/Pi3/RPi3.dsc 
> -DBUILD_EPOCH=`date +%s` -b RELEASE
> +```
> +

The below _is_ platform-specific, so clearly I have no issue with
it. Not sure that needed poinging out, but...
And the above line points out the location of the .dsc, so no
objection there.

> +# Booting the 

[edk2] [PATCH v4 edk2-platforms 20/23] Platform/Raspberry/Pi3: Add platform readme

2019-01-29 Thread Pete Batard
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard 
---
 Platform/Raspberry/Pi3/Readme.md | 259 
 Readme.md|   3 +
 2 files changed, 262 insertions(+)

diff --git a/Platform/Raspberry/Pi3/Readme.md b/Platform/Raspberry/Pi3/Readme.md
new file mode 100644
index ..7fb59ccdc321
--- /dev/null
+++ b/Platform/Raspberry/Pi3/Readme.md
@@ -0,0 +1,259 @@
+Raspberry Pi 3 EDK2 Platform Support
+
+
+# Summary
+
+This is a port of 64-bit Tiano Core UEFI firmware for the Raspberry Pi 3/3B+ 
platforms,
+based on [Ard Bisheuvel's 
64-bit](http://www.workofard.com/2017/02/uefi-on-the-pi/)
+and [Microsoft's 
32-bit](https://github.com/ms-iot/RPi-UEFI/tree/ms-iot/Pi3BoardPkg)
+implementations, as maintained by [Andrei 
Warkentin](https://github.com/andreiw/RaspberryPiPkg).
+
+This is meant as a generally useful 64-bit ATF + UEFI implementation for the 
Raspberry
+Pi 3/3B+ which should be good enough for most kind of UEFI development, as 
well as for
+running consummer Operating Systems in such as Linux or Windows.
+
+Raspberry Pi is a trademark of the [Raspberry Pi 
Foundation](http://www.raspberrypi.org).
+
+# Status
+
+This firmware, that has been validated to compile against the current
+[edk2](https://github.com/tianocore/edk2)/[edk2-platforms](https://github.com/tianocore/edk2-platforms),
+should be able to boot Linux (SUSE, Ubuntu), NetBSD, FreeBSD as well as 
Windows 10 ARM64
+(full GUI version).
+
+It also provides support for ATF ([Arm Trusted 
Platform](https://github.com/ARM-software/arm-trusted-firmware)).
+
+HDMI and the mini-UART serial port can be used for output devices, with 
mirrored output.
+USB keyboards and the mini-UART serial port can be used as input.
+
+The boot order is currently hardcoded, first to the USB ports and then to the 
uSD card.
+If there no bootable media media is found, the UEFI Shell is launched.
+Esc enters platform setup. F1 boots the UEFI Shell.
+
+# Building
+
+(These instructions were validated against the latest edk2 / edk2-platforms /
+edk2-non-osi as of 2019.01.27, on a Debian 9.6 x64 system).
+
+You may need to install the relevant compilation tools. Especially you should 
have the
+ACPI Source Language (ASL) compiler, `nasm` as well as a native compiler 
installed.
+On a Debian system, you can get these prerequisites installed with:
+```
+sudo apt-get install build-essential acpica-tools nasm uuid-dev
+```
+
+**IMPORTANT:** We recommend the use of the Linaro GCC for compilation instead 
of
+your system's native ARM64 GCC cross compiler.
+
+You can then build the firmware as follows:
+
+* Standalone instructions
+
+```
+mkdir ~/workspace
+cd ~/workspace
+git clone https://github.com/tianocore/edk2.git
+# The following is only needed once, after you cloned edk2
+make -C edk2/BaseTools
+git clone https://github.com/tianocore/edk2-platforms.git
+git clone https://github.com/tianocore/edk2-non-osi.git
+wget 
https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
+tar -xJvf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
+# If you have multiple AARCH64 toolchains, make sure the above one comes first 
in your path
+export PATH=$PWD/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin:$PATH
+export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
+export WORKSPACE=$PWD
+export 
PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms:$WORKSPACE/edk2-non-osi
+. edk2/edksetup.sh
+build -a AARCH64 -t GCC5 -p edk2-platforms/Platform/Raspberry/Pi3/RPi3.dsc 
-DBUILD_EPOCH=`date +%s` -b RELEASE
+```
+
+# Booting the firmware
+
+1. Format a uSD card as FAT32
+2. Copy the generated `RPI_EFI.fd` firmware onto the partition
+3. Download and copy the following files from 
https://github.com/raspberrypi/firmware/tree/master/boot
+  - `bootcode.bin`
+  - `fixup.dat`
+  - `start.elf`
+4. Create a `config.txt` with the following content:
+  ```
+  arm_control=0x200
+  enable_uart=1
+  armstub=RPI_EFI.fd
+  disable_commandline_tags=1
+  ```
+5. Insert the uSD card and power up the Pi.
+
+Note that if you have a model 3+ or a model 3 where you enabled USB boot 
through OTP
+(see 
[here](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md))
+you may also be able to boot from a FAT32 USB driver rather than uSD.
+
+# Notes
+
+## ARM Trusted Firmware (ATF)
+
+The ATF binaries being used were compiled from the ATF mainline.
+
+For more details on the ATF compilation, see the [README](./Binary/README.md) 
in the `Binary/` directory.
+
+## Custom Device Tree
+
+The default Device Tree included in the firmware is the one for a Raspberry Pi 
3 Model B (not B+).
+If you want to use a different Device Tree, to boot a Pi 3 Model B+ for 
instance (for which a
+DTB is also provided under `DeviceTree/`), you should copy the relevant `.dtb` 
into the root of
+the SD or USB, and