News:

Did you know - Google aren't very nice.  Apparently we're all evil pirates here on OpenIPCam, and they cancelled my adsense account due to that.  Sigh.

Author Topic: need help creating a custom BSP using buildroot  (Read 11086 times)

June 15, 2013, 04:45:15 am
cool, well at least we're making some kind of progress, looks like we're almost right on top of the problem. Question: does the older, working 2.4 version of uclinux that's part of the BSP also use elf2flt? If so, perhaps we could source a linker script from there?

  • **
June 15, 2013, 04:50:04 am
Good question.  The 2.4 BSP seems to use much the same linker script - no extab/exidx sections.  So I guess there must be some way to compile code without these sections?  There is some mention that elf2flt needs to be updated to handle the different sections produced by new versions of GCC, so I'm not sure whether it will be possible to avoid producing these sections, or whether we will have to update elf2flt.

June 15, 2013, 05:25:40 am
ok, so now Ive jumped into the actual source code for elf2flt.
It does appear that the elf2flt utility is rather old/obsolete, and it looks like it has pretty much been abandoned.. Perhaps youre right, and its going to be necessary to update elf2flt (I even read on some message list that someone gave up on it and created their own elf-flat converter...). Its going to be slow-going on my end, Im playing a large amount of catch-up on this, as Im pretty clueless on how most of this low-level stuff works.

the elf2flt source code is in the 'output/toolchain/elf2flt' folder

btw, there's an option for elf2flt for 'loading to ram', any idea what that could be used for, and if it could have something to do with these issues?

  • **
June 15, 2013, 05:42:52 am
Not sure, but it could be used to control XIP (execute in place), which is where the executable file is run directly from the filesystem in flash without loading it into RAM first, saving memory (since the flash can be accessed just like RAM anyway.)

I'm experimenting with compiler flags at the moment, in the hope that the right combination of flags might cause these sections to be omitted, so elf2flt doesn't complain about them.  I'll post back if I have any luck - at the moment I have done a clean build and now binutils won't compile because it doesn't like the -W,elf2flt option (because elf2flt hasn't been installed yet...no idea how I got it to compile the first time!)

June 22, 2013, 10:47:54 pm
Any updates on this?
did you have any luck finding a solution via the compiler flags?

FYI, don't know if this will help, but while I was looking into a solution for building an XIP kernel, I found the following code in the file ./linux-3.1/arch/arm/kernel/vmlinux.lds.S @around line 52:
Code: [Select]
/DISCARD/ : {
*(.ARM.exidx.exit.text)
*(.ARM.extab.exit.text)
ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
ARM_EXIT_DISCARD(EXIT_TEXT)
ARM_EXIT_DISCARD(EXIT_DATA)
EXIT_CALL
#ifndef CONFIG_HOTPLUG
*(.ARM.exidx.devexit.text)
*(.ARM.extab.devexit.text)
#endif
#ifndef CONFIG_MMU
*(.fixup)
*(__ex_table)
#endif
#ifndef CONFIG_SMP_ON_UP
*(.alt.smp.init)
#endif
*(.discard)
*(.discard.*)
}
although this set of linker commands appears to be specific to the kernel build, perhaps that /DISCARD/ directive might be the key we're looking for. Apparently, it is meant to 'discard' those input sections from the final linked output. Could this be a possible solution?

  • **
June 29, 2013, 06:56:54 pm
Sorry I haven't had a chance to get back to this for a couple of weeks.  I was hoping the buildroot team could tell me why buildroot was trying to compile binutils for the target when it's not required and I haven't selected it, but I haven't heard back.

I'm not sure that discarding those sections would be a solution - the error is complaining that the sections aren't there - so they must already be discarded somewhere.

I did change the linker script to keep those sections, but then I got the errors in my earlier post which have me pretty stumped.  Maybe the solution is to modify elf2flt so that it is able to cope if those sections are missing?