[Buildroot] Using buildroot to compile Xilinx Kernel - ELF file error

Arnout Vandecappelle arnout at mind.be
Tue Dec 18 09:02:43 UTC 2018

 Hi Gaston,

 Please keep the list in Cc, there may be other people who benefit from this

 Also please don't top-post, but reply inline like I do below.

On 18/12/2018 03:25, Gaston Melo wrote:
> Hi Arnout, thanks for your reply. Im totally new to buildroot (and for embedded
> world too). I was trying to embedded linux on spartan (xilinx ISE design 14.7).
> Im following this tutorial
> https://numato.com/kb/galatea-microblaze-and-linux-how-to-run-linux-on-galatea-pci-express-spartan-6-fpga-board/

 ... but with a more recent Buildroot than 2015.11 I hope...

> What I understand from section 3 from this tutorial, what I need to do is build
> the kernel (config of kernel from xilinx), this are the step I did:
> 1) config the xilinx kernel according to my needs.
> 2) get the config and copy to a folder inside buildroot
> 3) Make menuconfig inside buildroot and make some settings (according to
> microblaze - big endian - etc)
> 4) execute make and wait to finish process
> 5) download to fpga the simpleImage from /output/image to the fpga

 Sounds correct.

 However, what I don't understand is how and where this "readelf: Error: Not an
ELF file" message appears.

 Oh, I'm starting to understand: apparently the simpleImage is in fact an ELF
file, so I guess the tool you use to download is calling readelf... Is it
correct that it is the download that fails?

> Sorry to ask, but I dont understand  the cross-readelf. I find this
> microblaze-linux-readelf but I dont understand how to use it. I sent you my
> buildroot config for the fpga. Is there a pdf that I can read about using
> buildroot for embedded?

 You mean, other than what is referenced on https://buildroot.org/docs.html ?

> Im planning to use it for arm but im trying to learn
> first with fpga. A simple tutorial will be an start.

 Generally, running stuff on FPGA is way more complicated than running it on a
real CPU... E.g. if you have a beaglebone, you can just follow the instructions
in board/beaglebone/readme.txt and things will work out of the box.


> Thanks for your help.
> Regards
> Gastón
> On Mon, Dec 17, 2018 at 9:15 PM Arnout Vandecappelle <arnout at mind.be
> <mailto:arnout at mind.be>> wrote:
>     On 15/12/2018 22:46, Gaston Melo wrote:
>     > hi to all
>     >
>     > im really new on embedded world and I build a kernel using buildroot
>     >
>     > Im using the xilinx kernel (downloaded from github xilinx repository) and
>     > already make configs. I have the dts file generated by device-tree on ISE 14.7
>     >
>     > I can build the kernel using buildroot but my problem is when I tried to
>     > download the elf file to the spartan 6.
>     >
>     > it says "readelf: Error: Not an ELF file - it has the wrong magic bytes at the
>     > start"
>      What you say here doesn't make a lot of sense... The kernel is typically not an
>     ELF file (well, the vmlinux image is but that's not what you normally use), and
>     on the target system you typically don't have a readelf executable... So what
>     exactly are you doing here?
>     >
>     > I tried to find the cause of this error on the Net but no luck so far. IM
>     using
>     > this as references:
>     >
>     >
>     https://github.com/numato/samplecode/blob/master/FPGA/galatea/galateaLinux-BSP/numato_galatea_defconfig
>     >
>     >
>     https://github.com/numato/samplecode/blob/master/FPGA/galatea/galateaLinux-BSP/galatea_defconfig#L4
>     >
>     >
>     > The differences are Im using big endian
>      That could explain the "wrong magic bytes" thing. Maybe you're trying to use
>     your little-endian host readelf to check the target executable? That's not going
>     to work, you need the cross-readelf (output/host/bin/*-readelf).
>      Regards,
>      Arnout

More information about the buildroot mailing list