Skip to contentSkip to conversation

U-Boot: could not cross-compile u-boot tools

U-Boot Heiko Schocher 4 participants 7 messages Feb 27, 2014 – Feb 28, 2014 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hello all,

just noticed, that it is not longer possible to cross-compile the u-boot tools:

"Older" U-Boot (= before kbuild changes), could cross-compile the u-boot tools:

$ git log
commit 9137d19bdd321b810275f2e967e3a39165a4e8de
Author: Heiko Schocher <[email protected]>
Date:   Thu Jan 30 11:02:13 2014 +0100

net, phy: atheros ar803x bug
[...]

$ make mrproper
$ make IDS8247_config
Configuring for IDS8247 board...
$ make HOSTCC=${CROSS_COMPILE}gcc HOSTSTRIP=${CROSS_COMPILE}strip -s tools
$ powerpc-linux-objdump -f tools/mkimage

tools/mkimage: file format elf32-powerpc
architecture: powerpc:common, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x10001320

With current mainline:

$ git checkout master
Gewechselt zu Zweig 'master'
$ make mrproper
$ make IDS8247_config
Configuring for IDS8247 board...
$ make CROSS_COMPILE=powerpc-linux-  -s tools
$ powerpc-linux-objdump -f tools/mkimage

tools/mkimage: file format elf64-little
architecture: UNKNOWN!, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000004019c8

$ objdump -f tools/mkimage

tools/mkimage: file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000004019c8

$ make HOSTCC=${CROSS_COMPILE}gcc HOSTSTRIP=${CROSS_COMPILE}strip -s tools
/lib/ld.so.1: No such file or directory
make[1]: *** [scripts/basic/fixdep] Fehler 255
make: *** [scripts_basic] Fehler 2
$

Is this a Bug, which should be fixed? Any hints?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw
Quoted 49 lines · Heiko Schocher

Hello all,

just noticed, that it is not longer possible to cross-compile the u-boot tools:

"Older" U-Boot (= before kbuild changes), could cross-compile the u-boot tools:

$ git log
commit 9137d19bdd321b810275f2e967e3a39165a4e8de
Author: Heiko Schocher <[email protected]>
Date:   Thu Jan 30 11:02:13 2014 +0100

net, phy: atheros ar803x bug
[...]

$ make mrproper
$ make IDS8247_config
Configuring for IDS8247 board...
$ make HOSTCC=${CROSS_COMPILE}gcc HOSTSTRIP=${CROSS_COMPILE}strip -s tools
$ powerpc-linux-objdump -f tools/mkimage

tools/mkimage: file format elf32-powerpc
architecture: powerpc:common, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x10001320

With current mainline:

$ git checkout master
Gewechselt zu Zweig 'master'
$ make mrproper
$ make IDS8247_config
Configuring for IDS8247 board...
$ make CROSS_COMPILE=powerpc-linux-  -s tools
$ powerpc-linux-objdump -f tools/mkimage

tools/mkimage: file format elf64-little
architecture: UNKNOWN!, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000004019c8

$ objdump -f tools/mkimage

tools/mkimage: file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000004019c8

Quoted 7 lines
$ make HOSTCC=${CROSS_COMPILE}gcc HOSTSTRIP=${CROSS_COMPILE}strip -s tools
/lib/ld.so.1: No such file or directory
make[1]: *** [scripts/basic/fixdep] Fehler 255
make: *** [scripts_basic] Fehler 2
$

Is this a Bug, which should be fixed? Any hints?

It seems like we need to pick up
http://lists.linaro.org/pipermail/linaro-kernel/2013-August/005772.html

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140227/87d59f53/attachment.pgp>
#5 lore raw

Hello Tom,

Am 27.02.2014 15:30, schrieb Tom Rini:

Quoted 6 lines · Heiko Schocher
Quoted 5 lines

Hello all,

just noticed, that it is not longer possible to cross-compile the u-boot tools:

[...]

Quoted 28 lines
Quoted 28 lines

With current mainline:

$ git checkout master
Gewechselt zu Zweig 'master'
$ make mrproper
$ make IDS8247_config
Configuring for IDS8247 board...
$ make CROSS_COMPILE=powerpc-linux-  -s tools
$ powerpc-linux-objdump -f tools/mkimage

tools/mkimage: file format elf64-little
architecture: UNKNOWN!, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000004019c8

$ objdump -f tools/mkimage

tools/mkimage: file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000004019c8

$ make HOSTCC=${CROSS_COMPILE}gcc HOSTSTRIP=${CROSS_COMPILE}strip -s tools
/lib/ld.so.1: No such file or directory
make[1]: *** [scripts/basic/fixdep] Fehler 255
make: *** [scripts_basic] Fehler 2
$
Quoted 4 lines
Quoted 1 line

Is this a Bug, which should be fixed? Any hints?

It seems like we need to pick up
http://lists.linaro.org/pipermail/linaro-kernel/2013-August/005772.html

Yes, this seems a way to go...

@Masahiro: What is your opinion?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#6 lore raw

Hello Heiko,

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Is this a Bug, which should be fixed? Any hints?

It seems like we need to pick up
http://lists.linaro.org/pipermail/linaro-kernel/2013-August/005772.html

Yes, this seems a way to go...

@Masahiro: What is your opinion?

Hmm, I don't like such a patch because
[1] It changes too much
[2] We must build tools in two steps.
First time, build tools for host
make O=path/to/buildhost/ silentoldconfig prepare scripts
Second time, built tools for the target
make HOSTCC=$CROSS_COMPILE \
KBUILD_SCRIPTROOT=path/to/buildhost/
silentoldconfig prepare scripts
It seems ridiculous to type so many magic commands.

Heiko, can you check if the following works for you?

Modify tools/Makefile as follows

--- a/tools/Makefile
+++ b/tools/Makefile
@@ -5,6 +5,10 @@
# SPDX-License-Identifier: GPL-2.0+
#

   +ifneq ($(CROSS_BUILD_TOOLS),)
   +HOSTCC = $(CC)
   +endif
   +
    #
    # toolchains targeting win32 generate .exe files
    #

Usage:
Build tools for host
make CROSS_COMPILE=<your_gcc_prefix> tools
Build tools for target
make CROSS_BUILD_TOOLS=1 CROSS_COMPILE=<your_gcc_prefix> tools

This is my log.

$ make IDS8247_config
Configuring for IDS8247 board...
$ make CROSS_COMPILE=powerpc-linux-gnu- CROSS_BUILD_TOOLS=1 tools
  GEN     include/autoconf.mk.dep
  GEN     include/autoconf.mk
  CHK     include/config/uboot.release
  UPD     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  UPD     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  HOSTCC  scripts/basic/fixdep
  CC      lib/asm-offsets.s
  GEN     include/generated/generic-asm-offsets.h
  HOSTCC  tools/aisimage.o
  HOSTCC  tools/crc32.o
  HOSTCC  tools/default_image.o
  HOSTCC  tools/dumpimage.o
  HOSTCC  tools/env_embedded.o
  HOSTCC  tools/envcrc.o
  HOSTCC  tools/fdt.o
  HOSTCC  tools/fdt_ro.o
  HOSTCC  tools/fdt_rw.o
  HOSTCC  tools/fdt_strerror.o
  HOSTCC  tools/fdt_wip.o
  HOSTCC  tools/fit_image.o
  HOSTCC  tools/image-fit.o
  HOSTCC  tools/image-host.o
  HOSTCC  tools/image.o
  HOSTCC  tools/imagetool.o
  HOSTCC  tools/imximage.o
  HOSTCC  tools/kwbimage.o
  HOSTCC  tools/md5.o
  HOSTCC  tools/mkenvimage.o
  HOSTCC  tools/mkimage.o
  HOSTCC  tools/mxsimage.o
  HOSTCC  tools/omapimage.o
  HOSTCC  tools/os_support.o
  HOSTCC  tools/pblimage.o
  HOSTCC  tools/sha1.o
  HOSTCC  tools/ublimage.o
  HOSTLD  tools/envcrc
  HOSTCC  tools/gen_eth_addr
  HOSTCC  tools/img2srec
  HOSTLD  tools/mkenvimage
  HOSTLD  tools/dumpimage
  HOSTLD  tools/mkimage
  HOSTCC  tools/proftool
$ file tools/mkimage
tools/mkimage: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0xb76ad5a10a41700fcab9e86c079118c424446d89, with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70401, not stripped

Uknown Issue:
Tools are not stripped.
Too big for your target board?

Best Regards
Masahiro Yamada

#7 lore raw

Hallo Masahiro,

Am 28.02.2014 10:03, schrieb Masahiro Yamada:

Quoted 7 lines

Hello Heiko,

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

Is this a Bug, which should be fixed? Any hints?

It seems like we need to pick up
http://lists.linaro.org/pipermail/linaro-kernel/2013-August/005772.html

Quoted 6 lines
Quoted 3 lines

Yes, this seems a way to go...

@Masahiro: What is your opinion?

Hmm, I don't like such a patch because
[1] It changes too much

Ok, if there is an easier way, that would be great!

Quoted 8 lines

[2] We must build tools in two steps.
First time, build tools for host
make O=path/to/buildhost/ silentoldconfig prepare scripts
Second time, built tools for the target
make HOSTCC=$CROSS_COMPILE \
KBUILD_SCRIPTROOT=path/to/buildhost/
silentoldconfig prepare scripts
It seems ridiculous to type so many magic commands.

But it should be possible to compile the "tools" for the target. If this a serperate build step, that is as it was before the kbuild changes, so that should be no problem.

Quoted 20 lines

Heiko, can you check if the following works for you?

Modify tools/Makefile as follows

   --- a/tools/Makefile
   +++ b/tools/Makefile
   @@ -5,6 +5,10 @@
    # SPDX-License-Identifier:     GPL-2.0+
    #

    +ifneq ($(CROSS_BUILD_TOOLS),)
    +HOSTCC = $(CC)
    +endif
    +
     #
     # toolchains targeting win32 generate .exe files
     #
Quoted 5 lines

Usage:
Build tools for host
make CROSS_COMPILE=<your_gcc_prefix> tools
Build tools for target
make CROSS_BUILD_TOOLS=1 CROSS_COMPILE=<your_gcc_prefix> tools

Yep, works, great!

Quoted 3 lines

This is my log.

$ make IDS8247_config

[...]

Quoted 8 lines
$ file tools/mkimage
tools/mkimage: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0xb76ad5a10a41700fcab9e86c079118c424446d89, with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70401, not stripped

Uknown Issue:
Tools are not stripped.
Too big for your target board?

strip them would be nice ...

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#8 lore raw

Dear Heiko & Masahiro,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines

Usage:
Build tools for host
make CROSS_COMPILE=<your_gcc_prefix> tools
Build tools for target
make CROSS_BUILD_TOOLS=1 CROSS_COMPILE=<your_gcc_prefix> tools

Yep, works, great!

I'm not really hapy with the additional CROSS_BUILD_TOOLS paramert - but this may be a matter of taste, so the following is just a thought and a question:

Would it make more sense to provide a sparate make target instead?

Say, something like this:

Build tools for host
make CROSS_COMPILE=<your_gcc_prefix tools
Build tools for target
make CROSS_COMPILE=<your_gcc_prefix cross_tools

?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
Comparing information  and  knowledge  is  like  asking  whether  the
fatness  of  a  pig  is more or less green than the designated hitter
rule."                                               - David Guaspari
#9 lore raw
Quoted 18 lines · Wolfgang Denk

Dear Heiko & Masahiro,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines

Usage:
Build tools for host
make CROSS_COMPILE=<your_gcc_prefix> tools
Build tools for target
make CROSS_BUILD_TOOLS=1 CROSS_COMPILE=<your_gcc_prefix> tools

Yep, works, great!

I'm not really hapy with the additional CROSS_BUILD_TOOLS paramert - but this may be a matter of taste, so the following is just a thought and a question:

Would it make more sense to provide a sparate make target instead?

Quoted 8 lines

Say, something like this:

Build tools for host
make CROSS_COMPILE=<your_gcc_prefix tools
Build tools for target
make CROSS_COMPILE=<your_gcc_prefix cross_tools

?

I agree, this seems more natural.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140228/9fa31ae4/attachment.pgp>