X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/linexec-j720/blobdiff_plain/c5f1f439f689ac322fc715b979e343c93e8b8ec3..d4a1fe7da7b65b2be74457f9de20b8696cf636d7:/boot.cpp?ds=inline diff --git a/boot.cpp b/boot.cpp index 1204c79..5b0a0b7 100644 --- 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; - // 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); @@ -54,7 +53,7 @@ void setup_linux_params(long bootimg_dest, UINT32 initrd,UINT32 initrdl, long dr if (initrdl) { tag->hdr.tag = INITRD_TAG; tag->hdr.size = tag_size(tag_initrd); - tag->u.initrd.start = initrd; + tag->u.initrd.start = INITRD; tag->u.initrd.size = initrdl; tag = tag_next(tag); } @@ -312,7 +311,12 @@ void load_boot(char *ParamFile) 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);