wok-stable diff gpxe/stuff/prefix.u @ rev 7674

Fixed linux. Need to make folder PWD/_pkg before adding bzImage to it. Also i'm force copying kernel config file now so we have the right config. It is copyed twice so its needed and doesn't hunt anything i think.
author Christopher Rogers <slaxemulator@gmail.com>
date Thu Dec 16 17:16:06 2010 +0000 (2010-12-16)
parents a9ff8c135e36
children
line diff
     1.1 --- a/gpxe/stuff/prefix.u	Fri Jun 27 20:38:59 2008 +0000
     1.2 +++ b/gpxe/stuff/prefix.u	Thu Dec 16 17:16:06 2010 +0000
     1.3 @@ -1,6 +1,14 @@
     1.4  --- gpxe-0.9.3/src/arch/i386/prefix/lkrnprefix.S
     1.5  +++ gpxe-0.9.3/src/arch/i386/prefix/lkrnprefix.S
     1.6 -@@ -50,40 +50,343 @@
     1.7 +@@ -3,6 +3,7 @@
     1.8 + 
     1.9 + 	Authors: Gary Byers (gb@thinguin.org)
    1.10 + 		 Marty Connor (mdc@thinguin.org)
    1.11 ++		 Pascal Bellard (pascal.bellard@slitaz.org)
    1.12 + 
    1.13 + 	This software may be used and distributed according to the terms
    1.14 + 	of the GNU Public License (GPL), incorporated herein by reference.
    1.15 +@@ -50,40 +51,351 @@
    1.16   	.arch i386
    1.17   	.org	0
    1.18   	.section ".prefix", "ax", @progbits
    1.19 @@ -37,7 +45,8 @@
    1.20  +	/* Calculate segment address of image start */
    1.21  +	pushw	%cs
    1.22  +	popw	%ax
    1.23 -+	addw	$(0x100/16), %ax
    1.24 ++	addw	$(0x100/16), %ax	/* Adjust cs */
    1.25 ++	pushw	%ax
    1.26  +	jmp	go_setup_code
    1.27  +
    1.28  +bootsector:
    1.29 @@ -70,10 +79,7 @@
    1.30  + *
    1.31  + * Segments are as follows: ds=es=ss=cs - BOOTSEG
    1.32  + */
    1.33 - 
    1.34 --	movw	$0x0007, %bx		/* page 0, attribute 7 (normal) */
    1.35 --	movb	$0x0e, %ah		/* write char, tty mode */
    1.36 --prloop: 
    1.37 ++
    1.38  +	xorw	%cx,%cx
    1.39  +	movw	%cx,%es			/* access segment 0 */
    1.40  +	movw	$0x78, %bx		/* 0:bx is parameter table address */
    1.41 @@ -113,7 +119,10 @@
    1.42  + * 36 sectors if sector 36 can be read, 18 sectors if sector 18 can be read,
    1.43  + * 15 if sector 15 can be read.	Otherwise guess 9.
    1.44  + */
    1.45 -+
    1.46 + 
    1.47 +-	movw	$0x0007, %bx		/* page 0, attribute 7 (normal) */
    1.48 +-	movb	$0x0e, %ah		/* write char, tty mode */
    1.49 +-prloop: 
    1.50  +	movw	$disksizes, %si		/* table of sizes to try */
    1.51  +
    1.52  +probe_loop: 
    1.53 @@ -137,7 +146,6 @@
    1.54  +
    1.55  +/* ok, we've written the Loading... message, now we want to load the system */
    1.56  +
    1.57 -+	pushw	%es			/* = ds */
    1.58  +	movw	$SYSSEG, %ax
    1.59  +	movw	%ax,%es			/* segment of SYSSEG<<4 */
    1.60  +	pushw	%es
    1.61 @@ -152,7 +160,6 @@
    1.62  +
    1.63  +	call	print_nl
    1.64  +	pop	%es			/* = SYSSEG */
    1.65 -+	pop	%es			/* balance push/pop es */
    1.66  +sigok: 
    1.67  +
    1.68  +/* Restore original disk parameters */
    1.69 @@ -164,11 +171,21 @@
    1.70  +	movw	%di,(%bx)
    1.71  +	movw	%si,2(%bx)
    1.72  +
    1.73 -+/* after that (everything loaded), we call to the .ROM file loaded. */
    1.74 ++	/* Everything now loaded.  %es = SYSSEG, so %es:0000 points to
    1.75 ++	 * start of loaded image.
    1.76 ++	 */
    1.77  +
    1.78 -+	movw	$SYSSEG, %ax
    1.79 -+	jmp	go_setup_code
    1.80 ++	/* Jump to loaded copy */
    1.81 ++	ljmp	$SYSSEG, $run_etherboot
    1.82  +
    1.83 ++endseg:	.word SYSSEG + _load_size_pgh
    1.84 ++	.section ".zinfo.fixup", "a"	/* Compressor fixup information */
    1.85 ++	.ascii	"SUBW"
    1.86 ++	.long	endseg
    1.87 ++	.long	16
    1.88 ++	.long	0
    1.89 ++	.previous
    1.90 ++	
    1.91  +/* This routine loads the system at address SYSSEG<<4, making sure no 64kB
    1.92  + * boundaries are crossed. We try to load it as fast as possible, loading whole
    1.93  + * tracks whenever we can.
    1.94 @@ -187,8 +204,7 @@
    1.95  +	movb	$4, %cl
    1.96  +	shrw	%cl,%dx			/* bx is always divisible by 16 */
    1.97  +	addw	%dx,%ax
    1.98 -+.equ	SYSSIZE, _load_size_pgh - 32
    1.99 -+	cmpw	$SYSSEG+SYSSIZE, %ax	/* have we loaded all yet? */
   1.100 ++	cmpw	syssize, %ax		/* have we loaded all yet? */
   1.101  +	jb	ok1_read
   1.102  +	ret
   1.103  +ok1_read: 
   1.104 @@ -320,9 +336,11 @@
   1.105   	loop	prloop
   1.106  -freeze: jmp	freeze
   1.107  +	ret
   1.108 -+
   1.109 + 
   1.110 +-why:	.ascii	"This image cannot be loaded from a floppy disk.\r\n"
   1.111 +-why_end: 
   1.112  +/* print_hex prints the word pointed to by ss:bp in hexadecimal. */
   1.113 -+
   1.114 + 
   1.115  +print_hex: 
   1.116  +	movw	(%bp),%dx		/* load word into dx */
   1.117  +	movb	$4, %cl
   1.118 @@ -350,12 +368,10 @@
   1.119  +
   1.120  +sectors: 
   1.121  +	.word 0
   1.122 - 
   1.123 --why:	.ascii	"This image cannot be loaded from a floppy disk.\r\n"
   1.124 --why_end: 
   1.125 ++
   1.126  +dpseg:	.word 0
   1.127  +dpoff:	.word 0
   1.128 - 
   1.129 ++
   1.130  +disksizes: 
   1.131  +	.byte 36,18,15,9,0
   1.132  +
   1.133 @@ -365,13 +381,27 @@
   1.134   
   1.135   	.org	497
   1.136   setup_sects: 
   1.137 -@@ -123,14 +426,23 @@
   1.138 +@@ -106,13 +418,6 @@
   1.139 + 
   1.140 + 	.org	512
   1.141 + 
   1.142 +-	.section ".zinfo.fixup", "a"	/* Compressor fixup information */
   1.143 +-	.ascii	"SUBW"
   1.144 +-	.long	syssize
   1.145 +-	.long	16
   1.146 +-	.long	0
   1.147 +-	.previous
   1.148 +-	
   1.149 + /*
   1.150 + 	We're now at the beginning of the second sector of the image -
   1.151 + 	where the setup code goes.
   1.152 +@@ -123,14 +428,18 @@
   1.153   	executing the Etherboot image that's loaded at SYSSEG:0 and
   1.154   	whose entry point is SYSSEG:0.
   1.155   */
   1.156  -setup_code:
   1.157  +setup_code: 
   1.158 -+	movw	$(SYSSEG-(PREFIXSIZE/16)), %ax
   1.159 ++	pushw	$(SYSSEG-(PREFIXSIZE/16))
   1.160   	/* Etherboot expects to be contiguous in memory once loaded.
   1.161   	 * LILO doesn't do this, but since we don't need any
   1.162   	 * information that's left in the prefix, it doesn't matter:
   1.163 @@ -380,14 +410,20 @@
   1.164   	 */
   1.165  -	ljmp	$(SYSSEG-(PREFIXSIZE/16)), $run_etherboot
   1.166  +go_setup_code: 
   1.167 -+	xorw	%cx, %cx
   1.168 -+	pushw	%cx
   1.169 -+	pushw	%cx		/* No parameters to preserve for exit path */
   1.170 -+	pushw	%cx		/* Use prefix exit path mechanism */
   1.171 -+	pushw	%ax
   1.172  +	pushw	$run_etherboot
   1.173  +	/* Calculated lcall to _start with %cs:0000 = image start */
   1.174  +	lret
   1.175   
   1.176   
   1.177   	.org	PREFIXSIZE
   1.178 +@@ -140,6 +449,10 @@
   1.179 + run_etherboot:
   1.180 + 	call	install
   1.181 + 
   1.182 ++	/* Set up real-mode stack */
   1.183 ++	movw	%bx, %ss
   1.184 ++	movw	$_estack16, %sp
   1.185 ++
   1.186 + 	/* Jump to .text16 segment */
   1.187 + 	pushw	%ax
   1.188 + 	pushw	$1f