I need to run a script before the operating system starts. The script reads a text file (on file-system FAT32), if the result is "A", then launch OS1, elseif the result is "B", then launches OS2 (another operating system). I thought of Grub, but I do not know how it could be done. Alternatively, I could use EFI Shell, but in the firmware of my computer there is no EFI Shell. How can I do? Thank you all.
You can download EFI Shell from the TianoCore project. It's an open source release based on the Intel implementation.
Download that binary, place in on the EFI System Partition and add an UEFI boot entry. The easiest way to do that is using Linux: (as root)
cd /efi/boot wget https://github.com/tianocore/edk2/raw/master/ShellBinPkg/UefiShell/X64/Shell.efi efibootmgr -c -p 1 -l shell.efi -L "EFI Shell"
Then set it as default boot option through your UEFI configuration interface or using
efibootmgr -o $(efibootmgr | grep 'EFI Shell' | sed -r -e 's/^Boot0+//' -e 's/\*.*//')