Forum Discussion
107 Replies
- 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
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,
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
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
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 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 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,
My environment is gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-53). I try your new build shell script but still encounter the same problem which don't include bin folder in ~/buildroot/build_nios2/staging_dir. Do i need to change my environment or need to modify something? Thanks a lot. - Altera_Forum
Honored Contributor
Hi Sam,
Your Linux env may be too old. Please try install a fedora core 4. Please select "development" pakages when you install the Linux. And include compat gcc. Hippo - Altera_Forum
Honored Contributor
Hi nvs,
The .config is not related to ptf. The ptf is used to create a header file for hardware address. When you run,
it will ask you some questions, like these. And you should make selections. <div class='quotetop'>QUOTE </div> --- Quote Start --- no emulation specific options. RUNNING hwselect --- Please select which CPU you wish to build the kernel against: (1) cpu_0 - Class: altera_nios2 Type: f Version: 5.1 Selection: 1 --- Please select a device to upload the kernel to: (1) cfi_flash_0 Class: altera_avalon_cfi_flash Size: 8388608 bytes Selection: 1 --- Please select a device to execute kernel from: (1) ddr_sdram_0 Class: ddr_sdram_component Size: 67108864 bytes (2) onchip_memory_0 Class: altera_avalon_onchip_memory2 Size: 8192 bytes Selection: 1 --- Summary using PTF: /home/jack/prog/v1.ptf CPU: cpu_0 Device to upload to: cfi_flash_0 Program memory to execute from: ddr_sdram_0 --- Settings written to /home/jack/linux-2.6.15.3/arch/nios2nommu/hardware.mk[/b] --- Quote End --- You will always need a cfi memory for the hwselect perl script, even when you use EPCS. Just add a dummy cfi flash to a copy of your real ptf and make the hwselect happy. It is for hwselect only. You dont need it for hardware. That's what required for hwselect, <div class='quotetop'>QUOTE </div> --- Quote Start --- You should start with a mininal system with only nios2 cpu core,dram,timer,jtag/serial console and a cfi flash, (which can be dummy and removed later). Note, the interrupt vector (ie, execption vector) should be in uClinux program memory.[/b] --- Quote End --- You need a full featured timer.make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc- hwselect SYSPTF=your_system.ptf