Re: [PATCH v1 3/3] partitions/efi: Support gpt_sector parameter needed by NVIDIA Tegra devices

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

 



29.03.2021 20:31, Davidlohr Bueso пишет:
> On Sun, 28 Mar 2021, Dmitry Osipenko wrote:
> 
>> All NVIDIA Tegra20..124 Android devices use proprietary bootloader
>> which supplies the gpt_sector=<sector> kernel cmdline parameter that
>> should be used for looking up the EFI partition table on internal EMMC
>> storage.  If the kernel cmdline parameter isn't supplied, then the
>> partition is expected to be placed around the last but one sector of
>> EMMC.
>>
>> Apparently this was done in order to hide the PT from a usual userspace
>> tools since EFI entry exists only for compatibility with a Linux kernel,
>> while a custom proprietary partition table is what is really used by
>> these Android devices, thus these tools may corrupt the real PT, making
>> device unbootable and very difficult to restore.
>>
>> Add support for the gpt_sector cmdline parameter which will be used
>> for finding EFI entry on internal EMMC storage of NVIDIA Tegra20+
>> devices.
> 
> Since this is proprietary and playing yucky games hiding the pt, why not
> just force for the fallback on Nvidia's side and always just use the entry
> at the end of the block device? I'm not loving introducing a generic
> parameter for an obscure ad-hoc feature.

I understand the reluctance to support the ad-hoc features, I wouldn't
want to support this myself if I was in yours position.  This all is
necessary solely in order to provide a good user experience using
mainline kernel on the consumer devices that have Tegra SoC inside.  A
more advanced users could bypass the secure boot restrictions and
reformat the partition table as they wish, but this is very involved.
The only reason I'm submitting these patches is to allow more people to
have fun with their devices running mainline Linux without a need to
bother with extra out-of-tree patches.

There are total four possible variants of the PT that I'm aware about:

1. GPT entry exists at the proper "backup" location in the end of a
block device.  Unfortunately only Nexus 7 is known to have this.

2. GPT entry exists at the give sector offset using the gpt_sector=<>
parameter.  This offset may or may not match the offset that we can
calculate based on EMMC boot offset.  This case is common for the vast
majority of devices.

3. GPT entry exists at the expected sector offset which is calculated
based on EMMC boot offset.  This is common for devices that use older
versions of NVIDIA bootloader which doesn't provide the gpt_sector=<>
parameter.

4. GPT entry doesn't exist at all and other means are used to convey the
partition table info.  This is rare, but happens for the oldest devices.
 Using a reversed-engineered tegra-partition format helps in this case.

Technically we could use the reversed-engineered tegra-partition without
caring about GPT at all, but this may result in a different number of a
visible partitions to the system in comparison to the GPT entry because
some of partitions may be hidden from the GPT, like partition where
media keys are stored and etc.  This could be confusing and quite
inconvenient when /dev/mmcblk0p4 becomes /dev/mmcblk0p6, so it's more
preferred to use the existing GPT entry.



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux