Tuesday, August 5, 2008

Cross Compilation 03

I was right. It was too good to be true. I mounted the .ext2 file created by buildroot.

> sudo mkdir /mnt/mybook

> sudo mount -t ext2 -o loop rootfs-arm_nofpu.ext2 /mnt/mybook

and was able to browse around. It has all the config files and scripts under /etc (woop) but the /bin directory is completely empty (meh).

So it looks like, at the very least, I haven't built the kernel or busybox.

On the plus side, the build_arm_nofpu/staging/dir/bin did seem to contain a set of tools prefixed with "arm-linux-" so I wrote a very simple Hello World c file and compiled it using arm-linux-gcc. (I added the staging_dir/bin directory to the PATH).

> arm-linux-gcc -o helloarm helloworld.c

Then scp'd the resulting executable onto the mybook. Then from the mybook, I was able to run helloarm!

So technically I've carried out my first cross-compilation. But this was the most basic file possible and I guess I could have achieved it using gcc directly on the command line just as easily (although I've linked to uClibc I think. Which is nice.)

Try again tomorrow to configure the kernel and busybox; cross-compile those, hopefully all from within the buildroot run.

No comments: