boot.c revision 4db7e6d781c2d9bba4e9124d26e811dd4addc1c5
0N/A#include "graphics.h"
1663N/Astatic const char __attribute__((used)) magic[] = "#### LoaderInfo: systemd-boot " VERSION " ####";
338N/Aenum loader_type {
clear = 0;
clear++;
clear++;
clear = 0;
clear++;
clear++;
clear++;
if (len == 0)
len--;
if (len == 0)
len--;
if (cursor > 0)
cursor--;
first = 0;
first = 0;
len++;
cursor++;
first++;
return enter;
UINTN i;
if (key == 0)
for (i = 0; i < start; i++)
UINTN i;
CHAR16 *s;
CHAR8 *b;
UINTN x;
UINTN y;
if (uefi_call_wrapper(ST->ConOut->QueryMode, 4, ST->ConOut, ST->ConOut->Mode->Mode, &x, &y) == EFI_SUCCESS)
FreePool(b);
FreePool(b);
FreePool(b);
FreePool(s);
FreePool(s);
if (device_path) {
UINTN i;
err = uefi_call_wrapper(ST->ConOut->QueryMode, 4, ST->ConOut, ST->ConOut->Mode->Mode, &x_max, &y_max);
idx_highlight_prev = 0;
idx_first = 0;
y_start = 0;
UINTN j, k;
for (j = 0; j < x_start; j++)
for (; j < x_max; j++)
for (i = 0; i < x_max; i++)
clearline[i] = 0;
while (!exit) {
if (refresh) {
if (i == idx_highlight)
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, x_start-3, y_start + i - idx_first);
} else if (highlight) {
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, 0, y_start + idx_highlight_prev - idx_first);
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, x_start-3, y_start + idx_highlight_prev - idx_first);
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, 0, y_start + idx_highlight - idx_first);
uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, x_start-3, y_start + idx_highlight - idx_first);
if (timeout_remain > 0) {
if (status) {
UINTN x;
if (timeout_remain == 0) {
if (timeout_remain > 0) {
if (status) {
switch (key) {
if (idx_highlight > 0)
if (idx_highlight > 0) {
idx_highlight = 0;
idx_highlight = 0;
status = PoolPrint(L"systemd-boot " VERSION " (" EFI_MACHINE_TYPE_NAME "), UEFI Specification %d.%02d, Vendor %s %d.%02d",
if (idx < 0)
return run;
UINTN i;
if (is_digit(c))
if (order)
return order;
s1++;
s2++;
s1++;
s2++;
first = 0;
if (first == 0)
s1++;
s2++;
if (first)
return first;
static CHAR8 *line_get_key_value(CHAR8 *content, CHAR8 *sep, UINTN *pos, CHAR8 **key_ret, CHAR8 **value_ret) {
skip:
return NULL;
linelen = 0;
linelen++;
(*pos)++;
if (linelen == 0)
goto skip;
line++;
linelen--;
linelen--;
goto skip;
value++;
goto skip;
value++;
value++;
value++;
return line;
CHAR16 *s;
FreePool(s);
static VOID config_entry_add_from_file(Config *config, EFI_HANDLE *device, CHAR16 *file, CHAR8 *content, CHAR16 *loaded_image_path) {
if (initrd) {
CHAR16 *s;
initrd = s;
CHAR16 *s;
CHAR16 *s;
static VOID config_load(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir, CHAR16 *loaded_image_path) {
UINTN i;
if (len > 0)
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &entries_dir, L"\\loader\\entries", EFI_FILE_MODE_READ, 0ULL);
EFI_FILE_INFO *f;
if (len > 0)
UINTN k;
if (!more)
UINTN i;
if (found)
if (found)
UINTN i, k;
if (!title)
if (unique)
CHAR16 *s;
if (unique)
CHAR16 *s;
CHAR16 *m;
FreePool(m);
if (unique)
CHAR16 *s;
return TRUE;
return entry;
static BOOLEAN config_entry_add_loader_auto(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir, CHAR16 *loaded_image_path,
return FALSE;
return FALSE;
if (!entry)
return FALSE;
return TRUE;
UINTN i;
for (i = 0; i < handle_count; i++) {
if (!root)
if (found)
static VOID config_entry_add_linux( Config *config, EFI_LOADED_IMAGE *loaded_image, EFI_FILE *root_dir) {
err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &linux_dir, L"\\EFI\\Linux", EFI_FILE_MODE_READ, 0ULL);
EFI_FILE_INFO *f;
if (len <= 0)
config_entry_add_loader(config, loaded_image->DeviceHandle, LOADER_LINUX, conf, 'l', os_name, path);
static EFI_STATUS image_start(EFI_HANDLE parent_image, const Config *config, const ConfigEntry *entry) {
if (!path) {
return EFI_INVALID_PARAMETER;
goto out;
if (options) {
goto out_unload;
out:
return err;
CHAR8 *b;
FreePool(b);
return err;
return err;
UINTN i;
CHAR16 *s;
CHAR8 *b;
s = PoolPrint(L"%s %d.%02d", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
FreePool(s);
FreePool(s);
return err;
if (device_path) {
if (!root_dir) {
return EFI_LOAD_ERROR;
L"auto-efi-default", '\0', L"EFI Default Loader", L"\\EFI\\Boot\\boot" EFI_MACHINE_TYPE_NAME ".efi");
FreePool(b);
goto out;
if (idx >= 0)
if (menu) {
goto out;
out:
return err;