Compiling busybox to .s assembly file

Harald Becker ralda at gmx.de
Fri Feb 25 00:09:47 UTC 2011


 Hallo Eric,

as I have been interested to see if my tool chain idea may work for you,
I did a quick hack to get a prove of concept. With a big one liner I
created a complete fake tool chain that logs in
/usr/src/busybox-build.log every tool chain call that is executed by the
Makefile. That log file may give you hints on how the busybox binary is
constructed.

My first prove was to let this run and see if busybox gets build with my
fake tool chain, and that succeeded as expected.

There after I hacked my-gcc to filter of and bypass those invocations
that are probably not of your interest. On the other side, normal
compile calls are split off in two gcc invocations, the first call
produces the .s files from .c and the second gcc invocation processes
the .s file to produce the .o output.

... and that succeeded again, leaving the .s files in the directories, a
big log file on what tool chain invocations had been done by the make
process and a Busybox binary. That binary seems to work as expected.

In my-gcc between those normal gcc invocations you can insert your code
analyzing step (and may be modification step). The possibly modified
assembler file is than processed normally by the Makefile. That way you
do not need to fiddle with the make process and risk breaking things. In
addition most other packages allow the specification of a cross compiler
tool chain. Let that fake tool chain step in at this point and your
analyzing/modification is done for other packages too, with very little
extra work. Imagine!

Hint: If you need to create all .s files of busybox before your
analyzing can proceed, just let the second gcc invocation proceed on the
unmodified .s file. In parallel (with a bit of thinking) you are able to
auto create control files on which files need to be processed by your
steps and which commands are required to create the binary from your
modified sources. Or do a two run approach, first to create all .s, do
your steps and create modification hints, second run use your hints to
modify the .s files and pass them on to the rest of the build process.
 
My fake tool chain is appended. Feel free to use as you like, and let us
know, if you are able to succeed with your approach. Good luck ... and
share!

--
Harald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fake-toolchain.tar.gz
Type: application/gzip
Size: 1323 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20110225/4993e674/attachment.bin>


More information about the busybox mailing list