summaryrefslogtreecommitdiff
path: root/DuetPkg/BootSector
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-26 14:41:56 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-26 14:41:56 +0000
commit20193e01ca7f2e20c8be6b412c8cf0a5132d1c1c (patch)
tree2ecb056a0b0cade715547533d16ff042bf07daa8 /DuetPkg/BootSector
parent0375ec8d8f643a6c8c3238f22157592b44c6dba2 (diff)
downloadedk2-20193e01ca7f2e20c8be6b412c8cf0a5132d1c1c.zip
edk2-20193e01ca7f2e20c8be6b412c8cf0a5132d1c1c.tar.gz
edk2-20193e01ca7f2e20c8be6b412c8cf0a5132d1c1c.tar.bz2
Should use code16 for 16-bit assembler, otherwise 32-bit prefix will be added
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7721 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'DuetPkg/BootSector')
-rw-r--r--DuetPkg/BootSector/GNUmakefile40
-rw-r--r--DuetPkg/BootSector/bootsect.S6
-rw-r--r--DuetPkg/BootSector/bs16.S6
-rw-r--r--DuetPkg/BootSector/bs32.S17
-rw-r--r--DuetPkg/BootSector/efi32.S2
5 files changed, 41 insertions, 30 deletions
diff --git a/DuetPkg/BootSector/GNUmakefile b/DuetPkg/BootSector/GNUmakefile
index 5de0de8..8be0411 100644
--- a/DuetPkg/BootSector/GNUmakefile
+++ b/DuetPkg/BootSector/GNUmakefile
@@ -1,3 +1,6 @@
+# Just use host GCC to compile boot sector image.
+ASM=gcc
+DLINK=ld
ASSEMBLY_CODE_FILE_LIST = $(MODULE_DIR)/bootsect.S \
$(MODULE_DIR)/bs16.S \
@@ -30,55 +33,64 @@ all: $(TARGET_FILES)
$(OUTPUT_DIR)/bootsect.o: $(MODULE_DIR)/bootsect.S
$(ASM) -c -o $(OUTPUT_DIR)/bootsect.o $(MODULE_DIR)/bootsect.S
$(OUTPUT_DIR)/bootsect.bin: $(OUTPUT_DIR)/bootsect.o
- $(DLINK) -o $(OUTPUT_DIR)/bootsect.bin $(OUTPUT_DIR)/bootsect.o -Ttext 0
-
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/bootsect.bin $(OUTPUT_DIR)/bootsect.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/bootsect.o>$(OUTPUT_DIR)/bootsect.lst
+
# bs16.S
$(OUTPUT_DIR)/bs16.o: $(MODULE_DIR)/bs16.S
$(ASM) -c -o $(OUTPUT_DIR)/bs16.o $(MODULE_DIR)/bs16.S
$(OUTPUT_DIR)/bs16.bin: $(OUTPUT_DIR)/bs16.o
- $(DLINK) -o $(OUTPUT_DIR)/bs16.bin $(OUTPUT_DIR)/bs16.o -Ttext 0
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/bs16.bin $(OUTPUT_DIR)/bs16.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/bs16.o>$(OUTPUT_DIR)/bs16.lst
# bs32.S
$(OUTPUT_DIR)/bs32.o: $(MODULE_DIR)/bs32.S
$(ASM) -c -o $(OUTPUT_DIR)/bs32.o $(MODULE_DIR)/bs32.S
$(OUTPUT_DIR)/bs32.bin: $(OUTPUT_DIR)/bs32.o
- $(DLINK) -o $(OUTPUT_DIR)/bs32.bin $(OUTPUT_DIR)/bs32.o -Ttext 0
-
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/bs32.bin $(OUTPUT_DIR)/bs32.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/bs32.o>$(OUTPUT_DIR)/bs32.lst
+
# Gpt.S
$(OUTPUT_DIR)/Gpt.o: $(MODULE_DIR)/Gpt.S
$(ASM) -c -o $(OUTPUT_DIR)/Gpt.o $(MODULE_DIR)/Gpt.S
$(OUTPUT_DIR)/Gpt.bin: $(OUTPUT_DIR)/Gpt.o
- $(DLINK) -o $(OUTPUT_DIR)/Gpt.bin $(OUTPUT_DIR)/Gpt.o -Ttext 0
-
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/Gpt.bin $(OUTPUT_DIR)/Gpt.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/Gpt.o>$(OUTPUT_DIR)/Gpt.lst
+
# Mbr.S
$(OUTPUT_DIR)/Mbr.o: $(MODULE_DIR)/Mbr.S
$(ASM) -c -o $(OUTPUT_DIR)/Mbr.o $(MODULE_DIR)/Mbr.S
$(OUTPUT_DIR)/Mbr.bin: $(OUTPUT_DIR)/Mbr.o
- $(DLINK) -o $(OUTPUT_DIR)/Mbr.bin $(OUTPUT_DIR)/Mbr.o -Ttext 0
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/Mbr.bin $(OUTPUT_DIR)/Mbr.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/Mbr.o>$(OUTPUT_DIR)/Mbr.lst
# start.S
$(OUTPUT_DIR)/start.o: $(MODULE_DIR)/start.S
$(ASM) -c -o $(OUTPUT_DIR)/start.o $(MODULE_DIR)/start.S
$(OUTPUT_DIR)/start.bin: $(OUTPUT_DIR)/start.o
- $(DLINK) -o $(OUTPUT_DIR)/start.bin $(OUTPUT_DIR)/start.o -Ttext 0
-
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/start.bin $(OUTPUT_DIR)/start.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/start.o>$(OUTPUT_DIR)/start.lst
+
# start16.S
$(OUTPUT_DIR)/start16.o: $(MODULE_DIR)/start16.S
$(ASM) -c -o $(OUTPUT_DIR)/start16.o $(MODULE_DIR)/start16.S
$(OUTPUT_DIR)/start16.bin: $(OUTPUT_DIR)/start16.o
- $(DLINK) -o $(OUTPUT_DIR)/start16.bin $(OUTPUT_DIR)/start16.o -Ttext 0
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/start16.bin $(OUTPUT_DIR)/start16.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/start16.o>$(OUTPUT_DIR)/start16.lst
# start32.S
$(OUTPUT_DIR)/start32.o: $(MODULE_DIR)/start32.S
$(ASM) -c -o $(OUTPUT_DIR)/start32.o $(MODULE_DIR)/start32.S
$(OUTPUT_DIR)/start32.bin: $(OUTPUT_DIR)/start32.o
- $(DLINK) -o $(OUTPUT_DIR)/start32.bin $(OUTPUT_DIR)/start32.o -Ttext 0
-
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/start32.bin $(OUTPUT_DIR)/start32.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/start32.o>$(OUTPUT_DIR)/start32.lst
+
# efi32.S
$(OUTPUT_DIR)/efi32.o: $(MODULE_DIR)/efi32.S
$(ASM) -c -o $(OUTPUT_DIR)/efi32.o $(MODULE_DIR)/efi32.S
$(OUTPUT_DIR)/efi32.bin: $(OUTPUT_DIR)/efi32.o
- $(DLINK) -o $(OUTPUT_DIR)/efi32.bin $(OUTPUT_DIR)/efi32.o -Ttext 0
+ $(DLINK) --oformat binary -o $(OUTPUT_DIR)/efi32.bin $(OUTPUT_DIR)/efi32.o -Ttext 0
+ objdump --line-numbers --source $(OUTPUT_DIR)/efi32.o>$(OUTPUT_DIR)/efi32.lst
clean:
diff --git a/DuetPkg/BootSector/bootsect.S b/DuetPkg/BootSector/bootsect.S
index 2b82422..62f50ac 100644
--- a/DuetPkg/BootSector/bootsect.S
+++ b/DuetPkg/BootSector/bootsect.S
@@ -18,7 +18,7 @@
#.MODEL small
.stack:
.486p:
- .code16:
+ .code16
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x020
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
@@ -275,7 +275,7 @@ ErrorString:
# LBA Offset for BootSector, need patched by tool for HD boot.
# ****************************************************************************
- # .org 0x01fa # Comment it for pass build. Should optimise code size.
+ .org 0x01fa # Comment it for pass build. Should optimise code size.
LBAOffsetForBootSector:
.long 0x0
@@ -283,7 +283,7 @@ LBAOffsetForBootSector:
# Sector Signature
# ****************************************************************************
- # .org 0x01fe # Comment it for pass build.
+ .org 0x01fe # Comment it for pass build.
SectorSignature:
.word 0xaa55 # Boot Sector Signature
diff --git a/DuetPkg/BootSector/bs16.S b/DuetPkg/BootSector/bs16.S
index 440732e..57e7904 100644
--- a/DuetPkg/BootSector/bs16.S
+++ b/DuetPkg/BootSector/bs16.S
@@ -18,7 +18,7 @@
#.MODEL small
.stack:
.486p:
- .code16:
+ .code16
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x020
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
@@ -275,7 +275,7 @@ ErrorString:
# LBA Offset for BootSector, need patched by tool for HD boot.
# ****************************************************************************
- # .org 0x01fa # Comment it for pass build. Should optimise code size.
+ .org 0x01fa
LBAOffsetForBootSector:
.long 0x0
@@ -283,7 +283,7 @@ LBAOffsetForBootSector:
# Sector Signature
# ****************************************************************************
- # .org 0x01fe # Comment it for pass build. Should optimise code size.
+ .org 0x01fe
SectorSignature:
.word 0xaa55 # Boot Sector Signature
diff --git a/DuetPkg/BootSector/bs32.S b/DuetPkg/BootSector/bs32.S
index 72fa210..5df6d6a 100644
--- a/DuetPkg/BootSector/bs32.S
+++ b/DuetPkg/BootSector/bs32.S
@@ -16,10 +16,9 @@
#------------------------------------------------------------------------------
#.MODEL small
- #.stack:
- #.486p:
- .code16:
-.section .text
+ .stack:
+ .486p:
+ .code16
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x0020
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
@@ -31,7 +30,7 @@
.equ LOADER_FILENAME_PART2, 0x30325244 # "DR20"
.equ LOADER_FILENAME_PART3, 0x20202030 # "0___"
- .org 0x00
+ .org 0x0
.global _start
_start:
Ia32Jump:
@@ -80,7 +79,7 @@ BootSectorEntryPoint:
# ****************************************************************************
# Start Print
# ****************************************************************************
- leaw %cs:StartString, %si
+ movw $StartString, %si
call PrintString
# ****************************************************************************
@@ -283,7 +282,7 @@ NotFoundAll:
jne FoundEFILDR
BadBootSector:
DiskError:
- leaw %cs:ErrorString, %si
+ movw $ErrorString, %si
call PrintString
Halt:
jmp Halt
@@ -297,7 +296,7 @@ ErrorString:
# LBA Offset for BootSector, need patched by tool for HD boot.
# ****************************************************************************
- # .org 0x01fa # BUG_BUG
+ #.org 0x01fa
LBAOffsetForBootSector:
.long 0x0
@@ -305,7 +304,7 @@ LBAOffsetForBootSector:
# Sector Signature
# ****************************************************************************
- # .org 0x01fe # BUG_BUG
+ #.org 0x01fe
SectorSignature:
.word 0xaa55 # Boot Sector Signature
diff --git a/DuetPkg/BootSector/efi32.S b/DuetPkg/BootSector/efi32.S
index 7f9e77d..06b2516 100644
--- a/DuetPkg/BootSector/efi32.S
+++ b/DuetPkg/BootSector/efi32.S
@@ -22,7 +22,7 @@
.486:
#.MODEL flat
.stack:
- .code16:
+ .code:
.org 0x21000
.equ DEFAULT_HANDLER_SIZE, INT1 - INT0