Modified the pxe_ia32 stage 1 loader to load stage 2 at the same address as bios_ia32 stage 1 does.
This allowes to actually execute the boot loader now. Need to use Ingo's remote_disk_server now for booting. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19113 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
NotFile pxehaiku ;
|
NotFile pxehaiku ;
|
||||||
|
Depends pxehaiku : pxe_stage1.bin ;
|
||||||
|
|
||||||
NotFile haiku-pxe-image ;
|
NotFile haiku-pxe-loader ;
|
||||||
|
Depends pxehaiku : zbeos ;
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
#include "../bios_ia32/bios_drive.h"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#include "../bios_ia32/platform_kernel_args.h"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#include "../bios_ia32/platform_stage2_args.h"
|
||||||
@@ -44,6 +44,23 @@ KernelMergeObject boot_platform_pxe_ia32.o :
|
|||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
rule BuildPXEstage1 {
|
||||||
|
local bin = $(1) ;
|
||||||
|
local source = $(2) ;
|
||||||
|
|
||||||
|
Depends $(bin) : $(source) ;
|
||||||
|
MakeLocateDebug $(bin) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
actions BuildPXEstage1 {
|
||||||
|
rm -f $(1)
|
||||||
|
as -o $(1).o $(2)
|
||||||
|
ld --oformat binary --Ttext 0x7C00 -o $(1) $(1).o
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildPXEstage1 pxe_stage1.bin : pxe_stage1.S ;
|
||||||
|
|
||||||
SEARCH on [ FGristFiles $(bios_ia32_src) ]
|
SEARCH on [ FGristFiles $(bios_ia32_src) ]
|
||||||
= [ FDirName $(SUBDIR) $(DOTDOT) bios_ia32 ] ;
|
= [ FDirName $(SUBDIR) $(DOTDOT) bios_ia32 ] ;
|
||||||
|
|
||||||
@@ -56,5 +73,5 @@ SEARCH on stage1.bin
|
|||||||
|
|
||||||
# Tell the build system to where stage1.bin can be found, so it can be used
|
# Tell the build system to where stage1.bin can be found, so it can be used
|
||||||
# elsewhere.
|
# elsewhere.
|
||||||
SEARCH on pxe_stage1.bin = $(SUBDIR) ;
|
# SEARCH on pxe_stage1.bin = $(SUBDIR) ;
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,13 @@
|
|||||||
.equ PXENV_PACKET_TYPE_DHCP_ACK, 2
|
.equ PXENV_PACKET_TYPE_DHCP_ACK, 2
|
||||||
.equ PXENV_PACKET_TYPE_CACHED_REPLY, 3
|
.equ PXENV_PACKET_TYPE_CACHED_REPLY, 3
|
||||||
|
|
||||||
.equ scratchbuffer_addr_seg, 0x2000
|
.equ scratchbuffer_addr, 0x9000
|
||||||
.equ scratchbuffer_addr_ofs, 0x0000
|
.equ scratchbuffer_addr_seg, (scratchbuffer_addr / 16)
|
||||||
.equ scratchbuffer_addr, ((scratchbuffer_addr_seg << 4) + scratchbuffer_addr_ofs)
|
.equ scratchbuffer_addr_ofs, (scratchbuffer_addr % 16)
|
||||||
.equ scratchbuffer_size, 15000
|
.equ scratchbuffer_size, 0x7000
|
||||||
|
|
||||||
// load at 1 MB
|
.equ load_addr, 0x10000
|
||||||
.equ load_addr, 0x100000
|
.equ load_size_max, 0x80000
|
||||||
.equ load_addr_seg, 0xffff
|
|
||||||
.equ load_addr_ofs, 0x0010
|
|
||||||
|
|
||||||
.code16
|
.code16
|
||||||
.text
|
.text
|
||||||
@@ -237,7 +235,7 @@ _start:
|
|||||||
imull $65535, %eax
|
imull $65535, %eax
|
||||||
movl %eax, max_fsize
|
movl %eax, max_fsize
|
||||||
|
|
||||||
// print max file size
|
// print max TFTP file size
|
||||||
movw $maxfsize, %si
|
movw $maxfsize, %si
|
||||||
call puts
|
call puts
|
||||||
movl max_fsize, %eax
|
movl max_fsize, %eax
|
||||||
@@ -245,12 +243,26 @@ _start:
|
|||||||
movw $crlf, %si
|
movw $crlf, %si
|
||||||
call puts
|
call puts
|
||||||
|
|
||||||
// check if file is small enough
|
// print max stage 2 file size
|
||||||
|
movw $maxs2size, %si
|
||||||
|
call puts
|
||||||
|
movl $load_size_max, %eax
|
||||||
|
call puthex32
|
||||||
|
movw $crlf, %si
|
||||||
|
call puts
|
||||||
|
|
||||||
|
// check if file is small enough (TFTP limit)
|
||||||
movl s_PXENV_TFTP_GET_FSIZE_FileSize, %eax
|
movl s_PXENV_TFTP_GET_FSIZE_FileSize, %eax
|
||||||
movl max_fsize, %ebx
|
movl max_fsize, %ebx
|
||||||
cmpl %ebx, %eax
|
cmpl %ebx, %eax
|
||||||
ja err_etoobig
|
ja err_etoobig
|
||||||
|
|
||||||
|
// check if file is small enough (address range limit)
|
||||||
|
movl s_PXENV_TFTP_GET_FSIZE_FileSize, %eax
|
||||||
|
movl $load_size_max, %ebx
|
||||||
|
cmpl %ebx, %eax
|
||||||
|
ja err_etoobig
|
||||||
|
|
||||||
// load data
|
// load data
|
||||||
movl $load_addr, %edi
|
movl $load_addr, %edi
|
||||||
read_loop:
|
read_loop:
|
||||||
@@ -289,11 +301,11 @@ _copy_b: movb (%esi), %al
|
|||||||
jnz _copy_b
|
jnz _copy_b
|
||||||
_copy_done:
|
_copy_done:
|
||||||
|
|
||||||
// print a dot every 100 packets
|
// print a dot every 20 packets
|
||||||
movw pos, %ax
|
movw pos, %ax
|
||||||
incw %ax
|
incw %ax
|
||||||
movw %ax, pos
|
movw %ax, pos
|
||||||
cmpw $100, %ax
|
cmpw $20, %ax
|
||||||
jb _no_dot
|
jb _no_dot
|
||||||
xorw %ax, %ax
|
xorw %ax, %ax
|
||||||
movw %ax, pos
|
movw %ax, pos
|
||||||
@@ -340,7 +352,7 @@ pm_start:
|
|||||||
mov %ax, %gs
|
mov %ax, %gs
|
||||||
mov %ax, %ss
|
mov %ax, %ss
|
||||||
|
|
||||||
ljmp $0x8, $0x100000
|
ljmp $0x8, $load_addr
|
||||||
|
|
||||||
.code16
|
.code16
|
||||||
stop: hlt
|
stop: hlt
|
||||||
@@ -461,11 +473,12 @@ length: .asciz ", length "
|
|||||||
loading: .asciz "Loading image file "
|
loading: .asciz "Loading image file "
|
||||||
fsizeis: .asciz "Image file size is "
|
fsizeis: .asciz "Image file size is "
|
||||||
psizeis: .asciz "Packet size is "
|
psizeis: .asciz "Packet size is "
|
||||||
maxfsize: .asciz "Maximum file size is "
|
maxfsize: .asciz "Maximum TFTP file size is "
|
||||||
etoobig: .asciz "Image file is too large, loading failed\r\n"
|
maxs2size: .asciz "Maximum stage 2 file size is "
|
||||||
sizefailed: .asciz "\r\nCouldn't get image file size, loading failed\r\n"
|
etoobig: .asciz "haiku-pxe-loader file is too large, loading aborted\r\n"
|
||||||
loadfailed: .asciz "\r\nLoading image file failed\r\n"
|
sizefailed: .asciz "\r\nCouldn't get haiku-pxe-loader file size, loading failed\r\n"
|
||||||
executing: .asciz "\r\nExecuting stage 2 loader\r\n"
|
loadfailed: .asciz "\r\nLoading haiku-pxe-loader (stage 2) failed\r\n"
|
||||||
|
executing: .asciz "\r\nExecuting haiku-pxe-loader (stage 2)\r\n"
|
||||||
colon: .asciz ":"
|
colon: .asciz ":"
|
||||||
dot: .asciz "."
|
dot: .asciz "."
|
||||||
crlf: .asciz "\r\n"
|
crlf: .asciz "\r\n"
|
||||||
@@ -538,8 +551,8 @@ s_PXENV_TFTP_OPEN:
|
|||||||
s_PXENV_TFTP_OPEN_Status: .word 0
|
s_PXENV_TFTP_OPEN_Status: .word 0
|
||||||
s_PXENV_TFTP_OPEN_ServerIPAddress: .long 0
|
s_PXENV_TFTP_OPEN_ServerIPAddress: .long 0
|
||||||
s_PXENV_TFTP_OPEN_GatewayIPAddress: .long 0
|
s_PXENV_TFTP_OPEN_GatewayIPAddress: .long 0
|
||||||
s_PXENV_TFTP_OPEN_FileName: .asciz "haiku-pxe-image"
|
s_PXENV_TFTP_OPEN_FileName: .asciz "haiku-pxe-loader"
|
||||||
.fill 112
|
.fill 111
|
||||||
s_PXENV_TFTP_OPEN_TFTPPort: .word (69 << 8)
|
s_PXENV_TFTP_OPEN_TFTPPort: .word (69 << 8)
|
||||||
s_PXENV_TFTP_OPEN_PacketSize: .word 1456
|
s_PXENV_TFTP_OPEN_PacketSize: .word 1456
|
||||||
|
|
||||||
@@ -547,8 +560,8 @@ s_PXENV_TFTP_GET_FSIZE:
|
|||||||
s_PXENV_TFTP_GET_FSIZE_Status: .word 0
|
s_PXENV_TFTP_GET_FSIZE_Status: .word 0
|
||||||
s_PXENV_TFTP_GET_FSIZE_ServerIPAddress: .long 0
|
s_PXENV_TFTP_GET_FSIZE_ServerIPAddress: .long 0
|
||||||
s_PXENV_TFTP_GET_FSIZE_GatewayIPAddress:.long 0
|
s_PXENV_TFTP_GET_FSIZE_GatewayIPAddress:.long 0
|
||||||
s_PXENV_TFTP_GET_FSIZE_FileName: .asciz "haiku-pxe-image"
|
s_PXENV_TFTP_GET_FSIZE_FileName: .asciz "haiku-pxe-loader"
|
||||||
.fill 112
|
.fill 111
|
||||||
s_PXENV_TFTP_GET_FSIZE_FileSize: .long 0
|
s_PXENV_TFTP_GET_FSIZE_FileSize: .long 0
|
||||||
|
|
||||||
s_PXENV_TFTP_READ:
|
s_PXENV_TFTP_READ:
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** This file contains the stage 2 boot loader for the PXE (preboot execution
|
/** This file contains the stage 2 boot loader (haiku-pxe-loader) for the PXE
|
||||||
* environment) image.
|
* (preboot execution environment) API
|
||||||
* It gets loaded by the PXE stage1 loader to 0xffff:0010 (0x100000), and it
|
* It gets loaded by the PXE stage1 loader to 0x10000, and it starts execution
|
||||||
* starts execution in 32 bit protected mode. Entry point is at offset 0.
|
* in 32 bit protected mode. Entry point is at offset 0.
|
||||||
* This code will directly call the entry function of the embedded ELF part
|
* This code will directly call the entry function of the embedded ELF part
|
||||||
* of the loader.
|
* of the loader.
|
||||||
*/
|
*/
|
||||||
@@ -24,9 +24,6 @@ pxe_start:
|
|||||||
mov $0x10000, %ebp // setup new stack
|
mov $0x10000, %ebp // setup new stack
|
||||||
mov %ebp, %esp
|
mov %ebp, %esp
|
||||||
|
|
||||||
// stop: hlt
|
|
||||||
// jmp stop
|
|
||||||
|
|
||||||
call _start
|
call _start
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ OUTPUT_ARCH(i386)
|
|||||||
ENTRY(_start)
|
ENTRY(_start)
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
. = 0x100000;
|
. = 0x10000;
|
||||||
|
|
||||||
/* text/read-only data */
|
/* text/read-only data */
|
||||||
.text : { *(.text .gnu.linkonce.t.*) }
|
.text : { *(.text .gnu.linkonce.t.*) }
|
||||||
|
|||||||
Reference in New Issue
Block a user