diff mbox

[v2,2/7] boot/uboot: compute CRC on SPLs for Altera SoC FPGA

Message ID 1445340745-1000-3-git-send-email-viktorin@rehivetech.com
State Accepted
Headers show

Commit Message

Jan Viktorin Oct. 20, 2015, 11:32 a.m. UTC
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
 boot/uboot/Config.in | 10 ++++++++++
 boot/uboot/uboot.mk  |  9 +++++++++
 2 files changed, 19 insertions(+)

Comments

Jan Viktorin Oct. 20, 2015, 11:36 a.m. UTC | #1
A small mistake here...

On Tue, 20 Oct 2015 13:32:20 +0200
Jan Viktorin <viktorin@rehivetech.com> wrote:

> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> ---
>  boot/uboot/Config.in | 10 ++++++++++
>  boot/uboot/uboot.mk  |  9 +++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> index 8643dab..b2a69f3 100644
> --- a/boot/uboot/Config.in
> +++ b/boot/uboot/Config.in
> @@ -338,6 +338,16 @@ config BR2_TARGET_UBOOT_ZYNQ_IMAGE
>  	 for u-boot-dtb.img file so this U-Boot format is required
>  	 to be set.
>  
> +config BR2_TARGET_UBOOT_SOCFPGA_IMAGE_CRC
> +	bool "CRC SPL image for SoC FPGA"
> +	depends on BR2_arm
> +	depends on BR2_TARGET_UBOOT_SPL
> +	help
> +	  Generate SPL image fixed by the mkpimage tool to enable
> +	  booting on the SoC FPGA based platforms. The tool is
> +	  available at https://github.com/maximeh/mkpimage.
> +	  It requires a Go language compiler installed on your host.

The last 2 and half lines about mkpimage are obsolete for v2 ^^^^

> +
>  menuconfig BR2_TARGET_UBOOT_ENVIMAGE
>  	bool "Environment image"
>  	help
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index 66e728f..8b32154 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -215,6 +215,15 @@ UBOOT_DEPENDENCIES += host-zynq-boot-bin
>  UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_GENERATE_ZYNQ_IMAGE
>  endif
>  
> +ifeq ($(BR2_TARGET_UBOOT_SOCFPGA_IMAGE_CRC),y)
> +define UBOOT_CRC_SOCFPGA_IMAGE
> +	$(HOST_DIR)/usr/bin/mkpimage -o $(BINARIES_DIR)/$(notdir $(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))).crc \
> +		$(@D)/$(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))
> +endef
> +UBOOT_DEPENDENCIES += host-mkpimage
> +UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_CRC_SOCFPGA_IMAGE
> +endif
> +
>  ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
>  ifeq ($(BR_BUILDING),y)
>  ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),)
Thomas Petazzoni March 22, 2016, 10:54 p.m. UTC | #2
Hello,

On Tue, 20 Oct 2015 13:32:20 +0200, Jan Viktorin wrote:
> Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> ---
>  boot/uboot/Config.in | 10 ++++++++++
>  boot/uboot/uboot.mk  |  9 +++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> index 8643dab..b2a69f3 100644
> --- a/boot/uboot/Config.in
> +++ b/boot/uboot/Config.in
> @@ -338,6 +338,16 @@ config BR2_TARGET_UBOOT_ZYNQ_IMAGE
>  	 for u-boot-dtb.img file so this U-Boot format is required
>  	 to be set.
>  
> +config BR2_TARGET_UBOOT_SOCFPGA_IMAGE_CRC

I've added ALTERA in the option name.

> +	bool "CRC SPL image for SoC FPGA"

In the prompt.

> +	depends on BR2_arm
> +	depends on BR2_TARGET_UBOOT_SPL
> +	help
> +	  Generate SPL image fixed by the mkpimage tool to enable
> +	  booting on the SoC FPGA based platforms. The tool is
> +	  available at https://github.com/maximeh/mkpimage.
> +	  It requires a Go language compiler installed on your host.

I've tweaked this description to longer refer to Maxime's tool since
you're not using it. I've also s/SoC FPGA/Altera SoC FPGA/. SoC FPGA is
really a poor choice from Altera, since it's just two generic terms put
next to each other, so we really need to write "Altera SoC FPGA"
everywhere, otherwise it's confusing.

Applied with those things fixed.

Best regards,

Thomas
Jan Viktorin March 23, 2016, 12:57 p.m. UTC | #3
Hello,

I am surprise a bit by applying those quite old patchs. I've forgotten
about this patch series entirely. I am afraid, they've fixed this in
U-Boot upstream (2016.01?) by generating *.sfp files. I was testing
this some time ago with:

BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y                                               
BR2_TARGET_UBOOT_SPL=y                                                          
BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl-dtb.sfp"

and it seems to work. I didn't have time to sync this with Buildroot
upstream, sorry.

Regards
Jan

On Tue, 22 Mar 2016 23:54:28 +0100
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:

> Hello,
> 
> On Tue, 20 Oct 2015 13:32:20 +0200, Jan Viktorin wrote:
> > Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> > ---
> >  boot/uboot/Config.in | 10 ++++++++++
> >  boot/uboot/uboot.mk  |  9 +++++++++
> >  2 files changed, 19 insertions(+)
> > 
> > diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> > index 8643dab..b2a69f3 100644
> > --- a/boot/uboot/Config.in
> > +++ b/boot/uboot/Config.in
> > @@ -338,6 +338,16 @@ config BR2_TARGET_UBOOT_ZYNQ_IMAGE
> >  	 for u-boot-dtb.img file so this U-Boot format is required
> >  	 to be set.
> >  
> > +config BR2_TARGET_UBOOT_SOCFPGA_IMAGE_CRC  
> 
> I've added ALTERA in the option name.
> 
> > +	bool "CRC SPL image for SoC FPGA"  
> 
> In the prompt.
> 
> > +	depends on BR2_arm
> > +	depends on BR2_TARGET_UBOOT_SPL
> > +	help
> > +	  Generate SPL image fixed by the mkpimage tool to enable
> > +	  booting on the SoC FPGA based platforms. The tool is
> > +	  available at https://github.com/maximeh/mkpimage.
> > +	  It requires a Go language compiler installed on your host.  
> 
> I've tweaked this description to longer refer to Maxime's tool since
> you're not using it. I've also s/SoC FPGA/Altera SoC FPGA/. SoC FPGA is
> really a poor choice from Altera, since it's just two generic terms put
> next to each other, so we really need to write "Altera SoC FPGA"
> everywhere, otherwise it's confusing.
> 
> Applied with those things fixed.
> 
> Best regards,
> 
> Thomas
Thomas Petazzoni March 23, 2016, 1:06 p.m. UTC | #4
Hello,

On Wed, 23 Mar 2016 13:57:41 +0100, Jan Viktorin wrote:

> I am surprise a bit by applying those quite old patchs. I've forgotten
> about this patch series entirely. I am afraid, they've fixed this in
> U-Boot upstream (2016.01?) by generating *.sfp files. I was testing
> this some time ago with:
> 
> BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y                                               
> BR2_TARGET_UBOOT_SPL=y                                                          
> BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl-dtb.sfp"
> 
> and it seems to work. I didn't have time to sync this with Buildroot
> upstream, sorry.

No problem. Before applying, I looked in U-Boot if there was a tool
called mkpimage, and there wasn't, so I assumed it was still needed.

In this case, could you send some follow-up patches that revert the
changes that are no longer needed, and that update the two Altera
defconfigs to use newer U-Boot versions that have this capability?

Thanks!

Thomas
Jan Viktorin March 23, 2016, 1:10 p.m. UTC | #5
On Wed, 23 Mar 2016 14:06:32 +0100
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:

> Hello,
> 
> On Wed, 23 Mar 2016 13:57:41 +0100, Jan Viktorin wrote:
> 
> > I am surprise a bit by applying those quite old patchs. I've forgotten
> > about this patch series entirely. I am afraid, they've fixed this in
> > U-Boot upstream (2016.01?) by generating *.sfp files. I was testing
> > this some time ago with:
> > 
> > BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y                                               
> > BR2_TARGET_UBOOT_SPL=y                                                          
> > BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl-dtb.sfp"
> > 
> > and it seems to work. I didn't have time to sync this with Buildroot
> > upstream, sorry.  
> 
> No problem. Before applying, I looked in U-Boot if there was a tool
> called mkpimage, and there wasn't, so I assumed it was still needed.
> 
> In this case, could you send some follow-up patches that revert the
> changes that are no longer needed, and that update the two Altera
> defconfigs to use newer U-Boot versions that have this capability?

I'll be happy to do it if I find some time for this.

Jan

> 
> Thanks!
> 
> Thomas
diff mbox

Patch

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 8643dab..b2a69f3 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -338,6 +338,16 @@  config BR2_TARGET_UBOOT_ZYNQ_IMAGE
 	 for u-boot-dtb.img file so this U-Boot format is required
 	 to be set.
 
+config BR2_TARGET_UBOOT_SOCFPGA_IMAGE_CRC
+	bool "CRC SPL image for SoC FPGA"
+	depends on BR2_arm
+	depends on BR2_TARGET_UBOOT_SPL
+	help
+	  Generate SPL image fixed by the mkpimage tool to enable
+	  booting on the SoC FPGA based platforms. The tool is
+	  available at https://github.com/maximeh/mkpimage.
+	  It requires a Go language compiler installed on your host.
+
 menuconfig BR2_TARGET_UBOOT_ENVIMAGE
 	bool "Environment image"
 	help
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 66e728f..8b32154 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -215,6 +215,15 @@  UBOOT_DEPENDENCIES += host-zynq-boot-bin
 UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_GENERATE_ZYNQ_IMAGE
 endif
 
+ifeq ($(BR2_TARGET_UBOOT_SOCFPGA_IMAGE_CRC),y)
+define UBOOT_CRC_SOCFPGA_IMAGE
+	$(HOST_DIR)/usr/bin/mkpimage -o $(BINARIES_DIR)/$(notdir $(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))).crc \
+		$(@D)/$(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))
+endef
+UBOOT_DEPENDENCIES += host-mkpimage
+UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_CRC_SOCFPGA_IMAGE
+endif
+
 ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
 ifeq ($(BR_BUILDING),y)
 ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),)