[Buildroot] Using u-boot tools

Kantanu Kumar Mohapatra kantanukumar at gmail.com
Tue Sep 30 13:16:32 UTC 2014


Thanks Thomas,

On Tue, Sep 30, 2014 at 3:28 PM, Thomas De Schampheleire <
patrickdepinguin at gmail.com> wrote:

> Hi Kantanu,
>
> On Tue, Sep 30, 2014 at 11:33 AM, Kantanu Kumar Mohapatra
> <kantanukumar at gmail.com> wrote:
>
> >
> > Thanks a lot Thomas for your reply. Sorry for the typo, please consider
> the
> > new version as buildroot-2014.02.
> >
> > Let me explain all in detail.
> >
> > old br2:
> > ========
> > version: 2010.05
> > uboot: 2010.03(customized)
> > uboot-tools: 2010.03 (used from uboot src)
> >
> >
> > New br2 (which I am upgrading to):
> > ===========================
> > version: 2014.02
> > uboot: 2010.03(customized, same should be across tools too)
> > uboot-tools: 2014.01 ( should be same as uboot-2010.03)
>
> While I can understand that you do not want to update u-boot itself,
> what is the problem to use the most recent version of u-boot-tools ?
> In the cases I have seen, there was no conflict when using the most
> recent u-boot-tools with images of an older u-boot.
>
> ​The problem here is the files inside tools/env/, (fw_env.c, fw_env.h,
fw_env_main.c) where custom changes are placed.​

​I want to retain the old files​, I can't take the change and apply that to
tools-14, as I am not authorized to change those files.

> >
> > In br2-14, I am getting the uboot image(.bin) properly, which I
> customized
> > to get a .rom with my headers added to it, done in boot/uboot/uboot.mk
> >
> > Here the problem which I faced is "fw_printenv" executable, which is
> built
> > in tools, for br2-2014.02. fw_printenv is created, when getting the uboot
> > image in br2-2010.03 (target/uboot/Makefile.in).
> >
> > In br2-2014.02,
> > Tools should be taken from the source, which went into
> > output/build/uboot-2010.03, But instead it creates another
> > uboot-tools-2014.01 inside output/build/ and places source there.
> >
> > How to build that fw_printenv, in old way like br2-10, seen as below?
> >
> > $(TARGET_DIR)/usr/sbin/fw_printenv: $(U_BOOT_DIR)/$(U_BOOT_BIN)
> >     mkdir -p $(@D)
> >     $(TARGET_CC) -I$(U_BOOT_DIR)/include -I$(LINUX_HEADERS_DIR)/include \
> >         -D_custom_flag \
> >         -DUSE_HOSTCC -o $@ \
> >         $(U_BOOT_DIR)/tools/env/*.c $(U_BOOT_DIR)/lib_generic/crc32.c
>
> This is no longer used. In buildroot 2010.05, the rules to build
> fw_printenv were indeed part of buildroot explicitly, as shown above.
> In buildroot 2014.02, we are using the u-boot makefiles to define how
> to build these tools. So you cannot simply use the same way as you did
> for buildroot-2010.05.
>
> >
> > I want to use another "-D_custom_flag" to build "fw_printenv", in br2-14.
> > Please suggest me the changes to be done. If I change
>  UBOOT_TOOLS_VERSION
> > = 2010.03, in  uboot-tools.mk, getting compilation error, as it has
> > dependency on host-tools.
>
> I think you have two options:
>
> 1. add a patch for u-boot itself, adding your custom -D flag in the
> appropriate u-boot makefile (probably in tools/env/Makefile, but I
> don't know if this was already the case in u-boot-2010.03, I haven't
> checked).
>
> 2. In package/uboot-tools/uboot-tools.mk, there is this code:
>
> define UBOOT_TOOLS_BUILD_CMDS
>     $(MAKE) -C $(@D)             \
>         CROSS_COMPILE="$(TARGET_CROSS)"    \
>         CFLAGS="$(TARGET_CFLAGS)"    \
>         LDFLAGS="$(TARGET_LDFLAGS)"    \
>         CROSS_BUILD_TOOLS=y        \
>         tools-only
>     $(MAKE) -C $(@D)             \
>         CROSS_COMPILE="$(TARGET_CROSS)"    \
>         CFLAGS="$(TARGET_CFLAGS)"    \
>         LDFLAGS="$(TARGET_LDFLAGS)"    \
>         env no-dot-config-targets=env
> endef
>
> The second make command is (as far as I can see) responsible for
> building the fw_printenv tool. If your custom flag can safely be
> passed to other tools inside the tools/env directory of u-boot, then
> you could consider adding your custom flag here too, something like:
>     $(MAKE) -C $(@D)             \
>         CROSS_COMPILE="$(TARGET_CROSS)"    \
>         CFLAGS="$(TARGET_CFLAGS) -Dcustom_flag"    \
>         LDFLAGS="$(TARGET_LDFLAGS)"    \
>         env no-dot-config-targets=env
>
> Note that I have not tested this explicitly.
>
> ​I have tried to add the flag only for env, ​

​that gets compiled. I can see a fw_printenv executable inside tools/env/,
the size shows 30K in tools/env/, but it is not same in target/sbin/(22k).
I need the old files to compile with this flag​.

Hope this helps,
> Thomas
>


​Many thanks for your help,
Kantanu​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140930/2dc6c6a7/attachment.html>


More information about the buildroot mailing list