mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-06-29 14:38:12 +00:00
Update hwinfo
This commit is contained in:
@@ -314,6 +314,25 @@ static void ventoy_get_uefi_version(char *str, grub_size_t len)
|
|||||||
grub_snprintf(str, len, "%s.%d", str, uefi_minor_2);
|
grub_snprintf(str, len, "%s.%d", str, uefi_minor_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ventoy_get_pi_version(char *str, grub_size_t len)
|
||||||
|
{
|
||||||
|
grub_uint32_t data = 0;
|
||||||
|
grub_efi_uintn_t i = 0;
|
||||||
|
grub_efi_guid_t dxest =
|
||||||
|
{ 0x05ad34ba, 0x6f02, 0x4214, {0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9 } };
|
||||||
|
|
||||||
|
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
|
||||||
|
{
|
||||||
|
if (grub_memcmp(&dxest, &grub_efi_system_table->configuration_table[i].vendor_guid, 16) == 0)
|
||||||
|
{
|
||||||
|
grub_memcpy(&data, (char *)grub_efi_system_table->configuration_table[i].vendor_table + 8, 4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_snprintf(str, len, "%d.%d", (data >> 16) & 0xFFFF, (data & 0xFFFF) / 10);
|
||||||
|
}
|
||||||
|
|
||||||
int ventoy_set_sb_policy(void)
|
int ventoy_set_sb_policy(void)
|
||||||
{
|
{
|
||||||
const char *env = NULL;
|
const char *env = NULL;
|
||||||
@@ -486,8 +505,12 @@ static int ventoy_hwinfo_init(void)
|
|||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
ventoy_get_uefi_version(str, sizeof(str));
|
ventoy_get_uefi_version(str, sizeof(str));
|
||||||
ventoy_env_export("grub_uefi_version", str);
|
ventoy_env_export("grub_uefi_version", str);
|
||||||
|
|
||||||
|
ventoy_get_pi_version(str, sizeof(str));
|
||||||
|
ventoy_env_export("grub_pi_version", str);
|
||||||
#else
|
#else
|
||||||
ventoy_env_export("grub_uefi_version", "NA");
|
ventoy_env_export("grub_uefi_version", "NA");
|
||||||
|
ventoy_env_export("grub_pi_version", "NA");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -4752,23 +4752,10 @@ static grub_err_t ventoy_cmd_img_unhook_root(grub_extcmd_context_t ctxt, int arg
|
|||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
static grub_err_t ventoy_cmd_check_secureboot_var(grub_extcmd_context_t ctxt, int argc, char **args)
|
static grub_err_t ventoy_cmd_check_secureboot_var(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
{
|
{
|
||||||
int ret = 1;
|
|
||||||
grub_uint8_t *var = NULL;
|
|
||||||
grub_size_t size;
|
|
||||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
|
||||||
|
|
||||||
(void)ctxt;
|
(void)ctxt;
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)args;
|
(void)args;
|
||||||
|
return g_sys_sb ? 0 : 1;
|
||||||
var = grub_efi_get_variable("SecureBoot", &global, &size);
|
|
||||||
if (var && *var == 1)
|
|
||||||
{
|
|
||||||
grub_free(var);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static grub_err_t ventoy_cmd_check_secureboot_var(grub_extcmd_context_t ctxt, int argc, char **args)
|
static grub_err_t ventoy_cmd_check_secureboot_var(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
@@ -6463,7 +6450,6 @@ static grub_err_t ventoy_cmd_sb_info(grub_extcmd_context_t ctxt, int argc, char
|
|||||||
(void)args;
|
(void)args;
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
const char *env = NULL;
|
|
||||||
const char *policy = NULL;
|
const char *policy = NULL;
|
||||||
grub_efi_guid_t security =
|
grub_efi_guid_t security =
|
||||||
{ 0xA46423E3, 0x4617, 0x49f1, {0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 } };
|
{ 0xA46423E3, 0x4617, 0x49f1, {0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 } };
|
||||||
@@ -6483,13 +6469,9 @@ static grub_err_t ventoy_cmd_sb_info(grub_extcmd_context_t ctxt, int argc, char
|
|||||||
policy = "XXX";
|
policy = "XXX";
|
||||||
}
|
}
|
||||||
|
|
||||||
env = grub_env_get("grub_uefi_version");
|
grub_printf("UEFI Security %s\n", grub_efi_locate_protocol(&security, NULL) ? "Yes" : "No");
|
||||||
grub_printf("UEFI Firmware Version : %s\n", env ? env : "NA");
|
grub_printf("UEFI Security2 %s\n", grub_efi_locate_protocol(&security2, NULL) ? "Yes" : "No");
|
||||||
grub_printf("UEFI Firmware Secure Boot : %s\n", g_sys_sb ? "Enable" : "Disable");
|
grub_printf("Ventoy Secure Policy %s\n", policy);
|
||||||
grub_printf("Ventoy Secure Boot Policy : %s\n", policy);
|
|
||||||
|
|
||||||
grub_printf("UEFI Security Protocol : %s\n", grub_efi_locate_protocol(&security, NULL) ? "Yes" : "No");
|
|
||||||
grub_printf("UEFI Security2 Protocol : %s\n", grub_efi_locate_protocol(&security2, NULL) ? "Yes" : "No");
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
grub_printf("Non EFI mode!\n");
|
grub_printf("Non EFI mode!\n");
|
||||||
|
|||||||
@@ -28,11 +28,14 @@ menuentry "$VTLANG_HWINFO" --class=debug_hwinfo --class=F5tool {
|
|||||||
echo "Platform $grub_cpu-$grub_platform"
|
echo "Platform $grub_cpu-$grub_platform"
|
||||||
if [ "$grub_platform" != "pc" ]; then
|
if [ "$grub_platform" != "pc" ]; then
|
||||||
echo "UEFI Version $grub_uefi_version"
|
echo "UEFI Version $grub_uefi_version"
|
||||||
|
echo "PI Version $grub_pi_version"
|
||||||
if vt_check_secureboot_var; then
|
if vt_check_secureboot_var; then
|
||||||
echo "Secure Boot Enabled"
|
echo "Secure Boot Enabled"
|
||||||
else
|
else
|
||||||
echo "Secure Boot Disabled"
|
echo "Secure Boot Disabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
vt_sbinfo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user