Currently, we're always assuming a powerpc platform, as the powerpc
probe() function always returns true.
This change adds a check for some bits we need to work on a powerpc
platform.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
#include <limits.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <talloc/talloc.h>
#include <list/list.h>
#include <talloc/talloc.h>
#include <list/list.h>
static bool probe(struct platform *p, void *ctx)
{
struct platform_powerpc *platform;
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);
platform = talloc(ctx, struct platform_powerpc);
list_init(&platform->params);