[kvm-unit-tests,v4,09/13] s390x: Add binary generation to makefile
diff mbox series

Message ID 20190103100806.9039-10-frankja@linux.ibm.com
State New
Headers show
Series
  • 390x: Add cross hypervisor and disk boot
Related show

Commit Message

Janosch Frank Jan. 3, 2019, 10:08 a.m. UTC
make bin will now generate binaries that can be booted from disk or as
a non ELF kernel boot.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/Makefile | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Thomas Huth Jan. 3, 2019, 1:12 p.m. UTC | #1
On 2019-01-03 11:08, Janosch Frank wrote:
> make bin will now generate binaries that can be booted from disk or as
> a non ELF kernel boot.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  s390x/Makefile | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/s390x/Makefile b/s390x/Makefile
> index ede2961..82c4f15 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -10,10 +10,12 @@ tests += $(TEST_DIR)/cmm.elf
>  tests += $(TEST_DIR)/vector.elf
>  tests += $(TEST_DIR)/gs.elf
>  tests += $(TEST_DIR)/iep.elf
> +tests_binary = $(patsubst %.elf,%.bin,$(tests))
>  
> -all: directories test_cases
> +all: directories test_cases test_cases_binary
>  
>  test_cases: $(tests)
> +test_cases_binary: $(tests_binary)
>  
>  CFLAGS += -std=gnu99
>  CFLAGS += -ffreestanding
> @@ -55,8 +57,11 @@ FLATLIBS = $(libcflat)
>  	$(RM) $(@:.elf=.aux.o)
>  	@chmod a-x $@
>  
> +%.bin: %.elf
> +	objcopy -O binary  $< $@

Please use $(OBJCOPY) instead, otherwise this won't work when
cross-compiling.

 Thomas
Janosch Frank Jan. 3, 2019, 1:14 p.m. UTC | #2
On 03.01.19 14:12, Thomas Huth wrote:
> On 2019-01-03 11:08, Janosch Frank wrote:
>> make bin will now generate binaries that can be booted from disk or as
>> a non ELF kernel boot.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  s390x/Makefile | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/s390x/Makefile b/s390x/Makefile
>> index ede2961..82c4f15 100644
>> --- a/s390x/Makefile
>> +++ b/s390x/Makefile
>> @@ -10,10 +10,12 @@ tests += $(TEST_DIR)/cmm.elf
>>  tests += $(TEST_DIR)/vector.elf
>>  tests += $(TEST_DIR)/gs.elf
>>  tests += $(TEST_DIR)/iep.elf
>> +tests_binary = $(patsubst %.elf,%.bin,$(tests))
>>  
>> -all: directories test_cases
>> +all: directories test_cases test_cases_binary
>>  
>>  test_cases: $(tests)
>> +test_cases_binary: $(tests_binary)
>>  
>>  CFLAGS += -std=gnu99
>>  CFLAGS += -ffreestanding
>> @@ -55,8 +57,11 @@ FLATLIBS = $(libcflat)
>>  	$(RM) $(@:.elf=.aux.o)
>>  	@chmod a-x $@
>>  
>> +%.bin: %.elf
>> +	objcopy -O binary  $< $@
> 
> Please use $(OBJCOPY) instead, otherwise this won't work when
> cross-compiling.
> 
>  Thomas
> 

Didn't know, will do.
David Hildenbrand Jan. 10, 2019, 12:13 p.m. UTC | #3
On 03.01.19 14:12, Thomas Huth wrote:
> On 2019-01-03 11:08, Janosch Frank wrote:
>> make bin will now generate binaries that can be booted from disk or as
>> a non ELF kernel boot.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  s390x/Makefile | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/s390x/Makefile b/s390x/Makefile
>> index ede2961..82c4f15 100644
>> --- a/s390x/Makefile
>> +++ b/s390x/Makefile
>> @@ -10,10 +10,12 @@ tests += $(TEST_DIR)/cmm.elf
>>  tests += $(TEST_DIR)/vector.elf
>>  tests += $(TEST_DIR)/gs.elf
>>  tests += $(TEST_DIR)/iep.elf
>> +tests_binary = $(patsubst %.elf,%.bin,$(tests))
>>  
>> -all: directories test_cases
>> +all: directories test_cases test_cases_binary
>>  
>>  test_cases: $(tests)
>> +test_cases_binary: $(tests_binary)
>>  
>>  CFLAGS += -std=gnu99
>>  CFLAGS += -ffreestanding
>> @@ -55,8 +57,11 @@ FLATLIBS = $(libcflat)
>>  	$(RM) $(@:.elf=.aux.o)
>>  	@chmod a-x $@
>>  
>> +%.bin: %.elf
>> +	objcopy -O binary  $< $@
> 
> Please use $(OBJCOPY) instead, otherwise this won't work when
> cross-compiling.
> 
>  Thomas
> 

With that

Reviewed-by: David Hildenbrand <david@redhat.com>

Patch
diff mbox series

diff --git a/s390x/Makefile b/s390x/Makefile
index ede2961..82c4f15 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -10,10 +10,12 @@  tests += $(TEST_DIR)/cmm.elf
 tests += $(TEST_DIR)/vector.elf
 tests += $(TEST_DIR)/gs.elf
 tests += $(TEST_DIR)/iep.elf
+tests_binary = $(patsubst %.elf,%.bin,$(tests))
 
-all: directories test_cases
+all: directories test_cases test_cases_binary
 
 test_cases: $(tests)
+test_cases_binary: $(tests_binary)
 
 CFLAGS += -std=gnu99
 CFLAGS += -ffreestanding
@@ -55,8 +57,11 @@  FLATLIBS = $(libcflat)
 	$(RM) $(@:.elf=.aux.o)
 	@chmod a-x $@
 
+%.bin: %.elf
+	objcopy -O binary  $< $@
+
 arch_clean: asm_offsets_clean
-	$(RM) $(TEST_DIR)/*.{o,elf} $(TEST_DIR)/.*.d lib/s390x/.*.d
+	$(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d lib/s390x/.*.d
 
 generated-files = $(asm-offsets)
 $(tests:.elf=.o) $(cstart.o) $(cflatobjs): $(generated-files)