]> git.zerfleddert.de Git - linexec-j720/commitdiff
fix kernel commandline "parsing" -> do not always cut off the last
authormichael <michael>
Wed, 23 Nov 2005 19:16:24 +0000 (19:16 +0000)
committermichael <michael>
Wed, 23 Nov 2005 19:16:24 +0000 (19:16 +0000)
byte, it's not always a newline!

boot.cpp
out/linexec.exe

index 5e5da9bc63855cc31e794728a10e050eb1607620..5b0a0b7573d3ffd0f5ab746df8e81605ac6390e7 100644 (file)
--- a/boot.cpp
+++ b/boot.cpp
@@ -35,9 +35,8 @@ void setup_linux_params(long bootimg_dest, UINT32 initrd,UINT32 initrdl, long dr
 
        // now the cmdline tag
        tag->hdr.tag = ATAG_CMDLINE;
 
        // now the cmdline tag
        tag->hdr.tag = ATAG_CMDLINE;
-       // must be at least +3!! 1 for the null and 2 for the ???
-       tag->hdr.size = (strlen(cmdline) + 3 + sizeof(struct tag_header)) >> 2;
-       //tag->hdr.size = (strlen(cmdline) + 10 + sizeof(struct tag_header)) >> 2;
+       // tag header, zero-terminated string and round size to 32-bit words
+       tag->hdr.size = (sizeof (struct tag_header) + strlen (cmdline) + 1 + 3) >> 2;
        strcpy(tag->u.cmdline.cmdline,cmdline);
        tag = tag_next(tag);
 
        strcpy(tag->u.cmdline.cmdline,cmdline);
        tag = tag_next(tag);
 
@@ -312,7 +311,12 @@ void load_boot(char *ParamFile)
        initrd[strlen(initrd)-1]=0;
        
        fgets(cmd,200,stream);
        initrd[strlen(initrd)-1]=0;
        
        fgets(cmd,200,stream);
-       cmd[strlen(cmd)-1]=0;
+       if (cmd[strlen(cmd)-1] == 0x0a)
+       {
+               cmd[strlen(cmd)-1]=0;
+               if (cmd[strlen(cmd)-2] == 0x0d)
+                       cmd[strlen(cmd)-2]=0;
+       }
 
        fclose(stream);
 
 
        fclose(stream);
 
index 0ce0334fce597edef5e030ffdf90e02b6fbdf65b..529d0c6db42582adc9458f25ddae95244912c59d 100755 (executable)
Binary files a/out/linexec.exe and b/out/linexec.exe differ
Impressum, Datenschutz