When we start our computer then there is an operation which is performed automatically by the Computer which is also called as Booting. In the Booting, System will check all the hardware and Software those are installed or Attached with the System and this will also load all the files that are needed for running a system.
In the Booting Process, all the Files that are Stored into the ROM Chip will also be Loaded for Running the System. In the Booting Process the System will read all the information from the Files that are Stored into the ROM Chip and the ROM chip will read all the instructions that are Stored into these Files. After the Booting of the System, this will automatically display all the information on the System. The Instructions that are necessary to Start the System will be read at the Time of Booting.
BIOS and UEFI are two firmware interfaces for computers that work as an interpreter between the operating system and the computer firmware. Both of these interfaces are used at the startup of the computer to initialize the hardware components and start the operating system which is stored on the hard drive.
BIOS works by reading the first sector of the hard drive which has the next device’s address to initialize or code to execute. BIOS also selects the boot device that needs to be initialized for starting the operating system. Since BIOS has been in use since the very beginning, it still works in 16-bit mode, limiting the amount of code that can be read and executed from the firmware ROM.
UEFI does the same task a little differently. It stores all the information about initialization and startup in a .efi file instead of the firmware. This file is stored on the hard drive inside a special partition called EFI System Partition (ESP). The ESP partition will also contain the boot loader programs for the Operating System installed on the computer.UEFI is meant to completely replace BIOS in the future and bring in many new features and enhancements that can’t be implemented through BIOS.
import os
if (os.path.exists('/sys/firmware/efi')):
print('UEFI detected.')
else:
print('Legacy BIOS detected.')
Legacy BIOS detected.