* [PATCH] Convert .flat files to 32-bit elf format
@ 2010-12-05 8:15 Avi Kivity
2010-12-05 12:05 ` Alexander Graf
0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2010-12-05 8:15 UTC (permalink / raw)
To: Marcelo Tosatti, kvm
Recent qemus no longer load 64-bit elf kernels. Fix by converting
to 32-bit elf.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
config-x86-common.mak | 39 +++++++++++++++++++++------------------
1 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/config-x86-common.mak b/config-x86-common.mak
index b541c1c..c5508b3 100644
--- a/config-x86-common.mak
+++ b/config-x86-common.mak
@@ -20,9 +20,12 @@ CFLAGS += -m$(bits)
libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name)
FLATLIBS = lib/libcflat.a $(libgcc)
-%.flat: %.o $(FLATLIBS) flat.lds
+%.elf: %.o $(FLATLIBS) flat.lds
$(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $(filter %.o, $^) $(FLATLIBS)
+%.flat: %.elf
+ objcopy -O elf32-i386 $^ $@
+
tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \
$(TEST_DIR)/smptest.flat $(TEST_DIR)/port80.flat \
$(TEST_DIR)/realmode.flat $(TEST_DIR)/msr.flat \
@@ -35,47 +38,47 @@ test_cases: $(tests-common) $(tests)
$(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I lib -I lib/x86
-$(TEST_DIR)/access.flat: $(cstart.o) $(TEST_DIR)/access.o
+$(TEST_DIR)/access.elf: $(cstart.o) $(TEST_DIR)/access.o
-$(TEST_DIR)/hypercall.flat: $(cstart.o) $(TEST_DIR)/hypercall.o
+$(TEST_DIR)/hypercall.elf: $(cstart.o) $(TEST_DIR)/hypercall.o
-$(TEST_DIR)/sieve.flat: $(cstart.o) $(TEST_DIR)/sieve.o \
+$(TEST_DIR)/sieve.elf: $(cstart.o) $(TEST_DIR)/sieve.o \
$(TEST_DIR)/vm.o
-$(TEST_DIR)/vmexit.flat: $(cstart.o) $(TEST_DIR)/vmexit.o
+$(TEST_DIR)/vmexit.elf: $(cstart.o) $(TEST_DIR)/vmexit.o
-$(TEST_DIR)/smptest.flat: $(cstart.o) $(TEST_DIR)/smptest.o
+$(TEST_DIR)/smptest.elf: $(cstart.o) $(TEST_DIR)/smptest.o
-$(TEST_DIR)/emulator.flat: $(cstart.o) $(TEST_DIR)/emulator.o \
+$(TEST_DIR)/emulator.elf: $(cstart.o) $(TEST_DIR)/emulator.o \
$(TEST_DIR)/vm.o $(TEST_DIR)/idt.o
-$(TEST_DIR)/port80.flat: $(cstart.o) $(TEST_DIR)/port80.o
+$(TEST_DIR)/port80.elf: $(cstart.o) $(TEST_DIR)/port80.o
-$(TEST_DIR)/tsc.flat: $(cstart.o) $(TEST_DIR)/tsc.o
+$(TEST_DIR)/tsc.elf: $(cstart.o) $(TEST_DIR)/tsc.o
-$(TEST_DIR)/apic.flat: $(cstart.o) $(TEST_DIR)/apic.o $(TEST_DIR)/vm.o
+$(TEST_DIR)/apic.elf: $(cstart.o) $(TEST_DIR)/apic.o $(TEST_DIR)/vm.o
-$(TEST_DIR)/realmode.flat: $(TEST_DIR)/realmode.o
+$(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o
$(CC) -m32 -nostdlib -o $@ -Wl,-T,$(TEST_DIR)/realmode.lds $^
$(TEST_DIR)/realmode.o: bits = 32
-$(TEST_DIR)/msr.flat: $(cstart.o) $(TEST_DIR)/msr.o
+$(TEST_DIR)/msr.elf: $(cstart.o) $(TEST_DIR)/msr.o
-$(TEST_DIR)/idt_test.flat: $(cstart.o) $(TEST_DIR)/idt.o $(TEST_DIR)/idt_test.o
+$(TEST_DIR)/idt_test.elf: $(cstart.o) $(TEST_DIR)/idt.o $(TEST_DIR)/idt_test.o
-$(TEST_DIR)/xsave.flat: $(cstart.o) $(TEST_DIR)/idt.o $(TEST_DIR)/xsave.o
+$(TEST_DIR)/xsave.elf: $(cstart.o) $(TEST_DIR)/idt.o $(TEST_DIR)/xsave.o
-$(TEST_DIR)/rmap_chain.flat: $(cstart.o) $(TEST_DIR)/rmap_chain.o \
+$(TEST_DIR)/rmap_chain.elf: $(cstart.o) $(TEST_DIR)/rmap_chain.o \
$(TEST_DIR)/vm.o
-$(TEST_DIR)/svm.flat: $(cstart.o) $(TEST_DIR)/vm.o
+$(TEST_DIR)/svm.elf: $(cstart.o) $(TEST_DIR)/vm.o
-$(TEST_DIR)/kvmclock_test.flat: $(cstart.o) $(TEST_DIR)/kvmclock.o \
+$(TEST_DIR)/kvmclock_test.elf: $(cstart.o) $(TEST_DIR)/kvmclock.o \
$(TEST_DIR)/kvmclock_test.o
arch_clean:
- $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat \
+ $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
$(TEST_DIR)/.*.d $(TEST_DIR)/lib/.*.d $(TEST_DIR)/lib/*.o
-include $(TEST_DIR)/.*.d lib/.*.d lib/x86/.*.d
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Convert .flat files to 32-bit elf format
2010-12-05 8:15 [PATCH] Convert .flat files to 32-bit elf format Avi Kivity
@ 2010-12-05 12:05 ` Alexander Graf
2010-12-05 12:37 ` Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2010-12-05 12:05 UTC (permalink / raw)
To: Avi Kivity; +Cc: Marcelo Tosatti, kvm
On 05.12.2010, at 09:15, Avi Kivity wrote:
> Recent qemus no longer load 64-bit elf kernels. Fix by converting
> to 32-bit elf.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
> config-x86-common.mak | 39 +++++++++++++++++++++------------------
> 1 files changed, 21 insertions(+), 18 deletions(-)
>
> diff --git a/config-x86-common.mak b/config-x86-common.mak
> index b541c1c..c5508b3 100644
> --- a/config-x86-common.mak
> +++ b/config-x86-common.mak
> @@ -20,9 +20,12 @@ CFLAGS += -m$(bits)
> libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name)
>
> FLATLIBS = lib/libcflat.a $(libgcc)
> -%.flat: %.o $(FLATLIBS) flat.lds
> +%.elf: %.o $(FLATLIBS) flat.lds
> $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $(filter %.o, $^) $(FLATLIBS)
>
> +%.flat: %.elf
> + objcopy -O elf32-i386 $^ $@
Not sure it's that great to call 32bit elf binaries ".flat". I'd rather expect a flat file when reading that file extension ;). Mind to just call it ".elf32"?
Alternatively, you could also use real flat files and shove a multiboot header into the binary.
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Convert .flat files to 32-bit elf format
2010-12-05 12:05 ` Alexander Graf
@ 2010-12-05 12:37 ` Avi Kivity
2010-12-05 12:48 ` Alexander Graf
0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2010-12-05 12:37 UTC (permalink / raw)
To: Alexander Graf; +Cc: Marcelo Tosatti, kvm
On 12/05/2010 02:05 PM, Alexander Graf wrote:
> >
> > diff --git a/config-x86-common.mak b/config-x86-common.mak
> > index b541c1c..c5508b3 100644
> > --- a/config-x86-common.mak
> > +++ b/config-x86-common.mak
> > @@ -20,9 +20,12 @@ CFLAGS += -m$(bits)
> > libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name)
> >
> > FLATLIBS = lib/libcflat.a $(libgcc)
> > -%.flat: %.o $(FLATLIBS) flat.lds
> > +%.elf: %.o $(FLATLIBS) flat.lds
> > $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $(filter %.o, $^) $(FLATLIBS)
> >
> > +%.flat: %.elf
> > + objcopy -O elf32-i386 $^ $@
>
> Not sure it's that great to call 32bit elf binaries ".flat". I'd rather expect a flat file when reading that file extension ;). Mind to just call it ".elf32"?
It's a reminder from the good old days that these were flat files loaded
by kvmctl.
> Alternatively, you could also use real flat files and shove a multiboot header into the binary.
I'll rename them in a later patch. .elf32 isn't a good name either, it
implies 32-bit execution, whereas it's just the file format due to
multiboot constraints. Maybe .test (and .test32 and .test64 when we
build both).
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Convert .flat files to 32-bit elf format
2010-12-05 12:37 ` Avi Kivity
@ 2010-12-05 12:48 ` Alexander Graf
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2010-12-05 12:48 UTC (permalink / raw)
To: Avi Kivity; +Cc: Marcelo Tosatti, kvm
On 05.12.2010, at 13:37, Avi Kivity wrote:
> On 12/05/2010 02:05 PM, Alexander Graf wrote:
>> >
>> > diff --git a/config-x86-common.mak b/config-x86-common.mak
>> > index b541c1c..c5508b3 100644
>> > --- a/config-x86-common.mak
>> > +++ b/config-x86-common.mak
>> > @@ -20,9 +20,12 @@ CFLAGS += -m$(bits)
>> > libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name)
>> >
>> > FLATLIBS = lib/libcflat.a $(libgcc)
>> > -%.flat: %.o $(FLATLIBS) flat.lds
>> > +%.elf: %.o $(FLATLIBS) flat.lds
>> > $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $(filter %.o, $^) $(FLATLIBS)
>> >
>> > +%.flat: %.elf
>> > + objcopy -O elf32-i386 $^ $@
>>
>> Not sure it's that great to call 32bit elf binaries ".flat". I'd rather expect a flat file when reading that file extension ;). Mind to just call it ".elf32"?
>
> It's a reminder from the good old days that these were flat files loaded by kvmctl.
Nothing's as permanent as an improvised solution :).
>> Alternatively, you could also use real flat files and shove a multiboot header into the binary.
>
> I'll rename them in a later patch. .elf32 isn't a good name either, it implies 32-bit execution, whereas it's just the file format due to multiboot constraints. Maybe .test (and .test32 and .test64 when we build both).
Yeah, anything really. The .flat is definitely just wrong ;). .test32 and .test64 always sounds good to me. No reason to be clever and also have .test.
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-05 12:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-05 8:15 [PATCH] Convert .flat files to 32-bit elf format Avi Kivity
2010-12-05 12:05 ` Alexander Graf
2010-12-05 12:37 ` Avi Kivity
2010-12-05 12:48 ` Alexander Graf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox