From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 8/8] mips: bmips: add support for raw .elf images
Date: Sat, 15 Apr 2017 20:10:37 +0200 [thread overview]
Message-ID: <46e41241-dcdf-93f0-eeb2-83ceb56a8b0c@gmail.com> (raw)
In-Reply-To: <329101ee-fca8-b31e-5e4c-0702381c535b@gmail.com>
Hi,
El 15/04/2017 a las 19:19, Álvaro Fernández Rojas escribió:
>
>
> El 14/04/2017 a las 21:05, Daniel Schwierzeck escribió:
>>
>>
>> Am 13.04.2017 um 17:52 schrieb Álvaro Fernández Rojas:
>>> CFE supports loading .elf images instead of raw binaries.
>>>
>>> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
>>> ---
>>> Makefile | 22 ++++++++++++++++++++++
>>> arch/mips/cpu/u-boot-elf.lds | 10 ++++++++++
>>> 2 files changed, 32 insertions(+)
>>> create mode 100644 arch/mips/cpu/u-boot-elf.lds
>>>
>>> diff --git a/Makefile b/Makefile
>>> index 09b597d..667b5f2 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -568,6 +568,15 @@ ifndef LDSCRIPT
>>> endif
>>> endif
>>>
>>> +ifndef LDSCRIPT_ELF
>>> + ifeq ($(wildcard $(LDSCRIPT_ELF)),)
>>> + LDSCRIPT_ELF := $(srctree)/$(CPUDIR)/u-boot-elf.lds
>>> + endif
>>> + ifeq ($(wildcard $(LDSCRIPT_ELF)),)
>>> + LDSCRIPT_ELF := $(srctree)/arch/$(ARCH)/cpu/u-boot-elf.lds
>>> + endif
>>> +endif
>>
>> could you try to build the ELF binary without a custom linker script? I
>> think the built-in one should work too.
>>
>>> +
>>> else
>>> # Dummy target needed, because used as prerequisite
>>> include/config/auto.conf: ;
>>> @@ -786,6 +795,7 @@ ifneq ($(CONFIG_SPL_TARGET),)
>>> ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
>>> endif
>>> ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf
>>> +ALL-$(CONFIG_ARCH_BMIPS) += u-boot-bmips.elf
>>> ALL-$(CONFIG_EFI_APP) += u-boot-app.efi
>>> ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi
>>>
>>> @@ -1192,6 +1202,15 @@ u-boot.elf: u-boot.bin
>>> --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
>>> -Ttext=$(CONFIG_SYS_TEXT_BASE)
>>>
>>> +# Rules to link u-boot-bmips
>>> +quiet_cmd_u-boot-bmips ?= LD $@
>>> + cmd_u-boot-bmips ?= $(LD) -e startup -T u-boot-elf.lds \
>>> + -Ttext $(CONFIG_SYS_TEXT_BASE) -o $@ u-boot-bmips.o
>>> +
>>> +u-boot-bmips.elf: u-boot.bin u-boot-elf.lds
>>> + $(Q)$(LD) -r -b binary --oformat elf32-tradbigmips -o u-boot-bmips.o $<
>>> + $(call if_changed,u-boot-bmips)
>>
>> could you try to generate the ELF binary like in the existing rule
>> above? If that works, we could refactor the generic rule to remove the
>> hard-coded aarch64 flags. If not, move this code and the
>> "ALL-$(CONFIG_ARCH_BMIPS) += u-boot-bmips.elf" to arch/mips/Makefile
> Sure, I will try and see if it works.
It works, but it has to be changed:
u-boot.elf: u-boot.bin
@$(OBJCOPY) -B mips -I binary -O elf32-tradbigmips \
$< u-boot-elf.o
@$(LD) u-boot-elf.o -o $@ \
--defsym=__start=$(CONFIG_SYS_TEXT_BASE) \
-Ttext=$(CONFIG_SYS_TEXT_BASE)
Changes:
1) __start symbol instead of _start
2) mips instead of aarch64
3) elf32-tradbigmips instead of elf64-littleaarch64
>
>>
>> Also don't forget to add new binaries to .gitignore and the Makefile
>> clean targets.
> Right, my fault :).
>
>>
>>> +
>>> # Rule to link u-boot
>>> # May be overridden by arch/$(ARCH)/config.mk
>>> quiet_cmd_u-boot__ ?= LD $@
>>> @@ -1340,6 +1359,9 @@ cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \
>>> u-boot.lds: $(LDSCRIPT) prepare FORCE
>>> $(call if_changed_dep,cpp_lds)
>>>
>>> +u-boot-elf.lds: $(LDSCRIPT_ELF) prepare
>>> + $(call if_changed_dep,cpp_lds)
>>> +
>>> spl/u-boot-spl.bin: spl/u-boot-spl
>>> @:
>>> spl/u-boot-spl: tools prepare \
>>> diff --git a/arch/mips/cpu/u-boot-elf.lds b/arch/mips/cpu/u-boot-elf.lds
>>> new file mode 100644
>>> index 0000000..db0bb46
>>> --- /dev/null
>>> +++ b/arch/mips/cpu/u-boot-elf.lds
>>> @@ -0,0 +1,10 @@
>>> +OUTPUT_ARCH(mips)
>>> +SECTIONS {
>>> + .text : {
>>> + startup = .;
>>> + *(.text)
>>> + *(.text.*)
>>> + *(.data)
>>> + *(.data.*)
>>> + }
>>> +}
>>>
>>
next prev parent reply other threads:[~2017-04-15 18:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1492098775-3518-1-git-send-email-noltari@gmail.com>
[not found] ` <1492098775-3518-2-git-send-email-noltari@gmail.com>
2017-04-14 17:43 ` [U-Boot] [PATCH 1/8] cmd: cpu: fix NULL cpu feature prints Daniel Schwierzeck
2017-04-15 17:16 ` Álvaro Fernández Rojas
[not found] ` <1492098775-3518-5-git-send-email-noltari@gmail.com>
2017-04-14 18:19 ` [U-Boot] [PATCH 4/8] serial: add serial driver for BCM6345 Daniel Schwierzeck
2017-04-15 17:17 ` Álvaro Fernández Rojas
[not found] ` <1492098775-3518-8-git-send-email-noltari@gmail.com>
2017-04-14 18:26 ` [U-Boot] [PATCH 7/8] mips: bmips: fix ioremap for BCM6358 Daniel Schwierzeck
2017-04-15 17:18 ` Álvaro Fernández Rojas
2017-04-15 18:08 ` Álvaro Fernández Rojas
2017-04-15 18:48 ` Daniel Schwierzeck
2017-04-15 19:15 ` Álvaro Fernández Rojas
[not found] ` <1492098775-3518-9-git-send-email-noltari@gmail.com>
2017-04-14 19:05 ` [U-Boot] [PATCH 8/8] mips: bmips: add support for raw .elf images Daniel Schwierzeck
2017-04-15 17:19 ` Álvaro Fernández Rojas
2017-04-15 18:10 ` Álvaro Fernández Rojas [this message]
2017-04-15 18:54 ` Daniel Schwierzeck
2017-04-15 19:14 ` Álvaro Fernández Rojas
2017-04-15 19:30 ` Álvaro Fernández Rojas
[not found] ` <1492098775-3518-6-git-send-email-noltari@gmail.com>
2017-04-14 19:23 ` [U-Boot] [PATCH 5/8] mips: add support for Broadcom MIPS Daniel Schwierzeck
2017-04-15 17:24 ` Álvaro Fernández Rojas
2017-04-13 15:44 [U-Boot] [PATCH 0/8] Add support for Broadcom MIPS SoCs Álvaro Fernández Rojas
2017-04-13 15:44 ` [U-Boot] [PATCH 8/8] mips: bmips: add support for raw .elf images Álvaro Fernández Rojas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46e41241-dcdf-93f0-eeb2-83ceb56a8b0c@gmail.com \
--to=noltari@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox