[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 1/2] Add nomemcheck cmdline switch (#708966)



Make memory check non-fatal if nomemcheck is passed on the kernel
cmdline. Log it an an ERROR but continue.
---
 loader/loader.c |   19 ++++++++++++++-----
 loader/loader.h |    2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index 3b0204b..58aab9e 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -931,6 +931,8 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData) {
             }
         } else if (!strcasecmp(k, "noeject")) {
             flags |= LOADER_FLAGS_NOEJECT;
+        } else if (!strcasecmp(k, "nomemcheck")) {
+            flags |= LOADER_FLAGS_NOMEMCHECK;
         } else if (!strcasecmp(k, "sshd")) {
             logMessage(INFO, "early networking required for sshd");
             flags |= LOADER_FLAGS_EARLY_NETWORKING;
@@ -1140,11 +1142,15 @@ static void checkForRam(int install_method) {
         char *buf;
         checked_asprintf(&buf, reason, getProductName(), needed/1024, installed/1024);
 
-        startNewt();
-        newtWinMessage(_("Error"), _("OK"), buf);
-        free(buf);
-        stopNewt();
-        doExit(0);
+        if(FL_NOMEMTEST(flags)) {
+            logMessage(ERROR, buf);
+        } else {
+            startNewt();
+            newtWinMessage(_("Error"), _("OK"), buf);
+            free(buf);
+            stopNewt();
+            doExit(0);
+        }
     }
 }
 
@@ -2317,6 +2323,9 @@ int main(int argc, char ** argv) {
     if (FL_NOEJECT(flags))
         *argptr++ = "--noeject";
 
+    if (FL_NOMEMCHECK(flags))
+        *argptr++ = "--nomemcheck";
+
     if (FL_RESCUE(flags)) {
         *argptr++ = "--rescue";
     } else {
diff --git a/loader/loader.h b/loader/loader.h
index d761a4a..3011e93 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -72,6 +72,7 @@
 #define LOADER_FLAGS_KICKSTART_SEND_SERIAL   (((uint64_t) 1) << 39)
 #define LOADER_FLAGS_AUTOMODDISK        (((uint64_t) 1) << 40)
 #define LOADER_FLAGS_NOEJECT            (((uint64_t) 1) << 41)
+#define LOADER_FLAGS_NOMEMCHECK         (((uint64_t) 1) << 42)
 
 #define FL_TEXT(a)               ((a) & LOADER_FLAGS_TEXT)
 #define FL_RESCUE(a)             ((a) & LOADER_FLAGS_RESCUE)
@@ -107,6 +108,7 @@
 #define FL_KICKSTART_SEND_SERIAL(a) ((a) & LOADER_FLAGS_KICKSTART_SEND_SERIAL)
 #define FL_AUTOMODDISK(a)        ((a) & LOADER_FLAGS_AUTOMODDISK)
 #define FL_NOEJECT(a)            ((a) & LOADER_FLAGS_NOEJECT)
+#define FL_NOMEMCHECK(a)         ((a) & LOADER_FLAGS_NOMEMCHECK)
 
 void doExit(int) __attribute__ ((noreturn));
 void startNewt(void);
-- 
1.7.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]