Message ID | 20190603235718.28381-1-dalon.westergreen@linux.intel.com |
---|---|
State | Superseded |
Delegated to: | Marek Vasut |
Headers | show |
Series | [U-Boot,v2,1/2] Makefile: Add target to generate hex output for combined spl and dtb | expand |
On 6/4/19 1:57 AM, Dalon Westergreen wrote: > From: Dalon Westergreen <dalon.westergreen@intel.com> > > Some architectures, Stratix10, require a hex formatted spl that combines > the spl image and dtb. This adds a target to create said hex file with > and offset of SPL_TEXT_BASE. > > Signed-off-by: Dalon Westergreen <dalon.westergreen@intel.com> > [...] > @@ -363,6 +365,11 @@ endif > $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE > $(call if_changed,mkimage) > > +OBJCOPYFLAGS_$(SPL_BIN).hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE) Do we really need to do it here ? The commit message is not clear why this is needed ; I think if you link the SPl against the correct address, this should not be needed. > +$(obj)/$(SPL_BIN).hex: $(obj)/u-boot-spl.bin FORCE > + $(call if_changed,objcopy) > + > quiet_cmd_mksunxiboot = MKSUNXI $@ > cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \ > --default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@ > @@ -463,3 +470,4 @@ ifdef CONFIG_ARCH_K3 > tispl.bin: $(obj)/u-boot-spl-nodtb.bin $(SHRUNK_ARCH_DTB) $(SPL_ITS) FORCE > $(call if_changed,mkfitimage) > endif > + Drop this hunk
On Tue, 2019-06-04 at 02:00 +0200, Marek Vasut wrote: > On 6/4/19 1:57 AM, Dalon Westergreen wrote: > > From: Dalon Westergreen < > > dalon.westergreen@intel.com > > > > > > > Some architectures, Stratix10, require a hex formatted spl that combines > > the spl image and dtb. This adds a target to create said hex file with > > and offset of SPL_TEXT_BASE. > > > > Signed-off-by: Dalon Westergreen < > > dalon.westergreen@intel.com > > > > > > > [...] > > > @@ -363,6 +365,11 @@ endif > > $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE > > $(call if_changed,mkimage) > > > > +OBJCOPYFLAGS_$(SPL_BIN).hex := -I binary -O ihex --change- > > address=$(CONFIG_SPL_TEXT_BASE) > > Do we really need to do it here ? The commit message is not clear why > this is needed ; I think if you link the SPl against the correct > address, this should not be needed. > This objcopy is from the binary including the dtb and not the elf. If you objcopy using the elf, and link to the correct address, you are correct. It is not true when just taking a binary and converting to a hex file. The binary combined with the dtb is what is needed. I can try be more descriptive in the commit message. perhaps.. --- Stratix10 requires a hex image of the spl plus spl devicetree offset to the Stratix10 onchip memory located at SPL_TEXT_BASE. This patch adds a target to generate a hex file from the u-boot-spl binary including the dtb offset at SPL_TEST_BASE. --- > > +$(obj)/$(SPL_BIN).hex: $(obj)/u-boot-spl.bin FORCE > > + $(call if_changed,objcopy) > > + > > quiet_cmd_mksunxiboot = MKSUNXI $@ > > cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \ > > --default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@ > > @@ -463,3 +470,4 @@ ifdef CONFIG_ARCH_K3 > > tispl.bin: $(obj)/u-boot-spl-nodtb.bin $(SHRUNK_ARCH_DTB) $(SPL_ITS) FORCE > > $(call if_changed,mkfitimage) > > endif > > + > > Drop this hunk Will do, and i likely should have used (SPL_BIN).bin rather than u-boot-spl.bin. --dalon > >
On 6/4/19 5:12 AM, Dalon L Westergreen wrote: > On Tue, 2019-06-04 at 02:00 +0200, Marek Vasut wrote: >> On 6/4/19 1:57 AM, Dalon Westergreen wrote: >>> From: Dalon Westergreen < >>> dalon.westergreen@intel.com >>>> >>> >>> Some architectures, Stratix10, require a hex formatted spl that combines >>> the spl image and dtb. This adds a target to create said hex file with >>> and offset of SPL_TEXT_BASE. >>> >>> Signed-off-by: Dalon Westergreen < >>> dalon.westergreen@intel.com >>>> >>> >> >> [...] >> >>> @@ -363,6 +365,11 @@ endif >>> $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE >>> $(call if_changed,mkimage) >>> >>> +OBJCOPYFLAGS_$(SPL_BIN).hex := -I binary -O ihex --change- >>> address=$(CONFIG_SPL_TEXT_BASE) >> >> Do we really need to do it here ? The commit message is not clear why >> this is needed ; I think if you link the SPl against the correct >> address, this should not be needed. >> > > This objcopy is from the binary including the dtb and not the elf. If you > objcopy using the elf, and link to the correct address, you are correct. It > is not true when just taking a binary and converting to a hex file. The > binary combined with the dtb is what is needed. > > I can try be more descriptive in the commit message. > > perhaps.. > > --- > Stratix10 requires a hex image of the spl plus spl devicetree offset to > the Stratix10 onchip memory located at SPL_TEXT_BASE. This patch adds > a target to generate a hex file from the u-boot-spl binary including the > dtb offset at SPL_TEST_BASE. I think that's better, thanks. You could even include your explanation above. > --- > >>> +$(obj)/$(SPL_BIN).hex: $(obj)/u-boot-spl.bin FORCE >>> + $(call if_changed,objcopy) >>> + >>> quiet_cmd_mksunxiboot = MKSUNXI $@ >>> cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \ >>> --default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@ >>> @@ -463,3 +470,4 @@ ifdef CONFIG_ARCH_K3 >>> tispl.bin: $(obj)/u-boot-spl-nodtb.bin $(SHRUNK_ARCH_DTB) $(SPL_ITS) FORCE >>> $(call if_changed,mkfitimage) >>> endif >>> + >> >> Drop this hunk > > Will do, and i likely should have used (SPL_BIN).bin rather than > u-boot-spl.bin. > > --dalon >> >> >
diff --git a/Makefile b/Makefile index 07106138e9..12e36ebb72 100644 --- a/Makefile +++ b/Makefile @@ -1124,11 +1124,6 @@ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \ $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R .resetvec) -OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex) - -spl/u-boot-spl.hex: spl/u-boot-spl FORCE - $(call if_changed,objcopy) - binary_size_check: u-boot-nodtb.bin FORCE @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ map_size=$(shell cat u-boot.map | \ @@ -1707,6 +1702,10 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE spl/u-boot-spl.bin: spl/u-boot-spl @: + +spl/u-boot-spl.hex: spl/u-boot-spl + @: + spl/u-boot-spl: tools prepare \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb) diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 7af6b120b6..419bb6e222 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -216,6 +216,8 @@ ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),) ALL-y += $(obj)/$(SPL_BIN).sfp endif +ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex + ifdef CONFIG_ARCH_SUNXI ALL-y += $(obj)/sunxi-spl.bin @@ -363,6 +365,11 @@ endif $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE $(call if_changed,mkimage) +OBJCOPYFLAGS_$(SPL_BIN).hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE) + +$(obj)/$(SPL_BIN).hex: $(obj)/u-boot-spl.bin FORCE + $(call if_changed,objcopy) + quiet_cmd_mksunxiboot = MKSUNXI $@ cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \ --default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@ @@ -463,3 +470,4 @@ ifdef CONFIG_ARCH_K3 tispl.bin: $(obj)/u-boot-spl-nodtb.bin $(SHRUNK_ARCH_DTB) $(SPL_ITS) FORCE $(call if_changed,mkfitimage) endif +