aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-05-10 15:49:20 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-05-10 15:49:20 -0400
commit59fead6413261b10245508edc5f18316371cfaae (patch)
tree58987c60efd4924ef7313aec2436640418e7babb
parent4b39b82790d17a64d13171ba501efa4ffa044460 (diff)
downloadseabios-hppa-59fead6413261b10245508edc5f18316371cfaae.zip
seabios-hppa-59fead6413261b10245508edc5f18316371cfaae.tar.gz
seabios-hppa-59fead6413261b10245508edc5f18316371cfaae.tar.bz2
Fix elf build; rename target file rom.bin to bios.bin.
The main output file is now called out/bios.bin (instead of out/rom.bin). Use ld to build final elf file and call the result out/bios.bin.elf Make sure to long jump from external 32bit entry point.
-rw-r--r--Makefile4
-rw-r--r--README6
-rw-r--r--src/post.c2
-rwxr-xr-xtools/buildrom.py7
4 files changed, 9 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 3d7c3e2..c8e68bd 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ CFLAGS16INC = $(COMMONCFLAGS) -DMODE16 -fno-jump-tables
CFLAGS16 = $(CFLAGS16INC) -g
TABLETMP=$(addprefix $(OUT), $(patsubst %.c,%.16.s,$(TABLESRC)))
-all: $(OUT) $(OUT)rom.bin $(TABLETMP)
+all: $(OUT) $(OUT)bios.bin $(TABLETMP)
# Run with "make V=1" to see the actual compile commands
ifdef V
@@ -103,7 +103,7 @@ $(OUT)rom32.o: $(OUT)romlayout32.o $(OUT)rombios32.lds
@echo " Linking $@"
$(Q)ld -T $(OUT)rombios32.lds $< -o $@
-$(OUT)rom.bin: $(OUT)rom16.bin $(OUT)rom32.bin $(OUT)rom16.offset.auto.h $(OUT)rom32.offset.auto.h
+$(OUT)bios.bin: $(OUT)rom16.bin $(OUT)rom32.bin $(OUT)rom16.offset.auto.h $(OUT)rom32.offset.auto.h
@echo " Building $@"
$(Q)./tools/buildrom.py
diff --git a/README b/README
index dc0a725..fe5f601 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ This code implements an X86 legacy bios. It is intended to be
compiled using standard gnu tools (eg, gas and gcc).
To build, one should be able to run "make" in the main directory. The
-resulting file "out/rom.bin" contains the processed bios image.
+resulting file "out/bios.bin" contains the processed bios image.
The build requires gcc v4.1 or later. Some buggy versions of gcc have
issues with the '-combine' compiler option - in particular, recent
@@ -15,13 +15,13 @@ Testing of images:
To test the bios under bochs, one will need to instruct bochs to use
the new bios image. Use the 'romimage' option - for example:
-bochs -q 'floppya: 1_44=myfdimage.img' 'romimage: file=out/rom.bin'
+bochs -q 'floppya: 1_44=myfdimage.img' 'romimage: file=out/bios.bin'
To test under qemu, one will need to create a directory with all the
bios images and then overwrite the main bios image. For example:
cp /usr/share/qemu/*.bin mybiosdir/
-cp out/rom.bin mybiosdir/bios.bin
+cp out/bios.bin mybiosdir/
Once this is setup, one can instruct qemu to use the newly created
directory for rom images. For example:
diff --git a/src/post.c b/src/post.c
index f69773f..0d8f18e 100644
--- a/src/post.c
+++ b/src/post.c
@@ -275,5 +275,5 @@ asm(
"lidtl " __stringify(0xf0000 | OFFSET_pmode_IDT_info) "\n"
"lgdtl " __stringify(0xf0000 | OFFSET_rombios32_gdt_48) "\n"
"movl $" __stringify(CONFIG_STACK_OFFSET) ", %esp\n"
- "jmp _start\n"
+ "ljmp $0x10, $_start\n"
);
diff --git a/tools/buildrom.py b/tools/buildrom.py
index 83bedde..7d48cb5 100755
--- a/tools/buildrom.py
+++ b/tools/buildrom.py
@@ -13,7 +13,7 @@ ROM16='out/rom16.bin'
ROM32='out/rom32.bin'
OFFSETS16='out/rom16.offset.auto.h'
OFFSETS32='out/rom32.offset.auto.h'
-OUT='out/rom.bin'
+OUT='out/bios.bin'
def align(v, a):
return (v + a - 1) // a * a
@@ -81,9 +81,8 @@ def main():
# Build elf file with 32bit entry point
os.system(
- "objcopy -I binary -O elf32-i386 -B i386"
- " --change-addresses 0xf0000 --set-start %s %s %s" %(
- int(o32['OFFSET_post32'], 16) - 0xf0000, OUT, OUT+".o"))
+ "ld -melf_i386 -e %s -Ttext 0xf0000 -b binary %s -o %s" % (
+ int(o32['OFFSET_post32'], 16), OUT, OUT+".elf"))
if __name__ == '__main__':
main()