summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--discover/platform-powerpc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index e2a8631..7761769 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -4,6 +4,7 @@
#include <limits.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/stat.h>
#include <talloc/talloc.h>
#include <list/list.h>
@@ -535,6 +536,20 @@ static int save_config(struct platform *p, struct config *config)
static bool probe(struct platform *p, void *ctx)
{
struct platform_powerpc *platform;
+ struct stat statbuf;
+ int rc;
+
+ /* we need a device tree and a working nvram binary */
+ rc = stat("/proc/device-tree", &statbuf);
+ if (rc)
+ return false;
+
+ if (!S_ISDIR(statbuf.st_mode))
+ return false;
+
+ rc = process_run_simple(ctx, "nvram", "--print-config", NULL);
+ if (!WIFEXITED(rc) || WEXITSTATUS(rc) != 0)
+ return false;
platform = talloc(ctx, struct platform_powerpc);
list_init(&platform->params);
OpenPOWER on IntegriCloud