diff options
author | Jordan Crouse <jordan.crouse@amd.com> | 2008-03-19 23:59:13 +0000 |
---|---|---|
committer | Jordan Crouse <jordan.crouse@amd.com> | 2008-03-19 23:59:13 +0000 |
commit | f3029a8fc9025de0e09d1bb3fefe67e391c4160a (patch) | |
tree | de4a145154e42d0125b0e77bd2ed39ec6f01e5c5 /payloads/libpayload/util/kconfig/kconfig_load.c | |
parent | f6145c3c15789123f6b4a9ce64a517048e753762 (diff) | |
download | coreboot-f3029a8fc9025de0e09d1bb3fefe67e391c4160a.tar.xz |
libpayload: External code
This is external and properly licensed code that I pulled into the tree.
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3171 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/util/kconfig/kconfig_load.c')
-rw-r--r-- | payloads/libpayload/util/kconfig/kconfig_load.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/payloads/libpayload/util/kconfig/kconfig_load.c b/payloads/libpayload/util/kconfig/kconfig_load.c new file mode 100644 index 0000000000..dbdcaad823 --- /dev/null +++ b/payloads/libpayload/util/kconfig/kconfig_load.c @@ -0,0 +1,35 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#include "lkc.h" + +#define P(name,type,arg) type (*name ## _p) arg +#include "lkc_proto.h" +#undef P + +void kconfig_load(void) +{ + void *handle; + char *error; + + handle = dlopen("./libkconfig.so", RTLD_LAZY); + if (!handle) { + handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY); + if (!handle) { + fprintf(stderr, "%s\n", dlerror()); + exit(1); + } + } + +#define P(name,type,arg) \ +{ \ + name ## _p = dlsym(handle, #name); \ + if ((error = dlerror())) { \ + fprintf(stderr, "%s\n", error); \ + exit(1); \ + } \ +} +#include "lkc_proto.h" +#undef P +} |