mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-06-29 06:28:13 +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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
const char *env = NULL;
|
||||
@@ -486,8 +505,12 @@ static int ventoy_hwinfo_init(void)
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
ventoy_get_uefi_version(str, sizeof(str));
|
||||
ventoy_env_export("grub_uefi_version", str);
|
||||
|
||||
ventoy_get_pi_version(str, sizeof(str));
|
||||
ventoy_env_export("grub_pi_version", str);
|
||||
#else
|
||||
ventoy_env_export("grub_uefi_version", "NA");
|
||||
ventoy_env_export("grub_pi_version", "NA");
|
||||
#endif
|
||||
|
||||
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
|
||||
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)argc;
|
||||
(void)args;
|
||||
|
||||
var = grub_efi_get_variable("SecureBoot", &global, &size);
|
||||
if (var && *var == 1)
|
||||
{
|
||||
grub_free(var);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return g_sys_sb ? 0 : 1;
|
||||
}
|
||||
#else
|
||||
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;
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
const char *env = NULL;
|
||||
const char *policy = NULL;
|
||||
grub_efi_guid_t security =
|
||||
{ 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";
|
||||
}
|
||||
|
||||
env = grub_env_get("grub_uefi_version");
|
||||
grub_printf("UEFI Firmware Version : %s\n", env ? env : "NA");
|
||||
grub_printf("UEFI Firmware Secure Boot : %s\n", g_sys_sb ? "Enable" : "Disable");
|
||||
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");
|
||||
grub_printf("UEFI Security %s\n", grub_efi_locate_protocol(&security, NULL) ? "Yes" : "No");
|
||||
grub_printf("UEFI Security2 %s\n", grub_efi_locate_protocol(&security2, NULL) ? "Yes" : "No");
|
||||
grub_printf("Ventoy Secure Policy %s\n", policy);
|
||||
|
||||
#else
|
||||
grub_printf("Non EFI mode!\n");
|
||||
|
||||
@@ -24,17 +24,20 @@ menuentry "$VTLANG_HWINFO" --class=debug_hwinfo --class=F5tool {
|
||||
set bios_size="-";
|
||||
smbios -t 0 -b 0x09 --set=bios_size;
|
||||
|
||||
|
||||
|
||||
echo "Platform $grub_cpu-$grub_platform"
|
||||
if [ "$grub_platform" != "pc" ]; then
|
||||
echo "UEFI Version $grub_uefi_version"
|
||||
echo "PI Version $grub_pi_version"
|
||||
if vt_check_secureboot_var; then
|
||||
echo "Secure Boot Enabled"
|
||||
else
|
||||
echo "Secure Boot Disabled"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
vt_sbinfo
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "CPU Model $cpu_brand"
|
||||
echo "Physical RAM $grub_total_ram MB"
|
||||
|
||||
Reference in New Issue
Block a user