How do I create a usable .bin file from source code?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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 create a usable .bin file from source code?
I'm a total newbie to Linux and my first question for everyone, is:
How do I take a source code I have, and turn it into something usable?
I have the source for Linksys WRT310N router, and would like to get a usable .bin file from it. The router is currently running an older version of firmware, and the only upgrade that is available on their site will disable my ability to replace it with DD-WRT, or other open source options. I am not comfortable enough with DD-WRT to flash it on my router yet, I don't want to brick it.
As well as that, I don't like being forced into a particular upgrade by Linksys.
Usually you would use a compiler to build the code into an executable. Yours is a unique situation, however, because you want to build the code to run on an architecture that is different than the machine on which you'll be doing the compiling. This is referred to as cross-compiling, and to do that you need to install a cross-compiler.
That file you linked to contains everything you need, though. Extract it with:
Code:
tar -xzf wrt310n_v1.0.07.014.tar,0.gz
That will generate a directory with a .pdf file and another .tar.gz file, so extract that one:
Code:
cd wrt310n_v1.0.07.014
tar -xzf wrt310n_v1.0.07.014.tar.gz
That will generate a directory with the source in it. Inside you'll find a How_to_make_WRT310N.txt file with some information, and in tools-src/README.TXT you'll find even more information, along with the cross-compilers you need to set up and instructions on how to do so.
Usually you would use a compiler to build the code into an executable. Yours is a unique situation, however, because you want to build the code to run on an architecture that is different than the machine on which you'll be doing the compiling. This is referred to as cross-compiling, and to do that you need to install a cross-compiler.
That file you linked to contains everything you need, though. Extract it with:
Code:
tar -xzf wrt310n_v1.0.07.014.tar,0.gz
That will generate a directory with a .pdf file and another .tar.gz file, so extract that one:
Code:
cd wrt310n_v1.0.07.014
tar -xzf wrt310n_v1.0.07.014.tar.gz
That will generate a directory with the source in it. Inside you'll find a How_to_make_WRT310N.txt file with some information, and in tools-src/README.TXT you'll find even more information, along with the cross-compilers you need to set up and instructions on how to do so.
Thank you for your reply, it was very helpful and informative. Do I need a particular archiving program to run that command in windows, or do I just type it at the command prompt? Sorry to sound like such a newbie, but I don't have a clue.
Even if you can get it extracted, I'm not sure how you'd do the cross compiling in Windows. Possibly through Cygwin...otherwise you could set up a Linux VM and do the work there.
Even if you can get it extracted, I'm not sure how you'd do the cross compiling in Windows. Possibly through Cygwin...otherwise you could set up a Linux VM and do the work there.
So, can I boot from a linux live disc and do what I need to?
Probably, but I would recommend using a bootable live USB with persistent storage instead so that you can reboot without losing everything you did. Either that or a VM from within Windows, assuming your hardware can handle it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.