All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] u-boot: Add support for Altera mkpimage generation
Date: Fri, 10 Feb 2017 10:30:34 +0100	[thread overview]
Message-ID: <20170210103034.2036a164@free-electrons.com> (raw)
In-Reply-To: <20170210091030.dalq2ch2xazgb2w7@ed>

Hello,

On Fri, 10 Feb 2017 10:10:31 +0100, Lionel Flandrin wrote:

> > I missed it on my first review, but it seems like you missed it as
> > well: we already have some logic in uboot.mk to call mkpimage. See the
> > BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC option.
> > 
> > This should be extended rather than having two options doing the same
> > thing.  
> 
> I didn't miss it but the existing code is used for u-boot SPL
> generation, I didn't think there was an easy way to reuse it for
> "full" u-boot packaging (but admitedly my Make-foo is a bit
> weak). It's a different set of options.
> 
> The previous altera chips only had a 64K internal RAM which meant that
> you almost always had to use a SPL to bootstrap the bootloader. The
> newer chips however contain 256K of internal RAM so you can fit a full
> u-boot in a single stage quite snugly.

OK. Then I think we want something better indeed, because it's
completely impossible to understand if we have two separate options.

Here is what I would propose:

 1. Add an option BR2_TARGET_UBOOT_FORMAT_DTB_BIN so select
    u-boot-dtb.bin as the output format.

 2. Adjust the BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC option logic
    so that it will mkpimage the SPL if there is a SPL, or mkpimage the
    full U-Boot if u-boot-dtb.bin is selected. Something like:

config BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC
        bool "CRC U-Boot image for Altera SoC FPGA"
        depends on BR2_arm
        depends on BR2_TARGET_UBOOT_SPL || BR2_TARGET_UBOOT_FORMAT_DTB_BIN
        help

	  Pass the U-Boot image through the mkpimage tool to enable
	  booting on the Altera SoC FPGA based platforms.

	  On some platforms, it's the SPL that needs to be passed
	  through mkpimage. On some other platforms there is no SPL
	  because the internal SRAM is big enough to store the full
	  U-Boot. In this case, it's directly the full U-Boot image
	  that is passed through mkpimage.

	  Therefore, this option will convert the SPL image defined by
	  BR2_TARGET_UBOOT_SPL_NAME using mkpimage if
	  BR2_TARGET_UBOOT_SPL is enabled. Otherwise, it will convert
	  the full U-Boot image u-boot-dtb.bin if
	  BR2_TARGET_UBOOT_FORMAT_DTB_BIN is enabled.

And then in the .mk file, something like:

ifeq ($(BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC),y)
ifeq ($(BR2_TARGET_UBOOT_SPL),y)
UBOOT_CRC_ALTERA_SOCFPGA_INPUT_IMAGES = $(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME))
else
UBOOT_CRC_ALTERA_SOCFPGA_INPUT_IMAGES = u-boot-dtb.bin
endif
define UBOOT_CRC_ALTERA_SOCFPGA_IMAGE
        $(foreach f,$(UBOOT_CRC_ALTERA_SOCFPGA_INPUT_IMAGES), \
                $(HOST_DIR)/usr/bin/mkpimage \
                        -o $(BINARIES_DIR)/$(notdir $(call qstrip,$(f))).crc \
                        $(@D)/$(call qstrip,$(f))
        )
endef
UBOOT_DEPENDENCIES += host-mkpimage
UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_CRC_ALTERA_SOCFPGA_IMAGE
endif

Could you try this, and verify it works for both the SPL and full
U-Boot image cases?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-02-10  9:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 11:16 [Buildroot] [PATCH 1/3] mkpimage: rewrite to support header version 1 Lionel Flandrin
2017-01-26 11:17 ` [Buildroot] [PATCH 2/3] u-boot: Add support for Altera mkpimage generation Lionel Flandrin
2017-01-26 11:17   ` [Buildroot] [PATCH 3/3] DEVELOPERS: Add Lionel Flandrin to package/mkpimage Lionel Flandrin
2017-01-26 11:25 ` [Buildroot] [PATCH 1/3] mkpimage: rewrite to support header version 1 Lionel Flandrin
2017-01-26 11:28   ` Lionel Flandrin
2017-01-27  8:17     ` Thomas Petazzoni
2017-01-27  9:52       ` Lionel Flandrin
2017-01-28  8:42         ` Thomas Petazzoni
2017-01-28 11:27           ` Lionel Flandrin
2017-01-30 10:33             ` [Buildroot] [PATCH 1/2] mkpimage: bump to latest barebox version Lionel Flandrin
2017-01-30 10:33               ` [Buildroot] [PATCH 2/2] u-boot: Add support for Altera mkpimage generation Lionel Flandrin
2017-02-09 22:33                 ` Thomas Petazzoni
2017-02-10  9:10                   ` Lionel Flandrin
2017-02-10  9:30                     ` Thomas Petazzoni [this message]
2017-02-10 13:21                       ` Lionel Flandrin
2017-02-13 13:59                 ` [Buildroot] [PATCH 1/2] u-boot: add an option to generate u-boot-dtb.bin Lionel Flandrin
2017-02-13 13:59                   ` [Buildroot] [PATCH 2/2] u-boot: add support for full image socfpga mkpimage support Lionel Flandrin
2017-02-13 14:27                     ` Thomas Petazzoni
2017-02-13 14:57                       ` Lionel Flandrin
2017-02-13 15:20                         ` Thomas Petazzoni
2017-02-13 15:33                     ` [Buildroot] [PATCH v2 2/2] u-boot: add support for full image socfpga mkpimage Lionel Flandrin
2017-03-05 21:31                       ` Thomas Petazzoni
2017-03-05 21:30                   ` [Buildroot] [PATCH 1/2] u-boot: add an option to generate u-boot-dtb.bin Thomas Petazzoni
2017-02-09 22:34               ` [Buildroot] [PATCH 1/2] mkpimage: bump to latest barebox version Thomas Petazzoni

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=20170210103034.2036a164@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.