Hi folks,
I've just been having a discussion with folks about installing Debian
on an arm64 device. Another developer is booting via U-Boot with UEFI
and things are working OK, except...
The intructions for their board [0] include writing things raw to both
sector 0 and sector 1 of an SD card, meaning that both MBR and GPT
partitioning schemes are likely to break. Ugh. :-/
So, I have two (related) worries:
1. At the moment in Debian, our installer will default to using GPT
for arm64 machines (where disks are not already formatted). That
was fine when we were expecting server systems booting using edk2,
but it looks like that's now a dangerous assumption, as more and
more U-Boot devices are out there which will be wanting to load
firmware from low-numbered LBAs.
2. I'm just in the middle of adding EFI armhf installer support, and
that is also (currently) defaulting to GPT if you've booted via
EFI. This is fine for VMs booted using a 32-bit Arm build of edk2,
but also it's starting to look like a bad option for real boards
booting using U-Boot's EFI support (for similar reasons).
The "Firmware Storage" section of EBBR v0.6 touches on this and
describes how to store firmware in a safer manner, but obviously
(some/many) vendors are not following the spec thus far. What are
other folks doing in this area? How do you recognise which devices
it's safe to use GPT on, for example?
I'm now looking at updating our logic on armhf/arm64 to do something
like:
if (booted via UEFI); then
if (booted using U-Boot); then
echo MBR
else
echo GPT
fi
else
echo MBR
fi
but I'll need to find a sane way to detect U-Boot->UEFI boot. For now
I'm looking at parsing dmesg output to look for something like
[ 0.000000] efi: EFI v2.70 by Das U-Boot
but I'm hoping for a better solution. This is also somewhat assuming
that detecting U-Boot in the boot chain is a valid indicator for
"unsafe location for firmware", but I'm not sure of a better way!
[0] http://share.loverpi.com/board/libre-computer-project/libre-computer-board-…
Cheers,
--
Steve McIntyre steve.mcintyre(a)linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs
+boot-architecture list
On Tue, Feb 19, 2019 at 07:52:47PM +0800, liaoweixiong wrote:
> Create DT binding document for blkoops.
>
> Signed-off-by: liaoweixiong <liaoweixiong(a)allwinnertech.com>
> ---
> .../devicetree/bindings/pstore/blkoops.txt | 53 ++++++++++++++++++++++
> MAINTAINERS | 1 +
> 2 files changed, 54 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/pstore/blkoops.txt
>
> diff --git a/Documentation/devicetree/bindings/pstore/blkoops.txt b/Documentation/devicetree/bindings/pstore/blkoops.txt
> new file mode 100644
> index 0000000..5462915
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pstore/blkoops.txt
> @@ -0,0 +1,53 @@
> +Blkoops oops logger
> +===================
> +
> +Blkoops provides a block partition for oops, excluding panics now, so they can
> +be recovered after a reboot.
> +
> +Any space of block device will be used for a circular buffer of oops records.
> +These records have a configurable size, with a size of 0 indicating that they
> +should be disabled.
> +
> +At least one of "block-device" and "total_size" must be set.
> +
> +At least one of "dmesg-size" or "pmsg-size" must be set non-zero.
> +
> +Required properties:
> +
> +- compatible: must be "blkoops".
> +
> +Optional properties:
> +
> +- block-device: The block device to use. Most of the time, it is a partition of
> + device. If block-device is NULL, no block device is effective
> + and the data will be lost after rebooting.
> + It accept the following variants:
> + 1) <hex_major><hex_minor> device number in hexadecimal
> + represents itself no leading 0x, for example b302.
> + 2) /dev/<disk_name> represents the device number of disk
> + 3) /dev/<disk_name><decimal> represents the device number of
> + partition - device number of disk plus the partition number
> + 4) /dev/<disk_name>p<decimal> - same as the above, that form is
> + used when disk name of partitioned disk ends on a digit.
> + 5) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing
> + the unique id of a partition if the partition table provides
> + it. The UUID may be either an EFI/GPT UUID, or refer to an
> + MSDOS partition using the format SSSSSSSS-PP, where SSSSSSSS
> + is a zero-filled hex representation of the 32-bit
> + "NT disk signature", and PP is a zero-filled hex
> + representation of the 1-based partition number.
> + 6) PARTUUID=<UUID>/PARTNROFF=<int> to select a partition in
> + relation to a partition with a known unique id.
> + 7) <major>:<minor> major and minor number of the device
> + separated by a colon.
No.
I didn't suggest to go look at PARTUUID to copy it into the binding, but
rather to point out that the kernel can already mount by UUID.
Specifying the UUID in DT is also not what I suggested. My suggestion is
to define a known UUID so that the kernel (and bootloaders, userspace,
the world) can just know the UUID. Just like the EFI system partition.
Now this means you have to get it defined in the UEFI specification
(or maybe EBBR[1]). If you want help with how to do that, the
boot-architecture list is a good place to start.
major/minor numbers are a Linux thing, so they don't go in DT.
/dev/* is Linux thing, so it doesn't go in DT.
You can always define all these parameters as kernel command line
options and avoid DT. That would also make this work on *all* systems,
not just DT based systems. (Though I still believe that the partition
should be discoverable.)
Rob
[1] https://github.com/ARM-software/ebbr