How do I find source code for common utilities to compile myself?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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!
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'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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.