Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

buildroot on Gentoo Linux

Hello, all.

This is my first post, so please be patient with me ;-)

I'm using Gentoo Linux, and trying to build the nios2 toolchain using yesterday's snapshot buildroot.

As a first experiment, I tried leaving most of the menuconfig options as-is. Here's the list of what I altered from the defaults:

- target architecture changed from i386 to nios2

- build options -> number of simultaneous from 1 to 2

I also tried GCC 3.4.1, 3.4.2 and 3.4.3, but the behaviour is the same in each case.

Here's the make output:

rm -rf /home/therrien/Dev/uC/buildroot/build_nios2/root/usr/lib/libgcc_s*.so*

cp -a /home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/lib/libgcc_s* /home/therrien/Dev/uC/buildroot/build_nios2/root/lib/

cp: cannot stat `/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/lib/libgcc_s*': No such file or directory

make: [/home/therrien/Dev/uC/buildroot/build_nios2/root/lib/libgcc_s.so.1] Error 1 (ignored)

touch -c /home/therrien/Dev/uC/buildroot/build_nios2/root/lib/libgcc_s.so.1

make -C /home/therrien/Dev/uC/buildroot/toolchain_build_nios2/uClibc PATH=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin:/home/therrien/Dev/uC/buildroot/toolchain_build_nios2/bin:/bin:/sbin:/usr/bin:/usr/sbin AR=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-ar AS=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-as LD=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-ld NM=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-nm CC=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc GCC=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc CXX=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-g++ CPP=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-cpp RANLIB=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-ranlib STRIP=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-strip OBJCOPY=/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-objcopy

PREFIX=/home/therrien/Dev/uC/buildroot/build_nios2/root utils install_utils

make[1]: Entering directory `/home/therrien/Dev/uC/buildroot/toolchain_build_nios2/uClibc'

make[2]: Nothing to be done for `all'.

make CROSS=" /home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-" CC="/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc" -C utils utils_install

install -d /home/therrien/Dev/uC/buildroot/build_nios2/root/usr/bin# install -m 755 ../utils/readelf /home/therrien/Dev/uC/buildroot/build_nios2/root/usr/bin/readelf

make[1]: Leaving directory `/home/therrien/Dev/uC/buildroot/toolchain_build_nios2/uClibc'

mkdir -p /home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/target_utils

install -c /home/therrien/Dev/uC/buildroot/build_nios2/root/usr/bin/ldd

/home/therrien/Dev/uC/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/target_utils/ldd

install: cannot stat `/home/therrien/Dev/uC/buildroot/build_nios2/root/usr/bin/ldd': No such file or directory

make: *** [/home/therrien/Dev/uC/buildroot/build_nios2/root/usr/bin/ldd] Error 1

As was mentioned somewhere in the "help buildroot" topic, the ".so" error is expected.

However, it's the "ldd" error that's blocking me.

I'd appreciate any help you could provide.

Looking forward to trying this out! ;-)

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Welcome.

    Vapier, one of the developer of buildroot/uclibc/busybox, also develope Gentoo Linux.

    He had helped a lot to port Nios2. So it should work with Gentoo.

    But the configuration setting may be tricky and some latest update may break Nios2.

    So you might follow my buildroot guide, and take the build script and patches as a starting point.

    http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174)

    Happy hacking.

    Hippo
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by hippo@May 2 2006, 11:03 AM

    welcome.

    vapier, one of the developer of buildroot/uclibc/busybox, also develope gentoo linux.

    he had helped a lot to port nios2. so it should work with gentoo.

    but the configuration setting may be tricky and some latest update may break nios2.

    so you might follow my buildroot guide, and take the build script and patches as a starting point.

    http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174)

    happy hacking.

    hippo

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=14948)

    --- quote end ---

    --- Quote End ---

    Hi, Hippo.

    Thanks very much for the information, it&#39;s been useful thus far.

    Unfortunately, though, the snapshots your example build pick up are no longer visible on the websites...the oldest snapshot found there now is 20060409, and your script wants to download 20060320.

    I tried using 20060409 with your build script, but it looks like the patches are not 100% compatible (I run into the "rope" C++ build problem; I patched that, then ran into other problems later on, so gave up, pegging the failures to incompatible patches).

    One other note (though not a big deal): your build script seems to assume that "sh" or "bash" is being used as the shell...I run tcsh, and so I had to alter your instructions slightly...perhaps, next time you edit the notes, you could either alter the script, or put in a note, something like this:

    - if you use bash/sh, you can simply type "./build"

    - if you use any other shell (e.g. csh/tcsh), use "bash -c ./build"

    Are you planning to prepare a build with a newer snapshot?

    Also, for all the patches you provide in the build zip file, is there a plan for these to (eventually) make their way into the buildroot/busybox/etc. repositories?

    Thanks again,

    -- therrien
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by therrien+may 9 2006, 10:05 pm--><div class='quotetop'>quote (therrien @ may 9 2006, 10:05 pm)</div>

    --- quote start ---

    <!--quotebegin-hippo@May 2 2006, 11:03 AM

    welcome.

    vapier, one of the developer of buildroot/uclibc/busybox, also develope gentoo linux.

    he had helped a lot to port nios2. so it should work with gentoo.

    but the configuration setting may be tricky and some latest update may break nios2.

    so you might follow my buildroot guide, and take the build script and patches as a starting point.

    http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174)

    happy hacking.

    hippo

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=14948)

    --- quote end ---

    --- Quote End ---

    Hi, Hippo.

    Thanks very much for the information, it&#39;s been useful thus far.

    Unfortunately, though, the snapshots your example build pick up are no longer visible on the websites...the oldest snapshot found there now is 20060409, and your script wants to download 20060320.

    I tried using 20060409 with your build script, but it looks like the patches are not 100% compatible (I run into the "rope" C++ build problem; I patched that, then ran into other problems later on, so gave up, pegging the failures to incompatible patches).

    One other note (though not a big deal): your build script seems to assume that "sh" or "bash" is being used as the shell...I run tcsh, and so I had to alter your instructions slightly...perhaps, next time you edit the notes, you could either alter the script, or put in a note, something like this:

    - if you use bash/sh, you can simply type "./build"

    - if you use any other shell (e.g. csh/tcsh), use "bash -c ./build"

    Are you planning to prepare a build with a newer snapshot?

    Also, for all the patches you provide in the build zip file, is there a plan for these to (eventually) make their way into the buildroot/busybox/etc. repositories?

    Thanks again,

    -- therrien

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=15224)</div>

    [/b]

    --- Quote End ---

    Thank you for the kindly suggestions. That would be very helpful.

    The rope index issue of c++ was resovled by hootsmon, posted to buildroot and updated in the later snapshots. Thanks a lot to him.

    For the latest buildroot snapshots, I will try them and let you know.

    I shall add bash at the first line of the build script. And I am going to divide the build script in to parts, so that they may be easier to read and use. I am also working on the coming nios wiki, hope it will be more readable, too.

    I have a binary tools from buildroot. You might try out, at

    http://forum.niosforum.com/forum/index.php?showtopic=3879 (http://forum.niosforum.com/forum/index.php?showtopic=3879)

    I need more people to join the work to clean up the patches and post them to buildroot/uclibc/busybox. namely,

    1. svn13898 break the gcc for nios2, there are some undefined mul/div calls in compiled objects. I have reversed the patches in build script. But we still need to find out, and fix it.

    2. svn13961 break the elf2flt.ld with fini data. The elf2flt.ld was a reduced link script, and failed because it does not contain fini data. I rebuild it from normal link script. We have used it for months. maybe it is time to post the new elf2flt.ld to vapier, and he should post it to uclinux.org .

    3. a minor problem of do strip to busybox, we can not strip an FLAT obj. There is a new flag for flat in latest busybox Makefile, we need to find out the usage.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for the reply, hippo.

    I tried downloading/running the zImage you posted, and it worked...a great start.

    I figured the next step would be to try and compile a kernel and apps using the tools you had pre-built.

    I ran into some problems.

    I followed the instructions as found on http://forum.niosforum.com/forum/index.php?showtopic=3879 (http://forum.niosforum.com/forum/index.php?showtopic=3879).

    I&#39;m using the std_1s10.ptf.

    I got through the "hwselect" and "menuconfig" steps fine. But the zImage build failed, like this:

    arch/nios2nommu/boot/compressed/head.S: Assembler messages:
    arch/nios2nommu/boot/compressed/head.S:111: Error: symbol `_start&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:117: Error: symbol `text_init&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:126: Error: symbol `data_init&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:146: Error: symbol `flush_cache&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:151: Error: symbol `data_flush&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:158: Error: symbol `text_flush&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:169: Error: symbol `fake_headers_as_bzImage&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:202: Error: symbol `_start&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:208: Error: symbol `text_init&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:217: Error: symbol `data_init&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:237: Error: symbol `flush_cache&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:242: Error: symbol `data_flush&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:249: Error: symbol `text_flush&#39; is already defined
    arch/nios2nommu/boot/compressed/head.S:260: Error: symbol `fake_headers_as_bzImage&#39; is already defined
    make: ***  Error 1
    make: ***  Error 2

    I also noticed that the following Makefiles had 3 times the same content in them (i.e. 3 exact copy/paste copies of the same Make rules within the same file):

    arch/nios2nommu/boot/Makefile
    arch/nios2nommu/boot/compressed/Makefile

    This was leading to a number of Makefile warnings, saying that some rules were being ignored due to other rules being present, or some such.

    In any case, I edited those files to remove the duplicates. Then I re-ran the build steps as follows:

    clean

    hwselect

    menuconfig

    zImage

    I still get the same errors I quoted above.

    Any ideas?

    Thanks,

    -- therrien
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Scratch that......

    the file "head.S" also had 3 copies of the content, just like the Makefiles.

    And so did the following files:

    arch/nios2nommu/boot/compressed/Makefile
    arch/nios2nommu/boot/compressed/head.S
    arch/nios2nommu/boot/compressed/install.sh
    arch/nios2nommu/boot/compressed/misc.c
    arch/nios2nommu/boot/compressed/nios2_sio.c
    arch/nios2nommu/boot/compressed/vmlinux.lds
    arch/nios2nommu/boot/compressed/vmlinux.lds.S
    arch/nios2nommu/boot/compressed/vmlinux.scr

    Might&#39;ve been a bad patch? Or a patch applied 3 times or something?

    Anyways, I&#39;ve removed the duplicates, and things are working a whole lot better:

      CHK     usr/initramfs_list
      CC      arch/nios2nommu/boot/compressed/misc.o
      OBJCOPY arch/nios2nommu/boot/compressed/vmlinux.bin
      GZIP    arch/nios2nommu/boot/compressed/vmlinux.bin.gz
      LD      arch/nios2nommu/boot/compressed/piggy.o
      LD      arch/nios2nommu/boot/compressed/vmlinux
      OBJCOPY arch/nios2nommu/boot/zImage
    Kernel: arch/nios2nommu/boot/zImage is ready

    Thanks and sorry for the noise,

    -- therrien