Home |
RTTarget-32 Programming Manual Running Win32 Programs without Win32 Running a Program on the Target Booting from the CPU Reset Vector UEFI Booting Compiling and Linking with On Time RTOS-32 |
UEFI BootingThe Unified Extensible Firmware Interface (UEFI) is a new firmware standard to replace the legacy BIOS of the 80s. Advantages of booting in native UEFI mode instead of legacy BIOS compatibility mode are:
Disadvantages of UEFI booting are:
Just about all UEFI systems available today support both native UEFI and legacy BIOS compatibility mode (sometimes called CSM) booting. On Time RTOS-32 programs can boot in native UEFI mode if the following conditions are met: GPT Partition Table with an EFI System PartitionThe UEFI firmware loads an operating system from a disk partitioned with a GPT Partition Table. The boot partition must have type EFI System Partition and it must be formatted with a FAT-12/16/32 file system. RTFiles-32 can create such partitions with function RTFCreateGPTPartition or RTFSplitGPTPartition if parameter Flag RTF_GPT_SYSPART is applied. \EFI\BOOT\ Directory with all Required Boot FilesThe directory \EFI\BOOT\ on the EFI System Partition must contain the RTTarget-32 UEFI boot loader (BOOTIA32.EFI for 32 bit UEFI or BOOTX64.EFI for 64 bit UEFI) and at least one of up to 3 boot .ini files (BOOT0.INI, BOOT1.INI, boot2.INI) and for each boot .ini file, an .rtb file to be booted. The UEFI boot loader will try each boot .ini file from file 0 to 2 until one is successfully booted. An UEFI bootable .rtb file must contain boot code Pmboot.exe and a BootVector. Boot .ini File FormatThe boot .ini files must contain section [Boot] with mandatory entry Image. Example:[Boot] Image=\EFI\BOOT\MONITOR.RTB Status=Void Verbose=1 DelayError=10 A boot .ini file is case sensitive and may not contain any blanks (except empty lines). It may not be larger than 4k. Image must specify the full path without drive letter to the file to boot. The .rtb file must reside on the same partition as the .ini file. Optional entry Status may be used to manage boot failures. It may have one of these values: Void, Loading, Started, Success. The boot loader will load the image only if the Status is either Void or Success. If it is Success, the status is first changed to Loading and the .rtb file is loaded into RAM. Then, Status is set to Started and control is passed to the loaded image. At run-time, the application should then call function RTTUefiBootSuccess to update the status to Success. Please note that the Debug Monitor does not contain RTFiles-32 and can thus not call RTTUefiBootSuccess. The Monitor supports only Status Void or no boot Status. When the boot loader encounters a Status Loading or Started, it will abandon the current .ini file and move on to the next boot .ini file. The following optional entries are supported in section [Boot]:
Here is an example of how an UEFI bootable USB stick can be created: First, we need a bootable program. UEFI boots in protected mode, so we need boot code Pmboot.exe, and instead of a DiskBuffer, we need a BootVector. With any one of our demos, we must change in file Demopc.cfg: Locate BootCode BIOSBOOT.EXE LowMem Locate BootData BootData LowMem 0 16 Locate DiskBuffer DiskBuffer DOSMem to: Locate BootCode PMBOOT.EXE LowMem Locate BootVector BootVector LowMem 0 16 Locate BootData BootData LowMem 0 16 We can now build bootable programs like this (no change over booting on legacy BIOS systems): RTLoc -DBOOT Monitor Demopc.cfg Monitor.cfg or: RTLoc -DBOOT Hello Demopc.cfg Hello.cfg We also need at least one boot .ini file. Here is an example BOOT0.INI file: [Boot] Image=\EFI\BOOT\MONITOR.RTB SetGModeCols0=640 SetGModeCols1=800 Creating an UEFI bootable USB stick would then work like this: UefiDisk.exe /uG /C /wait /v 2 BOOT0.INI MONITOR.RTB The example above assumes that the target drive is Windows disk 2 which has mounted drive G:. This example uses UefiDisk option /C which will delete all data on the target drive. Future updates to this disk will not need option /C and data on its data partition can be maintained without the use of program UefiDisk. Running a Program on the Target
|