9
0
Fork 0

Merge branch 'for-next/efi'

This commit is contained in:
Sascha Hauer 2017-02-13 09:26:04 +01:00
commit bb1a6a2fd3
8 changed files with 19 additions and 10 deletions

View File

@ -28,8 +28,8 @@ cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \
quiet_cmd_efi_image = EFI-IMG $@
cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc -j __barebox_initcalls \
-j __barebox_cmd -j .barebox_magicvar -j .bbenv.* \
--target=$(TARGET) $< $@
-j __barebox_exitcalls -j __barebox_cmd -j .barebox_magicvar \
-j .bbenv.* --target=$(TARGET) $< $@
KBUILD_BINARY := barebox

View File

@ -130,12 +130,16 @@ static int efi_execute_image(const char *file)
efi_status_t efiret;
struct linux_kernel_header *image_header;
const char *options;
bool is_driver;
int ret;
ret = efi_load_image(file, &loaded_image, &handle);
if (ret)
return ret;
is_driver = (loaded_image->image_code_type == EFI_BOOT_SERVICES_CODE) ||
(loaded_image->image_code_type == EFI_RUNTIME_SERVICES_CODE);
image_header = (struct linux_kernel_header *)loaded_image->image_base;
if (image_header->boot_flag == 0xAA55 &&
image_header->header == 0x53726448) {
@ -145,13 +149,15 @@ static int efi_execute_image(const char *file)
loaded_image->load_options = xstrdup_char_to_wchar(options);
loaded_image->load_options_size =
(strlen(options) + 1) * sizeof(wchar_t);
shutdown_barebox();
}
efiret = BS->start_image(handle, NULL, NULL);
if (EFI_ERROR(efiret))
pr_err("failed to StartImage: %s\n", efi_strerror(efiret));
BS->unload_image(handle);
if (!is_driver)
BS->unload_image(handle);
efi_connect_all();
efi_register_devices();
@ -255,6 +261,7 @@ static int do_bootm_efi(struct image_data *data)
efi_set_variable_usec("LoaderTimeExecUSec", &efi_systemd_vendor_guid,
get_time_ns()/1000);
shutdown_barebox();
linux_efi_handover(handle, boot_header);
return 0;

View File

@ -80,6 +80,7 @@ SECTIONS
*(.rela.data*)
*(.rela.barebox*)
*(.rela.initcall*)
*(.rela.exitcall*)
*(.rela.got)
*(.rela.stab)
}

View File

@ -53,7 +53,7 @@ static void getColor(uint16_t value, char *color, size_t length)
static void drawBoard(uint16_t board[SIZE][SIZE])
{
int8_t x,y;
char color[40], reset[] = "\033[m";
char color[40], reset[] = "\033[0m";
printf("\033[H");
printf("2048.c %17d pts\n\n",score);

View File

@ -185,7 +185,7 @@ static void print_menu_entry(struct menu *m, struct menu_entry *me,
__print_entry(me->display);
if (selected)
puts("\e[m");
puts("\e[0m");
}
int menu_set_selected_entry(struct menu *m, struct menu_entry* me)

View File

@ -99,9 +99,10 @@ static struct efi_ctrlkey ctrlkeys[] = {
{ 0x05, BB_KEY_HOME },
{ 0x06, BB_KEY_END },
{ 0x07, BB_KEY_INSERT },
{ 0x08, BB_KEY_DEL },
{ 0x08, BB_KEY_DEL7 },
{ 0x09, BB_KEY_PAGEUP },
{ 0x0a, BB_KEY_PAGEDOWN },
{ 0x17, 27 /* escape key */ },
};
static int efi_read_key(struct efi_console_priv *priv, bool wait)

View File

@ -26,8 +26,8 @@
#define ANSI_CLEAR_SCREEN "\e[2J\e[;H"
#define printf_reverse(fmt,args...) printf("\e[7m" fmt "\e[m",##args)
#define puts_reverse(fmt) puts("\e[7m" fmt "\e[m")
#define printf_reverse(fmt,args...) printf("\e[7m" fmt "\e[0m",##args)
#define puts_reverse(fmt) puts("\e[7m" fmt "\e[0m")
#define gotoXY(row, col) printf("\e[%d;%dH", col, row)
#define clear() puts("\e[2J")

View File

@ -51,8 +51,8 @@ static const struct esc_cmds esccmds[] = {
int read_key(void)
{
char c;
char esc[5];
unsigned char c;
unsigned char esc[5];
c = getchar();
if (c == 27) {