wok rev 16069

syslinux/iso2exe: add a20 support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Mar 13 08:22:47 2014 +0000 (2014-03-13)
parents 00606601418e
children 6430769b32b3
files syslinux-tools/receipt syslinux/stuff/iso2exe/Makefile syslinux/stuff/iso2exe/a20.c syslinux/stuff/iso2exe/bootlinux.c udev/receipt
line diff
     1.1 --- a/syslinux-tools/receipt	Wed Mar 12 22:05:19 2014 +0100
     1.2 +++ b/syslinux-tools/receipt	Thu Mar 13 08:22:47 2014 +0000
     1.3 @@ -20,5 +20,6 @@
     1.4  	done
     1.5  	cp -a $src/iso2exe/isohybrid.exe $fs/usr/share/boot
     1.6  	cp -a $src/iso2exe/meminfo.exe $fs/usr/share/boot
     1.7 +	cp -a $src/iso2exe/tazboot.exe $fs/usr/share/boot
     1.8  	find $fs/usr -exec chown root.root {} \;
     1.9  }
     2.1 --- a/syslinux/stuff/iso2exe/Makefile	Wed Mar 12 22:05:19 2014 +0100
     2.2 +++ b/syslinux/stuff/iso2exe/Makefile	Thu Mar 13 08:22:47 2014 +0000
     2.3 @@ -2,7 +2,7 @@
     2.4  BCC=bcc -ansi -O -0 -C-t
     2.5  BCCFLAGS=-D__MSDOS__ -Md
     2.6  
     2.7 -all: isohybrid.exe iso2exe meminfo.exe
     2.8 +all: isohybrid.exe iso2exe meminfo.exe tazboot.exe
     2.9  
    2.10  meminfo.exe: meminfo.S
    2.11  	cc -o meminfo.o -Wa,-a=meminfo.lst -c meminfo.S
    2.12 @@ -30,6 +30,9 @@
    2.13  	./iso2exe.sh --exe mvcom.bin iso2exe.com iso2exe.exe > $@
    2.14  	chmod +x $@
    2.15  
    2.16 +tazboot.exe: boot.com
    2.17 +	com2exe $< > $@
    2.18 +
    2.19  OBJS = boot.o iso9660.o libdos.o bootlinux.o
    2.20  boot.com: $(OBJS)
    2.21  	$(BCC) $(BCCFLAGS) -o $@ $(OBJS) &&  upx --ultra-brute $@
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/syslinux/stuff/iso2exe/a20.c	Thu Mar 13 08:22:47 2014 +0000
     3.3 @@ -0,0 +1,142 @@
     3.4 +#ifndef __A20
     3.5 +#define __A20
     3.6 +
     3.7 +// http://www.win.tue.nl/~aeb/linux/kbd/A20.html
     3.8 +static void a20enable(void)
     3.9 +{
    3.10 +#asm
    3.11 +		call	a20test
    3.12 +
    3.13 +		in	al, 0x92	// fast A20
    3.14 +		test	al, #0x2
    3.15 +		jnz	no92
    3.16 +		or	al, #0x2	// Enable A20
    3.17 +		and	al, #0xFE	// Do not reset machine
    3.18 +		out	0x92, al
    3.19 +		call	a20test
    3.20 +no92:
    3.21 +		call	empty_8042
    3.22 +		mov	al, #0xD1	// command write
    3.23 +		out	0x64, al 
    3.24 +		call	empty_8042
    3.25 +		mov	al, #0xDF	// Enable A20
    3.26 +		out	0x60, al 
    3.27 +		call	empty_8042
    3.28 +
    3.29 +		mov	al, #0xFF	// Null command, but UHCI wants it
    3.30 +		out	0x64, al 
    3.31 +		call	empty_8042
    3.32 +		call	a20test
    3.33 +		
    3.34 +		mov	ax, #0x2401
    3.35 +		int	0x15
    3.36 +		call	a20test
    3.37 +		
    3.38 +		in	al, 0xEE	// fast enable A20
    3.39 +		jmp	a20test
    3.40 +
    3.41 +empty_8042:
    3.42 +		mov	ah, #-32
    3.43 +wait_8042:
    3.44 +		in	al, 0x64
    3.45 +		inc	ax		// FF 32x : no kbd
    3.46 +		jz	enabled
    3.47 +		dec	ax
    3.48 +		shr	ax, #1		// Bit 0: input data
    3.49 +		jc	data
    3.50 +		shr	ax, #1		// Bit 1: buffer empty
    3.51 +		jc	wait_8042
    3.52 +		ret
    3.53 +data:
    3.54 +		in	al, 0x60	// read data
    3.55 +		jmp	wait_8042
    3.56 +a20test:
    3.57 +		push	ds
    3.58 +		xor	cx, cx
    3.59 +		xor	bx, bx
    3.60 +		mov	ds, cx		// ds = 0000
    3.61 +		dec	cx
    3.62 +		mov	gs, cx		// gs = FFFF
    3.63 +		cli
    3.64 +a1:
    3.65 +		mov	ax, [bx]
    3.66 +		not	ax
    3.67 +		mov	dx, ax
    3.68 +		seg	gs
    3.69 +		xchg	dx, [bx+10]
    3.70 +		cmp	ax, [bx]
    3.71 +		seg	gs
    3.72 +		mov	[bx+10], dx
    3.73 +		loopne	a1
    3.74 +		pop	ds
    3.75 +		xchg	ax, cx
    3.76 +		sti
    3.77 +		jne	enabled
    3.78 +		pop	cx		// quit a20enable
    3.79 +enabled:
    3.80 +		ret			// ax != 0 : enabled
    3.81 +#endasm
    3.82 +}
    3.83 +
    3.84 +#define A20HOLDBUFFER	0x80000
    3.85 +static int a20buffer = 0;
    3.86 +static void movehia20(void)
    3.87 +{
    3.88 +	if ((mem.base - 0x100000UL) >= 0x10000UL) {
    3.89 +		movehi();
    3.90 +		return;
    3.91 +	}
    3.92 +	a20buffer = 1;
    3.93 +#asm
    3.94 +		pusha
    3.95 +		push	#A20HOLDBUFFER/16
    3.96 +		pop	es
    3.97 +		mov	di, _mem	// mem.base & 0xFFFF
    3.98 +		mov	si, #_buffer
    3.99 +		mov	cx, #BUFFERSZ/2
   3.100 +		cld
   3.101 +		rep
   3.102 +		  movsw
   3.103 +		popa
   3.104 +#endasm
   3.105 +}
   3.106 +#define movehi movehia20
   3.107 +
   3.108 +#define REALMODE_SWITCH _realmode_switch_a20
   3.109 +static void realmode_switch_a20(void)
   3.110 +{
   3.111 +	if (!a20buffer) return;
   3.112 +	a20enable();
   3.113 +#asm
   3.114 +		pusha
   3.115 +		xor	di, di		// 30
   3.116 +		mov	cx, #9		// 2E..1E
   3.117 +a20z1:
   3.118 +		push	di
   3.119 +		loop	a20z1
   3.120 +		push	#0x10
   3.121 +		push	di		// 1A 0x100000
   3.122 +		push	#-1		// 18
   3.123 +		push	di		// 16
   3.124 +		push	#A20HOLDBUFFER/0x10000
   3.125 +		push	di		// 12 A20HOLDBUFFER
   3.126 +		push	#-1		// 10
   3.127 +		mov	cl, #8		// 0E..00
   3.128 +a20z2:
   3.129 +		push	di
   3.130 +		loop	a20z2
   3.131 +		mov	ch, #0x10000/512
   3.132 +		push	ss
   3.133 +		pop	es
   3.134 +		mov	si, sp
   3.135 +		mov	ax, #0x8793
   3.136 +		mov	[si+0x15], al
   3.137 +		xchg	[si+0x1D], al
   3.138 +		xchg	[si+0x1F], al	// bits 24..31
   3.139 +		int	0x15
   3.140 +		add	sp, #0x30
   3.141 +		popa
   3.142 +#endasm
   3.143 +}
   3.144 +
   3.145 +#endif
     4.1 --- a/syslinux/stuff/iso2exe/bootlinux.c	Wed Mar 12 22:05:19 2014 +0100
     4.2 +++ b/syslinux/stuff/iso2exe/bootlinux.c	Thu Mar 13 08:22:47 2014 +0000
     4.3 @@ -19,8 +19,10 @@
     4.4  #define HEAPPTR		0x224
     4.5  #define CMDLINE		0x228
     4.6  
     4.7 +#define SYSTEM_SEGMENT	0x1000
     4.8  #define SETUP_SEGMENT	0x9000
     4.9  #define CMDLINE_OFFSET	0x9E00
    4.10 +#define SETUP_END	0x8200
    4.11  
    4.12  #define PAGE_BITS	12
    4.13  #define PAGE_SIZE	4096
    4.14 @@ -92,6 +94,7 @@
    4.15  
    4.16  #ifdef ZIMAGE_SUPPORT
    4.17  static unsigned zimage = 0;
    4.18 +#ifndef FULL_ZIMAGE 
    4.19  static unsigned getss(void)
    4.20  {
    4.21  #asm
    4.22 @@ -99,6 +102,7 @@
    4.23  #endasm
    4.24  }
    4.25  #endif
    4.26 +#endif
    4.27  
    4.28  static int versiondos;
    4.29  static int dosversion(void)
    4.30 @@ -122,15 +126,16 @@
    4.31  #endasm
    4.32  }
    4.33  
    4.34 +
    4.35 +#include "a20.c"
    4.36 +
    4.37  static void load(unsigned long size)
    4.38  {
    4.39  	if (vm86())
    4.40  		die("Need real mode");
    4.41  	switch (mem.align) {
    4.42  	case 0:	// kernel
    4.43 -		switch (dosversion()) {
    4.44 -		case 3: case 4: case 6: case 7: break;
    4.45 -		default:
    4.46 +		if ((unsigned) (dosversion() - 3) > 7 - 3) {
    4.47  			printf("DOS %d not supported.\nTrying anyway...\n",
    4.48  				versiondos);
    4.49  		}
    4.50 @@ -142,6 +147,9 @@
    4.51  		initrd_addr = mem.base;
    4.52  		mem.align = 4;
    4.53  	}
    4.54 +#ifdef ALLOCMEM
    4.55 +	ALLOCMEM(size);
    4.56 +#endif
    4.57  	while (size) {
    4.58  		int n, s = sizeof(buffer);
    4.59  		for (n = 0; n < s; n++) buffer[n] = 0;
    4.60 @@ -229,11 +237,17 @@
    4.61  			}
    4.62  			if (!setup_version || !(buffer[LOADFLAGS] & 1)) {
    4.63  #ifdef ZIMAGE_SUPPORT
    4.64 +#ifndef FULL_ZIMAGE 
    4.65  				zimage = getss() + 0x1000;
    4.66  				mem.base = zimage * 16L; 
    4.67  				if (mem.base + syssize > SETUP_SEGMENT*16L - 32)
    4.68  					die("Out of memory");
    4.69  #else
    4.70 +				zimage = 0x11;
    4.71 +				mem.base = 0x110000L;	// 1M + 64K HMA 
    4.72 +
    4.73 +#endif
    4.74 +#else
    4.75  				die("Not a bzImage format");
    4.76  #endif
    4.77  			}
    4.78 @@ -335,20 +349,30 @@
    4.79  	or	bx, bx
    4.80  	jz	notzimage
    4.81  		mov	eax, _mem
    4.82 +#ifndef FULL_ZIMAGE 
    4.83  		shr	eax, #4		// top
    4.84 -		mov	dx, #0x1000
    4.85 +		mov	dx, #SYSTEM_SEGMENT
    4.86 +#else
    4.87 +		dec	eax
    4.88 +		shr	eax, #16
    4.89 +		inc	ax
    4.90 +		mov	dx, #SYSTEM_SEGMENT/0x1000
    4.91 +#endif
    4.92  		push	cs
    4.93  		pop	ds
    4.94 -		mov	es, ax
    4.95 +		push	ss
    4.96 +		pop	es
    4.97  		push	es
    4.98  		mov	si, #sysmove
    4.99 -		xor	di, di
   4.100 +		mov	di, #SETUP_END
   4.101  		push	di
   4.102  		mov	cx, #endsysmove-sysmove
   4.103 +		cld
   4.104  		rep
   4.105  		  movsb
   4.106  		retf
   4.107  sysmove:
   4.108 +#ifndef FULL_ZIMAGE 
   4.109  		mov	ds, bx
   4.110  		mov	es, dx
   4.111  		xor	di, di
   4.112 @@ -358,8 +382,36 @@
   4.113  		  movsw
   4.114  		inc	bx
   4.115  		inc	dx
   4.116 -		cmp	ax,bx
   4.117 +		cmp	ax, bx
   4.118  		jne	sysmove
   4.119 +#else
   4.120 +		xchg	ax, cx
   4.121 +		mov	si, di
   4.122 +		push	es
   4.123 +		pop	ds
   4.124 +		push	cx
   4.125 +		mov	cx, #0x18
   4.126 +		rep
   4.127 +		  stosw
   4.128 +		dec	cx
   4.129 +		mov	[si+0x10], cx
   4.130 +		mov	[si+0x18], cx
   4.131 +		pop	cx
   4.132 +		mov	bh, #0x93
   4.133 +		mov	dh, #0x93
   4.134 +mvdown:
   4.135 +		mov	[si+0x12+2], bx	// srce
   4.136 +		mov	[si+0x1A+2], dx	// dest
   4.137 +		pusha
   4.138 +		mov	cx, #0x8000
   4.139 +		mov	ah, #0x87
   4.140 +		int	0x15	// catched by himem.sys: may need dos=high,umb
   4.141 +		popa
   4.142 +		inc	bx
   4.143 +		inc	dx
   4.144 +		cmp	cl, bl
   4.145 +		jne	mvdown
   4.146 +#endif
   4.147  notzimage:
   4.148  #endasm
   4.149  #endif
     5.1 --- a/udev/receipt	Wed Mar 12 22:05:19 2014 +0100
     5.2 +++ b/udev/receipt	Thu Mar 13 08:22:47 2014 +0000
     5.3 @@ -18,7 +18,9 @@
     5.4  libgudev-dev pcre-dev liblzma-dev util-linux-uuid-dev"
     5.5  
     5.6  # Use build host: gperf
     5.7 -BUILD_DEPENDS="util-linux-blkid-dev kmod-dev acl-dev glib-dev"
     5.8 +case "$ARCH" in
     5.9 +	arm*) BUILD_DEPENDS="util-linux-blkid-dev kmod-dev acl-dev glib-dev"
    5.10 +esac
    5.11  
    5.12  # Rules to configure and make the package.
    5.13  compile_rules()