3 #include <talloc/talloc.h>
9 static struct config *config;
10 static struct config_storage *storage;
13 static void config_set_defaults(struct config *config)
15 config->autoboot_enabled = true;
16 config->network_configs = NULL;
17 config->n_network_configs = 0;
20 static void dump_config(struct config *config)
24 pb_log("configuration:\n");
26 pb_log(" autoboot enabled: %s\n",
27 config->autoboot_enabled ? "yes" : "no");
29 if (config->n_network_configs > 0)
30 pb_log(" network configuration:\n");
32 for (i = 0; i < config->n_network_configs; i++) {
33 struct network_config *netconf = config->network_configs[i];
35 pb_log(" interface %02x:%02x:%02x:%02x:%02x:%02x\n",
36 netconf->hwaddr[0], netconf->hwaddr[1],
37 netconf->hwaddr[2], netconf->hwaddr[3],
38 netconf->hwaddr[4], netconf->hwaddr[5]);
40 if (netconf->ignore) {
45 if (netconf->method == CONFIG_METHOD_DHCP) {
48 } else if (netconf->method == CONFIG_METHOD_STATIC) {
50 pb_log(" ip: %s\n", netconf->static_config.address);
51 pb_log(" gw: %s\n", netconf->static_config.gateway);
52 pb_log(" dns: %s\n", netconf->static_config.dns);
58 int config_init(void *ctx)
60 config = talloc(ctx, struct config);
61 config_set_defaults(config);
63 storage = create_powerpc_nvram_storage(config);
65 storage->load(storage, config);
72 const struct config *config_get(void)