Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12745 Discussions

Update to buildroot toolchain for nios2

Altera_Forum
Honored Contributor II
4,338 Views

UPDATE : This post is out of date. Please follow the new one, 

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

 

 

Vapier has kindly incorporated patches from marc into the buildroot. 

Try out the lastest update of buildroot/uClibc/busybox with svn now or daily snapshot (tommorow). 

svn co svn://uclibc.org/trunk/buildroot
0 Kudos
36 Replies
Altera_Forum
Honored Contributor II
1,370 Views

I have tested the new buildroot. 

It works now with buildroot-snapshot, uClibc-0.9.28, busybox-snapshot. 

http://buildroot.uclibc.org/downloads/snap...napshot.tar.bz2 (http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2

http://www.uclibc.org/downloads/uclibc-0.9.28.tar.bz2 (http://www.uclibc.org/downloads/uclibc-0.9.28.tar.bz2

http://busybox.net/downloads/snapshots/bus...napshot.tar.bz2 (http://busybox.net/downloads/snapshots/busybox-snapshot.tar.bz2

 

1. unpack buildroot , tar jxf buildroot-snapshot.tar.bz2 

 

2. download uClibc-0.9.28 into buildroot/dl dir. 

# unpack uClibc-0.9.28,  

tar jxf uClibc-0.9.28.tar.bz2 

# remove the line of "default nios2-elf-" from uClibc-0.9.28/extran/Configs/Config.nios2 

# repack 

tar jcf uClibc-0.9.28.tar.bz2 uClibc-0.9.28 

 

3. update buildroot/package/busybox/busybox.config 

CONFIG_STATIC=y EXTRA_CFLAGS_OPTIONS="-D__uClinux__ -Dfork=vfork"# CONFIG_START_STOP_DAEMON is not set CONFIG_FEATURE_2_6_MODULES=y 

 

4. update buildroot/toolchain/uClibc/uClibc.config 

 DL_FINI_CRT_COMPAT=y  COMPAT_ATEXIT=y 

 

5. get the elf2flt patch of marc's into buildroot/dl 

http://bugs.uclibc.org/file_download.php?f...id=225&type=bug (http://bugs.uclibc.org/file_download.php?file_id=225&type=bug

update the first part of elf2flt.diff 

Index: buildroot/toolchain/Config.in =================================================================== --- buildroot/toolchain/Config.in    2006-01-07 16:15:08.000000000 +0800 +++ buildroot/toolchain/Config.in    2006-01-09 09:08:15.000000000 +0800 @@ -10,6 +10,7 @@ source "toolchain/ccache/Config.in" source "toolchain/gdb/Config.in" source "toolchain/sstrip/Config.in" +source "toolchain/elf2flt/Config.in" comment "Common Toolchain Options" 

Apply the patch 

cd buildroot 

patch -p1 <dl/elf2flt.diff 

 

6. in buildroot dir 

make menuconfig 

select nios2, in toolchain option, 

[ ] Use a daily snapshot of uClibc?  

[*] Enable elf2flt support?  

[ ] Include target utils in cross toolchain 

 

7. make, it will make binutils,gcc,uclibc, and fail in busybox 

 

8. update the busybox&#39;s 

buildroot/build_nios2/busybox/Rules.mak, add elf2flt 

#LDFLAGS+=-nostdlib# LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc LDFLAGS+=-Wl,-elf2flt="-s 16000" -Wl,-v -Wl,-d LIBRARIES:=-lc -lgcc 

buildroot/build_nios2/busybox/Makefile, comment out the stripcmd 

busybox: .depend $(libraries-y)     $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group#     $(STRIPCMD) $@ 

 

9. cd buildroot/build_nios2/busybox, make menuconfig 

in "shell->", choose default shell "msh", unselect ash, select "standalone shell". 

 

10. back to buildroot/ 

make, and it will build busybox 

 

11. copy the buildroot/build_nios2/root to another place, cp -a 

remove usr/lib,usr/include 

it is your new root fs now. 

add a sym-link for initramfs , ln -s /sbin/init init 

 

This is the cross compiler for nios2 with default to uClibc, and the root fs with busybox. 

Thanks a lots, to marc and vapier.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

failed build gcc,because can&#39;t connected to mirros.rcn.net to get gcc-3.4.2.tar.bz2. 

where the server(mirros.rcn.net) located? 

within china ,many site outside china can not connected.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

 

--- Quote Start ---  

originally posted by leonqin@Jan 9 2006, 04:01 PM 

failed build gcc,because can&#39;t connected to mirros.rcn.net to get gcc-3.4.2.tar.bz2. 

where the server(mirros.rcn.net) located? 

within china ,many site outside china can not connected. 

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

--- quote end ---  

 

--- Quote End ---  

 

 

You can search gnu mirrors in china. Most universities have ftp mirror for unix/gnu. 

www.gnu.org 

 

China: ftp://linuxforum.net/ftp.gcc.gnu.org/ (ftp://linuxforum.net/ftp.gcc.gnu.org/), thanks to David Deng (david99deng at yahoo dot com) 

 

China 

 

* ftp.cs.cuhk.edu.hk/pub/gnu/gnu/ 

 

* sunsite.ust.hk/pub/gnu/
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

wait, I found some problem in busybox. I am trying to fix it.

0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

It is cleared. And it is running now. 

The dev nodes in buildroot/build-nios2/root/dev/ are incorrect when running as a linux user account. 

remove and create them in your rootfs/dev with mknod. 

add a line "::sysinit:/bin/sh" to rootfs/etc/inittab for console shell. 

add dir rootfs/sys for sysfs. 

it is better to run buildroot using linux root account. 

 

You should place all the downloaded tarballs (gcc,binutils.. etc) in the buildroot/dl dir. 

 

more patch buildroot/dl/uClibc-0.9.28.tar.bz2, (which I found before but forget to add this time) 

upack,update,repack. 

--- uClibc-0.9.28/libc/misc/internals/__uClibc_main.c    2006/01/09 09:08:11    1.1 +++ uClibc-0.9.28/libc/misc/internals/__uClibc_main.c    2006/01/10 01:17:40 @@ -256,7 +256,7 @@ } # ifdef _DL_FINI_CRT_COMPAT -extern int weak_function main(int argc, char **argv, char **envp); +extern int main(int argc, char **argv, char **envp); void __attribute__ ((__noreturn__)) __uClibc_start_main(int argc, char **argv, char **envp,       void (*app_fini)(void), void (*app_init)(void)) 

 

buildroot/package/busybox.config, should update more settings 

CONFIG_STATIC=y# CONFIG_START_STOP_DAEMON is not set CONFIG_FEATURE_2_6_MODULES=y 

 

buildroot/build_nios2/busybox/Rules.mak, should have libc and libgcc 

# For other libraries, you are on your own.  But these may (or may not) help...# LDFLAGS+=-nostdlib# LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc LDFLAGS+=-Wl,-elf2flt="-s 16000" -Wl,-v -Wl,-d LIBRARIES:=-lc -lgcc# CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR) -funsigned-char# GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

Alex, 

 

Sorry I am not good at chinese typing, and I will use english. 

 

1. the buildroot/dl used to be created by the buildroot make. 

but we will mkdir of it by hand before make. 

and put all other download into it in advance. 

 

2. the uClibc-0.9.28.tar.bz2 will be unpack to uClibc-0.9.28 without the need to specify dir name. 

the busybox-snapshot.tar.bz2 will be unpack to busybox without the need to specify dir name. 

you should place *bz2 in buildroot/dir, unpack , update, and repack in the dl dir. 

 

I have just met with the people from Altera. I have asked them to setup a ftp mirror for these tools for nios2 in China, to solve the download problem. I have asked them to translate more docs into chinese, too. They have a chinse nios2 forum and chinse altera support. But I suggest them to merge, to support all native languages all over the world. If you have any suggestions, let me know, and I will forward to their high-level managements.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

Thank you very much

0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

hi: 

 

question A: 

 

When I execed patch command after I updated the elf2lt.diff ,but got following 

information.  

# patch -p1 <dl/elf2flt.diff 

patching file toolchain/Config.in 

patch:**** malformed patch at line 13:Index: buildroot/toolchain/elf2flt/Config.in 

 

Why? 

 

question B: 

 

In buildroot dir I execed make command, but fail. 

# make 

make -C package/config ncurses conf mconf 

make[1]: Entering directory &#39;/usr/local/nios2_toolschain/buildroot/package/config&#39; 

gcc: installation problem, cannot exec &#39;cc1&#39;:&#27809;&#26377;&#37027;&#20010;&#25991;&#20214;&#25110;&#30446;&#24405; 

 

>> Unable to findthe Ncurses libraries. 

>> 

>> You must have Ncurses installed in order 

>> to use &#39;make menuconfig&#39; 

>> 

>> Maybe you want to try &#39;make config, which 

>> doesn&#39;t depend on the Ncurese libraries. 

 

make[1]: *** [ncurses] Error 1 

make[1]: Leaving directory &#39;/usr/local/nios2_toolschain/buildroot/package/config, 

make: *** [package/config/mcong] Error 2 

 

In package, I find ncurses dir.But the dir is empty.If i want to use ncurses, frist I 

must download ncurses source code in the dir?
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

You may write your question in chinese here. 

 

A. the patch is incorrect between first and second file. 

Just apply the orginal patch without the modification. 

There will be only one fail in the first part. then edit the file buildroot/toolchain/Config.in with an editor on Linux. add the line for elf2flt at about line 13. 

 

source "toolchain/elf2flt/Config.in

 

B. You need to install Ncurese libraries to your Linux for buildroot. 

 

If you use slackware, it is in "L" set. 

File: ncurses-5.3-i386-1.tgz for slackware 9.0 

installpkg ncurses-5.3-i386-1.tgz 

 

If you use redhat/fedora core 

File: ncurses-5.4-17.i386.rpm for fc4 

rpm -ivh ncurses-5.4-17.i386.rpm 

or yum ncurses
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

Vapier sync up kernel header 2.6.11 to buildroot now, (use svn). Thank you, vapier. 

You can choose kernel head 2.6.11 in buildroot menuconfig. 

2.6.11 is the kernel version used in Microtronix release 1.4.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

Great help from Vapier. Now the elf2flt is in the buildroot svn. 

 

cd buildroot svn update 

 

You don&#39;t need to add patch by hand. 

Just select elf2flt in buildroot menuconfig -> toolchain option.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

 

--- Quote Start ---  

originally posted by alex824@Jan 10 2006, 09:26 AM 

&#25105;&#22312;&#25105;&#30340;/buildroot/toolchain/  &#30340;&#30446;&#24405;&#19979;&#27809;&#26377;&#25214;&#21040;elf2flt &#36825;&#20010;&#25991;&#20214;&#22841;.&#25105;&#35273;&#30340;&#25105;&#26377;&#21487;&#33021;&#23433;&#35013; 

toolchain&#26377;&#38382;&#39064;. 

--- Quote End ---  

 

 

You should never use any language but English on an international forum; most of the users are non native speakers and if everyone started using their own language, the forum would become completely useless. 

 

The idea behind a forum like this is that we learn from each others problems and help where we can. If you decide to use Chinese, you limit your target audience and the usability for ppl to reply. If you wanted to send a personal message to another user, you should have used that functionality instead of the forum.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

 

--- Quote Start ---  

originally posted by hippo@Jan 4 2006, 09:51 AM 

vapier has kindly incorporated patches from marc into the buildroot. 

try out the lastest update of buildroot/uclibc/busybox with svn now or daily snapshot (tommorow). 

svn co svn://uclibc.org/trunk/buildroot 

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

--- Quote End ---  

 

 

I haven&#39;t been able to test the new SVN release, but does it include the changes from Thomas Chou too (I don&#39;t know if he submitted this in parallel or if those patches still should be sent to buildroot)? 

 

Thomas did a great job on this forum and with upgrading the buildroot patches to the latest busybox/uclibc releases.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

marc, I am so sorry. 

 

Because my english very poor. I send a chinese mail to hippo.But hippo&#39;s 

pc not support chinese type. So I use chinese in BBS.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

 

--- Quote Start ---  

originally posted by alex824@Jan 10 2006, 10:15 AM 

because my english very poor. i send a chinese mail to hippo.but hippo&#39;s 

pc not support chinese type. so i use chinese in bbs. 

--- Quote End ---  

 

 

You shouldn&#39;t worry that your english is not perfect, from what I&#39;ve read from your posts and mails, you always manage to get your point across, no problem there. 

 

Judging by the poor quality of posts on /. and other forums, the english from native english speakers isn&#39;t perfect either, so we&#39;re in good company http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

Thank for the reminding from marc. We shall keep it. 

 

I would like to give my best thanks to marc and vapier. 

I reminded vapier of the prior post from marc, bug# 273. 

I did patch some of the *.S code to nios2 for the new abi in uClibc 0.9.28/29, bug# 616-618. 

Most of the works came from marc, I just learn and follow him. 

Vapier has been always helpful to sync up the patches. psm gives some helpful hints, too. 

 

These are works in progress.  

And still need a lot of tests and fixs, which all you can help.
0 Kudos
Altera_Forum
Honored Contributor II
1,370 Views

Alex, 

 

The update of elf2flt should be in tommorow&#39;s snapshot. 

But it seems to have "segment fault", I shall find out and fix it.  

Use the older one, and patch to add elf2flt by hand. 

 

What browser do you use for downloading? The naming .tar.tar is strange. 

 

you should update the file 

buildroot/dl/uClibc-0.9.28/libc/misc/internals/__uClibc_main.c 

as in the previous post# 6, remove "weak_function" from main(). 

 

you should update the uClibc-0.9.28.tar.bz2 in the buildroot/dl dir, 

without using "remove file", ie "rm" is not needed, just overwrite it, 

cd buildroot/dl tar jcf uClibc-0.9.28.tar.bz2 uClibc-0.9.28 

 

buildroot/package/busybox/busybox.config 

we need static obj, add CONFIG_STATIC=y as in post#6, 

## Build Options# CONFIG_STATIC=y CONFIG_LFS=y# USING_CROSS_COMPILER is not set EXTRA_CFLAGS_OPTIONS="-D__uClinux__ -Dfork=vfork" 

 

other steps are correct. 

then you should proceed to step 6 of my previous post# 2, to make menuconfig, make. 

 

good luck, and let me know if you have any questions.
0 Kudos
Altera_Forum
Honored Contributor II
1,301 Views

Frist I download toolschain use IE 6.0 in windows XP.Then I copied these files to my another PC of red hat linux OS. 

 

I will try again . 

 

Thanks hippo.
0 Kudos
Reply