Forum Discussion
Altera_Forum
Honored Contributor
20 years agoUpdate to buildroot toolchain for nios2
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/buildroot36 Replies
- Altera_Forum
Honored Contributor
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
4. update buildroot/toolchain/uClibc/uClibc.configCONFIG_STATIC=y EXTRA_CFLAGS_OPTIONS="-D__uClinux__ -Dfork=vfork"# CONFIG_START_STOP_DAEMON is not set CONFIG_FEATURE_2_6_MODULES=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.diffDL_FINI_CRT_COMPAT=y COMPAT_ATEXIT=y
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's buildroot/build_nios2/busybox/Rules.mak, add elf2fltIndex: 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"
buildroot/build_nios2/busybox/Makefile, comment out the stripcmd#LDFLAGS+=-nostdlib# LIBRARIES:=$(LIBCDIR)/lib/libc.a -lgcc LDFLAGS+=-Wl,-elf2flt="-s 16000" -Wl,-v -Wl,-d LIBRARIES:=-lc -lgcc
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.busybox: .depend $(libraries-y) $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group# $(STRIPCMD) $@ - Altera_Forum
Honored Contributor
failed build gcc,because can'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. - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by leonqin@Jan 9 2006, 04:01 PM failed build gcc,because can'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/
- Altera_Forum
Honored Contributor
wait, I found some problem in busybox. I am trying to fix it.
- Altera_Forum
Honored Contributor
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.
buildroot/package/busybox.config, should update more settings--- 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/build_nios2/busybox/Rules.mak, should have libc and libgccCONFIG_STATIC=y# CONFIG_START_STOP_DAEMON is not set CONFIG_FEATURE_2_6_MODULES=y# 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") - Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
Thank you very much
- Altera_Forum
Honored Contributor
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 '/usr/local/nios2_toolschain/buildroot/package/config' gcc: installation problem, cannot exec 'cc1':没有那个文件或目录 >> Unable to findthe Ncurses libraries. >> >> You must have Ncurses installed in order >> to use 'make menuconfig' >> >> Maybe you want to try 'make config, which >> doesn't depend on the Ncurese libraries. make[1]: *** [ncurses] Error 1 make[1]: Leaving directory '/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? - Altera_Forum
Honored Contributor
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 - Altera_Forum
Honored Contributor
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.