From 9fe6d2e1c3113c84182a0dd9833ac88796ddfd91 Mon Sep 17 00:00:00 2001 From: anchao Date: Wed, 22 Aug 2018 07:53:15 -0600 Subject: [PATCH] Remove illegal calls into OS to initialize BINFMT support. This must be moved to the board initialization logic within the OS. --- examples/posix_spawn/spawn_main.c | 17 --------------- examples/thttpd/thttpd_main.c | 35 ------------------------------- system/nsh/nsh_main.c | 15 ------------- 3 files changed, 67 deletions(-) diff --git a/examples/posix_spawn/spawn_main.c b/examples/posix_spawn/spawn_main.c index 91c60a057..289227fad 100644 --- a/examples/posix_spawn/spawn_main.c +++ b/examples/posix_spawn/spawn_main.c @@ -53,7 +53,6 @@ #include #include -#include #include #include "filesystem/romfs.h" @@ -248,18 +247,6 @@ int spawn_main(int argc, char *argv[]) mm_initmonitor(); - /* Initialize the ELF binary loader */ - - message("Initializing the ELF binary loader\n"); - ret = elf_initialize(); - if (ret < 0) - { - errmsg("ERROR: Initialization of the ELF loader failed: %d\n", ret); - exit(1); - } - - mm_update(&g_mmstep, "after elf_initialize"); - /* Create a ROM disk for the ROMFS filesystem */ message("Registering romdisk at /dev/ram%d\n", CONFIG_EXAMPLES_ELF_DEVMINOR); @@ -268,7 +255,6 @@ int spawn_main(int argc, char *argv[]) if (ret < 0) { errmsg("ERROR: romdisk_register failed: %d\n", ret); - elf_uninitialize(); exit(1); } @@ -284,7 +270,6 @@ int spawn_main(int argc, char *argv[]) { errmsg("ERROR: mount(%s,%s,romfs) failed: %s\n", CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno); - elf_uninitialize(); } mm_update(&g_mmstep, "after mount"); @@ -477,8 +462,6 @@ int spawn_main(int argc, char *argv[]) /* Clean-up */ - elf_uninitialize(); - mm_update(&g_mmstep, "End-of-Test"); return 0; } diff --git a/examples/thttpd/thttpd_main.c b/examples/thttpd/thttpd_main.c index 01c6c7344..172a9cf40 100644 --- a/examples/thttpd/thttpd_main.c +++ b/examples/thttpd/thttpd_main.c @@ -58,15 +58,9 @@ #include "netutils/thttpd.h" #include -#include - -#ifdef CONFIG_THTTPD_NXFLAT -# include -#endif #ifdef CONFIG_THTTPD_BINFS # include -# include #endif #ifdef CONFIG_NET_SLIP @@ -260,18 +254,6 @@ int thttp_main(int argc, char *argv[]) netlib_ifup("eth0"); -#ifdef CONFIG_THTTPD_NXFLAT - /* Initialize the NXFLAT binary loader */ - - printf("Initializing the NXFLAT binary loader\n"); - ret = nxflat_initialize(); - if (ret < 0) - { - printf("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret); - exit(2); - } -#endif - /* Create a ROM disk for the ROMFS filesystem */ printf("Registering romdisk\n"); @@ -280,9 +262,6 @@ int thttp_main(int argc, char *argv[]) if (ret < 0) { printf("ERROR: romdisk_register failed: %d\n", ret); -#ifdef CONFIG_THTTPD_NXFLAT - nxflat_uninitialize(); -#endif exit(1); } @@ -296,23 +275,9 @@ int thttp_main(int argc, char *argv[]) { printf("ERROR: mount(%s,%s,romfs) failed: %d\n", ROMFSDEV, ROMFS_MOUNTPT, errno); -#ifdef CONFIG_THTTPD_NXFLAT - nxflat_uninitialize(); -#endif } #ifdef CONFIG_THTTPD_BINFS - /* Initialize the BINFS binary loader */ - - printf("Initializing the Built-In binary loader\n"); - - ret = builtin_initialize(); - if (ret < 0) - { - printf("ERROR: Initialization of the Built-In loader failed: %d\n", ret); - exit(2); - } - /* Mount the BINFS file system */ printf("Mounting BINFS filesystem at %s\n", BINFS_MOUNTPT); diff --git a/system/nsh/nsh_main.c b/system/nsh/nsh_main.c index fb6fcc1db..9e7563096 100644 --- a/system/nsh/nsh_main.c +++ b/system/nsh/nsh_main.c @@ -46,10 +46,6 @@ #include #include -#if defined(CONFIG_FS_BINFS) && (CONFIG_BUILTIN) -# include -#endif - #if defined(CONFIG_LIBC_EXECFUNCS) # include #endif @@ -215,17 +211,6 @@ static int nsh_task(void) (void)boardctl(BOARDIOC_APP_SYMTAB, (uintptr_t)&symdesc); #endif -#if defined(CONFIG_FS_BINFS) && (CONFIG_BUILTIN) - /* Register the BINFS file system */ - - ret = builtin_initialize(); - if (ret < 0) - { - fprintf(stderr, "ERROR: builtin_initialize failed: %d\n", ret); - exitval = 1; - } -#endif - /* Initialize the NSH library */ nsh_initialize();