[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1112448: partman-partitioning: GPT may overwrite U-Boot on armhf and arm64 platforms



Package: partman-partitioning
Version: 159
X-Debbugs-CC: debian-arm@lists.debian.org

Dear maintainers,

On many platforms based on ARM SoCs, the normal boot process usually involves loading a boot loader (often U-Boot) from a fixed location of a SD card or eMMC, specific to each SoC family. The Debian installer can install the system on the same SD/eMMC or on any other attached storage device supported by the boot loader. It does not install U-Boot itself, so the installed system relies on the same boot loader as the installer.

The default partition table type for arm64/* and armhf/efi platforms is GPT (may be overridden with partman-partitioning/default_label). However, GPT standard layout overlaps with the boot location of some SoC families such as Allwinner sunxi and NXP/Freescale i.MX. So creating a GPT partition table on the boot device overwrites the boot loader and renders the system unable to boot.

Details:
- GPT primary table standard layout uses sectors 2-33 (1KiB-17KiB). The GPT specification allows to change the partition table size and location but libparted which partman uses can only create a standard GPT layout. - sunxi standard boot location starts at sector 16 (8KiB). Newer models, including armhf H3 and all arm64, support an alternate boot location at sector 256 (128KiB) or 512 (256KiB) which is compatible with GPT standard layout, but SD card firmware images built by debian-installer install U-Boot at the standard 8KiB location.
- i.MX boot location starts at sector 2 (1KiB) as far as I know.

The default partition table type is used by both manual creation of a new partition table in normal install and guided partitioning using an entire disk. Only manual creation of a new partition table in expert install prompts the user to choose the partition table type. Guided partitioning using free space does not create a new partition table.

Proposed solutions:
- Force MSDOS default type on SD/eMMC if the platform boot location overlaps with the GPT area. - Force MSDOS default type on SD/eMMC if the platform boot location overlaps with the GPT area and a boot loader is detected. - Force MSDOS default type on SD/eMMC if the platform boot location overlaps with the GPT area and a boot loader is detected or the platform does not support an alternate boot location.

Possible mitigations for sunxi platforms:
- debian-installer: build SD card firmware images using the alternate boot location for platforms which support it (sunxi H3, A64, H5, H6). - u-boot-sunxi: write the U-Boot image at the alternate boot location for platforms which support it (see #928643 [1]).

Feedback from ARM platform users and developers welcome.

[1] <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928643>


Reply to: