The Taming of the Kernel or, If Shakespeare Needed to Cross-Compile Linux

Sing, o muse, of man and the machine
the trial and err of misguided questing
to bring the works of Linux to new homes.

We seek this day to port a system to
the idle Advanced RISC Machine in hand.
But fear! For this is no ord’nary task;
the process convoluted to no end.
I shall be your guide and lend you tools,
that with which you may meet your needs forthwith.

To this end we must use Linux itself
as its gears they do fit many a clock.
The errant knight doth try Cygwin in vain,
the virt’al machine works splendidly well.

And now for tools we need to make
natively, fight the battle on home turf.
The GCC and binutils for one
and newlib and the GDB as well.
The versioning important you must learn
as gears’ teeth filed do so eas’ly slip.

So first we must compile binutils;
to reap the native assembler we seek.
For this we need only the gears of old,
and for the future its use shall be bold.

Then follows trickery like Loki’s wrath,
the compiler is only made in half.
For we need it to create, oh, itself,
and thus we cheat, and lift it by its straps.
We config’ with no C library, then,
with newlib magically we’ll make the whole.
Compile with gears old, assembler new,
be careful we’re not done until we’re through.

So onward now to newlib in a jam –
a native compiler needed in hand.
Our bootstrap one is ready for the test,
a trial by fire and then on to the next.

And once again we’re back to GCC,
it needs rebuilt to be of use at all.
Yea, with newlib and its C library,
we have outwitted that which caused dismay.
The cheat letting compiler make itself,
rebuild, rejoice, this time we’re nearly through.

The last tool unneeded but a relief,
GDB gives eyes and ears in chaos.
Build quick and rush to meet the final foe,
the Kernel waits to battle you alone.

with heavy breath our final task at hand,
the Kernel ready, poised over the band.
Configure fire, board-support brimstone,
the kernel will not relinquish its throne.
But armed as such, compiler armed at hand,
the Linux boxed and sent to its new home.

Fret not if journeys fail from time to time,
for patience, virtue, will keep righteous mind,
and in the end victor’ous you shall find.

Chris Fleck
Latest posts by Chris Fleck (see all)
Tags:
, ,


Every challenge is different – Tell us about yours.