Navigation

Project: wok

Clone project: hg clone http://hg.slitaz.org/wok

  • Download tarball:
  • bz2
  • gz

Search

wok changeset 16025:d814ca840c3c

syslinux/iso2exe: fix cmdline
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 07 10:50:10 2014 +0000 (5 months ago ago)
parents f6c50dca5c38
children 61bec0518c8c
files syslinux/stuff/iso2exe/boot.c syslinux/stuff/iso2exe/bootlinux.c syslinux/stuff/iso2exe/init
line diff
     1.1 --- a/syslinux/stuff/iso2exe/boot.c	Thu Mar 06 23:00:20 2014 +0100
     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);
     2.1 --- a/syslinux/stuff/iso2exe/bootlinux.c	Thu Mar 06 23:00:20 2014 +0100
     2.2 +++ b/syslinux/stuff/iso2exe/bootlinux.c	Fri Mar 07 10:50:10 2014 +0000
     2.3 @@ -24,7 +24,7 @@
     2.4  
     2.5  #define PAGE_BITS	12
     2.6  #define PAGE_SIZE	4096
     2.7 -#define BUFFERSZ	2048		// lower than mix setup
     2.8 +#define BUFFERSZ	2048		// lower than min setup
     2.9  static char buffer[BUFFERSZ];
    2.10  static unsigned long initrd_addr = 0, initrd_size;
    2.11  
    2.12 @@ -289,17 +289,6 @@
    2.13  #asm
    2.14  	push	#SETUP_SEGMENT
    2.15  	pop	es
    2.16 -	push	es
    2.17 -	pop	ss
    2.18 -	mov	sp, #CMDLINE_OFFSET
    2.19 -	mov	eax, _initrd_addr
    2.20 -	or	eax, eax
    2.21 -	jz	no_initrd
    2.22 -	mov	di, #0x218
    2.23 -	stosd
    2.24 -	mov	eax, _initrd_size
    2.25 -	stosd
    2.26 -no_initrd:
    2.27  #endasm
    2.28  	if (cmdline) {
    2.29  		if (setup_version <= 0x201) {
    2.30 @@ -328,6 +317,20 @@
    2.31  		jne	copy
    2.32  #endasm
    2.33  	}
    2.34 +	if (setup_version >= 0x200) {
    2.35 +#asm
    2.36 +		mov	eax, _initrd_addr
    2.37 +		mov	di, #0x218
    2.38 +		stosd
    2.39 +		mov	eax, _initrd_size
    2.40 +		stosd
    2.41 +#endasm
    2.42 +	}
    2.43 +#asm
    2.44 +	push	es
    2.45 +	pop	ss
    2.46 +	mov	sp, #CMDLINE_OFFSET
    2.47 +#endasm
    2.48  #ifdef ZIMAGE_SUPPORT
    2.49  	if (zimage) {
    2.50  #asm
     3.1 --- a/syslinux/stuff/iso2exe/init	Thu Mar 06 23:00:20 2014 +0100
     3.2 +++ b/syslinux/stuff/iso2exe/init	Fri Mar 07 10:50:10 2014 +0000
     3.3 @@ -350,7 +350,7 @@
     3.4  
     3.5  cdexe()
     3.6  {
     3.7 -	[ $(get 0 /media/cdrom/$1 2> /dev/null || echo 0) -ne 23117 ] &&
     3.8 +	[ $(get 0 /media/cdrom/$1 2> /dev/null || echo 0) -eq 23117 ] &&
     3.9  	echo -en "\"$2\"	\"$3\""
    3.10  }
    3.11