- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all. I'm trying to build net-snmp for Nios II uClinux (specifically its agent, snmpd). I found an account of how to do this from forum member "temex" at http://forum.niosforum.com/forum/index.php?showtopic=2955 (http://forum.niosforum.com/forum/index.php?showtopic=2955) (see post# 5 in that topic)), but I seem to be missing the final step and I'm hoping someone here can help.
I downloaded the same version of net-snmp mentioned by temex (5.2.2), but I don't have the (expensive) Microtronix Nios II Linux CDK, so I downloaded what appears to be a very similar thing from http://scorpius.homelinux.org/~marc/nios2.html (http://scorpius.homelinux.org/~marc/nios2.html) (see "binary snapshot of the toolchain", near the bottom of that page). I installed that on a Linux PC and then followed the instructions from temex to build net-snmp for Nios II Linux, which went fine. However, the binaries that it produced were in the ELF format, and uClinux only accepts FLT. So, my problem is: "what do I have to do to get FLT binaries?" I've already tried one approach. I've got the Microtronix Nios II Linux Distribution 1.4 on a Windows PC (which has Quartus II 5.1 and the Nios II Development Kit 5.0), so I tried looking at what its tools do to make FLT binaries. In the Rules.mak for a Nios II Linux Application Project, it uses a program called elf2flt to do this, but when I tried to use that program on the ELF binary that I'd made for snmpd, it died complaining that "Input file contains no relocation info". I noticed that the Rules.mak file used some linker options that might be needed to make elf2flt work on the resulting ELF file (it uses -r, -d, -Ur, and -T <a particular linker script>), so I tried making the net-snmp build process use those options by giving --with-ldflags="..." to ./configure. (I had to leave out -d because, when I supplied it, ./configure complained that nios2-linux-gcc couldn't make executables and wouldn't proceed.) However, when I built with these extra flags and tried to convert the ELFs, elf2flt still died with the same complaint. This seems odd to me, because the -r flag means to make a relocatable file, which is what elf2flt was demanding. I think the resulting ELF files might have been the same size as before, too ... So ... does anyone know what I've done wrong? http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif Thanks in advance.Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is a problem of gcc check in configure.
You could add a short dummy --with-ldflag for configure only, eg, "-Wl,-v". After it build Makefile, edit the LDFLAGS in Makefile to include -elf2flt.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Awesome. After doing that, the binaries that the build made were in the FLT format. Thanks very much!
To anyone else looking to get net-snmp's snmpd to work, I also needed to configure my kernel to support large mem allocations (Processor type and features -> Allow allocating large blocks of memory), and I need to run snmpd with -f. After that just set up the environment on your uClinux system like how snmpd needs it (i.e. with the .conf and the MIBs) and it runs fine.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi tschmelcher,
I have been working with buildroot team to sync up the nios2 port of marc's. It is getting to the final stage now. Please help to try out the new buildroot toolchain, and let me know if there is problem. Thanks. http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174) hippo- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks hippo, I'm going to try out the buildroot toolchain. I'll let you know how it goes.
About net-snmp, if anyone needs to port 5.3.0.1, you can use the same procedure as for 5.2.2, except I also needed to comment out the definitions of getutent, endutent, and setutent in agent/mibgroup/host/hr_system.c (they're already defined in uClibc and the linker complains about having two sets of them). Also, if you use the same toolchain binaries as I did, then gcc's optimizer will introduce a bug when compiling agent/mibgroup/hardware/cpu/cpu.c. Either add 'asm("nop");' after the call to _cpu_update_stats on line 34, or compile with -O1 instead of -O2. Incidentally, I've also found that it's not necessary to use --with-ldflags="-Wl,-v" and then edit the Makefiles to add -elf2flt. You can just use --with-ldflags="-elf2flt" when running ./configure.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
tschmelcher,
how big did your executable get? When I build it , the snmpd has 1636952 Bytes. Is this approx right ? Is there a way to make it leaner?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page