Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20693 Discussions

buildroot to build toolchain on Linux

Altera_Forum
Honored Contributor II
6,554 Views

TO_BE_DONE

0 Kudos
107 Replies
Altera_Forum
Honored Contributor II
826 Views

Thank you very much! I get the toolchain ,then kernel! 

But how do upload the kernel file to flash ? 

Who can teach me ? 

Who can write a doc ? 

 

Thank you ! 

 

Sorry ,my english so poor!
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

You should find them on the nios2 doc and the forum.  

You should download to ram first, and after you have a lot of tests, then download to flash. 

check, 

http://www.altera.com/literature/ug/ug_nio..._programmer.pdf (http://www.altera.com/literature/ug/ug_nios2_flash_programmer.pdf

 

 

Sorry, I can not help you. I don't use CFI flash.
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

hi hippo: 

 

I have a question aboot follow reference: 

 

************************************************************************* 

NOTE : the inittab was missing when patching the uClinuc-dist-test, add it with 

CODEtouch ~/uClinux-dist-test/vendors/Altera/nios2nommu/inittab 

************************************************************************* 

 

I have already download uClinux-dist-20051110.But I didn't find the uClinux-dist-test. Where is the uClinux-dist-test I can download? 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

You should do the "touch" command after "./build" finished.

0 Kudos
Altera_Forum
Honored Contributor II
826 Views

hi hippo: 

 

I uesed exec ./build commaand,but i got a erro. 

 

The erro informathion follow: 

 

/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strerror.c: In function `strerror':/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strerror.c:663: warning: return discards qualifiers from pointer target type 

if [ x"" != x ]; then  

/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5-final/gcc/xgcc -B/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5-final/gcc/ -B/home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/bin/ -B/home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/lib/ -isystem /home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/include -isystem /home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/sys-include-c -DHAVE_CONFIG_H -g -Os -I. -I/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/../include -W -Wall -Wtraditional -pedantic /home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strsignal.c -o pic/strsignal.o;  

else true; fi 

/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5-final/gcc/xgcc -B/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5-final/gcc/ -B/home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/bin/ -B/home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/lib/ -isystem /home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/include -isystem /home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/sys-include -c -DHAVE_CONFIG_H -g -Os -I. -I/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/../include -W -Wall -Wtraditional -pedantic /home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strsignal.c -o strsignal.o 

/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strsignal.c:414: error: conflicting types for 's trsignal' 

/home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/sys-include/string.h:374: error: previous declaration of 'strsignal' was here 

/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strsignal.c:414: error: conflicting types for 's trsignal' 

/home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/sys-include/string.h:374: error: previous declaration of 'strsignal' was here 

/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strsignal.c: In function `psignal':/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strsignal.c:563: error: argument "signo" doesn't match prototype 

/home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/sys-include/signal.h:141: error: prototype declaration 

/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strsignal.c:563: error: argument "message" doesn 't match prototype 

/home/alex/buildroot/build_nios2/staging_dir/nios2-linux-uclibc/sys-include/signal.h:141: error: prototype declaration 

/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5/libiberty/strsignal.c:568: warning: comparison between sig ned and unsigned 

make[2]: *** [strsignal.o] 错误 1 

make[2]: Leaving directory `/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5-final/nios2-linux-uclibc/libiberty' 

make[1]: *** [all-target-libiberty] 错误 2 

make[1]: Leaving directory `/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5-final'make: *** [/home/alex/buildroot/toolchain_build_nios2/gcc-3.4.5-final/.compiled] 错误 2[alex@localhost download]$ 

 

What can I do? Thank you!
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Attached is the zip containing the kernel's usr/initramfs_list. You should have the similar file AFTER the kernel build. If you can't boot kernel, attach the zip containing your file in the post. 

 

You should check the .config of your kernel. Compare it with the file kernel.config in build.zip, the only diff should be atlera jtag console. It must have correct initramfs setup.
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Hi Alex, 

 

I think you are using the latest buildroot/uClibc which have problems. 

Please use the new build0207 script attached in post#1, remove line 1-34, which prepares source for kernel/uClinux-dist. Remove old ~/buildroot, and run ./build0207
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

hi hippo: 

I remove old buildroot ,rootfs, linux-2.6.x, linux-2.6.15.4 frisst.Then rebuilded the toolschian follow your new update with ./build0207. 

 

But I still failed .I think the failed reason is ccache.samba.org web site 

I got follow informathion: 

 

/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-objcopy  

PREFIX=/home/alex/buildroot/build_nios2/root utils install_utils 

make[1]: Entering directory `/home/alex/buildroot/toolchain_build_nios2/uClibc' 

CC utils/readelf 

STRIP -x -R .note -R .comment ../utils/readelf 

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

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

make[1]: Leaving directory `/home/alex/buildroot/toolchain_build_nios2/uClibc' 

touch -c /home/alex/buildroot/build_nios2/root/usr/bin/ldd 

wget --passive-ftp -P /home/alex/buildroot/dl http://ccache.samba.org/ftp/ccache/ccache-2.4.tar.gz (http://ccache.samba.org/ftp/ccache/ccache-2.4.tar.gz

--12:14:39-- http://ccache.samba.org/ftp/ccache/ccache-2.4.tar.gz (http://ccache.samba.org/ftp/ccache/ccache-2.4.tar.gz

=> `/home/alex/buildroot/dl/ccache-2.4.tar.gz' 

正在解析主机 ccache.samba.org... 66.70.73.150 

正在连接 ccache.samba.org[66.70.73.150]:80... 已连接。 

已发出 HTTP 请求,正在等待回应... 404 Not Found 

12:14:40 错误 404:Not Found。 

 

make: *** [/home/alex/buildroot/dl/ccache-2.4.tar.gz] 错误 1 

[alex@localhost download]$ 

 

I will search other web to obtain the ccache-2.4.tar.gz, then download it in ~/download dir.If you know other web site what have the file ,pelease tell me. 

 

2) I make process, I got other information about watchdog. 

 

patch file drivers/char/watchdogs/Makefile 

Hunk# 1 Failed at 39 

1 out of 1 hunk Failed -saving rejects to file drivers/char/watchdogs/Makefile.rej
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Hi Alex, 

 

1. the ccache is not required, you can disable it. 

cd ~/buildroot 

make menuconfig 

Toolchain Options--> [ ] Enable ccache support? 

make 

 

2. Ignore the watchdog patch fail of the new kernel. You can update the watchdog Makefile later.
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

HI HIPPO: 

 

I make successed,and run in my dvb. 

 

Thank you.
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Hi Alex, 

 

Great!  

How about user's apps, such as BOA, dhcpd ..etc ?
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Hi hippo: 

 

I am testing boa and DHCP now. 

 

Frist I must config the ethernet setting. I use the ifconfig command as follow: 

 

ifconfig eth0 inet addr:192.168.0.85 Mask:255.255.255.0 up 

 

but I find the command not setting my dvb success. 

 

I use ping command use loopback address(127.0.0.1),it's OK. 

 

I think the problem maybe I use wrong config method. 

 

I want to use ifconfig -h command to look for help,but no any information display. 

 

Can you help me? Thank you.
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Sorry, I am not good at network. Maybe someone better help out. 

 

First, check if you have your net device in kernel menuconfig. 

Next, check the boot up message if the net device init.
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Hi hippo: 

 

I successed setting net setting. 

 

1) select Netsetting in menuconfig 

2) select the fact mac/phy product of net device in menuconfig  

 

The correct setting commadn is: 

# ifconfig eth0 netaddr 192.168.0.85 netmask 255.255.255.0 up
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

hi hippo: 

 

I make boa ,dhcp, netsnmp ,but failed. 

 

The failed information: 

 

[alex@localhost uClinux-dist-test]$ make subdirs 

echo "Build start unix" 

Build start unix 

echo 1140414275 

1140414275 

for dir in include lib include user ; do [ ! -d $dir ] || make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc- -C $dir || exit 1 ; done 

make[1]: Entering directory `/home/alex/uClinux-dist-test/include' 

find . -depth -type l -a ! -name Makefile | xargs rm > /dev/null 2>&1 || exit 0 

find . -depth -type d | xargs rmdir > /dev/null 2>&1 || exit 0 

Making symlinks in include/ 

/bin/sh: nios2-linux-uclibc-gcc: command not found 

Making include/c++ symlink to compiler c++ includes 

make[1]: Leaving directory `/home/alex/uClinux-dist-test/include' 

make[1]: Entering directory `/home/alex/uClinux-dist-test/lib' 

for i in ../include ../include /home/alex/uClinux-dist-test/prop ; do  

if [ -d $i ]; then  

touch $i/.sgbuilt_lib;  

make -C $i || exit $? ;  

fi;  

make make_links || exit ;  

done 

make[2]: Entering directory `/home/alex/uClinux-dist-test/include' 

find . -depth -type l -a ! -name Makefile | xargs rm > /dev/null 2>&1 || exit 0 

find . -depth -type d | xargs rmdir > /dev/null 2>&1 || exit 0 

Making symlinks in include/ 

/bin/sh: nios2-linux-uclibc-gcc: command not found 

Making include/c++ symlink to compiler c++ includes 

make[2]: Leaving directory `/home/alex/uClinux-dist-test/include' 

make[2]: Entering directory `/home/alex/uClinux-dist-test/lib' 

Making symlinks in lib/ 

make[2]: Leaving directory `/home/alex/uClinux-dist-test/lib' 

make[2]: Entering directory `/home/alex/uClinux-dist-test/include' 

find . -depth -type l -a ! -name Makefile | xargs rm > /dev/null 2>&1 || exit 0 

find . -depth -type d | xargs rmdir > /dev/null 2>&1 || exit 0 

Making symlinks in include/ 

/bin/sh: nios2-linux-uclibc-gcc: command not found 

Making include/c++ symlink to compiler c++ includes 

make[2]: Leaving directory `/home/alex/uClinux-dist-test/include' 

make[2]: Entering directory `/home/alex/uClinux-dist-test/lib' 

Making symlinks in lib/ 

make[2]: Leaving directory `/home/alex/uClinux-dist-test/lib' 

make[2]: Entering directory `/home/alex/uClinux-dist-test/lib' 

Making symlinks in lib/ 

make[2]: Leaving directory `/home/alex/uClinux-dist-test/lib' 

make[1]: Leaving directory `/home/alex/uClinux-dist-test/lib' 

make[1]: Entering directory `/home/alex/uClinux-dist-test/include' 

find . -depth -type l -a ! -name Makefile | xargs rm > /dev/null 2>&1 || exit 0 

find . -depth -type d | xargs rmdir > /dev/null 2>&1 || exit 0 

Making symlinks in include/ 

/bin/sh: nios2-linux-uclibc-gcc: command not found 

Making include/c++ symlink to compiler c++ includes 

make[1]: Leaving directory `/home/alex/uClinux-dist-test/include' 

make[1]: Entering directory `/home/alex/uClinux-dist-test/user' 

for i in boa dhcpd games net-snmp /home/alex/uClinux-dist-test/vendors/Altera/ni os2nommu/. /home/alex/uClinux-dist-test/prop; do  

if [ -d $i ]; then  

touch $i/.sgbuilt_user;  

make -C $i || exit $? ;  

fi;  

done 

make[2]: Entering directory `/home/alex/uClinux-dist-test/user/boa' 

for i in src ; do make -C $i all || exit ; done 

make[3]: Entering directory `/home/alex/uClinux-dist-test/user/boa/src' 

nios2-linux-uclibc-gcc -Os -g -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED -I/home/alex/uClinux-dist-test -fno-builtin -c -o alias.o alias.c 

make[3]: nios2-linux-uclibc-gcc:命令未找到 

make[3]: *** [alias.o] 错误 127 

make[3]: Leaving directory `/home/alex/uClinux-dist-test/user/boa/src' 

make[2]: *** [all] 错误 2 

make[2]: Leaving directory `/home/alex/uClinux-dist-test/user/boa' 

make[1]: *** [all] 错误 2 

make[1]: Leaving directory `/home/alex/uClinux-dist-test/user' 

make: *** [subdirs] 错误 1 

[alex@localhost uClinux-dist-test]$ 

 

Why do not find the command : nios2-linux-uclibc-gcc? Thank you.
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Your PATH may not have the cross gcc. 

check step4 in post#1. 

try "nios2-linux-uclibc-gcc -v"
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

Sorry to jump in like this... 

 

I managed to compile, build and run 2.6.11 acording to your procedure - I apreciate very much your effort and I'm hopping I speak for a lot o people watching this forum. 

 

Of course, I did run into a few problems after booting: 

 

First, my network interface (OpenCores EthMAC + TDK PHY) doesn't want to work. I get to see the link status (100FDX) when I connect the cable and configure the interface, but that's about all. 

This, however, is going to require some more work on my part. 

 

The reason I'm writting under this topic is that I get the following messages (boot time or dmesg) and don't know if it's going to affect the operation in a very bad way (or not). 

 

(This should be the NO NETWOK kernel, in spite of the messages you see bellow !) 

 

uClinux/Nios II Altera Nios II support (C) 2004 Microtronix Datacom Ltd. Built 1 zonelists Kernel command line: root=/dev/mtdblock0 ro PID hash table entries: 128 (order: 7, 2048 bytes) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory available: 14340k/16384k RAM, 0k/0k ROM (1303k kernel code, 545k data) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) NET: Registered protocol family 16                                          <<< !!!!! NIOS serial driver version 0.0 ttyS0 (irq = 5) is a builtin NIOS UART ttyS1 (irq = 6) is a builtin NIOS UART ttyS2 (irq = 8) is a builtin NIOS UART ttyS3 (irq = 9) is a builtin NIOS UART ttyS4 (irq = 10) is a builtin NIOS UART Serial: JTAG UART driver $Revision: 1.4 $ ttyJ0 at MMIO 0x80920820 (irq = 2) is a jtag_uart io scheduler noop registered io scheduler anticipatory registered RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize physmap flash device: 8000000 at 0 Failed to ioremap                                                         <<<<<<<<< uclinux: RAM probe address=0x11ce450 size=0x0 Creating 1 MTD partitions on "RAM": 0x00000000-0x00000000 : "ROMfs" mtd: partition "ROMfs" is out of reach -- disabled                      <<<<<<<<< uclinux: set ROMfs to be root filesystem                               Microtronix map: Found 1 x16 devices at 0x0 in 16-bit bank Amd/Fujitsu Extended Query Table at 0x0040 Microtronix map: CFI does not contain boot bank location. Assuming top. number of CFI chips: 1 cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. cmdlinepart partition parsing not available RedBoot partition parsing not available Using Microtronix development partition definition Creating 2 MTD partitions on "Microtronix map": 0x00200000-0x00800000 : "romfs" 0x00000000-0x00200000 : "loader/kernel" microtronix: RAM probe address=0x200000 size=0xf3000 Creating 1 MTD partitions on "RAM": 0x00000000-0x000f3000 : "ROMfs" microtronix: set ROMfs to be root filesystem slram: not enough parameters.                                                       <<<<<<<<< blkmtd: version $Revision: 1.5 $                                                        <<<<<<<<< blkmtd: error: missing `device&#39; name                                               <<<<<<<<< NET: Registered protocol family 2                                              << !!!! IP: routing cache hash table of 512 buckets, 4Kbytes                                   << !!!! TCP established hash table entries: 1024 (order: 1, 8192 bytes)                << !!!! TCP bind hash table entries: 1024 (order: 0, 4096 bytes)                               << !!!! TCP: Hash tables configured (established 1024 bind 1024)                          << !!!! NET: Registered protocol family 1                                                     << !!!! Freeing unused kernel memory: 440k freed (0x1152000 - 0x11bf000) init started:  BusyBox v1.1.0 (2006.02.12-20:01+0000) multi-call binary Initializing ramdisk for /var ... Initializing ramdisk for /tmp ... Initializing ramdisk for /mnt ... Mounting /proc filesystem... Mounting /sys filesystem...          Welcome to Our Own(TM)             uClinux NO NET         development environment! nios_01 login: root Nov 30 00:02:37 login: root login  on `ttyJ0&#39; BusyBox v1.1.0 (2006.02.12-20:01+0000) Built-in shell (msh) Enter &#39;help&#39; for a list of built-in commands. #
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

I make the http and boa in uclinux-dist-test and successed. 

 

Then I copy boa.config to /rootfs/etc/config/ after I reworked the original boa.config. I make dir /rootfs/home/httpd and I put my index.html in the dir. 

copy boa and http exec file to /rootfs/bin. 

make kernel again for intramfs. 

 

I download the vmlinux to cyclone1c20 dvb,and it init ok. 

 

I can visit index.html in dvb when I use http as webserver. 

 

But when I use boa as webserver, the uclinux will restart when I viset it use  

IE.
0 Kudos
Altera_Forum
Honored Contributor II
826 Views

HI dumdan, 

 

You are very close to sucess. 

 

1. start with minimal kernel config, (copy kernel2.config to .config). 

2. check if you have network support and your opencore emac / tdk phy in kernel menuconfig, better compile-in kernel, instead of modules. 

ie, minimal config + network + emac + phy 

3. cfi, mtd,ramdisk,and kernel command line are not required in kernel config, because we use initramfs. 

4. boot uclinux, and check if the eth0 init sucessfully.
0 Kudos
Altera_Forum
Honored Contributor II
822 Views

Hi Alex, 

 

1. Are you running linux-2.6.15.4? Please try linux-2.6.x first. 

2. Is the httpd, which sucessed, from busybox? 

3. should boa.conf and mime.types be placed in rootfs/etc ? 

4. try check some debug messages from boa. 

 

..I am really not good at network, sorry.
0 Kudos
Altera_Forum
Honored Contributor II
822 Views

 

--- Quote Start ---  

originally posted by hippo@Feb 21 2006, 11:19 AM 

hi dumdan, 

 

you are very close to sucess. 

 

1. start with minimal kernel config, (copy kernel2.config to .config). 

2. check if you have network support and your opencore emac / tdk phy in kernel menuconfig, better compile-in kernel, instead of modules. 

ie, minimal config + network + emac + phy 

3. cfi, mtd,ramdisk,and kernel command line are not required in kernel config, because we use initramfs. 

4. boot uclinux, and check if the eth0 init sucessfully. 

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

--- quote end ---  

 

--- Quote End ---  

 

 

 

Hi hippo, 

Thanks for the prompt answer. 

You see, my network driver is not really ready, yet. So, for my tests I configured the kernel without network support (NO NET). 

For the network part I was, mostly, concerned with why I still see some netwiork messages. The network is not a major concern of mine, just yet. 

 

Now, I know the goal here is to be able to use initramfs and, because of that, the cfi & mtd-related messages are what i&#39;m concerned about

 

..... 

failed to ioremap 

..... 

mtd: partition "romfs" is out of reach -- disabled 

.... 

Where do these come from and what (if anything) should I do about them ? 

(of course, I could read the sources and figure out for myself, but the time I have is very, very limitted) 

 

Also, I am going to need access to the flash in the very near future, so I&#39;d like to be able to mount readonly a flash partition, if at all possible. That&#39;s why I did not totaly removed the MTD and CFI options. 

What would be the minmal options to be able to access the AMD flash on the eval board and nothing else ? 

 

 

Thanks again, 

 

Daniel
0 Kudos
Reply