View Full Version : iLiad How-to: build a toolchain for the iliad using crosstool


Antartica
07-25-2006, 10:21 AM
For more information on building a toolchain for the iliad using crosstool, see the wiki page (it's more detailed than this description):
Mobileread Wiki: Notes about building a toolchain for the iliad using crosstool (http://wiki.mobileread.com/wiki/Notes_about_building_a_toolchain_for_the_iliad_usi ng_crosstool)

Original post follows...
Hi all!

I've built a toolchain for the iliad using crosstool (for using it with scratchbox, but it also works without it). Here are the instructions (tested on Debian Sarge):

1. Untar the attached file in the home of your user (it's a tar.gz despite the .zip extension -- the .zip was a workaround to be able to upload the file). It should create a crosstool subdirectory
2. Download crosstool 0.42 (crosstool-0.42.tar.gz) from http://www.kegel.com/crosstool/crosstool-0.42.tar.gz to the crosstool subdirectory and unpack it there. You should have now a lot of files in ~/crosstool/crosstool-0.42/
3. cd ~/crosstool/crosstool-0.42/
4. cp ../demo-iliad.sh .
5. Edit demo-iliad.sh and change RESULT_TOP to suit your tastes
6. Execute the following ". ../prepare.sh" just to be sure there is no LD_LIBRARY_PATH set
7. Start compiling the new toolchain with "./demo-iliad.sh"
8. Wait a lot of time while the toolchain builds
9. That's all, you should have your new toolchain in the specified RESULT_TOP directory.

Notes:

1. The libc is built against linux-2.4.19-rmk7-pxa2, but not linux-2.4.19-rmk7-pxa2-irex as irex hasn't published the patch yet.
2. The libc used is 2.3.3, but the iliad has 2.3.4 with the name renamed to 2.3.3; executables built with this toolchain should work in the iliad, but the executables in the iliad doesn't like the libc of the toolchain (no problem, but you should know it, just if a problem arises...)

Have fun!

Antartica
03-18-2007, 03:24 PM
I'm preparing the instructions for building the toolchain from scrtach, aimed at iliad firmware 2.9

The "work in progress" wiki page is here:

Notes about building a toolchain for the iliad using crosstool (http://http://wiki.mobileread.com/wiki/Notes_about_building_a_toolchain_for_the_iliad_usi ng_crosstool)

Any needed files will be attached to this post O:-).

deadite66
03-18-2007, 03:50 PM
maybe someone could make a vmware (vmplayer is free) image with the crosscompiler already setup

Alexander Turcic
03-19-2007, 05:07 AM
maybe someone could make a vmware (vmplayer is free) image with the crosscompiler already setup
That is an excellent idea!! Any volunteers?

PS: We could also host the vmware image if it's kept to a minimum size.

Adam B.
03-19-2007, 06:39 AM
That is an excellent idea!! Any volunteers?

PS: We could also host the vmware image if it's kept to a minimum size.

I had planned to set this up once Antartica posts an updated tool chain. :cool: However, my current VMware image is 2GB... Bittorrent may be a better choice. I'll see what I can do about keeping the file size down.

Alexander Turcic
03-19-2007, 06:45 AM
I had planned to set this up once Antartica posts an updated tool chain. :cool: However, my current VMware image is 2GB... Bittorrent may be a better choice. I'll see what I can do about keeping the file size down.
I agree, a torrent seems best.

deadite66
03-19-2007, 06:54 AM
someone made a 121MB image based off DSL (Damn small linux) for zaurus development.
no idea if this is compatible or just an example of how small you can make a build system.
http://kopsisengineering.com/kopsis/SharpZaurusSdkDsl

yokos
03-19-2007, 07:22 AM
However, my current VMware image is 2GB... Bittorrent may be a better choice. I'll see what I can do about keeping the file size down.
I agree, a torrent seems best.
Another alternative would be to use a one-click-hoster like uploaded.to (http://uploaded.to/?lang=ENG) or oxedion.com to share such a large VM-image. I don't know, whether we are enough users for BT [the more users the better].
[Edit:] Both sites don't have a waiting time like rapidshare after a download. It's free to up~ & download.

b_k
03-19-2007, 07:54 AM
I had planned to set this up once Antartica posts an updated tool chain. :cool: However, my current VMware image is 2GB... Bittorrent may be a better choice. I'll see what I can do about keeping the file size down.
i think thats uncompressed, isn't it?
with some sort of compression you should get some reasonable file size. (given that you can be able to fit a default ubuntu install into < 800 MB, example: http://www.vmware.com/vmtn/appliances/directory/693)

Adam B.
03-19-2007, 08:22 AM
i think thats uncompressed, isn't it?
with some sort of compression you should get some reasonable file size. (given that you can be able to fit a default ubuntu install into < 800 MB, example: http://www.vmware.com/vmtn/appliances/directory/693)

You're right, that is uncompressed. I just Gzip'd it, turned out to be 384MB. That's a much more reasonable size....

narve
03-19-2007, 02:34 PM
You're right, that is uncompressed. I just Gzip'd it, turned out to be 384MB. That's a much more reasonable size....
I don't think torrent is the correct solution for this, too few users. Even emule would be better I think.

Anyway, if hosting is a big problem I can host it at home (I have ASDL2+) or at work (2Mib/s outgoing optical thingy), should be more than enough.

Alexander Turcic
03-19-2007, 02:45 PM
Sounds good. We would definitely store it @ MR as well but it would be necessary to find backup download sites.

narve
03-19-2007, 05:25 PM
Sounds good. We would definitely store it @ MR as well but it would be necessary to find backup download sites.
No problem. It is a shame to waste all that free bandwith :)

DHer
03-20-2007, 04:15 AM
my hoster recently offered me unlimited traffic - so i'd also love to donate a backup server.

b_k
03-20-2007, 04:31 AM
what about this?
the download is not so nice, but mostly you get a steady connection between 70 and 100kb/s. and be warned, i have my Opera fed with some up2date adblocker list, so I can't see ads that may or may not be there.

http://www.gigeshare.com/

ericshliao
09-18-2008, 11:21 AM
The crosstool mentioned above has a newer version: 0.43. Any update to this thread?

Antartica
09-20-2008, 09:05 AM
The crosstool mentioned above has a newer version: 0.43. Any update to this thread?

An updated crosstool gives more supported libc/compilers/platforms. There is no need to rebuild the toolchain.

BUT it could help for the people who had trouble because they were not using linux-x86 (i.e. OS X, PowerPC, etc). Is thereanyone in that situation? :blink:

Anyway, I update the first post to add a link to the wiki page, as it's a lot more detailed than the instructions here.

ericshliao
09-20-2008, 03:43 PM
I see that ScratchBox also provide some arm toolchain. Are they working for iLiad development? Why choose crosstool? Can the kernel patch provide by iRex applied to toolchain provide by ScratchBox?

BTW, I tried to incorporate the official SDK with ScratchBox but failed. Any one succeeded?

Sorry for all the questions. I found it really difficult (for me) to build a cross-compiling environment if I want to try a different path.

Antartica
09-21-2008, 06:15 AM
I see that ScratchBox also provide some arm toolchain.
Some background:

Scratchbox is a development environment built around Qemu and a user-supplied toolchain.

Scratchbox was developed by the folks at Nokia and is used as a development tool for the arm-and-linux-based nokia internet tablet (N770, N800 and N810). Scratchbox has also some tools for integration with Debian GNU/Linux (that is, there are advantages using ScratchBox under Debian/Ubuntu that you miss if you use RedHat/Fedora or Novell/OpenSuSE).



Nope. ScratchBox folks are realated to the Nokia Internet Tablet development, not with the Iliad.

When I built the unofficial toolchain I used scratchbox because I had some experience with it and being able to native-compile instead of simply cross-compile eliminates a lot of headaches :-).

OTOH, crosstool is the right tool for the job when building crosscompilers. I've built crosscompilers in the past without crosstool and is not something too pleasant. With crosstool is something quick and works well.

The integration of the toolchain with scratchbox was done following the instructions on the scratchbox website.

[QUOTE=ericshliao;256111]BTW, I tried to incorporate the official SDK with ScratchBox but failed. Any one succeeded?

I've not tried it...

Sorry for all the questions. I found it really difficult (for me) to build a cross-compiling environment if I want to try a different path.

Path?

ericshliao
10-08-2008, 07:20 AM
Now, I have incorporated iRex official SDK with ScratchBox and built some working apps. Too bad many others not working on iLiad even though I can build it.
I just found that some apps need GCC >=4.10. So, I am trying to build a GCC4.11 with crosstools for ScratchBox. Please give some suggestion or anything might be of help. Thanx.

Antartica
10-08-2008, 03:14 PM
Now, I have incorporated iRex official SDK with ScratchBox and built some working apps. Too bad many others not working on iLiad even though I can build it.

About the apps not working on iliad althugh you can build them:

1. They work in the scratchbox environment? (i.e. you can execute them if the display is correctly set)

2. Have you checked there are no missing libraries in the iliad for them? (executing them from the command line doesn't complain about a not found libary)

I just found that some apps need GCC >=4.10. So, I am trying to build a GCC4.11 with crosstools for ScratchBox. Please give some suggestion or anything might be of help. Thanx.

You may find that the minimum version of the libc that works with gcc4.1 is greater than the one on the iliad (2.3.3 beta, if I'm not mistaken). Anyway, look at the tested gc/libc combination matrix at crosstool site. If you have to use a newer libc, that would mean that you have to include that libc with your app (Adam did this for one of his ports; gnumeric IIRC), and then your package would be rather big...

ericshliao
10-08-2008, 03:36 PM
1. They work in the scratchbox environment? (i.e. you can execute them if the display is correctly set)

I didn't test my app in sb environment. Becasue I was too lazy then. I am figuring how to start vnc now.


2. Have you checked there are no missing libraries in the iliad for them? (executing them from the command line doesn't complain about a not found libary)


I think I have put needed lib to the same dir by specifying --prefix=. I also set LD_LIBRARY_PATH in script. I also tried to execute it from command prompt and fix missing lib, if any. Finally, I got "Segmentation Fault".


You may find that the minimum version of the libc that works with gcc4.1 is greater than the one on the iliad (2.3.3 beta, if I'm not mistaken). Anyway, look at the tested gc/libc combination matrix at crosstool site. If you have to use a newer libc, that would mean that you have to include that libc with your app (Adam did this for one of his ports; gnumeric IIRC), and then your package would be rather big...

What you said above is just what I want to know. Dependency is so compilcated for me that I can't be sure if my environment is qualified to build.

I still got plenty unsolved questions. But I have to think it over before asking.

ericshliao
10-08-2008, 03:42 PM
I just found that the tutorial: building a toolchain for the iliad using crosstool (http://wiki.mobileread.com/wiki/Notes_about_building_a_toolchain_for_the_iliad_usi ng_crosstool) takes crosstool 0.43 for demonstration, not past 0.42. Who made this update? When?

Antartica
10-09-2008, 01:56 PM
I just found that the tutorial: building a toolchain for the iliad using crosstool (http://wiki.mobileread.com/wiki/Notes_about_building_a_toolchain_for_the_iliad_usi ng_crosstool) takes crosstool 0.43 for demonstration, not past 0.42. Who made this update? When?

By the diffs, it was on 18 March 2007, see

http://wiki.mobileread.com/index.php?title=Notes_about_building_a_toolchain_f or_the_iliad_using_crosstool&oldid=3331

And it was probably by me, as that is the first version of the page and I was the original author of that page O:).

ericshliao
11-23-2008, 03:48 AM
Antartica,
in your Notes about building a toolchain for the iliad using crosstool (http://wiki.mobileread.com/wiki/Notes_about_building_a_toolchain_for_the_iliad_usi ng_crosstool), there is no step for downloading kernel source from iRex. Is it needed?
I tried to follow your instruction, but the patch failed.
The attached file is the output write to stdout when I execute "./demo-iliad-softfloat-29.sh".
Besides, your instruction is based on FW2.09, is any update needed for FW2.11? There is a patch (http://developer.irexnet.com/pub/iLiad/Linux%20kernel/linux-2.4.19-rmk7-pxa2-irex1-v2.11.patch) for FW2.11 in iRex. Is it useful for building toolchain?


Added:
in "./demo-iliad-softfloat-29.sh", there is a line
eval `cat arm-softfloat.dat gcc-3.4.4-glibc-2.3.3.dat` LINUX_DIR=linux-2.4.19 sh all.sh --notest

But "the Note" seems to be based on gcc-3.4.2. For example, the patch is put in gcc-3.4.2 directory.
mv crosstool/gcc-3.4.2/patches/fix-fixincl-3.4.2.patch crosstool-0.43/patches/gcc-3.4.2/

Is there any discrepancy?

ericshliao
11-23-2008, 08:57 AM
I modified
eval `cat arm-softfloat.dat gcc-3.4.4-glibc-2.3.3.dat` LINUX_DIR=linux-2.4.19 sh all.sh --notest
to
eval `cat arm-softfloat.dat gcc-3.4.2-glibc-2.3.3.dat` LINUX_DIR=linux-2.4.19 sh all.sh --notest

and removed the kernel patch downloaded from iRex.
Crosstool can build gcc now. But I don't know if it does build working app for iLiad. Further test is needed.


Added:

Just had a thought.
Crosstool will download required files and put them in /home/crosstool. For example, kernel 2.4.19 is downloaded as "linux-2.4.19.tar.bz2". Since I iRex's kernel patch is not working on crosstool, if I replace it with patched kernel source from iRex, maybe it will work.

Antartica
11-24-2008, 09:18 AM
ICrosstool can build gcc now. But I don't know if it does build working app for iLiad. Further test is needed.

Don't worry, they should work.

The reason the kernel is needed is that the GNU libc needs the kernel sources to obtain some structs to "talk" with the kernel. But the generated libc will work in that kernel and newer ones.

And the executables generated with that libc will work with that version of the libc and newer ones, regardless of the kernel .

So for this case it doesn't really matters as you are building an (slightly) older libc than the one that comes with the iliad, and the executables you generate will be using the libc of the iliad, not the one you compiled..

P.S.: about the instructions in the wiki, I'll try to have a look at them sometime to fix that, but right now I would rather focus on xepdmgr... In the meantime, could you add to the wiki page a note with your fixes? Thanks :)

ericshliao
11-24-2008, 09:26 AM
In the meantime, could you add to the wiki page a note with your fixes? Thanks :)

I am glad to do it.

Added:
just made some modification and addon in Wiki.

jhench
12-13-2008, 07:09 AM
Hi guys,

I am coming from a slightly different, yet similar low power ARM platform, namely NAS devices like the LaCie EDmini which I am using as my multi-purpose server. Since there is a big community (nas-central.org) community around these devices, and there has been a native toolchain to compile on the devices themselves for quite a time. Storage space on the root file system is not that much of an issue on gigabyte-NAS drives, I would say that's the main difference between them and the iLiad. Otherwise, most of today's NAS machines are based on an ARM CPU and 64 MB of RAM, just like our iLiad.

Since I have been compiling all software I needed directly on the NAS (e.g. over night ;) due to the slow CPU) I am wondering if this was an option for the iLiad as well. Does anyone of you know how I could arrange it to put e.g. antarctica's native toolchain on the iLiad to get a compiler on the iLiad? I think it should be possible, but I just want to make sure that this would not break the whole system due to built-in software components that might get changed. It should also be stored on the CF card as the toolchain (maybe even a minimalistic one) would not really fit on the root file system.

Is there anyone out there who has already compiled things ON the iliad directly? It would be really nice if one could compile a bit in the background while reading :).

hansel
12-13-2008, 07:43 AM
Hi Jhench,

I think 64MB ram is not enough to run gcc
What you CAN do is run arm-gcc on an emulated computer.

I've experimented with Qemu: you can set- up a virtual ARM computer runing Linux (I used Debian etch). I was able to install and run arm-gcc-3.4. What stopped me was the fact that the stuff on the Iliad uses software floating point and the Debian gcc uses hardware floating point (binary incompatible object files). Didn't have time to investigate further...

Here are some QEMU links; hope it helps...

http://www.aurel32.net/info/debian_arm_qemu.php
http://technowizah.com/2007/02/debian-how-to-qemu-virtual-machine.html

Hansel.

ericshliao
12-13-2008, 07:56 AM
Is there anyone out there who has already compiled things ON the iliad directly? It would be really nice if one could compile a bit in the background while reading :).

Doing compile on iLiad? How long will it take for me to do the compile task on iLIad? I can't image it. I did build gcc using crosstool, but I never thought to use it on iLiad.

Antartica
12-14-2008, 02:12 AM
Storage space on the root file system is not that much of an issue on gigabyte-NAS drives, I would say that's the main difference between them and the iLiad. Otherwise, most of today's NAS machines are based on an ARM CPU and 64 MB of RAM, just like our iLiad.
(...)
Since I have been compiling all software I needed directly on the NAS (e.g. over night ;) due to the slow CPU) I am wondering if this was an option for the iLiad as well. Does anyone of you know how I could arrange it to put e.g. antarctica's native toolchain on the iLiad to get a compiler on the iLiad?


My experience differs a little to yours (I use a nslu2 with debian, which has a paltry 32MB of RAM), but you're right that compiling in those NAS machines is reasonable (myself: I do it to compile things for my zaurus, to execute them in a debian chroot).

But the problem is that in those machines you have:
1) lots of swapspace
2) storage not limited by a number of write cycles (CF and SD cards get broken after a lot of read-erase-write cycles; not important for normal filesystem use but very important for swap partitions).

So, although doable, not recommended.

That said, I have compiled in the past small programs in the debian chroot in the zaurus without enabling swap (the Zaurus SL-5500 also has 64MB of RAM), and I recall that scotty1024 did test a debian chroot in the iliad and it worked well (he even used emacs in there).

The main problem you would have is to compile a gcc with softfloat for the iliad (debian arm uses "hardware FP", and debian armel uses EABI, both of them not compatible with the iliad binaries). You can try to rip apart the one of pdaXrom 1.1.0beta1 as it should be compatible, but no idea if the libc there is newer than in the iliad or not; they are both named libc-2.3.3 but the iliad one if from CVS prior to 2.3.3 release... internally is 2.3.2.

Personally I think that it doesn't worth the effort; in case that you have to compile things in the iliad its quicker the setup a debian chroot, and compile and execute things from there.

P.D.: There could be othe possiblities; one of the is to compile the gcc yourself in the PC using OpenEmbedded's bitbake.

ericshliao
12-14-2008, 02:29 AM
Suppose all obstacles in reality not exist, can the toolchain built by crosstool be used on iLiad?

Antartica
12-14-2008, 02:53 AM
Suppose all obstacles in reality not exist, can the toolchain built by crosstool be used on iLiad?

No. You would have to build a native toolchain. BUT to build that toolchain you can use the croos-compiling one you did with crosstool (hope that makes sense to you).

ericshliao
12-14-2008, 03:49 AM
BUT to build that toolchain you can use the croos-compiling one you did with crosstool (hope that makes sense to you).

You mean that the toolchain built by crosstool can be used to build gcc runnable on iLiad? That's reasonable. Just like what I did to port apps to run on iLiad. Thanx.