LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do I create a usable .bin file from source code? (https://www.linuxquestions.org/questions/linux-general-1/how-do-i-create-a-usable-bin-file-from-source-code-4175424297/)

friendlybear 08-27-2012 05:07 PM

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.

This is the file here:

wrt310n_v1.0.07.014.tar,0.gz

Thanks for looking, and extra thanks for answering.

suicidaleggroll 08-27-2012 05:16 PM

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.

friendlybear 08-27-2012 05:24 PM

Quote:

Originally Posted by suicidaleggroll (Post 4765843)
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.

suicidaleggroll 08-27-2012 05:57 PM

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.

friendlybear 08-27-2012 06:06 PM

Quote:

Originally Posted by suicidaleggroll (Post 4765870)
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?

Again, thank you for your assistance.

suicidaleggroll 08-27-2012 08:24 PM

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.


All times are GMT -5. The time now is 01:10 PM.