wok-current rev 20534

Add util-linux-losetup
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Nov 26 09:46:23 2018 +0100 (2018-11-26)
parents 21eeda2ce014
children a8e996b473e0
files linld/stuff/src/CRTL.ASM linld/stuff/src/ISO9660.CPP linld/stuff/src/ISO9660.H linld/stuff/src/JUMP.ASM linld/stuff/src/LOAD.CPP linld/stuff/src/MEMCPY32.ASM linld/stuff/src/TAZBOOT.CPP linld/stuff/src/VCPI.ASM linld/stuff/src/pipehole.awk util-linux-losetup/description.txt util-linux-losetup/receipt
line diff
     1.1 --- a/linld/stuff/src/CRTL.ASM	Wed Nov 21 17:11:16 2018 +0100
     1.2 +++ b/linld/stuff/src/CRTL.ASM	Mon Nov 26 09:46:23 2018 +0100
     1.3 @@ -330,20 +330,22 @@
     1.4          endp    @lseekset$qiul
     1.5  
     1.6  		ifdef	EXTRA
     1.7 -struc		isostate	; struct isostate {
     1.8 -fd		dw	?	; 0	int fd;
     1.9 -fileofs		dd	?	; 2	unsigned long fileofs;
    1.10 -filesize	dd	?	; 6	unsigned long filesize;
    1.11 -filemod		dw	?	;10	unsigned short filemod;
    1.12 -filename	dw	?	;12	char *filename;
    1.13 -dirofs		dd	?	;14	unsigned long dirofs;
    1.14 -dirsize		dd	?	;16	unsigned long dirsize;
    1.15 -curdirofs	dd	?	;20	unsigned long curdirofs;
    1.16 -curdirsize	dd	?	;24	unsigned long curdirsize;
    1.17 -curpos		dd	?	;28	unsigned long curpos;
    1.18 -ends				; } isostate;
    1.19 +;typedef unsigned dirsizetype;
    1.20 +struc		isostate		; struct isostate {
    1.21 +fd		dw	?		; 0	int fd;
    1.22 +filemod		dw	?		; 2	unsigned short filemod;
    1.23 +fileofs		dd	?		; 4	unsigned long fileofs;
    1.24 +filesize	dd	?		; 8	unsigned long filesize;
    1.25 +filename	dw	?		;12	char *filename;
    1.26 +curdirsize	dw	?		;14	dirsizetype curdirsize;
    1.27 +dirsize		dw	?		;16	dirsizetype dirsize;
    1.28 +curdirofs	dd	?		;18	unsigned long curdirofs;
    1.29 +dirofs		dd	?		;22	unsigned long dirofs;
    1.30 +curpos		dw	?		;26	unsigned curpos;
    1.31 +buffer		db	2560	dup(?)	;28	char buffer[2048+512];
    1.32 +ends					; } isostate;
    1.33  ;***************************************************************
    1.34 -;pascal int isolseek(const unsigned long *offset);
    1.35 +;pascal long isolseek(const unsigned long *offset);
    1.36  ;***************************************************************
    1.37          global  @isolseek$qpxul:near
    1.38          proc    @isolseek$qpxul near
    1.39 @@ -351,16 +353,40 @@
    1.40  		pop	ax
    1.41  		pop	bx
    1.42  		push	ax
    1.43 +isolseek:
    1.44  		mov	dx,[bx]
    1.45  		mov	cx,[bx+2]
    1.46  		extrn	_isostate:isostate
    1.47  		mov	bx,[_isostate.fd]
    1.48 -		call	lseekset		; (bx=fd, sz=cx:dx)
    1.49 +		jmp	lseekset		; (bx=fd, sz=cx:dx)
    1.50 +		
    1.51 +        endp    @isolseek$qpxul
    1.52 +
    1.53 +
    1.54 +;***************************************************************
    1.55 +;pascal int isoreadsector(const unsigned long *offset);
    1.56 +;***************************************************************
    1.57 +        global  @isoreadsector$qpxul:near
    1.58 +        proc    @isoreadsector$qpxul near
    1.59 +
    1.60 +		pop	ax
    1.61 +		pop	bx
    1.62 +		push	ax
    1.63 +		call	isolseek
    1.64  		and	ax,dx
    1.65  		inc	ax
    1.66 +		jz	@@fail
    1.67 +		mov	cx,2560
    1.68 +		mov	dx,offset _isostate.buffer
    1.69 +		mov	bx,[_isostate.fd]
    1.70 +		call	@read$cxdxbx		; read(fd,buffer,2560)
    1.71 +@@fail:
    1.72 +		cmp	ax,2048
    1.73 +		sbb	ax,ax
    1.74  		ret
    1.75 -		
    1.76 -        endp    @isolseek$qpxul
    1.77 +
    1.78 +        endp    @isoreadsector$qpxul
    1.79 +
    1.80  		endif
    1.81  
    1.82  
    1.83 @@ -852,9 +878,14 @@
    1.84  		push	cx
    1.85                  push	di
    1.86  		xchg	ax,di
    1.87 -		mov	[(image_himem di).next_chunk],offset next_chunk
    1.88                  mov	[(image_himem di).state],bx
    1.89  		push	bx
    1.90 +		ifdef	EXTRA
    1.91 +		xor	ax,ax
    1.92 +		or	ax,[(image_himem di).next_chunk]
    1.93 +		jne	@@next
    1.94 +		endif
    1.95 +		mov	[(image_himem di).next_chunk],offset next_chunk
    1.96  @@next:
    1.97                  call	[(image_himem di).next_chunk]	; m->next_chunk()
    1.98  		ifndef	NO386
     2.1 --- a/linld/stuff/src/ISO9660.CPP	Wed Nov 21 17:11:16 2018 +0100
     2.2 +++ b/linld/stuff/src/ISO9660.CPP	Mon Nov 26 09:46:23 2018 +0100
     2.3 @@ -3,17 +3,8 @@
     2.4  #include "iso9660.h"
     2.5  #define __ROCKRIDGE
     2.6  
     2.7 -#define SECTORSZ 2048
     2.8 -#define SECTORBITS 11
     2.9 -static char buffer[SECTORSZ+512];	// RR overflow
    2.10  struct isostate isostate;
    2.11  
    2.12 -static int readsector(const unsigned long *offset)
    2.13 -{
    2.14 -	return (isolseek(offset) != 0
    2.15 -		    && read(isostate.fd, buffer, sizeof(buffer)) >= SECTORSZ);
    2.16 -}
    2.17 -
    2.18  int isoreset(char *name)
    2.19  {
    2.20  	static const unsigned long root = 16UL * 2048;
    2.21 @@ -21,12 +12,12 @@
    2.22  	if (name)
    2.23  		//x->fd = open(name, O_RDONLY);
    2.24  		x->fd = open(name);
    2.25 -	if (!readsector(&root) || strhead(buffer+1,"CD001")) {
    2.26 +	if (isoreadsector(&root) < 0 || strhead(x->buffer+1,"CD001")) {
    2.27  		//close(x->fd);
    2.28  		return -1;
    2.29  	}
    2.30 -	x->dirofs = (* (unsigned long *) (buffer + 0x9E)) << SECTORBITS;
    2.31 -	x->dirsize = filesize2dirsize(* (unsigned long *) (buffer + 0xA6));
    2.32 +	x->dirofs = (* (unsigned long *) (x->buffer + 0x9E)) << SECTORBITS;
    2.33 +	x->dirsize = filesize2dirsize(* (unsigned long *) (x->buffer + 0xA6));
    2.34  	return 0;
    2.35  }
    2.36  
    2.37 @@ -44,16 +35,16 @@
    2.38  		x->curdirofs = x->dirofs;
    2.39  		goto restarted;
    2.40  	}
    2.41 -	if (x->curpos >= SECTORSZ || * (short *) (buffer + x->curpos) == 0) {
    2.42 +	if (x->curpos >= SECTORSZ || * (short *) (x->buffer + x->curpos) == 0) {
    2.43  		if (x->curdirsize < DIRSECTORSZ) return -1;
    2.44  	restarted:
    2.45 -		readsector(&x->curdirofs);
    2.46 +		isoreadsector(&x->curdirofs);
    2.47  		//x->curdirofs += SECTORSZ;
    2.48  		*(int *)((char *) &x->curdirofs+1) += SECTORSZ/256;
    2.49  		x->curdirsize -= DIRSECTORSZ;
    2.50  		x->curpos = 0;
    2.51  	}
    2.52 -	p = buffer + x->curpos;
    2.53 +	p = x->buffer; p += x->curpos;
    2.54  	if ((size = * (short *) p) == 0)
    2.55  		return -1;
    2.56  	x->fileofs = (* (unsigned long *) (p + 2)) << SECTORBITS;
    2.57 @@ -63,7 +54,7 @@
    2.58  #ifdef __ROCKRIDGE
    2.59  	endname = NULL;
    2.60  	// p += 34 + (p[32] & -2); ?
    2.61 -	p = buffer + 34 + ((p[32] + x->curpos) & -2);
    2.62 +	p = x->buffer + 34 + ((p[32] + x->curpos) & -2);
    2.63  	do {
    2.64  		int len = p[2];
    2.65  		switch (* (short *) p) {
    2.66 @@ -76,13 +67,13 @@
    2.67  			break;
    2.68  		}
    2.69  		p += len;
    2.70 -	} while (buffer + x->curpos + size - p > 2);
    2.71 +	} while (x->buffer + x->curpos + size - p > 2);
    2.72  	if (endname)
    2.73  		*endname = 0;
    2.74  	else
    2.75  #endif
    2.76  	{
    2.77 -		p = x->filename = buffer + x->curpos + 33;
    2.78 +		p = x->buffer + 33; x->filename = p += x->curpos;
    2.79  		p--;
    2.80  		if (((* (short *) p) & 0xFEFF) -1 == 0) {
    2.81  			x->filename = "..";
     3.1 --- a/linld/stuff/src/ISO9660.H	Wed Nov 21 17:11:16 2018 +0100
     3.2 +++ b/linld/stuff/src/ISO9660.H	Mon Nov 26 09:46:23 2018 +0100
     3.3 @@ -16,13 +16,17 @@
     3.4  	dirsizetype curdirsize, dirsize;
     3.5  	unsigned long curdirofs, dirofs;
     3.6  	unsigned curpos;
     3.7 +#define SECTORSZ 2048
     3.8 +#define SECTORBITS 11
     3.9 +	char buffer[SECTORSZ+512];	// RR overflow
    3.10  } isostate;
    3.11  #define isofd isostate.fd
    3.12  #define	isofileofs isostate.fileofs
    3.13  #define	isofilesize isostate.filesize
    3.14  #define	isofilemod isostate.filemod
    3.15  #define	isofilename isostate.filename
    3.16 -extern pascal int isolseek(const unsigned long *offset);
    3.17 +extern pascal long isolseek(const unsigned long *offset);
    3.18 +extern pascal int isoreadsector(const unsigned long *offset);
    3.19  extern int isoreset(char *name);
    3.20  extern int isoopen(const char *name);
    3.21  extern int isoreaddir(int restart);
     4.1 --- a/linld/stuff/src/JUMP.ASM	Wed Nov 21 17:11:16 2018 +0100
     4.2 +++ b/linld/stuff/src/JUMP.ASM	Mon Nov 26 09:46:23 2018 +0100
     4.3 @@ -162,7 +162,8 @@
     4.4  		;cld
     4.5  		pop	es			; min 2048 bytes for stack
     4.6  		jne	@@isbzimage
     4.7 -		mov	cx,offset movedend
     4.8 +		extrn	gdt_data
     4.9 +		mov	cx,offset gdt_data+8
    4.10  		xor	si,si			;  A000 -9000 -0800(>movedend)
    4.11  		rep
    4.12  		  movsb
     5.1 --- a/linld/stuff/src/LOAD.CPP	Wed Nov 21 17:11:16 2018 +0100
     5.2 +++ b/linld/stuff/src/LOAD.CPP	Mon Nov 26 09:46:23 2018 +0100
     5.3 @@ -152,7 +152,7 @@
     5.4      if(kernelparams->setup_sects == 0) {
     5.5  #if 1
     5.6          if(* (int *) &first1k->pad10[0x3F-0x24] == 0x3AE8) {
     5.7 -            lseekset(pm.fd,rm_seek=0x200);
     5.8 +            lseekset(m->fd,rm_seek=0x200);
     5.9              csip+=0xFFE00042;
    5.10          }
    5.11          else
     6.1 --- a/linld/stuff/src/MEMCPY32.ASM	Wed Nov 21 17:11:16 2018 +0100
     6.2 +++ b/linld/stuff/src/MEMCPY32.ASM	Mon Nov 26 09:46:23 2018 +0100
     6.3 @@ -46,7 +46,7 @@
     6.4  		;cld
     6.5                  pushf
     6.6                  push    ds es
     6.7 -                pushad
     6.8 +		pushad				; struct declared in VCPI.ASM
     6.9  		mov	cl,4
    6.10                  movzx   esi,[srcseg]
    6.11                  shl     esi,cl
    6.12 @@ -73,6 +73,9 @@
    6.13  		and	di,cx
    6.14  		inc	cx
    6.15                  sub     [sz],ecx
    6.16 +		jae	@@movpara
    6.17 +		add	ecx,[sz]
    6.18 +@@movpara:
    6.19              rep movsb
    6.20                  ja	@@movlp
    6.21  		jmp	@@done
    6.22 @@ -135,7 +138,7 @@
    6.23  		pop	si
    6.24  		js	@@done16
    6.25                  p386
    6.26 -                pushad
    6.27 +		pushad				; struct declared in VCPI.ASM
    6.28                  mov     esi,[srcofs]
    6.29                  mov     edi,[dstofs]
    6.30  
    6.31 @@ -149,11 +152,8 @@
    6.32  		jz	@@real_mode
    6.33  ; Note: bp points to std stack frame now. bp will be passed to
    6.34  ; pm routine. This allows params to be passed on stack
    6.35 -		extrn	do_memcpy_vcpi:near
    6.36 -                push    offset do_memcpy_vcpi
    6.37 -		extrn	call_pm_routine:near
    6.38 -                call    near call_pm_routine ; Call pm copy routine via vcpi pm
    6.39 -                pop     ax
    6.40 +		extrn	vcpi_pm_copy_routine:near
    6.41 +                call    near vcpi_pm_copy_routine ; Call pm copy routine via vcpi pm
    6.42  		jmp	@@done
    6.43  @@real_mode:
    6.44                  cmp     esi,edi
    6.45 @@ -204,7 +204,7 @@
    6.46                  p8086
    6.47  @@done16:
    6.48                  pop     es ds
    6.49 -                popf
    6.50 +		popf			; restore I & D
    6.51  			ifndef	NO386
    6.52                  p386
    6.53  		leave
     7.1 --- a/linld/stuff/src/TAZBOOT.CPP	Wed Nov 21 17:11:16 2018 +0100
     7.2 +++ b/linld/stuff/src/TAZBOOT.CPP	Mon Nov 26 09:46:23 2018 +0100
     7.3 @@ -101,7 +101,7 @@
     7.4  		c = x->filename[6];
     7.5  	}
     7.6  
     7.7 -	strcatb(buf_cmdline," rw root=/dev/null autologin bootfrom=");
     7.8 +	strcatb(buf_cmdline,"rw root=/dev/null autologin bootfrom=");
     7.9  	strcat(buf_cmdline,*iso);
    7.10  	if (magic < 0x20630)
    7.11  		init = ""; // Does not support multiple initramfs
    7.12 @@ -133,9 +133,7 @@
    7.13  			read(x->fd, &x->filemod, 10); // + x->fileofs & x->filesize
    7.14  			magic = x->filemod;
    7.15  			x->fileofs &= 0xFFFFL;
    7.16 -			//x->fileofs -= 0xC0L + (x->filesize &= 0xFFFF);
    7.17 -			* ((short *) &x->filesize + 1) = 0;
    7.18 -			x->fileofs -= 0xC0L + x->filesize;
    7.19 +			x->fileofs -= 0xC0L + (x->filesize &= 0xFFFF);
    7.20  			if (((short *) &x->fileofs)[1] == 0) addinitrd();
    7.21  			else init="";
    7.22  		}
     8.1 --- a/linld/stuff/src/VCPI.ASM	Wed Nov 21 17:11:16 2018 +0100
     8.2 +++ b/linld/stuff/src/VCPI.ASM	Mon Nov 26 09:46:23 2018 +0100
     8.3 @@ -72,10 +72,16 @@
     8.4  endm
     8.5  
     8.6  
     8.7 -        group   DGROUP  _TEXT,_DATA,_BSS
     8.8 +        group   DGROUP  _TEXT,_BSS
     8.9          assume  cs:DGROUP,ds:DGROUP
    8.10  
    8.11 -        segment _DATA byte public use16 'DATA'
    8.12 +        segment _BSS byte public use16 'BSS'
    8.13 +
    8.14 +tss             dd      ?,?     ;enough, we'll never use it anyway
    8.15 +
    8.16 +        ends    _BSS
    8.17 +
    8.18 +        segment _TEXT byte public use16 'CODE'
    8.19  
    8.20  label   gdt     byte
    8.21  gdt_null        descr   <?>     ;0000
    8.22 @@ -86,6 +92,7 @@
    8.23  ;Note: code/data segs must be flagged use16 (i.e. use ip/sp, not eip/esp)
    8.24  ;Note: base addrs will be fixed up in prepare_vcpi()
    8.25  descriptor      gdt_code,(code_seg+readable),priv0,is_present,0fffffh,(gran_page+use_16),0
    8.26 +	global	gdt_data
    8.27  descriptor      gdt_data,(data_seg+writable),priv0,is_present,0fffffh,(gran_page+use_16),0
    8.28  descriptor      gdt_tss ,tss386_avail       ,priv0,is_present,0ffh   ,gran_byte         ,<offset tss>
    8.29  SEL_VCPI        = (gdt_vcpi - gdt_null)
    8.30 @@ -117,15 +124,6 @@
    8.31  idt_lim         dw      03ffh   ;we won't enable ints,
    8.32  idt_base        dd      0       ;  so let's leave it the same as for rm
    8.33  
    8.34 -        ends    _DATA
    8.35 -
    8.36 -        segment _BSS byte public use16 'BSS'
    8.37 -
    8.38 -tss             dd      ?,?     ;enough, we'll never use it anyway
    8.39 -
    8.40 -        ends    _BSS
    8.41 -
    8.42 -        segment _TEXT byte public use16 'CODE'
    8.43  
    8.44  ;***************************************************************
    8.45  ;char* prepare_vcpi(void *pagebuf);
    8.46 @@ -229,8 +227,8 @@
    8.47  ;****** Copies PAGE_SIZE bytes
    8.48  ;****** Uses:   Flags
    8.49  ;***************************************************************
    8.50 -        global  call_pm_routine:near
    8.51 -        proc    call_pm_routine near
    8.52 +        global  vcpi_pm_copy_routine:near
    8.53 +        proc    vcpi_pm_copy_routine near
    8.54  
    8.55                arg     dstofs  :dword, \
    8.56                        srcseg  :word,  \
    8.57 @@ -238,7 +236,6 @@
    8.58  
    8.59  struc   pm_regs
    8.60  $$retaddr       dw      ?
    8.61 -$$f             dw      ?
    8.62  $$edi           dd      ?
    8.63  $$esi           dd      ?
    8.64  $$ebp           dd      ?
    8.65 @@ -284,16 +281,15 @@
    8.66                  lea     sp,[bp-9*4]     ;else we can do this trick with bp
    8.67  
    8.68  ; Call the routine (bp points to params on stack if any)
    8.69 -                mov     ax,[(pm_regs bp).$$f]   ; ss:bp => struct pm_regs
    8.70                  mov     bp,[word (pm_regs bp).$$ebp]    ;ss:bp => params
    8.71 -                call    ax
    8.72 +                call    do_memcpy_vcpi
    8.73  
    8.74  ; Ok, let's return to vm
    8.75                  mov     ax,0DE0Ch       ; maybe we need whole eax?
    8.76                  cli     ; to be safe
    8.77                  clts    ;
    8.78 -                push    SEL_ABS         ; vcpi wants ds=all_addrspace
    8.79 -                pop     ds              ;
    8.80 +              ;;push    SEL_ABS         ; vcpi wants ds=all_addrspace
    8.81 +              ;;pop     ds              ;
    8.82                  call    [pword cs:vcpi_pm_entry]
    8.83  @@vm_ret:
    8.84  ; Now we are in vm86 mode. Sregs, esp, eflags (IF) restored from IRET stack
    8.85 @@ -320,7 +316,7 @@
    8.86  
    8.87  ; Note: ss:bp => params
    8.88  ; Move data
    8.89 -                mov     ax,SEL_ABS
    8.90 +                mov     al,SEL_ABS
    8.91                  mov     ds,ax
    8.92                  mov     es,ax
    8.93                  assume  nothing
    8.94 @@ -365,8 +361,8 @@
    8.95  vcpi_ret:
    8.96                  ret
    8.97  
    8.98 -        endp    call_pm_routine
    8.99 -                assume  cs:DGROUP,ds:DGROUP
   8.100 +        endp    vcpi_pm_copy_routine
   8.101 +               assume  cs:DGROUP,ds:DGROUP
   8.102  
   8.103  
   8.104  ;***************************************************************
     9.1 --- a/linld/stuff/src/pipehole.awk	Wed Nov 21 17:11:16 2018 +0100
     9.2 +++ b/linld/stuff/src/pipehole.awk	Mon Nov 26 09:46:23 2018 +0100
     9.3 @@ -3,7 +3,7 @@
     9.4  {
     9.5  	if (hold == 0) {
     9.6  		s=$0
     9.7 -		if (/^	mov	.x,bx$/ || /^	mov	.x,.i$/) {
     9.8 +		if (/^	mov	.[ix],bx$/ || /^	mov	.[ix],.i$/) {
     9.9  			r=$2
    9.10  			hold=1; split($2,regs,","); next
    9.11  		}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/util-linux-losetup/description.txt	Mon Nov 26 09:46:23 2018 +0100
    10.3 @@ -0,0 +1,1 @@
    10.4 +  * `losetup` - configure loop/cloop device
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/util-linux-losetup/receipt	Mon Nov 26 09:46:23 2018 +0100
    11.3 @@ -0,0 +1,26 @@
    11.4 +# SliTaz package receipt.
    11.5 +
    11.6 +PACKAGE="util-linux-losetup"
    11.7 +VERSION="2.28"
    11.8 +CATEGORY="base-system"
    11.9 +SHORT_DESC="The losetup utility from Util Linux"
   11.10 +MAINTAINER="pankso@slitaz.org"
   11.11 +LICENSE="GPL2"
   11.12 +WEB_SITE="https://en.wikipedia.org/wiki/Util-linux"
   11.13 +HOST_ARCH="i486 arm"
   11.14 +
   11.15 +WANTED="util-linux"
   11.16 +DEPENDS="glibc-base"
   11.17 +SUGGESTED="util-linux-mount linux-cloop"
   11.18 +
   11.19 +# Rules to gen a SliTaz package suitable for Tazpkg.
   11.20 +genpkg_rules()
   11.21 +{
   11.22 +	cook_copy_files losetup
   11.23 +	rm -r $fs/usr/share
   11.24 +}
   11.25 +
   11.26 +post_remove()
   11.27 +{
   11.28 +	ln -s /bin/busybox "$1/sbin/losetup"
   11.29 +}