wok-current rev 23811

linld/isoboot: canonicalize filename
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon May 25 16:38:34 2020 +0000 (2020-05-25)
parents d33c3c211ef8
children ec56ab0f8e5b
files linld/stuff/src/_ISOBEG.ASM syslinux/stuff/iso2exe/init syslinux/stuff/iso2exe/taziso
line diff
     1.1 --- a/linld/stuff/src/_ISOBEG.ASM	Mon May 25 10:10:30 2020 +0000
     1.2 +++ b/linld/stuff/src/_ISOBEG.ASM	Mon May 25 16:38:34 2020 +0000
     1.3 @@ -60,36 +60,25 @@
     1.4  ; build arg
     1.5  ;***************************************************************
     1.6  
     1.7 -		mov	bx,endbzimage-bzimage
     1.8  		mov	si,80h
     1.9 -		mov	di,si
    1.10  		lodsb
    1.11 -		add	[di],bl
    1.12  		cbw
    1.13 -		mov	bp,-1
    1.14 -skipspace:
    1.15 -		inc	bp
    1.16 -		cmp	[byte bp+si]," "
    1.17 -		je	skipspace
    1.18 -		xchg	ax,cx
    1.19 -		add	si,cx
    1.20 +		xchg	ax,bx
    1.21 +		mov	[bx+si],bh		; set EOS
    1.22 +searchStart:
    1.23 +		lodsb
    1.24 +		cmp	al,0
    1.25 +		je	_abort
    1.26 +		cmp	al,' '
    1.27 +		je	searchStart
    1.28  		dec	si
    1.29 -		lea	di,[bx+si]
    1.30 -		mov	[di+1],bh
    1.31 -		sub	cx,bp
    1.32 -		std
    1.33 -		rep
    1.34 -		  movsb
    1.35 +		mov	di,offset filename
    1.36  		push	di
    1.37 -		mov	si,offset endbzimage-1
    1.38 -		mov	cl,bl
    1.39 -		rep
    1.40 -		  movsb
    1.41 +		mov	ah,60h			; canonicalize filename
    1.42 +                int	21h
    1.43 +		jc	_abort
    1.44 +	ifdef	WITH_LONG_FILENAME
    1.45  		pop	si
    1.46 -		inc	si
    1.47 -		cld
    1.48 -
    1.49 -	ifdef	LONG_FILENAME
    1.50  		mov	ax,716Ch
    1.51  		xor	bx,bx			; R/O
    1.52  		;xor	cx,cx			; attributes
    1.53 @@ -97,10 +86,12 @@
    1.54  		stc
    1.55                  int	21h
    1.56                  jnc	opened
    1.57 +                mov	dx,si
    1.58 +	else
    1.59 +		pop	dx
    1.60  	endif
    1.61                  mov	ax,3d00h		; read-only+compatibility
    1.62  		;mov	cl,0			; attribute mask
    1.63 -                mov	dx,si
    1.64                  int	21h
    1.65                  jnc	opened
    1.66  
    1.67 @@ -117,9 +108,9 @@
    1.68  jc_abort:
    1.69  		jc	_abort
    1.70  
    1.71 +; patch magic
    1.72  ;***************************************************************
    1.73  
    1.74 -; patch magic
    1.75  		extrn	@readmenu$qv:near
    1.76  		call	@readmenu$qv
    1.77  		mov	ax,[_isostate.filemod]
    1.78 @@ -134,7 +125,7 @@
    1.79  		jnz	@@loop1
    1.80  		push	ds
    1.81  		pop	es
    1.82 -		lea	di,[bp+magic-bzimage+81h]
    1.83 +		mov	di,offset magic
    1.84  @@loop2:
    1.85  		pop	ax
    1.86  		add	al,'0'
    1.87 @@ -142,6 +133,7 @@
    1.88  		loop	@@loop2
    1.89  
    1.90  ; patch initrd
    1.91 +;***************************************************************
    1.92  		cwd
    1.93  		or	[_isostate.curdirsize],-1
    1.94  		jmp	patchtest
    1.95 @@ -158,7 +150,7 @@
    1.96  		jne	patchlp
    1.97  		cmp	dx,100h
    1.98  		je	initrddone
    1.99 -		lea	di,[bp+rootfs-bzimage+87h]
   1.100 +		mov	di,offset dotgz
   1.101  		or	dh,dh
   1.102  		je	modify
   1.103  		add	di,4
   1.104 @@ -168,14 +160,32 @@
   1.105  		  movsw
   1.106  modify:
   1.107  		xchg	ax,dx
   1.108 +		mov	ah,'.'
   1.109 +		stosw
   1.110 +		mov	ax,'zg'
   1.111 +		stosw
   1.112 +		mov	ax,'!,'
   1.113 +		stosw
   1.114 +initrddone:
   1.115 +
   1.116 +;***************************************************************
   1.117 +
   1.118 +		mov	si, offset cmdline
   1.119 +		mov	di, 82h
   1.120 +copy:
   1.121 +		mov	ah,al
   1.122 +		lodsb
   1.123 +		cmp	al,' '
   1.124 +		jne	docopy
   1.125 +		cmp	al,ah
   1.126 +		je	copy
   1.127 +docopy:
   1.128  		stosb
   1.129 -		mov	si,offset dotgz
   1.130 -		mov	cl,5
   1.131 -		rep
   1.132 -		  movsb
   1.133 -initrddone:
   1.134 -		
   1.135 -;***************************************************************
   1.136 +		cmp	al,0
   1.137 +		jnz	copy
   1.138 +		xchg	di,ax
   1.139 +		sub	al, 82h
   1.140 +		mov	[80h],al
   1.141  
   1.142  		mov	ax,offset linld
   1.143  		call	iso_open
   1.144 @@ -183,6 +193,7 @@
   1.145  		mov	cx,[word _isostate.filesize]
   1.146  		mov	dx,100h
   1.147  		jmp	near unfold
   1.148 +
   1.149  patchlp:
   1.150  		mov	si,[_isostate.filename]
   1.151  		mov	di,offset rootfs
   1.152 @@ -204,9 +215,10 @@
   1.153  		db	"/boot",0
   1.154  linld:
   1.155  		db	"linld.com",0
   1.156 -bzimage:
   1.157 +cmdline:
   1.158  		db	"-f "
   1.159 -		;db	"image=boot\bzImage "
   1.160 +		;db	"image=boot\"
   1.161 +		;db	"bzImage "
   1.162  		db	"initrd="
   1.163  rootfs:
   1.164  		db	"rootfs"
   1.165 @@ -218,7 +230,7 @@
   1.166  magic:
   1.167  		db	"0     bootfrom="
   1.168  		;	"65535 bootfrom="
   1.169 -endbzimage:
   1.170 +filename:
   1.171  
   1.172  
   1.173  ;***************************************************************
     2.1 --- a/syslinux/stuff/iso2exe/init	Mon May 25 10:10:30 2020 +0000
     2.2 +++ b/syslinux/stuff/iso2exe/init	Mon May 25 16:38:34 2020 +0000
     2.3 @@ -134,7 +134,7 @@
     2.4  	uudecode - >> $1 << EOT
     2.5  HEADERCODE
     2.6  EOT
     2.7 -	ddq if=/mnt/slitaz/boot/linld.com >> $1
     2.8 +	ddq if=/media/slitaz/boot/linld.com >> $1
     2.9  }
    2.10  
    2.11  checkmagic()
     3.1 --- a/syslinux/stuff/iso2exe/taziso	Mon May 25 10:10:30 2020 +0000
     3.2 +++ b/syslinux/stuff/iso2exe/taziso	Mon May 25 16:38:34 2020 +0000
     3.3 @@ -40,7 +40,7 @@
     3.4  	uudecode - >> $1 << EOT
     3.5  HEADERCODE
     3.6  EOT
     3.7 -	ddq if=/mnt/slitaz/boot/linld.com >> $1
     3.8 +	ddq if=$media/boot/linld.com >> $1
     3.9  }
    3.10  
    3.11  uncpio()