Forum Discussion
Altera_Forum
Honored Contributor
20 years agobuildroot to build toolchain on Linux
TO_BE_DONE
107 Replies
- Altera_Forum
Honored Contributor
Hi Sam,
Which linux distribution do you use? what is your gcc version, try "gcc -v" to find out. I have updated with a new build shell script. Please check the update, and let me know if you have any problems. Hippo - Altera_Forum
Honored Contributor
Hi hippo,
thanks for the patch for jtag_uart. The other error is fixed : it can be useful for other : when I first compiled buildroot, I had an error about 2 missing files (ansidecl.h and symcat.h) when compiling elf2flt. To fix this I made a find, and I found them in gcc3 sources, so I made a symlink to them. This is dangerous because it worked with no error, but apparently it was not the right files... I installed binutils-dev (the debian package, which contains those files), and it works correctly now. Thanks again Pierre-olivier - Altera_Forum
Honored Contributor
Hi cetic,
1. missing jtag uart port: add it to include/linux/serial_core.h, download attached kernel2_04.zip
2. missing elf2flt for busybox, download attached busybox_110.zip add the elf2flt stuf to busybox Makefilecd ~/download unzip kernel2_04.zip cd ~/linux-2.6.15.2 patch -p0 <~/download/linux-2.6.15.2-nios2-04.diff
check again with flthdr. then rebuild kernel. Or you may try post#4, to rebuild toolchain. Hippocd ~/download unzip busybox_110.zip cd ~/buildroot/build_nios2/busybox-1.1.0 patch -p1 <~/download/busybox-110.diff rm busybox make cd ~/buildroot make - Altera_Forum
Honored Contributor
Hi all,
thanks Hippo for this post, this is very interesting, however I have 2 questions : - in the post regarding your port of linux-2.6.15.2, when I try to enable the JTAG uart, I get an error message : <div class='quotetop'>QUOTE </div> --- Quote Start --- CC drivers/serial/altera_juart.o drivers/serial/altera_juart.c: In function `jtaguart_type': drivers/serial/altera_juart.c:285: error: `PORT_JTAG_UART' undeclared (first use in this function) drivers/serial/altera_juart.c:285: error: (Each undeclared identifier is reported only once drivers/serial/altera_juart.c:285: error: for each function it appears in.) drivers/serial/altera_juart.c: In function `jtaguart_config_port': drivers/serial/altera_juart.c:311: error: `PORT_JTAG_UART' undeclared (first use in this function) drivers/serial/altera_juart.c: In function `jtaguart_verify_port': drivers/serial/altera_juart.c:322: error: `PORT_JTAG_UART' undeclared (first use in this function) drivers/serial/altera_juart.c: At top level: drivers/serial/altera_juart.c:335: warning: initialization from incompatible pointer type drivers/serial/altera_juart.c:336: warning: initialization from incompatible pointer type make[2]: *** [drivers/serial/altera_juart.o] Error 1 make[1]: *** [drivers/serial] Error 2 make: *** [drivers] Error 2[/b] --- Quote End --- - it seems that I have a problem with the elf2flt : when I try to execute <div class='quotetop'>QUOTE </div> --- Quote Start --- nios2-linux-uclibc-flthdr build_nios2/busybox-1.1.0/busybox[/b] --- Quote End --- I get an error message : <div class='quotetop'>QUOTE </div> --- Quote Start --- Cannot read header of ../buildroot/build_nios2/busybox-1.1.0/busybox[/b] --- Quote End --- and when I run the kernel, I get a bad magic error, which, I think, means that the format of busybox is not flt. Have you any idea on how to solve this ? Thanks a lot Best regards Pierre-olivier - Altera_Forum
Honored Contributor
Hey Hippo,
why i don't find bin folder in ~/buildroot/build_nios2/staging_dir? Whether i need use the same as your fedora environment and install compat-gcc or not. Thanks a lot. Sam mkdir -p /home/samchou/buildroot/toolchain_build_nios2 bzcat /home/samchou/buildroot/dl/uClibc-20060116.tar.bz2 | tar -C /home/samchou/ buildroot/toolchain_build_nios2 -xf - toolchain/patch-kernel.sh /home/samchou/buildroot/toolchain_build_nios2/uClibc toolchain/uClibc/ \*.patch touch /home/samchou/buildroot/toolchain_build_nios2/uClibc/.unpacked cp toolchain/uClibc/uClibc.config /home/samchou/buildroot/toolchain_build_nios2/uClibc/.config /home/samchou/buildroot/toolchain_build_nios2/bin/sed -i -e 's,^CROSS_COMPILER_PREFIX=.*,CROSS_COMPILER_PREFIX="/home/samchou/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-",g' -e 's,# TARGET_nios2 is not set,TARGET_nios2=y,g' -e 's,^TARGET_ARCH="none",TARGET_ARCH=\"nios2\",g' -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"/home/samchou/buildroot/toolchain_build_nios2/linux\",g' -e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' -e 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' /home/samchou/buildroot/toolchain_build_nios2/uClibc/.config /home/samchou/buildroot/toolchain_build_nios2/bin/sed -i -e 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' /home/samchou/buildroot/toolchain_build_nios2/uClibc/.config /home/samchou/buildroot/toolchain_build_nios2/bin/sed -i -e 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' /home/samchou/buildroot/toolchain_build_nios2/uClibc/.config /home/samchou/buildroot/toolchain_build_nios2/bin/sed -i -e 's,# UCLIBC_HAS_THREADS is not set,UCLIBC_HAS_THREADS=y,g' /home/samchou/buildroot/toolchain_build_nios2/uClibc/.config /home/samchou/buildroot/toolchain_build_nios2/bin/sed -i -e 's,# PTHREADS_DEBUG_SUPPORT is not set,PTHREADS_DEBUG_SUPPORT=y,g' /home/samchou/buildroot/toolchain_build_nios2/uClibc/.config /home/samchou/buildroot/toolchain_build_nios2/bin/sed -i -e 's,# LINUXTHREADS_OLD is not set,LINUXTHREADS_OLD=y,g' /home/samchou/buildroot/toolchain_build_nios2/uClibc/.config mkdir -p /home/samchou/buildroot/toolchain_build_nios2/uClibc_dev/usr/include mkdir -p /home/samchou/buildroot/toolchain_build_nios2/uClibc_dev/usr/lib mkdir -p /home/samchou/buildroot/toolchain_build_nios2/uClibc_dev/lib make -C /home/samchou/buildroot/toolchain_build_nios2/uClibc PREFIX=/home/samchou/buildroot/toolchain_build_nios2/uClibc_dev/ DEVEL_PREFIX=/usr/ RUNTIME_PREFIX=/home/samchou/buildroot/toolchain_build_nios2/uClibc_dev/ HOSTCC="gcc" pregen install_dev; make[1]: /home/samchou/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: Command not found make[1]: Entering directory `/home/samchou/buildroot/toolchain_build_nios2/uClibc' make[1]: /home/samchou/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: Command not found ����*make -C extra/config conf make[2]: /home/samchou/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: Command not found make[2]: Entering directory `/home/samchou/buildroot/toolchain_build_nios2/uClibc/extra/config' make[2]: /home/samchou/buildroot/build_nios2/staging_dir/bin/nios2-linux-uclibc-gcc: Command not found ����*make[2]: *** No rule to make target `|', needed by `../../extra/config/conf.o'. Stop. make[2]: Leaving directory `/home/samchou/buildroot/toolchain_build_nios2/uClibc/extra/config' make[1]: *** [extra/config/conf] Error 2 make[1]: Leaving directory `/home/samchou/buildroot/toolchain_build_nios2/uClibc' make: *** [/home/samchou/buildroot/toolchain_build_nios2/uClibc/.configured] Error 2 - Altera_Forum
Honored Contributor
Jdhar,
Happy that you're back. It would be very helpful to test the drivers out with the new kernel. Try it if you have some spare time. Those who want to write their own drivers should work on the new kernel. There are still a lot of codes to clean up. Those are problems in the Microtronix's port. I'm trying to resolve them by cross-checking with other arch, eg sh/h8300/mips. I use subversion too. It is very helpful, when I moved from 2.6.11 up, 2.6.12..., step-by-step. Those attached kernel patches were genereated with "svn diff". I hope Altera can help to setup the svn/git for the tools/kernel, but putting them on to the upsteams is even better. Hippo - Altera_Forum
Honored Contributor
Hey hippo, I'm back (again)! Great thread you started. I have some little snippets of useful info that I would like to add regarding uClinux (common tasks), and I will start posting these on the forum soon. Also, if you need some help putting out these driver sets, I can test out builds for you since I have a whole army of dev boards available http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
I'm not sure if this would be helpful or not (maybe I could get some feedback), but I use SVN for all my internal development. Since I'm constantly rebuilding new toolchains, I could open up my SVN repository that basically combines all this information into one place so users don't have to keep repatching and checking for version nums etc.. J - Altera_Forum
Honored Contributor
UPDATE : merged to post#1
Here come the latest Linux kernel 2.6.15.3 on Nios2. I did include most of the drivers in the mx1.4 release. But I did not build and test them, because I did not have any dev boards to test out. Only serial console is tested. - Altera_Forum
Honored Contributor
<div class='quotetop'>QUOTE </div>
--- Quote Start --- I don't understand how to update the kernel Makefile for modules install
[/b] --- Quote End --- That's a format of diff/patch command. You can use editor, open Makefile, go to line 897, it was,--- Makefile 2006/01/26 06:13:18 1.1 +++ Makefile 2006/01/26 06:14:23 @@ -894,7 +894,7 @@ ifeq "$(strip $(INSTALL_MOD_PATH))" "" depmod_opts := else -depmod_opts := -b $(INSTALL_MOD_PATH)/lib/modules -r +depmod_opts := -b $(INSTALL_MOD_PATH) -r endif .PHONY: _modinst_post _modinst_post: _modinst_
change it todepmod_opts := -b $(INSTALL_MOD_PATH)/lib/modules -r
Do you remember, we have several "patch" commands in the post? A patch file is generated with the "diff" command. When we change some files, we can find the differences from what they were before we change. Send only the change to others, and he can update the files with "patch" command. So if you save the "diff" to a file, Makefile.diff you can update without using editor, with the commanddepmod_opts := -b $(INSTALL_MOD_PATH) -r
The parameter "-p0" mean cut zero dir level from file header, ie, the files in diff are in the same directory. Sometime, we use "-p1", we cut one level dir level from file header. eg, "linux-2.6.x/Makefile" with "-p1" will be the same as "Makefile" with "-p0" .cd ~/linux-2.6.x patch -p0 <Makefile.diff - Altera_Forum
Honored Contributor
The current config for 2.6.15.1 has no module enabled. So you should skip this step.
And the vmlinux is ready for download and test.