How to detect whether Linux runs in UEFI or BIOS mode inside the Linux itself without needed to boot the the management console of the mother board?
如何检测Linux是否在Linux自身内部以UEFI或BIOS模式运行而无需启动主板的管理控制台?
You can detect whether Linux runs in EFI mode by checking whether /sys/firmware/efi
exist. In bash, you can test by
您可以通过检查/sys/firmware/efi
是否存在来检测Linux是否以EFI模式运行。 在bash中,您可以通过
[ -d /sys/firmware/efi/ ]
This technique is used in the grub2-regen-cfg tool: http://www.systutorials.com/136638/how-to-regenerate-grub2-config-file-on-linux/
在grub2 -regen-cfg工具中使用了此技术: http : //www.systutorials.com/136638/how-to-regenerate-grub2-config-file-on-linux/
翻译自: https://www.systutorials.com/how-to-detect-whether-linux-runs-in-uefi-or-bios-mode-inside-the-linux/