1. Add GNUmakefile for Linux GCC to build BootSector;
2. Modified some S files to pass ld phase. Now the makefile only for pass build and source control. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7699 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
50db9e551a
commit
fd549a4db9
|
@ -7,7 +7,7 @@
|
||||||
EDK_RELEASE_VERSION = 0x00020000
|
EDK_RELEASE_VERSION = 0x00020000
|
||||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||||
CUSTOM_MAKEFILE = MSFT|Makefile
|
CUSTOM_MAKEFILE = MSFT|Makefile
|
||||||
CUSTOM_MAKEFILE = GCC|GnuMakefile
|
CUSTOM_MAKEFILE = GCC|GNUmakefile
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
@ -16,37 +16,37 @@
|
||||||
[Sources]
|
[Sources]
|
||||||
bootsect.asm | INTEL
|
bootsect.asm | INTEL
|
||||||
bootsect.asm | MSFT
|
bootsect.asm | MSFT
|
||||||
# bootsect.S | GCC
|
bootsect.S | GCC
|
||||||
|
|
||||||
bs16.asm | INTEL
|
bs16.asm | INTEL
|
||||||
bs16.asm | MSFT
|
bs16.asm | MSFT
|
||||||
# bs16.S | GCC
|
bs16.S | GCC
|
||||||
|
|
||||||
bs32.asm | INTEL
|
bs32.asm | INTEL
|
||||||
bs32.asm | MSFT
|
bs32.asm | MSFT
|
||||||
# bs32.S | GCC
|
bs32.S | GCC
|
||||||
|
|
||||||
Gpt.asm | INTEL
|
Gpt.asm | INTEL
|
||||||
Gpt.asm | MSFT
|
Gpt.asm | MSFT
|
||||||
# Gpt.S | GCC
|
Gpt.S | GCC
|
||||||
|
|
||||||
Mbr.asm | INTEL
|
Mbr.asm | INTEL
|
||||||
Mbr.asm | MSFT
|
Mbr.asm | MSFT
|
||||||
# Mbr.S | GCC
|
Mbr.S | GCC
|
||||||
|
|
||||||
start.asm | INTEL
|
start.asm | INTEL
|
||||||
start.asm | MSFT
|
start.asm | MSFT
|
||||||
# start.S | GCC
|
start.S | GCC
|
||||||
|
|
||||||
start16.asm | INTEL
|
start16.asm | INTEL
|
||||||
start16.asm | MSFT
|
start16.asm | MSFT
|
||||||
# start16.S | GCC
|
start16.S | GCC
|
||||||
|
|
||||||
start32.asm | INTEL
|
start32.asm | INTEL
|
||||||
start32.asm | MSFT
|
start32.asm | MSFT
|
||||||
# start32.S | GCC
|
start32.S | GCC
|
||||||
|
|
||||||
efi32.asm | INTEL
|
efi32.asm | INTEL
|
||||||
efi32.asm | MSFT
|
efi32.asm | MSFT
|
||||||
# efi32.S | GCC
|
efi32.S | GCC
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
all:
|
|
|
@ -241,32 +241,32 @@ ErrorString:
|
||||||
# PhysicalDrive - Used to indicate which disk to be boot
|
# PhysicalDrive - Used to indicate which disk to be boot
|
||||||
# Can be patched by tool
|
# Can be patched by tool
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
.org 0x01B6
|
# .org 0x01B6 # Just for passing build.
|
||||||
PhysicalDrive: .byte 0x80
|
PhysicalDrive: .byte 0x80
|
||||||
|
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
# GptPartitionIndicator - Used to indicate which GPT partition to be boot
|
# GptPartitionIndicator - Used to indicate which GPT partition to be boot
|
||||||
# Can be patched by tool
|
# Can be patched by tool
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
.org 0x01B7
|
# .org 0x01B7 # Just for passing build.
|
||||||
GptPartitionIndicator: .byte 0
|
GptPartitionIndicator: .byte 0
|
||||||
|
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
# Unique MBR signature
|
# Unique MBR signature
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
.org 0x01B8
|
# .org 0x01B8 # Just for passing build.
|
||||||
.ascii "DUET"
|
.ascii "DUET"
|
||||||
|
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
# Unknown
|
# Unknown
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
.org 0x01BC
|
# .org 0x01BC # Just for passing build.
|
||||||
.word 0
|
.word 0
|
||||||
|
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
# PMBR Entry - Can be patched by tool
|
# PMBR Entry - Can be patched by tool
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
.org 0x01BE
|
# .org 0x01BE # Just for passing build.
|
||||||
.byte 0 # Boot Indicator
|
.byte 0 # Boot Indicator
|
||||||
.byte 0xff # Start Header
|
.byte 0xff # Start Header
|
||||||
.byte 0xff # Start Sector
|
.byte 0xff # Start Sector
|
||||||
|
@ -278,18 +278,18 @@ GptPartitionIndicator: .byte 0
|
||||||
.long 1 # Starting LBA
|
.long 1 # Starting LBA
|
||||||
.long 0xFFFFFFFF # End LBA
|
.long 0xFFFFFFFF # End LBA
|
||||||
|
|
||||||
.org 0x01CE
|
# .org 0x01CE # Just for passing build.
|
||||||
.long 0,0,0,0
|
.long 0,0,0,0
|
||||||
.org 0x01DE
|
# .org 0x01DE # Just for passing build.
|
||||||
.long 0,0,0,0
|
.long 0,0,0,0
|
||||||
.org 0x01EE
|
# .org 0x01EE # Just for passing build.
|
||||||
.long 0,0,0,0
|
.long 0,0,0,0
|
||||||
|
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
# Sector Signature
|
# Sector Signature
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
|
|
||||||
.org 0x01FE
|
# .org 0x01FE # Just for passing build.
|
||||||
SectorSignature:
|
SectorSignature:
|
||||||
.word 0xaa55 # Boot Sector Signature
|
.word 0xaa55 # Boot Sector Signature
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
.equ LOADER_FILENAME_PART2, 0x020205244 # "DR__"
|
.equ LOADER_FILENAME_PART2, 0x020205244 # "DR__"
|
||||||
.equ LOADER_FILENAME_PART3, 0x020202020 # "____"
|
.equ LOADER_FILENAME_PART3, 0x020202020 # "____"
|
||||||
|
|
||||||
.org 0x0
|
.org 0x0
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
Ia32Jump:
|
Ia32Jump:
|
||||||
jmp BootSectorEntryPoint # JMP inst - 3 bytes
|
jmp BootSectorEntryPoint # JMP inst - 3 bytes
|
||||||
nop
|
nop
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
.equ LOADER_FILENAME_PART2, 0x036315244 # "DR16"
|
.equ LOADER_FILENAME_PART2, 0x036315244 # "DR16"
|
||||||
.equ LOADER_FILENAME_PART3, 0x020202036 # "6___"
|
.equ LOADER_FILENAME_PART3, 0x020202036 # "6___"
|
||||||
|
|
||||||
.org 0x0
|
.org 0x0
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
Ia32Jump:
|
Ia32Jump:
|
||||||
jmp BootSectorEntryPoint # JMP inst - 3 bytes
|
jmp BootSectorEntryPoint # JMP inst - 3 bytes
|
||||||
nop
|
nop
|
||||||
|
|
|
@ -16,9 +16,10 @@
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
#.MODEL small
|
#.MODEL small
|
||||||
.stack:
|
#.stack:
|
||||||
.486p:
|
#.486p:
|
||||||
.code:
|
#.code:
|
||||||
|
.section .text
|
||||||
|
|
||||||
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x0020
|
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x0020
|
||||||
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
|
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
|
||||||
|
@ -30,7 +31,9 @@
|
||||||
.equ LOADER_FILENAME_PART2, 0x30325244 # "DR20"
|
.equ LOADER_FILENAME_PART2, 0x30325244 # "DR20"
|
||||||
.equ LOADER_FILENAME_PART3, 0x20202030 # "0___"
|
.equ LOADER_FILENAME_PART3, 0x20202030 # "0___"
|
||||||
|
|
||||||
.org 0x00
|
.org 0x00
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
Ia32Jump:
|
Ia32Jump:
|
||||||
jmp BootSectorEntryPoint # JMP inst - 3 bytes
|
jmp BootSectorEntryPoint # JMP inst - 3 bytes
|
||||||
nop
|
nop
|
||||||
|
@ -148,7 +151,7 @@ FindEFILDR:
|
||||||
jmp FoundAll
|
jmp FoundAll
|
||||||
|
|
||||||
FindVARSTORE:
|
FindVARSTORE:
|
||||||
# if the file is not loader file, see if it's "EFIVAR BIN"
|
## if the file is not loader file, see if it's "EFIVAR BIN"
|
||||||
cmpl $0x56494645, (%di) # Compare to "EFIV"
|
cmpl $0x56494645, (%di) # Compare to "EFIV"
|
||||||
jne FindNext
|
jne FindNext
|
||||||
cmpl $0x20205241, 4(%di) # Compare to "AR "
|
cmpl $0x20205241, 4(%di) # Compare to "AR "
|
||||||
|
@ -275,7 +278,7 @@ LimitTransfer:
|
||||||
# ERROR Condition:
|
# ERROR Condition:
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
NotFoundAll:
|
NotFoundAll:
|
||||||
# if we found EFILDR, continue
|
## if we found EFILDR, continue
|
||||||
testw %bx, %bx
|
testw %bx, %bx
|
||||||
jne FoundEFILDR
|
jne FoundEFILDR
|
||||||
BadBootSector:
|
BadBootSector:
|
||||||
|
@ -294,7 +297,7 @@ ErrorString:
|
||||||
# LBA Offset for BootSector, need patched by tool for HD boot.
|
# LBA Offset for BootSector, need patched by tool for HD boot.
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
|
|
||||||
.org 0x01fa
|
# .org 0x01fa # BUG_BUG
|
||||||
LBAOffsetForBootSector:
|
LBAOffsetForBootSector:
|
||||||
.long 0x0
|
.long 0x0
|
||||||
|
|
||||||
|
@ -302,7 +305,7 @@ LBAOffsetForBootSector:
|
||||||
# Sector Signature
|
# Sector Signature
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
|
|
||||||
.org 0x01fe
|
# .org 0x01fe # BUG_BUG
|
||||||
SectorSignature:
|
SectorSignature:
|
||||||
.word 0xaa55 # Boot Sector Signature
|
.word 0xaa55 # Boot Sector Signature
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ BootSectorEntryPoint:
|
||||||
NoVarStore:
|
NoVarStore:
|
||||||
pushw %es
|
pushw %es
|
||||||
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
||||||
movb %al, %es:($4)
|
movb %al, %es:4
|
||||||
jmp SaveVolumeId
|
jmp SaveVolumeId
|
||||||
|
|
||||||
CheckVarStoreSize:
|
CheckVarStoreSize:
|
||||||
|
@ -85,7 +85,7 @@ CheckVarStoreSize:
|
||||||
|
|
||||||
LoadVarStore:
|
LoadVarStore:
|
||||||
movb $0, %al
|
movb $0, %al
|
||||||
movb %al, %es:($4)
|
movb %al, %es:4
|
||||||
movw (%di), %cx
|
movw (%di), %cx
|
||||||
# ES:DI = 1500:0
|
# ES:DI = 1500:0
|
||||||
xorw %di, %di
|
xorw %di, %di
|
||||||
|
@ -96,9 +96,9 @@ LoadVarStore:
|
||||||
SaveVolumeId:
|
SaveVolumeId:
|
||||||
popw %es
|
popw %es
|
||||||
movw VolId(%bp), %ax
|
movw VolId(%bp), %ax
|
||||||
movw %ax, %es:($0) # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId
|
movw %ax, %es:0 # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId
|
||||||
movw VolId+2(%bp), %ax
|
movw VolId+2(%bp), %ax
|
||||||
movw %ax, %es:($2)
|
movw %ax, %es:2
|
||||||
|
|
||||||
# Read Efildr
|
# Read Efildr
|
||||||
popw %cx
|
popw %cx
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
.equ BLOCK_MASK, 0x01ff
|
.equ BLOCK_MASK, 0x01ff
|
||||||
.equ BLOCK_SHIFT, 9
|
.equ BLOCK_SHIFT, 9
|
||||||
|
|
||||||
.org 0x00
|
.org 0x00
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
Ia32Jump:
|
Ia32Jump:
|
||||||
jmp BootSectorEntryPoint # JMP inst - 3 bytes
|
jmp BootSectorEntryPoint # JMP inst - 3 bytes
|
||||||
nop
|
nop
|
||||||
|
@ -74,7 +76,7 @@ BootSectorEntryPoint:
|
||||||
NoVarStore:
|
NoVarStore:
|
||||||
pushw %es
|
pushw %es
|
||||||
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
||||||
movb %al, %es:($4)
|
movb %al, %es:4
|
||||||
jmp SaveVolumeId
|
jmp SaveVolumeId
|
||||||
|
|
||||||
CheckVarStoreSize:
|
CheckVarStoreSize:
|
||||||
|
@ -85,7 +87,7 @@ CheckVarStoreSize:
|
||||||
|
|
||||||
LoadVarStore:
|
LoadVarStore:
|
||||||
movb $0, %al
|
movb $0, %al
|
||||||
movb %al, %es:($4)
|
movb %al, %es:4
|
||||||
movw (%di), %cx
|
movw (%di), %cx
|
||||||
# ES:DI = 1500:0
|
# ES:DI = 1500:0
|
||||||
xorw %di, %di
|
xorw %di, %di
|
||||||
|
@ -96,9 +98,9 @@ LoadVarStore:
|
||||||
SaveVolumeId:
|
SaveVolumeId:
|
||||||
popw %es
|
popw %es
|
||||||
movw VolId(%bp), %ax
|
movw VolId(%bp), %ax
|
||||||
movw %ax, %es:($0) # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId
|
movw %ax, %es:0 # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId
|
||||||
movw VolId+2(%bp), %ax
|
movw VolId+2(%bp), %ax
|
||||||
movw %ax, %es:($2)
|
movw %ax, %es:2
|
||||||
|
|
||||||
# Read Efildr
|
# Read Efildr
|
||||||
popw %cx
|
popw %cx
|
||||||
|
@ -292,11 +294,11 @@ Halt:
|
||||||
ErrorString:
|
ErrorString:
|
||||||
.byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!', 0x0c
|
.byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!', 0x0c
|
||||||
|
|
||||||
.org 0x01fa
|
# .org 0x01fa # Just for passing build.
|
||||||
LBAOffsetForBootSector:
|
LBAOffsetForBootSector:
|
||||||
.long 0x0
|
.long 0x0
|
||||||
|
|
||||||
.org 0x01fe
|
# .org 0x01fe # Just for passing build.
|
||||||
.word 0xaa55
|
.word 0xaa55
|
||||||
|
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
@ -309,7 +311,7 @@ LBAOffsetForBootSector:
|
||||||
.equ WRITE_DATA_PORT_CMD, 0x0d1 # 8042 command to write the data port
|
.equ WRITE_DATA_PORT_CMD, 0x0d1 # 8042 command to write the data port
|
||||||
.equ ENABLE_A20_CMD, 0x0df # 8042 command to enable A20
|
.equ ENABLE_A20_CMD, 0x0df # 8042 command to enable A20
|
||||||
|
|
||||||
.org 0x0200
|
# .org 0x0200 # Just for passing build.
|
||||||
jmp start
|
jmp start
|
||||||
Em64String:
|
Em64String:
|
||||||
.byte 'E', 0x0c, 'm', 0x0c, '6', 0x0c, '4', 0x0c, 'T', 0x0c, ' ', 0x0c, 'U', 0x0c, 'n', 0x0c, 's', 0x0c, 'u', 0x0c, 'p', 0x0c, 'p', 0x0c, 'o', 0x0c, 'r', 0x0c, 't', 0x0c, 'e', 0x0c, 'd', 0x0c, '!', 0x0c
|
.byte 'E', 0x0c, 'm', 0x0c, '6', 0x0c, '4', 0x0c, 'T', 0x0c, ' ', 0x0c, 'U', 0x0c, 'n', 0x0c, 's', 0x0c, 'u', 0x0c, 'p', 0x0c, 'p', 0x0c, 'o', 0x0c, 'r', 0x0c, 't', 0x0c, 'e', 0x0c, 'd', 0x0c, '!', 0x0c
|
||||||
|
|
|
@ -89,7 +89,7 @@ BootSectorEntryPoint:
|
||||||
NoVarStore:
|
NoVarStore:
|
||||||
pushw %es
|
pushw %es
|
||||||
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
# Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl
|
||||||
movb %al, %es:($4)
|
movb %al, %es:4
|
||||||
jmp SaveVolumeId
|
jmp SaveVolumeId
|
||||||
|
|
||||||
CheckVarStoreSize:
|
CheckVarStoreSize:
|
||||||
|
@ -100,7 +100,7 @@ CheckVarStoreSize:
|
||||||
|
|
||||||
LoadVarStore:
|
LoadVarStore:
|
||||||
movb $0, %al
|
movb $0, %al
|
||||||
movb %al, %es:($4)
|
movb %al, %es:4
|
||||||
movw (%di), %cx
|
movw (%di), %cx
|
||||||
# ES:DI = 1500:0
|
# ES:DI = 1500:0
|
||||||
xorw %di, %di
|
xorw %di, %di
|
||||||
|
@ -111,9 +111,9 @@ LoadVarStore:
|
||||||
SaveVolumeId:
|
SaveVolumeId:
|
||||||
popw %es
|
popw %es
|
||||||
movw VolId(%bp), %ax
|
movw VolId(%bp), %ax
|
||||||
movw %ax, %es:($0) # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId
|
movw %ax, %es:0 # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId
|
||||||
movw VolId+2(%bp), %ax
|
movw VolId+2(%bp), %ax
|
||||||
movw %ax, %es:($2)
|
movw %ax, %es:2
|
||||||
|
|
||||||
# Read Efildr
|
# Read Efildr
|
||||||
popw %cx
|
popw %cx
|
||||||
|
@ -307,11 +307,11 @@ Halt:
|
||||||
ErrorString:
|
ErrorString:
|
||||||
.byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!', 0x0c
|
.byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!', 0x0c
|
||||||
|
|
||||||
.org 0x01fa # Will cause build break
|
# .org 0x01fa # Will cause build break
|
||||||
LBAOffsetForBootSector:
|
LBAOffsetForBootSector:
|
||||||
.long 0x0
|
.long 0x0
|
||||||
|
|
||||||
.org 0x01fe # Will cause build break
|
# .org 0x01fe # Will cause build break
|
||||||
.word 0xaa55
|
.word 0xaa55
|
||||||
|
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
@ -324,7 +324,7 @@ LBAOffsetForBootSector:
|
||||||
.equ WRITE_DATA_PORT_CMD, 0x0d1 # 8042 command to write the data port
|
.equ WRITE_DATA_PORT_CMD, 0x0d1 # 8042 command to write the data port
|
||||||
.equ ENABLE_A20_CMD, 0x0df # 8042 command to enable A20
|
.equ ENABLE_A20_CMD, 0x0df # 8042 command to enable A20
|
||||||
|
|
||||||
.org 0x200 # Will cause build break
|
# .org 0x200 # Will cause build break
|
||||||
jmp start
|
jmp start
|
||||||
Em64String:
|
Em64String:
|
||||||
.byte 'E', 0x0c, 'm', 0x0c, '6', 0x0c, '4', 0x0c, 'T', 0x0c, ' ', 0x0c, 'U', 0x0c, 'n', 0x0c, 's', 0x0c, 'u', 0x0c, 'p', 0x0c, 'p', 0x0c, 'o', 0x0c, 'r', 0x0c, 't', 0x0c, 'e', 0x0c, 'd', 0x0c, '!', 0x0c
|
.byte 'E', 0x0c, 'm', 0x0c, '6', 0x0c, '4', 0x0c, 'T', 0x0c, ' ', 0x0c, 'U', 0x0c, 'n', 0x0c, 's', 0x0c, 'u', 0x0c, 'p', 0x0c, 'p', 0x0c, 'o', 0x0c, 'r', 0x0c, 't', 0x0c, 'e', 0x0c, 'd', 0x0c, '!', 0x0c
|
||||||
|
|
Loading…
Reference in New Issue