LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2015, 09:35 PM   #1
mxmaniac
LQ Newbie
 
Registered: Feb 2014
Posts: 26

Rep: Reputation: Disabled
How do I find source code for common utilities to compile myself?


I'm working with a NAS system that runs an embedded version of linux which has no package manager. I want to be able to learn to compile some common and basic linux utilities myself, to be able to install them without using a package manager.

Some examples of these basic pieces of software are hexdump, watch, nano, and other similar ones.

Now I have some instructions from a developer document how I can cross compile for the system, but the issue I'm having right now seems to be finding the proper source code. I've googled, searched git, searched the debian site, etc. I can't seem to find the official source code for these common applications.

Any advice where to find these, or heads up on any gotchas I may face doing this?
 
Old 11-15-2015, 09:48 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by mxmaniac View Post
I'm working with a NAS system that runs an embedded version of linux which has no package manager. I want to be able to learn to compile some common and basic linux utilities myself, to be able to install them without using a package manager.

Some examples of these basic pieces of software are hexdump, watch, nano, and other similar ones.

Now I have some instructions from a developer document how I can cross compile for the system, but the issue I'm having right now seems to be finding the proper source code. I've googled, searched git, searched the debian site, etc. I can't seem to find the official source code for these common applications.

Any advice where to find these, or heads up on any gotchas I may face doing this?
If it's embedded, it may use busybox or another stripped-down version of the Linux command set. Busybox should be easy to find on the internet.
I don't know about Busybox alternatives, but if they operate like Busybox, there is only one executable, and all commands under /bin etc are hard-linked to it.

Otherwise most of the standard command set is from GNU.

And for the rest, including essentials like openssh, load your favourite search engine with lots of bullets and go hunting. I am not aware of a central directory of source code; what comes closest is Linux From Scratch.

Last edited by berndbausch; 11-15-2015 at 09:50 PM.
 
Old 11-15-2015, 10:06 PM   #3
mxmaniac
LQ Newbie
 
Registered: Feb 2014
Posts: 26

Original Poster
Rep: Reputation: Disabled
It does indeed use busybox, although the busybox it has is quite limited, and does not have hexdump, watch, nano, or others similar basic utilities. Isn't it possible to just download the source code in C, and then cross compile it on a different system using the dev tools, and then simply copy the compiled binary to the /usr/local/bin directory in order to have a working version of those utilities?

I am a total newbie at this, so it is possible I might be trying to do something that isn't possible. If so, then please let me know.

PS: It might not be fully embedded. Part of the os resides on flash memory, and part on the disks, although I'm unsure specifically which parts.

Last edited by mxmaniac; 11-15-2015 at 10:08 PM.
 
Old 11-15-2015, 10:14 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by mxmaniac View Post
It does indeed use busybox, although the busybox it has is quite limited, and does not have hexdump, watch, nano, or others similar basic utilities. Isn't it possible to just download the source code in C, and then cross compile it on a different system using the dev tools, and then simply copy the compiled binary to the /usr/local/bin directory in order to have a working version of those utilities?
Absolutely, though it requires some care. You have to set up a development environment that matches your target system's architecture, in particular taking extra care NOT to use the host system's libraries. And you have to cross-compile if the architecture is different from the host's, which is more than likely.

I can't give you more tips, simply because I don't know much about this. Other LQ'ers might chime in here, but since this is a popular topic, especially now that there are so many single-chip-based systems a la Raspberry Pi or Beaglebox, you should have no problems finding instructions. Good luck!
 
Old 11-15-2015, 11:41 PM   #5
mxmaniac
LQ Newbie
 
Registered: Feb 2014
Posts: 26

Original Poster
Rep: Reputation: Disabled
I'm pretty sure i can get the cross compiling to work, based on the developer toolchain instructions, but the problem I'm facing is where do I find the official source code for these standard utilities like hexdump, watch, nano, etc?
 
Old 11-16-2015, 12:58 AM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by mxmaniac View Post
I'm pretty sure i can get the cross compiling to work, based on the developer toolchain instructions, but the problem I'm facing is where do I find the official source code for these standard utilities like hexdump, watch, nano, etc?
I suggest you practice the art of web searching. Put the words "nano editor" in your favourite search engine and find http://nano-editor.org. Incidentally this is a GNU product as I said earlier. So, you are likely to be quite successful with www.gnu.org.
 
  


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
How to read source code of linux utilities? zero91 Linux - Software 4 05-13-2012 08:21 PM
problems upgrading dapper, common system utilities missing SerfurJ Ubuntu 2 01-28-2007 06:09 PM
Where to find the source of gnu/linux shell utilities irfanhab Programming 1 03-16-2006 06:05 AM
where is the source code for utilities in a distro? (If they are included) dr_zayus69 Linux - Software 1 09-04-2005 10:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:26 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
Open Source Consulting | Domain Registration