[ELDK] Binutils error - Building a 3.x kernel with ELDK 5.1

Wolfgang Denk wd at denx.de
Mon Mar 19 20:40:43 CET 2012


Dear Fernando Carrio Argos,

In message <862116BDE7CDFD459FBA2837D571B41132EFC0BB at CERNXCHG22.cern.ch> you wrote:
> 
> I applied the sequent commands:
> 
> root at fcarrio-VirtualBox# source /opt/eldk-5.1/powerpc-4xx-softfloat/environment-setup-ppc405-linux

I see two problems here:

- First: thee is absolutely no reason that justifies running these
  commands as root.  It is a very, very bad idea to always work as
  root - please restict this to the very few administrative commands
  that really need it, and work as a normal user otherwise.

- Second: you are building for a 44x system, so you should use a tool
  chain configuration for these, and not one for 40x systems.  Please
  use "powerpc-4xx" instead of "powerpc-4xx-softfloat".

However, none of these items cause the problem you see.


> If I don't specify the ARCH I obtain the next error:
> ...# make 44x/> virtex5_defconfig
...
> *** Can't find default configuration "arch/x86/configs/44x/virtex5_defconfig"!

I recommend to export ARCH, i. e. run

	$ export ARCH=powerpc

so you can run "make" without adding an "ARCH=" argument on each
command line.

However, this also does not cause your problem.

I tested the very same commands you used, it's working fine for me.

> And when I use the male command it crashes but only for 3.x kernels:
> root at fcarrio-VirtualBox:/home/fcarrio/work/linux1/linux-2.6-xlnx# make -s -j8 ARCH=powerpc simpleImage.initrd.virtex440-ml507
> *** 3.0 kernels no longer build correctly with old versions of binutils.
> *** Please upgrade your binutils to 2.12.1 or newer

OK - there is a significant differenc here.  I did my tests with the
latest stable 3.x kernel (v3.2.9), while you used some 3.0.x version.

The relevant code has changed between these releases - in 3.2.9,
there is no such test any more.  It has been removed with commit
v3.2-rc2-15-ga9a8f77:

commit a9a8f77ac72d6dd3c92ea268291678836f77681c
Author: Kyle Moffett <Kyle.D.Moffett at boeing.com>
Date:   Mon Nov 7 13:30:43 2011 +0000

    powerpc: Remove buggy 9-year-old test for binutils < 2.12.1
    
    Recent binutils refuses to assemble AltiVec opcodes when in e500/SPE
    mode, as some of those opcodes alias the "SPE" instructions.  This
    triggers an ancient binutils version check even when building a kernel
    with CONFIG_ALTIVEC disabled.
    
    In theory, the check could be conditionalized on CONFIG_ALTIVEC, but in
    practice it has long outlived its utility.  It is virtually impossible
    to find binutils older than 2.12.1 (released 2002) in the wild anymore.
    Even ancient RedHat Enterprise Linux 4 has binutils-2.14.
    
    To fix the kernel build when done natively on e500 systems with this new
    binutils, the test is simply removed.
    
    Signed-off-by: Kyle Moffett <Kyle.D.Moffett at boeing.com>
    Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 57af16e..70ba0c0 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -255,12 +255,6 @@ checkbin:
                echo 'disable kernel modules' ; \
                false ; \
        fi
-       @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
-               echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
-               echo 'correctly with old versions of binutils.' ; \
-               echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \
-               false ; \
-       fi


It would be safe to apply the same patch to your kernel tree.


However, this is also NOT the cause of your problems, because I can build
the latest stable 3.0 release (v3.0.23) just fine, like all others.

As we can see from above patch, the failing test is simple:

	/bin/echo dssall | $(AS) -many -o $(TOUT)

It just tests if the assembler digests a single "dssall" instruction.

The tools for Power Architecture(R) systems in ELDK 5.1 definitely do.

So is there any chance you do NOT run the ELDK assembler?

$(AS) is set in the top level Makefile as "$(CROSS_COMPILE)as" ; to
pick up the wrong version either your PATH or your CROSS_COMPILE
settings would have to be incorrect.

I am positively sure that you set PATH correctly becuase you source the 
"environment-setup-*" script.  However... this does not set CROSS_COMPILE...

Let's try...

-> unset CROSS_COMPILE
-> make -s -j8 ARCH=powerpc simpleImage.initrd.virtex440-ml507
*** 3.0 kernels no longer build correctly with old versions of binutils.
*** Please upgrade your binutils to 2.12.1 or newer
make: *** [checkbin] Error 1


Bingo!!

Your problems are caused by not setting CROSS_COMPILE as needed.

Please try:

	$ export ARCH=powerpc
	$ export CROSS_COMPILE=powerpc-linux-

Then retry your build.


I realize that this is a shortcoming of our documentation. I will try
and improve that.

You might also look into using the "eldk-switch" tool which makes all
this stuff much easier - I've always used it, so I never ran into the
issue as you did.


Best regards,

Wolfgang Denk

-- 
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: wd at denx.de
Computers are not intelligent.  They only think they are.


More information about the eldk mailing list