Make read-only guarantee user-settable
[petitboot] / discover / platform-powerpc.c
index 2b3b043489e889573d0033d8c354d5bffb39d8d4..fc96305ad70bc56d71d5e002a5b03617a84a57a6 100644 (file)
@@ -53,6 +53,7 @@ static const char *known_params[] = {
        "petitboot,bootdevs",
        "petitboot,language",
        "petitboot,debug?",
+       "petitboot,write?",
        NULL,
 };
 
@@ -548,6 +549,10 @@ static void populate_config(struct platform_powerpc *platform,
                val = get_param(platform, "petitboot,debug?");
                config->debug = val && !strcmp(val, "true");
        }
+
+       val = get_param(platform, "petitboot,write?");
+       if (val)
+               config->allow_writes = !strcmp(val, "true");
 }
 
 static char *iface_config_str(void *ctx, struct interface_config *config)
@@ -707,6 +712,12 @@ static int update_config(struct platform_powerpc *platform,
        val = config->lang ?: "";
        update_string_config(platform, "petitboot,language", val);
 
+       if (config->allow_writes == defaults->allow_writes)
+               val = "";
+       else
+               val = config->allow_writes ? "true" : "false";
+       update_string_config(platform, "petitboot,write?", val);
+
        update_network_config(platform, config);
 
        update_bootdev_config(platform, config);