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
This commit is contained in:
35
payloads/libpayload/util/kconfig/kconfig_load.c
Normal file
35
payloads/libpayload/util/kconfig/kconfig_load.c
Normal file
@@ -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
|
||||
}
|
Reference in New Issue
Block a user