wok-next diff syslinux/stuff/iso2exe/boot.c @ rev 16025
syslinux/iso2exe: fix cmdline
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Mar 07 10:50:10 2014 +0000 (2014-03-07) |
parents | 592369f78d12 |
children | 8cf93f4aedd1 |
line diff
1.1 --- a/syslinux/stuff/iso2exe/boot.c Thu Mar 06 19:57:41 2014 +0000 1.2 +++ b/syslinux/stuff/iso2exe/boot.c Fri Mar 07 10:50:10 2014 +0000 1.3 @@ -24,7 +24,7 @@ 1.4 1.5 static void bootiso(char **iso) 1.6 { 1.7 - char *init = "rdinit=/init.exe", *mode="menu"; 1.8 + char *init = " rdinit=/init.exe", *mode="menu", *fmt=""; 1.9 char c, rootfs[16], cmdline[256]; 1.10 int restart; 1.11 unsigned long magic; 1.12 @@ -40,18 +40,24 @@ 1.13 } 1.14 if (isoopen(mode)) 1.15 isoopen("bzImage"); 1.16 - if (loadkernel() < 0x20630) 1.17 + magic = loadkernel(); 1.18 + if (magic < 0x20630) 1.19 init = ""; // Does not support multiple initramfs 1.20 - isoopen(rootfs); 1.21 - loadinitrd(); 1.22 - lseek(isofd, 24, SEEK_SET); 1.23 - read(isofd, &magic, 4); 1.24 - isofilesize = magic & 0xFFFF; 1.25 - isofileofs = 0x7EE0 - isofilesize; 1.26 - loadinitrd(); 1.27 + if (magic > 0) { 1.28 + fmt = "rw root=/dev/null%s iso=%s magic=%lu mode=%s"; 1.29 + isoopen(rootfs); 1.30 + loadinitrd(); 1.31 + if (*init) { 1.32 + lseek(isofd, 24L, SEEK_SET); 1.33 + read(isofd, &magic, 4); 1.34 + isofilesize = magic & 0xFFFFL; 1.35 + isofileofs = 0x7EE0L - isofilesize; 1.36 + if (isofilesize) loadinitrd(); 1.37 + else init=""; 1.38 + } 1.39 + } 1.40 + sprintf(cmdline, fmt, init, *iso, magic, mode); 1.41 close(isofd); 1.42 - sprintf(cmdline,"rw root=/dev/null %s iso=%s magic=%lu mode=%s", 1.43 - init, *iso, magic, mode); 1.44 bootlinux(cmdline); 1.45 } 1.46 1.47 @@ -135,7 +141,7 @@ 1.48 } 1.49 if (cmdfile) { 1.50 int fd; 1.51 - fd = chkstatus(open(cmdfile, O_RDONLY), chkstatus); 1.52 + fd = chkstatus(open(cmdfile, O_RDONLY), cmdfile); 1.53 if (fd != -1) { 1.54 read(fd, args, sizeof(args)); 1.55 close(fd);