LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 10-10-2018, 11:53 PM   #1
JimC_LinuxMan
LQ Newbie
 
Registered: Oct 2018
Posts: 4

Rep: Reputation: Disabled
Question Building an Elf file for a flavorless embedded linux?


Hello first off I have read the "Read before posting" and I feel like this question is not something I can easly find others of or otherwise I woudlnt be posting this. So im trying to make my first post here and trying to follow the rules! With this being said i must say I dont expect to be spoon fed i just need guidance to an issue!!!

The issue I have is I have been studying a embedded linux system that seems to be flavorless (No ubuntu , no debian, no fedora) I dont see any information on it except a Linux Version as well as a gcc version and the processor type.
This is all i know.
Linux version 2.6.XX.X -r XXX (gcc version 4.X.X) ARM processor
Ofcourse the X values are numbers

I am trying to build a elf file and run it on the system sucsessfully. The Linux System is minimal and lacks many things like gcc on it.

My question is do I have enough information to build a elf file for this system? I need some way to build a elf file for this system but this is all i know of it am i missing something?

Also does linux come as JUST linux... with no flavor?


Because of research purposes I cant give any more information regaurding version information. Though I Dont expect an exact answer based on exact information I just need a bit of guidance please!

Hopefully i follow gguidelines and make a good first post.
(Apoligies if my questions dont make sense I am not a professional in linux systems definantly weird embedded ones with no flavor)
 
Old 10-11-2018, 06:08 AM   #2
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: CentOS at the time of this writing, but some others over the years too...
Posts: 2,026

Rep: Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919
Quote:
Originally Posted by JimC_LinuxMan View Post
Hello first off I have read the "Read before posting" and I feel like this question is not something I can easly find others of or otherwise I woudlnt be posting this. So im trying to make my first post here and trying to follow the rules! With this being said i must say I dont expect to be spoon fed i just need guidance to an issue!!!
Their suggestions, not "rules". See here for the rules.

Quote:
The issue I have is I have been studying a embedded linux system that seems to be flavorless (No ubuntu , no debian, no fedora) I dont see any information on it except a Linux Version as well as a gcc version and the processor type.
This is all i know.
Linux version 2.6.XX.X -r XXX (gcc version 4.X.X) ARM processor
Ofcourse the X values are numbers
Unless you say where you got this information from, it's hard to suggest any other options that you have not already tried. "Linux version 2.6.XX.X" tells us very, very little other than you have Linux kernel version 2.6.?? installed. You need to include those numbers, not "XX.X", as that tells us nothing. Linux by itself is just the OS kernel, not a complete system, that's why you would download a Linux distribution, that's what we need to know.

Quote:
I am trying to build a elf file and run it on the system sucsessfully. The Linux System is minimal and lacks many things like gcc on it.
Well then good luck trying to compile your "ELF file", as you will not be able to without gcc. If you want to build software then you need a far more complete system that does have things like gcc installed upon it.


Quote:
My question is do I have enough information to build a elf file for this system? I need some way to build a elf file for this system but this is all i know of it am i missing something?
Not even close, no you don't. You're missing quite a lot by the sounds of it.

Quote:
Also does linux come as JUST linux... with no flavor?
Yes, but that is only the kernel, which will be completely useless without the rest of the operating system to go with it. See above.

Quote:
Because of research purposes I cant give any more information regaurding version information. Though I Dont expect an exact answer based on exact information I just need a bit of guidance please!
...
Well then, help is going to be limited. Sure, provide more information and we can try and help. Like why and what purpose are you "writing this ELF file" for?
 
Old 10-11-2018, 06:23 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,705

Rep: Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379
Welcome to LinuxQuestions.

I assume this is a school progject?

Quote:
Also does linux come as JUST linux... with no flavor?
Yes.

In many cases an embedded board does not have the resources to build/compile programs and requires one to use a cross compiler. This allows you to compile a program on one system like a regular PC x86.. that will run on an ARM processor. The board's manufacture might provide information on how to setup a cross compiler and tools necessary.

Last edited by michaelk; 10-11-2018 at 07:34 AM.
 
Old 10-12-2018, 12:46 AM   #4
JimC_LinuxMan
LQ Newbie
 
Registered: Oct 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Ok thanks for the Information so far!

This is not a school project but more of a research project thats not related to school or anything. As for the purpose of making this elf was first to build a POC hello world program on it to see if I could actually run an elf on the system After that the development could be for anything But I need to develop a working example program.

It sounds like this is mostly answered and all the confusion is cleared up.
The issue is I don't have much more information than that to give Just the linux version number but that was not the concern.

So being that this is a linux kernel couldn't I just download a Linux kernel that has gcc on it and build a hello world example? (to test if it works) To me it sounds like I need to have a cross compiler to compile elf files for a linux kernel. If this nothing more than the kernel it shouldn't be too hard or as jsbjsb001 makes it seem that there are many kernels and I lack this specific information? Or it sounds like I would have to specifically go to the manufacture to do this? I do understand theres very little information to go off here but thats really all I have other than a version number that I can use when I better understand this all.

From my understanding all elf files should work merely the same across distributions but the difference is the linking...?

I think my question has turned in to a more technical software development question regarding finding out the information by dissecting the elf files at this point so I'm going to create a new post in the proper area of the website.

The information has been very eye opening so far thanks guys.
 
Old 10-12-2018, 03:12 AM   #5
blue_z
Member
 
Registered: Jul 2015
Location: USA
Distribution: Ubuntu, Lubuntu, Mint, custom embedded
Posts: 88

Rep: Reputation: Disabled
Quote:
Originally Posted by JimC_LinuxMan View Post
The issue I have is I have been studying a embedded linux system that seems to be flavorless (No ubuntu , no debian, no fedora) I dont see any information on it except a Linux Version as well as a gcc version and the processor type.
This is all i know.
Linux version 2.6.XX.X -r XXX (gcc version 4.X.X) ARM processor
Ofcourse the X values are numbers
That is typical of embedded Linux systems. Both the Linux kernel and root filesystem are customized for that product. It's hobbyists who install a pre-built filesystem from a "distribution" on a SBC.


Quote:
Originally Posted by JimC_LinuxMan View Post
My question is do I have enough information to build a elf file for this system? I need some way to build a elf file for this system but this is all i know of it am i missing something?
Almost, you need the type (and version) of installed libraries.
If you insist on a small filesize for your executable. then you will have to come up with a compatible cross-toolchain that matches the installed dynamic libraries, SoC, and the kernel version.

If the filesize of your executable is not a concern, then static linking of the dependencies is the quick & dirty way of building programs.
All you need is a suitable development PC with a cross-toolchain for the same type of C library (e.g. glibc versus uClibc), the architecture of your SoC (e.g. 32-bit ARM, little endian), and approximate kernel version (i.e. a version of kernel headers not more recent than your kernel).


Native compiling (i.e. on the the embedded system) is rarely practical typically due to the lack of storage space (e.g. no massive hard disk).

Regards

Last edited by blue_z; 10-12-2018 at 03:18 AM.
 
Old 10-12-2018, 05:04 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,705

Rep: Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379Reputation: 2379
Post the make and model number of your SBC
 
Old 10-12-2018, 11:58 PM   #7
JimC_LinuxMan
LQ Newbie
 
Registered: Oct 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Cool

Quote:
Please post the manufacture and model of your SBC
Because of research purposes I am unable to post this information. It sounds to me like even without this information though its possible. That is if I can determine the architecture as blue_z said Im sure running cat on an elf and examining the elf would tell me if its little endian or big endian and all the other information. This will be a pain but If it means All the information is there to get a "cross-toolchain?".


Quote:
Almost, you need the type (and version) of installed libraries.

I actually found a directory in /lib/ that seems to contain a whole bunch of .so files including uClibc as well as libc.so.0 and other files.
So it sounds like....
- I must get a hold of these files
- put them on to my system
- use gcc with the proper arguments to point to the library on my system.......
It sounds like I have all the information to build the elf now.


I just don't get is there some place to get a cross-toolchain other than the people who developed the system?

I have too many questions and am trying to avoid seeming like I want to be spoon fed I just am quite new to this.


Thanks for the response guys I would have not gotten far in this issue at all.
 
Old 10-15-2018, 12:29 AM   #8
blue_z
Member
 
Registered: Jul 2015
Location: USA
Distribution: Ubuntu, Lubuntu, Mint, custom embedded
Posts: 88

Rep: Reputation: Disabled
Quote:
Originally Posted by JimC_LinuxMan View Post
I actually found a directory in /lib/ that seems to contain a whole bunch of .so files including uClibc as well as libc.so.0 and other files.
...
It sounds like I have all the information to build the elf now.
No, you severely underestimate the complexity of a cross-toolchain.


Quote:
Originally Posted by JimC_LinuxMan View Post
I just don't get is there some place to get a cross-toolchain other than the people who developed the system?
Since you refuse to provide any version information whatsoever, it's up to you to obtain a suitable cross-toolchain yourself.
Study Getting a toolchain.
Crosstool-NG is the tool I've used to build most of the cross-toolchains I use.
With effort it's possible to build a cross-toolchain for a CPU architecture and given versions of gcc, uClibc, and Linux kernel headers.

Regards

Last edited by blue_z; 10-15-2018 at 12:34 AM.
 
Old 10-22-2018, 02:34 AM   #9
rocq
Member
 
Registered: Jan 2013
Location: Netherlands
Distribution: XUbuntu
Posts: 57

Rep: Reputation: Disabled
Generally, you don't install gcc on your target. You use a cross toolchain on your machine (called "host") to build programs and libs for your embedded device (called "target"). The toolchain you use however cannot be any. Not just because of architecture but also the software your support (libraries, kernel version, kernel modules, etc.)

So you need to find out which toolchain you should use. The website of the board vendor is the place to start. They should have a wiki for this.

You could also try to use a generic ARM compiler (Ubuntu, google).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: 4 tools for building embedded Linux systems LXer Syndicated Linux News 0 06-15-2018 03:24 PM
uClinux ARM-ELF Toolchain Building Procedure vinchipsathya Linux - Newbie 1 11-02-2009 07:28 PM
.bin, .elf, .out - Linux file extension raedbenz Linux - Software 7 09-15-2009 01:34 AM
LXer: Building Embedded Linux Systems LXer Syndicated Linux News 0 11-10-2008 04:00 AM
Building a cool device. Linux embedded. barton Linux - Hardware 18 12-26-2004 10:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 06:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration