disk: add TegraPT support
v2 cover disk: add TegraPT support
Production Tegra20/30/114/124/132 devices use Nvidia's own partition table, which makes them a bit complicated to deal with. Luckily, it is compatible with the existing EFI partition already available in U-Boot, apart from the fact that it cannot pass Protective MBR check.
In order to address this without unwanted code additions, I have come up with this solution.
---
Changes from v1
- fix typo in code comment
---
Svyatoslav Ryhel (1):
disk: add TegraPT support
disk/Kconfig | 8 ++++++++ disk/part_efi.c | 13 +++++++++++++ 2 files changed, 21 insertions(+)
Signature · 1 line
2.43.0
PATCH v2 1/1 disk: add TegraPT support
TegraPT is compatible with EFI part but it can't pass Protective MBR check. Skip this check if CONFIG_TEGRA_PARTITION is enabled, storage uclass is MMC and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.
--- disk/Kconfig | 8 ++++++++ disk/part_efi.c | 13 +++++++++++++ 2 files changed, 21 insertions(+)
disk/Kconfig +8 -0
@@ -49,6 +49,14 @@ config SPL_MAC_PARTITION default y if MAC_PARTITION select SPL_PARTITIONS +config TEGRA_PARTITION + bool "Enable Nvidia Tegra partition table" + select PARTITIONS + select EFI_PARTITION + help + Say Y here if you would like to use U-Boot on a device with + Nvidia Tegra partition table. + config DOS_PARTITION bool "Enable MS Dos partition table" default y if BOOT_DEFAULTS
disk/part_efi.c +13 -0
@@ -318,6 +318,19 @@ static int part_test_efi(struct blk_desc *desc)/* Read legacy MBR from block 0 and validate it */ if ((blk_dread (desc,0 ,1 , (ulong *)legacymbr) !=1 ) || (is_pmbr_valid (legacymbr) !=1 )) { + +/* +* TegraPT is compatible with EFI part, but it +* cannot pass the Protective MBR check. Skip it +* if CONFIG_TEGRA_PARTITION is enabled and the +* device in question is eMMC. +*/ +if (IS_ENABLED (CONFIG_TEGRA_PARTITION )) +if (!is_pmbr_valid (legacymbr) && + desc->uclass_id ==UCLASS_MMC && + !desc->devnum) +return 0 ; +return -1 ; }return 0 ;
Signature · 1 line
2.43.0
Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel <[email protected]>:
Quoted 3 lines
TegraPT is compatible with EFI part but it can't pass Protective MBR check. Skip this check if
CONFIG_TEGRA_PARTITIONis enabled, storage uclass is MMC and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.
Why wouldn't you use U-Boot's gpt command to fix the non-conformant partition table?
Best regards
Heinrich
Quoted 50 lines
Signed-off-by Svyatoslav Ryhel <[email protected]>---
disk/Kconfig | 8 ++++++++disk/part_efi.c| 13 +++++++++++++2 files changed, 21 insertions(+)disk/Kconfig +8
-0@@ -49,6 +49,14 @@ config SPL_MAC_PARTITION default y if MAC_PARTITION select SPL_PARTITIONS +config TEGRA_PARTITION + bool "Enable Nvidia Tegra partition table" + select PARTITIONS + select EFI_PARTITION + help + Say Y here if you would like to use U-Boot on a device with + Nvidia Tegra partition table. +config
DOS_PARTITION
bool "Enable MS Dos partition table"
default y ifBOOT_DEFAULTSdisk/part_efi.c +13
-0@@ -318,6 +318,19 @@ static int part_test_efi(struct blk_desc *desc)/* Read legacy MBR from block 0 and validate it */ if ((blk_dread (desc,0 ,1 , (ulong *)legacymbr) !=1 ) || (is_pmbr_valid (legacymbr) !=1 )) { + +/* +* TegraPT is compatible with EFI part, but it +* cannot pass the Protective MBR check. Skip it +* if CONFIG_TEGRA_PARTITION is enabled and the +* device in question is eMMC. +*/ +if (IS_ENABLED (CONFIG_TEGRA_PARTITION )) +if (!is_pmbr_valid (legacymbr) && + desc->uclass_id ==UCLASS_MMC && + !desc->devnum) +return 0 ; +return -1 ; }return 0 ;
пт, 9 серп. 2024 р. о 08:49 Heinrich Schuchardt <[email protected]> пише:
Quoted 10 lines
Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel <[email protected]>:
Quoted 3 lines
TegraPT is compatible with EFI part but it can't pass Protective MBR check. Skip this check if
CONFIG_TEGRA_PARTITIONis enabled, storage uclass is MMC and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.Why wouldn't you use U-Boot's gpt command to fix the non-conformant partition table?
I would love to, but I am forced to use TegraPT and DON'T modify it. Tegra114 bootloader is RSA signed and there is no possible way to replace it with open source one unless vendor allows this. SO I am stuck with vendor bootloader to chainload from which enforces TegraPT as well. Modification of existing partition table can irreversibly brick the device.
Best regards,
Svyatoslav R.
Quoted 54 lines
Best regards
Heinrich
Quoted 50 lines
Signed-off-by Svyatoslav Ryhel <[email protected]>---
disk/Kconfig | 8 ++++++++disk/part_efi.c| 13 +++++++++++++2 files changed, 21 insertions(+)disk/Kconfig +8
-0@@ -49,6 +49,14 @@ config SPL_MAC_PARTITION default y if MAC_PARTITION select SPL_PARTITIONS +config TEGRA_PARTITION + bool "Enable Nvidia Tegra partition table" + select PARTITIONS + select EFI_PARTITION + help + Say Y here if you would like to use U-Boot on a device with + Nvidia Tegra partition table. +config
DOS_PARTITION
bool "Enable MS Dos partition table"
default y ifBOOT_DEFAULTSdisk/part_efi.c +13
-0@@ -318,6 +318,19 @@ static int part_test_efi(struct blk_desc *desc)/* Read legacy MBR from block 0 and validate it */ if ((blk_dread (desc,0 ,1 , (ulong *)legacymbr) !=1 ) || (is_pmbr_valid (legacymbr) !=1 )) { + +/* +* TegraPT is compatible with EFI part, but it +* cannot pass the Protective MBR check. Skip it +* if CONFIG_TEGRA_PARTITION is enabled and the +* device in question is eMMC. +*/ +if (IS_ENABLED (CONFIG_TEGRA_PARTITION )) +if (!is_pmbr_valid (legacymbr) && + desc->uclass_id ==UCLASS_MMC && + !desc->devnum) +return 0 ; +return -1 ; }return 0 ;
Quoted 12 lines · Svyatoslav Ryhel
пт, 9 серп. 2024 р. о 08:49 Heinrich Schuchardt <[email protected]> пише:
Quoted 10 lines
Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel <[email protected]>:
Quoted 3 lines
TegraPT is compatible with EFI part but it can't pass Protective MBR check. Skip this check if
CONFIG_TEGRA_PARTITIONis enabled, storage uclass is MMC and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.Why wouldn't you use U-Boot's gpt command to fix the non-conformant partition table?
Quoted 6 lines
I would love to, but I am forced to use TegraPT and DON'T modify it. Tegra114 bootloader is RSA signed and there is no possible way to replace it with open source one unless vendor allows this. SO I am stuck with vendor bootloader to chainload from which enforces TegraPT as well. Modification of existing partition table can irreversibly brick the device.
Can we please incorporate some of this information to the help text, so it's clear what the use case is? Thanks.
Signature · 1 line
Tom
сб, 10 серп. 2024 р. о 01:02 Tom Rini <[email protected]> пише:
Quoted 21 lines · Svyatoslav Ryhel
Quoted 12 lines
пт, 9 серп. 2024 р. о 08:49 Heinrich Schuchardt <[email protected]> пише:
Quoted 10 lines
Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel <[email protected]>:
Quoted 3 lines
TegraPT is compatible with EFI part but it can't pass Protective MBR check. Skip this check if
CONFIG_TEGRA_PARTITIONis enabled, storage uclass is MMC and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.Why wouldn't you use U-Boot's gpt command to fix the non-conformant partition table?
Quoted 6 lines
I would love to, but I am forced to use TegraPT and DON'T modify it. Tegra114 bootloader is RSA signed and there is no possible way to replace it with open source one unless vendor allows this. SO I am stuck with vendor bootloader to chainload from which enforces TegraPT as well. Modification of existing partition table can irreversibly brick the device.
Quoted 2 lines
Can we please incorporate some of this information to the help text, so it's clear what the use case is? Thanks.
Sure, though usually those who know what they are dealing with will understand. BTW, Tom, may I pick patchsets assigned to Thierry (tagr) via Tegra custodian tree if they pass? Even if they, apart being related to Tegra, belong to different subsystems (like this patch and, for example, tegra gpio driver changes).
Quoted 2 lines
--
Tom
Quoted 22 lines · Svyatoslav Ryhel
сб, 10 серп. 2024 р. о 01:02 Tom Rini <[email protected]> пише:
Quoted 21 lines · Svyatoslav Ryhel
Quoted 18 lines
пт, 9 серп. 2024 р. о 08:49 Heinrich Schuchardt <[email protected]> пише:
Quoted 10 lines
Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel <[email protected]>:
Quoted 3 lines
TegraPT is compatible with EFI part but it can't pass Protective MBR check. Skip this check if
CONFIG_TEGRA_PARTITIONis enabled, storage uclass is MMC and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.Why wouldn't you use U-Boot's gpt command to fix the non-conformant partition table?
I would love to, but I am forced to use TegraPT and DON'T modify it. Tegra114 bootloader is RSA signed and there is no possible way to replace it with open source one unless vendor allows this. SO I am stuck with vendor bootloader to chainload from which enforces TegraPT as well. Modification of existing partition table can irreversibly brick the device.
Quoted 8 lines
Quoted 2 lines
Can we please incorporate some of this information to the help text, so it's clear what the use case is? Thanks.
Sure, though usually those who know what they are dealing with will understand. BTW, Tom, may I pick patchsets assigned to Thierry (tagr) via Tegra custodian tree if they pass? Even if they, apart being related to Tegra, belong to different subsystems (like this patch and, for example, tegra gpio driver changes).
Yes, that's fine.
Signature · 1 line
Tom
Since there were no objections (apart help Kconfig expansion which I will add) or improvement suggestions to this patch for over 2 weeks (first patchset submitted on 01.08.24) I am picking it into Tegra custodian tree.
пн, 12 серп. 2024 р. о 21:42 Tom Rini <[email protected]> пише:
Quoted 38 lines · Svyatoslav Ryhel
Quoted 23 lines
сб, 10 серп. 2024 р. о 01:02 Tom Rini <[email protected]> пише:
Quoted 21 lines · Svyatoslav Ryhel
Quoted 18 lines
пт, 9 серп. 2024 р. о 08:49 Heinrich Schuchardt <[email protected]> пише:
Quoted 10 lines
Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel <[email protected]>:
Quoted 3 lines
TegraPT is compatible with EFI part but it can't pass Protective MBR check. Skip this check if
CONFIG_TEGRA_PARTITIONis enabled, storage uclass is MMC and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.Why wouldn't you use U-Boot's gpt command to fix the non-conformant partition table?
I would love to, but I am forced to use TegraPT and DON'T modify it. Tegra114 bootloader is RSA signed and there is no possible way to replace it with open source one unless vendor allows this. SO I am stuck with vendor bootloader to chainload from which enforces TegraPT as well. Modification of existing partition table can irreversibly brick the device.
Quoted 8 lines
Quoted 2 lines
Can we please incorporate some of this information to the help text, so it's clear what the use case is? Thanks.
Sure, though usually those who know what they are dealing with will understand. BTW, Tom, may I pick patchsets assigned to Thierry (tagr) via Tegra custodian tree if they pass? Even if they, apart being related to Tegra, belong to different subsystems (like this patch and, for example, tegra gpio driver changes).
Yes, that's fine.
--
Tom