summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-02-13 09:26:04 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-02-13 09:26:04 +0100
commitbb1a6a2fd3cc41be6db1a1362f311456019317b1 (patch)
tree72db0cbebe64670f6858e3a9955a62f1b6213299
parenta06513273fc18c16b5081ddd80ce14b7de37cf6e (diff)
parentaa6f3cc4b46c90c485aed7e183199871348c4821 (diff)
downloadbarebox-bb1a6a2fd3cc41be6db1a1362f311456019317b1.tar.gz
barebox-bb1a6a2fd3cc41be6db1a1362f311456019317b1.tar.xz
Merge branch 'for-next/efi'
-rw-r--r--arch/efi/Makefile4
-rw-r--r--arch/efi/efi/efi-image.c9
-rw-r--r--arch/efi/lib/elf_x86_64_efi.lds.S1
-rw-r--r--commands/2048.c2
-rw-r--r--common/menu.c2
-rw-r--r--drivers/serial/efi-stdio.c3
-rw-r--r--include/readkey.h4
-rw-r--r--lib/readkey.c4
8 files changed, 19 insertions, 10 deletions
diff --git a/arch/efi/Makefile b/arch/efi/Makefile
index b078bd0e35..32a1c152b7 100644
--- a/arch/efi/Makefile
+++ b/arch/efi/Makefile
@@ -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
diff --git a/arch/efi/efi/efi-image.c b/arch/efi/efi/efi-image.c
index 32e060886a..27f3c1b39c 100644
--- a/arch/efi/efi/efi-image.c
+++ b/arch/efi/efi/efi-image.c
@@ -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;
diff --git a/arch/efi/lib/elf_x86_64_efi.lds.S b/arch/efi/lib/elf_x86_64_efi.lds.S
index e1bc2120fa..93d34d17ab 100644
--- a/arch/efi/lib/elf_x86_64_efi.lds.S
+++ b/arch/efi/lib/elf_x86_64_efi.lds.S
@@ -80,6 +80,7 @@ SECTIONS
*(.rela.data*)
*(.rela.barebox*)
*(.rela.initcall*)
+ *(.rela.exitcall*)
*(.rela.got)
*(.rela.stab)
}
diff --git a/commands/2048.c b/commands/2048.c
index 5ceb5cfb7d..865803a5a6 100644
--- a/commands/2048.c
+++ b/commands/2048.c
@@ -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);
diff --git a/common/menu.c b/common/menu.c
index e757216c5a..31e5c90a0f 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -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)
diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index bf14c5e24a..5ab917386e 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -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)
diff --git a/include/readkey.h b/include/readkey.h
index 8398ec2e51..ed1cd1542d 100644
--- a/include/readkey.h
+++ b/include/readkey.h
@@ -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")
diff --git a/lib/readkey.c b/lib/readkey.c
index 2870a5a9fe..e72da0066b 100644
--- a/lib/readkey.c
+++ b/lib/readkey.c
@@ -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) {