wok rev 23999

syslinux/iso2exe: read isolinux.cfg
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jan 12 07:47:12 2021 +0000 (2021-01-12)
parents 42a48dc164f3
children 1bb3a050ea16
files linld/stuff/src/!COMPILE.BAT linld/stuff/src/COMMON.H linld/stuff/src/CRTL.ASM linld/stuff/src/ISO9660.CPP linld/stuff/src/LINLD.CPP linld/stuff/src/MEMCPY32.ASM linld/stuff/src/VCPI.ASM linld/stuff/src/XMM.ASM linld/stuff/src/_BEG.ASM linld/stuff/src/pipehole.awk syslinux/stuff/iso2exe/bootiso.S syslinux/stuff/iso2exe/iso2exe.sh
line diff
     1.1 --- a/linld/stuff/src/!COMPILE.BAT	Fri Jan 08 21:11:45 2021 +0000
     1.2 +++ b/linld/stuff/src/!COMPILE.BAT	Tue Jan 12 07:47:12 2021 +0000
     1.3 @@ -3,7 +3,7 @@
     1.4  tasm /h > helptasm.log
     1.5  bcc > helpbcc.log
     1.6  tlink > helptlink.log
     1.7 -bcc @bccopt.opt -S -mt -DISOHOOK -DMOVE_SETUP -DUSE_ARGSTR -DLARGE_IMAGES *.cpp > cpp.log
     1.8 +bcc @bccopt.opt -S -mt -DISOHOOK -DMOVE_SETUP -DLARGE_IMAGES *.cpp > cpp.log
     1.9  ren LINLD.ASM LINLD.ASO
    1.10  ren LOAD.ASM LOAD.ASO
    1.11  ren HIMEM.ASM HIMEM.ASO
    1.12 @@ -12,5 +12,5 @@
    1.13  mawk -f pipehole.awk LOAD.ASO > LOAD.ASM
    1.14  mawk -f pipehole.awk HIMEM.ASO > HIMEM.ASM
    1.15  mawk -f pipehole.awk ISO9660.ASO > ISO9660.ASM
    1.16 -tasm /la /m /dISOHOOK /dBIG_CMDLINE /dMOVE_SETUP /dUSE_ARGSTR /dNO386 /dLARGE_IMAGES /dLONG_FILENAME *.asm > asm.log
    1.17 +tasm /la /m /dISOHOOK /dBIG_CMDLINE /dMOVE_SETUP /dNO386 /dLARGE_IMAGES /dLONG_FILENAME *.asm > asm.log
    1.18  tlink /m /s /t @link.cmd > lnk.log
     2.1 --- a/linld/stuff/src/COMMON.H	Fri Jan 08 21:11:45 2021 +0000
     2.2 +++ b/linld/stuff/src/COMMON.H	Tue Jan 12 07:47:12 2021 +0000
     2.3 @@ -65,7 +65,8 @@
     2.4  #define vid_mode	(cmdnum[1])	// -3 = ask, -2 = Extended VGA, -1 = Normal VGA,  n = as "n" was pressed
     2.5  #define topmem		(cmdnum[2])
     2.6  #define base_himem	(cmdnum[3])
     2.7 -extern u32 cmdnum[4];
     2.8 +#define	skip_alloc	(* (char *) &cmdnum[4])
     2.9 +extern u32 cmdnum[5];
    2.10  
    2.11  extern _fastcall void memcpy_image(struct image_himem *m);
    2.12  extern _fastcall void storepage(u32 *dst);
     3.1 --- a/linld/stuff/src/CRTL.ASM	Fri Jan 08 21:11:45 2021 +0000
     3.2 +++ b/linld/stuff/src/CRTL.ASM	Tue Jan 12 07:47:12 2021 +0000
     3.3 @@ -292,6 +292,7 @@
     3.4          endp    @isoreadsector$qpxul
     3.5  
     3.6  
     3.7 +		ifdef ISOHOOK
     3.8  ;***************************************************************
     3.9  ;_fastcall int strhead(bx:const char* a, ax:const char* b);
    3.10  ;***************************************************************
    3.11 @@ -327,6 +328,28 @@
    3.12  
    3.13          endp    @strcmp$qpxzct1
    3.14  
    3.15 +		else
    3.16 +
    3.17 +;***************************************************************
    3.18 +;_fastcall int strcmp(bx:const char* a, ax:const char* b);
    3.19 +;***************************************************************
    3.20 +        global  @strcmp$qpxzct1:near
    3.21 +        proc    @strcmp$qpxzct1 near
    3.22 +
    3.23 +@@loop:
    3.24 +		xchg	ax,bx
    3.25 +                mov	dl,[bx]			; dl = *b++
    3.26 +                inc	bx
    3.27 +		xchg	ax,bx
    3.28 +                xor	dl,[bx]			; dl ^= *a++
    3.29 +		jne	fail			; return -1
    3.30 +                inc	bx
    3.31 +		or	dl,dl			; clear C
    3.32 +		jz	failifc			; return 0
    3.33 +                jmp	@@loop
    3.34 +
    3.35 +        endp    @strcmp$qpxzct1
    3.36 +		endif
    3.37  
    3.38  ;***************************************************************
    3.39  ;_fastcall const char **argstr(bx:const char *s, ax:const char keywords[], dx:const char **var);
    3.40 @@ -356,7 +379,7 @@
    3.41  @@match:
    3.42  		inc	bx			; keywords++
    3.43  		lodsb				; *s++
    3.44 -		or	al,20h
    3.45 +		or	al,20h			; locase
    3.46  		cmp	al,[bx]
    3.47  		je	@@match
    3.48  		cmp	al,'/'			; 2f
    3.49 @@ -377,6 +400,8 @@
    3.50  		cmp	[byte bx],dh
    3.51  		jne	@@loop
    3.52  @@testal:
    3.53 +		cmp	al,'*'
    3.54 +		je	@@setnum
    3.55  		cmp	al,'='
    3.56  		;je	@@found
    3.57  		;cmp	al,0			; eos, si=next argv
    3.58 @@ -387,6 +412,7 @@
    3.59  		dec	dx
    3.60  		je	@@done
    3.61  		call	@strtol$qpxzc
    3.62 +@@setnum:
    3.63  		xchg	ax,si
    3.64  		mov	[di+2],dx
    3.65  @@done:
     4.1 --- a/linld/stuff/src/ISO9660.CPP	Fri Jan 08 21:11:45 2021 +0000
     4.2 +++ b/linld/stuff/src/ISO9660.CPP	Tue Jan 12 07:47:12 2021 +0000
     4.3 @@ -19,14 +19,15 @@
     4.4  
     4.5  	struct isostate *x=&isostate;
     4.6  
     4.7 -	if (x->curpos >= SECTORSZ || * (short *) (x->buffer + x->curpos) == 0) {
     4.8 +	p = x->buffer;
     4.9 +	if (x->curpos >= SECTORSZ || * (short *) (p + x->curpos) == 0) {
    4.10  		if ((x->curdirsize =- DIRSECTORSZ) < 0) return -1;
    4.11  		isoreadsector(&x->curdirofs);	// x->filepos = 0
    4.12  		//x->curdirofs += SECTORSZ;
    4.13  		*(int *)((char *) &x->curdirofs+1) += SECTORSZ/256;
    4.14  		x->curpos = 0;
    4.15  	}
    4.16 -	p = x->buffer; p += x->curpos;
    4.17 +	p += x->curpos;
    4.18  	x->fileofs = (* (unsigned long *) (p + 2)) << SECTORBITS;
    4.19  	if ((x->entrysize = * (short *) p) == 0) {
    4.20  		return -1;
    4.21 @@ -66,8 +67,10 @@
    4.22  #define _64bits (x->_64bits)
    4.23  	char *s;
    4.24  
    4.25 +#ifdef ISOHOOK
    4.26  	_64bits = cpuhaslm();
    4.27    _32bits:
    4.28 +#endif
    4.29  	s = (char *) x->filename2open;
    4.30  	if (*s == '/') {
    4.31  		s++;
    4.32 @@ -82,17 +85,21 @@
    4.33  	c = *s; *s = 0;
    4.34  	do {
    4.35  		if (isoreaddir() == -1) {
    4.36 +#ifdef ISOHOOK
    4.37  			if ((_64bits ^= CPUMASKLM) == 0) goto _32bits;
    4.38 +#endif
    4.39  			return -1;
    4.40  		}
    4.41  		const char *n = name;
    4.42  #define i (x->tmp)
    4.43  		i = x->filename;
    4.44 +#ifdef ISOHOOK
    4.45  		if (_64bits) {
    4.46  			if (strhead(i, n) == -1) continue;
    4.47  			n = "64";
    4.48  			i += s - name; // strlen(name);
    4.49  		}
    4.50 +#endif
    4.51  		if (strcmp(i, n) != -1) break;
    4.52  	} while (1);
    4.53  	*s++ = c;
     5.1 --- a/linld/stuff/src/LINLD.CPP	Fri Jan 08 21:11:45 2021 +0000
     5.2 +++ b/linld/stuff/src/LINLD.CPP	Tue Jan 12 07:47:12 2021 +0000
     5.3 @@ -8,7 +8,7 @@
     5.4  
     5.5  extern char bzimagestr[];
     5.6  const char* cmdstr[4] = {"auto",bzimagestr,NULL,NULL};
     5.7 -u32 cmdnum[4];
     5.8 +u32 cmdnum[5];
     5.9  
    5.10  inline void syntax() {
    5.11      die("Syntax:" NL
    5.12 @@ -51,7 +51,7 @@
    5.13  	    exit();
    5.14  	}
    5.15  	if (argstr(*argv,"cl|image|initrd|iso",clp) == (int) clp) continue;
    5.16 -	if (argnum(*argv,"root|vga|mem|-b",&root_dev) == (int) &base_himem) continue;
    5.17 +	if (argnum(*argv,"root|vga|mem|-b|-f*",&root_dev) >= (int) &base_himem) continue;
    5.18  	if (fileexist(*argv) != -1) {
    5.19              kernel_name=*argv;
    5.20  	    continue;
     6.1 --- a/linld/stuff/src/MEMCPY32.ASM	Fri Jan 08 21:11:45 2021 +0000
     6.2 +++ b/linld/stuff/src/MEMCPY32.ASM	Tue Jan 12 07:47:12 2021 +0000
     6.3 @@ -108,8 +108,8 @@
     6.4  		jnz	@@2flat
     6.5  		pop	dx			; dstseg
     6.6  		pop	ax			; srcseg
     6.7 -		dec	bx			; <1mb ?
     6.8 -                jns     @@pmcopy
     6.9 +		cmp	bx,si			; <1mb ?
    6.10 +                jne     @@pmcopy
    6.11  		push	di
    6.12  @@movlp:
    6.13  		mov	ds,ax
    6.14 @@ -124,18 +124,16 @@
    6.15  		inc	cx
    6.16                  sub     [word sz],cx
    6.17  		;jae	@@movpara
    6.18 -		sbb	[word sz+2],0
    6.19 +		sbb	[word sz+2],bx
    6.20  		jae	@@movpara
    6.21  		add	cx,[word sz]
    6.22  		;stc
    6.23  @@movpara:
    6.24              rep movsb
    6.25  		jae	@@movlp
    6.26 -		dec	cx			; set S
    6.27  		pop	di
    6.28 +		jmp	@@done16
    6.29  @@pmcopy:
    6.30 -		pop	si
    6.31 -		js	@@done16
    6.32                  p386
    6.33  		pushad				; struct declared in VCPI.ASM
    6.34                  mov     esi,[srcofs]
    6.35 @@ -193,6 +191,9 @@
    6.36                  popad
    6.37                  p8086
    6.38  @@done16:
    6.39 +			ifdef	NO386
    6.40 +		pop	si
    6.41 +			endif
    6.42                  pop     es ds
    6.43  		popf			; restore I & D
    6.44  			ifndef	NO386
     7.1 --- a/linld/stuff/src/VCPI.ASM	Fri Jan 08 21:11:45 2021 +0000
     7.2 +++ b/linld/stuff/src/VCPI.ASM	Tue Jan 12 07:47:12 2021 +0000
     7.3 @@ -66,15 +66,15 @@
     7.4  use_32          = 01000000b
     7.5  
     7.6  ;****** rm32,imm16 helper
     7.7 -macro   movzx_e rm,i
     7.8 -        db      66h
     7.9 -        mov     rm,i
    7.10 -        dw      0
    7.11 +macro	movzx_e	rm,i
    7.12 +	db	66h
    7.13 +	mov	rm,i
    7.14 +	dw	0
    7.15  endm
    7.16  
    7.17 -macro	pushd	v
    7.18 -        db      66h
    7.19 -	push	v
    7.20 +macro	pushd	sreg
    7.21 +	db	66h
    7.22 +	push	sreg
    7.23  endm
    7.24  
    7.25          group   DGROUP  _TEXT
    7.26 @@ -259,49 +259,35 @@
    7.27  ;***************************************************************
    7.28                  mov     bp,sp           ; ss:bp => struct pm_regs
    7.29  
    7.30 -                pushd   gs              ; IRET stack for return to vm
    7.31 -                pushd   fs              ;   (9 dwords)
    7.32 -                pushd   ds              ;
    7.33 -                pushd   es              ;
    7.34 -                pushd   ss              ;
    7.35 +		mov	bx,5		; IRET stack for return to vm
    7.36 +@@push_sreg:
    7.37 +		pushd	ss		; fake pushd gs fs ds es ss
    7.38 +		dec	bx
    7.39 +		jnz	@@push_sreg	;   (9 dwords)
    7.40                  push    ebp             ; esp
    7.41                  pushfd                  ; eflags: IF saved here
    7.42                  pushd   cs              ;
    7.43 -                push    0               ;\eip
    7.44 -                push    offset @@vm_ret ;/
    7.45 -
    7.46 -              ;;mov     [saved_xx],xx   ;use if your vcpi trashes bp/etc
    7.47 +                push    bx              ;\eip
    7.48 +                push    offset vcpi_ret ;/
    7.49  
    7.50  		call	switch_to_pm	; EAX, EDX/ESI, DS, ES, FS, GS destroyed
    7.51                  assume  nothing
    7.52                  assume  cs:DGROUP
    7.53  
    7.54  ; Now we are in 16-bit protected mode
    7.55 -		;push	SEL_DATA
    7.56 -		;pop	ss
    7.57 -                mov     ax,SEL_DATA
    7.58 -                mov     ss,ax
    7.59 -              ;;mov     ds,ax
    7.60 -              ;;mov     es,ax
    7.61 -              ;;mov     fs,ax
    7.62 -              ;;mov     gs,ax
    7.63 -
    7.64 -              ;;mov     xx,[saved_xx]   ;use if your vcpi trashes bp/etc
    7.65 -                lea     sp,[bp-9*4]     ;else we can do this trick with bp
    7.66 +		mov	bl,SEL_DATA
    7.67 +                mov     ss,bx
    7.68 +                lea     sp,[bp-8-9*4]
    7.69  
    7.70  ; Call the routine (bp points to params on stack if any)
    7.71 -                call    do_memcpy_vcpi
    7.72 +                call    do_memcpy_vcpi	; set ds=all_addrspace
    7.73  
    7.74  ; Ok, let's return to vm
    7.75                  mov     ax,0DE0Ch       ; maybe we need whole eax?
    7.76                  cli     ; to be safe
    7.77                  clts    ;
    7.78 -              ;;push    SEL_ABS         ; vcpi wants ds=all_addrspace
    7.79 -              ;;pop     ds              ; (done by do_memcpy_vcpi)
    7.80 -                call    [pword cs:vcpi_pm_entry]
    7.81 -@@vm_ret:
    7.82 -; Now we are in vm86 mode. Sregs, esp, eflags (IF) restored from IRET stack
    7.83 -                ret
    7.84 +; Go to vm86 mode. Sregs, esp, eflags (IF) restored from IRET stack
    7.85 +                jmp	[pword cs:vcpi_pm_entry]
    7.86  
    7.87  ;***************************************************************
    7.88  
    7.89 @@ -310,8 +296,6 @@
    7.90  ;***************************************************************
    7.91  label   do_memcpy_vcpi near
    7.92  
    7.93 -; Note: ss:bp => params
    7.94 -; Move data
    7.95                  push    SEL_ABS
    7.96                  pop     ds
    7.97                  push    ds
    7.98 @@ -325,30 +309,15 @@
    7.99  		xchg	eax,edi
   7.100                  mov     al,03h          ; writeable, present
   7.101  		call	@@set_mapping
   7.102 -               ;push    eax             ;X we'll need to restore mapping...
   7.103                  xor     edi,edi         ;es:edi => remapped page
   7.104  
   7.105          ; Set up source addr
   7.106  		mov	esi,edx
   7.107  
   7.108          ; Do copying
   7.109 -;		xor	ecx,ecx
   7.110 -;               mov     ch,4096/256
   7.111 -                ;cld
   7.112 -;;              cmp     esi,edi
   7.113 -;;              jae     @@do_copy
   7.114 -;;              add     esi,ecx         ;src<dst: we must do
   7.115 -;;              dec     esi             ;  copy backwards to avoid
   7.116 -;;              add     edi,ecx         ;  overwrite bug
   7.117 -;;              dec     edi             ;
   7.118 -;;              std                     ;
   7.119 -;;@@do_copy:
   7.120                  db      67h     ;address width override for esi/edi
   7.121              rep movsb
   7.122 -;;              cld
   7.123  
   7.124 -        ; Restore page mapping for page at 0
   7.125 -               ;pop     eax             ;X
   7.126  @@set_mapping:
   7.127                  mov     esi,[cs:sw2pm_cr3]
   7.128                  xchg    [esi-1000h],eax ; restore page0[0]
   7.129 @@ -385,9 +354,9 @@
   7.130  		mov	bx,offset sssp
   7.131                  endif
   7.132                  p386
   7.133 -                pop	ax
   7.134 -                push    cs      ;*
   7.135 -                push	ax
   7.136 +                pop	ax		; convert
   7.137 +                push    cs      	; near call
   7.138 +                push	ax		; to far call
   7.139                  push	ds
   7.140                  mov     [bx],sp
   7.141                  ;mov     [bx+2],ss
   7.142 @@ -397,13 +366,6 @@
   7.143                  assume  cs:DGROUP
   7.144  
   7.145  ; Now we are in 16-bit protected mode
   7.146 -                ;mov     ax,SEL_DATA     ; load data sregs with limit >=64k
   7.147 -                ;mov     ss,ax           ;   or you may get limit violations
   7.148 -                ;mov     ds,ax           ;   later in rm
   7.149 -                ;mov     es,ax           ;   (actually I prefer 4gig limits :-)
   7.150 -                ;mov     fs,ax           ;
   7.151 -                ;mov     gs,ax           ;
   7.152 -
   7.153  ; Black magic here
   7.154                  mov     eax,cr0
   7.155                  and     eax,7ffffffeh   ; clear PG,P bits
     8.1 --- a/linld/stuff/src/XMM.ASM	Fri Jan 08 21:11:45 2021 +0000
     8.2 +++ b/linld/stuff/src/XMM.ASM	Tue Jan 12 07:47:12 2021 +0000
     8.3 @@ -75,6 +75,10 @@
     8.4          global  @xmm_alloc$qp11image_himem:near
     8.5          proc    @xmm_alloc$qp11image_himem near
     8.6  
     8.7 +		extrn	_cmdnum:dword
     8.8 +skip_alloc	=	(byte _cmdnum+16)
     8.9 +		cmp	[skip_alloc],0
    8.10 +		jne	@@err
    8.11  		ifndef	NO386
    8.12  		mov	edx,[(image_himem si).size]		; m->size
    8.13                  ;dec     edx
    8.14 @@ -94,16 +98,14 @@
    8.15                  mov     ah,9h          ;allocate blk of DX kilobytes (<64Mb)
    8.16  		endif
    8.17                  call    xmm_driver      ;
    8.18 -                jnz     @@goerr
    8.19 +                jnz     @@err
    8.20                                          ;now: dx=handle of the blk
    8.21                  mov     ah,0Ch          ;lock blk
    8.22                  call    xmm_driver      ;
    8.23                                          ;now: dx:bx=addr of blk
    8.24 -                xchg    ax,bx
    8.25 -@@goerr:
    8.26                  jnz     @@err
    8.27 -		mov	[word (image_himem bx).buf],ax		; lo m->buf
    8.28 -		mov	[word (image_himem bx+2).buf],dx	; hi m->buf
    8.29 +		mov	[word (image_himem si).buf],bx		; lo m->buf
    8.30 +		mov	[word (image_himem si+2).buf],dx	; hi m->buf
    8.31  @@err:
    8.32                  ret
    8.33  
     9.1 --- a/linld/stuff/src/_BEG.ASM	Fri Jan 08 21:11:45 2021 +0000
     9.2 +++ b/linld/stuff/src/_BEG.ASM	Tue Jan 12 07:47:12 2021 +0000
     9.3 @@ -273,7 +273,6 @@
     9.4  ;***************************************************************
     9.5  
     9.6  
     9.7 -		ifdef	USE_ARGSTR
     9.8  ;***************************************************************
     9.9  ;_fastcall void set_cmdline(bx:const char *filename);
    9.10  ;***************************************************************
    9.11 @@ -287,7 +286,6 @@
    9.12  		jmp	read_cmdline		; read_cmdline(ax,di,cx)
    9.13  
    9.14          endp	@set_cmdline$qpxzc
    9.15 -		endif
    9.16  
    9.17  		ifdef	NO386
    9.18  ;***************************************************************
    10.1 --- a/linld/stuff/src/pipehole.awk	Fri Jan 08 21:11:45 2021 +0000
    10.2 +++ b/linld/stuff/src/pipehole.awk	Tue Jan 12 07:47:12 2021 +0000
    10.3 @@ -159,7 +159,7 @@
    10.4  	sub(/_imgs\+65534/,"_imgs-2")
    10.5  	if (/setup_sects == 0/) isload=9
    10.6  	if (isload == 9) {  # LOAD.LST
    10.7 -		sub(/,0/,",al")
    10.8 +		sub(/,0/,",al	; worst case 2k boundary (iso)")
    10.9  		if (/jne/) isload=0
   10.10  	}
   10.11  	if (/cmd_line_ptr =/ && is386 == 0) isload=7
   10.12 @@ -261,7 +261,7 @@
   10.13  			sub(/mov	al/,"movzx	eax")
   10.14  		}
   10.15  		if (is386 == 0) {
   10.16 -			if (/m->size -= _rm_size/) print "	cwd"
   10.17 +			if (/m->size -= _rm_size/) print "	cwd	; do not trust rewind result (iso case)"
   10.18  			sub(/,0$/,",dx")
   10.19  		}
   10.20  		if (/ax,word ptr/) next
   10.21 @@ -308,9 +308,8 @@
   10.22  		if (/,bx/) next
   10.23  		if (/isoreadrootsector/) {
   10.24  			print
   10.25 -			print "	cmp	word ptr [si+39],17475"
   10.26 -			print "	stc"
   10.27 -			$0="	jne	returnC"
   10.28 +			print "	xor	word ptr [si+39],17475	; clear C"
   10.29 +			$0="	jne	returnNotC"
   10.30  		}
   10.31  	}
   10.32  	if (/cpytodirpage.x->dirpage/) isiso=16
   10.33 @@ -436,7 +435,7 @@
   10.34  		if (/@2@142$/) { print "	inc	di"; sub(/jmp/,"loop") }
   10.35  	}
   10.36  	if (/i\+36\]/) next
   10.37 -	sub(/DGROUP:_isostate\[bx/,"[bx+si")
   10.38 +	sub(/di,offset DGROUP:_isostate/,"di,si")
   10.39  	 } # file == "iso9660.cpp"
   10.40  	if (wascall) {
   10.41  		if (rcall != "") {
    11.1 --- a/syslinux/stuff/iso2exe/bootiso.S	Fri Jan 08 21:11:45 2021 +0000
    11.2 +++ b/syslinux/stuff/iso2exe/bootiso.S	Tue Jan 12 07:47:12 2021 +0000
    11.3 @@ -268,10 +268,10 @@
    11.4  	rep
    11.5  	  movsb
    11.6  	movw	EXEADRS(headbuf+18),%ax		// magic
    11.7 -	movw	$10,%si
    11.8 +	movw	$10,%bp
    11.9  magiclp1:
   11.10  	xorw	%dx,%dx
   11.11 -	divw	%si
   11.12 +	divw	%bp
   11.13  	pushw	%dx
   11.14  	incw	%cx
   11.15  	orw	%ax,%ax
   11.16 @@ -285,7 +285,7 @@
   11.17  // iso=<file> arg
   11.18  
   11.19  	movb	$5,%cl
   11.20 -	movw	$EXEADRS(isostr),%si
   11.21 +	//movw	$EXEADRS(isostr),%si
   11.22  	rep
   11.23  	  movsb
   11.24  	popw	%si
    12.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Fri Jan 08 21:11:45 2021 +0000
    12.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Tue Jan 12 07:47:12 2021 +0000
    12.3 @@ -107,10 +107,11 @@
    12.4  		i=$(($(get 20 $1)-0xC0))
    12.5  		store $(($i-6)) $(($(stat -m /tmp/mnt$$/boot/linld.com | sed q)*2048)) $1 32
    12.6  		store $(($i-2)) $(stat -c %s /tmp/mnt$$/boot/linld.com) $1
    12.7 -		r0="$(cd /tmp/mnt$$/boot/ ; ls rootfs.gz 2> /dev/null)"
    12.8 -		r1="$(cd /tmp/mnt$$/boot/ ; ls -r rootfs?*.gz 2> /dev/null | sed q)"
    12.9 -		[ "$r0" -a "$r1" ] && r0="$r0,"
   12.10 -		echo -n "image=/boot/bzImage initrd=$r0$r1,! autologin rdinit=/init.exe" | \
   12.11 +		r="rootfs.gz"
   12.12 +		grep -qE 'rootfs[0-9]' /tmp/mnt$$/boot/isolinux/isolinux.cfg &&
   12.13 +		r="$(sed '/rootfs[0-9]/!d;s|.* initrd=||;s|/boot/||g;s| .*||' \
   12.14 +			/tmp/mnt$$/boot/isolinux/isolinux.cfg | tail -n1)"
   12.15 +		echo -n "image=/boot/bzImage initrd=$r,! autologin rdinit=/init.exe" | \
   12.16  		ddn bs=1 of=$1 conv=notrunc seek=$(($i-134))
   12.17  	fi
   12.18  	umount /tmp/mnt$$