Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex > iRex Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 01-11-2009, 06:42 AM   #1
-Thomas-
Addict
-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.
 
-Thomas-'s Avatar
 
Posts: 325
Karma: 1725
Join Date: Dec 2007
Location: Münster, Germany
Device: iRex iLiad v2
Ruby 1.8.5 for iLiad

Hey folks,

I've cross-compiled Ruby 1.8 over to the iLiad. For those who don't know Ruby:
Quote:
Originally Posted by Wikipedia
Ruby is a dynamic, reflective, general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features.
Installer is attached, it puts ruby into /usr/local/. It's an ipkg package, so if you want to remove it, ssh to your iLiad and do a ipkg remove ruby1.8

Have fun!
Attached Files
File Type: zip ruby1.8_installer.zip (2.37 MB, 410 views)
-Thomas- is offline   Reply With Quote
Old 01-11-2009, 09:52 AM   #2
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
NICE!!!

Ruby is my prefered language: is easy to learn, has a simple clean syntax. Much nicer than perl, much easier than C/C++, no need to compile... Only problem might be the somewhat large memory footprint.

The standard installation has everything you need to to xml and network stuff. (I've run a small webserver on my Iliad (Webrick), to have remote access to it)

The best free available resource is http://www.ruby-doc.org/docs/ProgrammingRuby/

A great tool for the Iliad.
Thanks.

PS: Thomas, why not Ryby 1.8.7? It compiles without problems. If I remember well, 1.8.5 had some issues in the xml parser (REXML)
hansel is offline   Reply With Quote
Advert
Old 01-11-2009, 10:07 AM   #3
-Thomas-
Addict
-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.
 
-Thomas-'s Avatar
 
Posts: 325
Karma: 1725
Join Date: Dec 2007
Location: Münster, Germany
Device: iRex iLiad v2
Quote:
Originally Posted by hansel View Post
PS: Thomas, why not Ryby 1.8.7? It compiles without problems. If I remember well, 1.8.5 had some issues in the xml parser (REXML)
Hmm, just did an apt-get source ruby1.8 in scratchbox, and that downloaded 1.8.5 (it's the Debian etch version), so no special reason for this version. I will update any time soon
-Thomas- is offline   Reply With Quote
Old 01-11-2009, 11:02 AM   #4
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Hi Thomas,

One more question...

What is happening in the preinstall script inside the ipk file? (I don't understand what all the symlink commands are for).

PS: I'm currently trying to make my first ipk file (for Lua, another script language). Do you (or does someone else) have a simple recipe to build such a package file?
hansel is offline   Reply With Quote
Old 01-11-2009, 11:30 AM   #5
-Thomas-
Addict
-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.
 
-Thomas-'s Avatar
 
Posts: 325
Karma: 1725
Join Date: Dec 2007
Location: Münster, Germany
Device: iRex iLiad v2
I've grabbed the preinstall script from some other package, XBoard or so. It creates a directory structure for /usr/local on the memory you run the installer from. So if you run it from CF card, /usr/local will point to /media/cf/_local. This is done to overcome the iLiad's small internal memory and to have a central location for third party apps.

My simple receipe for creating ipk's: First I create the data.tar.gz holding the files, then I copy control.tar.gz and debian-control from some other project and adapt it for my needs , third I create the ipkg with ar (on Debian it's in the binutils package).
-Thomas- is offline   Reply With Quote
Advert
Old 01-11-2009, 12:02 PM   #6
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Quote:
Originally Posted by -Thomas- View Post
It creates a directory structure for /usr/local on the memory you run the installer from. So if you run it from CF card, /usr/local will point to /media/cf/_local. This is done to overcome the iLiad's small internal memory and to have a central location for third party apps.
I hope this (slightly off-topic) discussion does not shadow the availability of Ruby on the Iliad ... it's great to have!

IMHO it's a *very* bad idea to symlink /usr/local to a cf or sd.
  • Other apps (like Feedbooks subscriptions plugin) might depend on software installed there. These will be broken when the sd card is removed
  • Besides: the preinstall will break apps that have been installed with a similar trick; and your package will be broken by the next one using a similar preinstall script.
  • I think this would corrupt the ipkg configuration...
  • I think using ipk's is only safe when installing on internal memory. For installs on cf just use plain install scripts.
  • What if another package (to be installed in /usr/local) does not want to be installed on the cf card (I read that access to cf can break a wifi connection)?

thanks for the recipe

Continue the good work!

Last edited by hansel; 01-11-2009 at 12:14 PM.
hansel is offline   Reply With Quote
Old 01-11-2009, 04:38 PM   #7
-Thomas-
Addict
-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.
 
-Thomas-'s Avatar
 
Posts: 325
Karma: 1725
Join Date: Dec 2007
Location: Münster, Germany
Device: iRex iLiad v2
Quote:
Originally Posted by hansel View Post
IMHO it's a *very* bad idea to symlink /usr/local to a cf or sd.
Well, internal storage is also possible if you run the installer from there. It's not restricted to external storage locations.
Quote:
  • Other apps (like Feedbooks subscriptions plugin) might depend on software installed there. These will be broken when the sd card is removed
  • Besides: the preinstall will break apps that have been installed with a similar trick; and your package will be broken by the next one using a similar preinstall script.
  • I think this would corrupt the ipkg configuration...
  • I think using ipk's is only safe when installing on internal memory. For installs on cf just use plain install scripts.
  • What if another package (to be installed in /usr/local) does not want to be installed on the cf card (I read that access to cf can break a wifi connection)?
I agree on your points, but I have made some assumptions in advance:
  • I assumed people only have one storage card, and not an SD and CF together, so most of their programs will reside in the same location
  • I'm always having my storage card inserted, I remove it only when I copy files from my PC. I agree that I will run into problems when I'm running the Feedbooks plugin while my card is not inserted. But as my newspapers usually go to the CF card, I will have a problem there anyway.
  • We should keep the internal memory clean for really important programs. I installed some programs that had to go to internal memory (FBreader, Dillo (to avoid the WiFi bug)), and I have only ~3MBs left which isn't enough for Ruby. And IMO Ruby is not such an essential program (yet ) that it has to reside on the internal memory.
  • (just a minor one) Compiling is much easier. Just do a ./configure --prefix=/usr/local and let preinstall do the rest
The best situation would be if we had enough storage to store the apps internally. But as this isn't the case we have to find a workaround. IMO storing all external apps in a single location and linking this to /usr/local/ is a good trade-off.

I think this topic is important when we think of the new iLiad OS. In future "visions" I see a centralized package management system for the device, and things have to be standardized then. So do you have any other idea how to solve these problems?

Quote:
thanks for the recipe

Continue the good work!
Thanks!
-Thomas- is offline   Reply With Quote
Old 01-12-2009, 01:54 AM   #8
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Quote:
Originally Posted by -Thomas- View Post
The best situation would be if we had enough storage to store the apps internally. But as this isn't the case we have to find a workaround. IMO storing all external apps in a single location and linking this to /usr/local/ is a good trade-off.

I think this topic is important when we think of the new iLiad OS. In future "visions" I see a centralized package management system for the device, and things have to be standardized then. So do you have any other idea how to solve these problems?
I agree it's an important topic: install procedures must be standardized in order to avoid one package corrupting another.

What would work is a symlink from /usr/local to /mnt/free/local: that's internal memory, and it has 100+ MB free if you don't use it for books. Of course this would have to be done before installing the first package to /usr/local, and leave it alone thereafter...

Maybe we can make a 'dummy' package iliadlocal.ipk that creates this link (and tests carefully if this succeeds), and let all other packages depend on this one? Or, for now, just create the link manually and hope for the best...

Maybe some other experienced installers have some good idea's? I'm a bit new to the Iliad installer business...
hansel is offline   Reply With Quote
Old 01-12-2009, 05:12 AM   #9
-Thomas-
Addict
-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.
 
-Thomas-'s Avatar
 
Posts: 325
Karma: 1725
Join Date: Dec 2007
Location: Münster, Germany
Device: iRex iLiad v2
I've just learned of the following threads:
Proposed iLiad Packaging/Installation Standard
iLiad 3rd Party Program Standardization

Looks like this structure was actually not "God-given" but merely the result of a lenghty discussion some months/years ago. So the first-gen developers voted for the symlink version.

But as the iLiad OS project evolves, maybe we can re-partition the root file system in some time to give / some more space to hold user apps. But that has to be seen.
-Thomas- is offline   Reply With Quote
Old 01-12-2009, 06:46 AM   #10
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
Personally, I don't like to install anything to iLiad root file system, because it's not convenient to maintan with iLiad's input/output facility. Unless I have to replace/modify some files in root file system, I always put apps in MMC.
To be honest, I seldom use installable package for iLiad, although it's convenient. I fear that it will make some unwanted modification to my system. Since I don't know what the installable package does, I have to spend some time to figure out what happens and its cause.
ericshliao is offline   Reply With Quote
Old 01-12-2009, 08:02 AM   #11
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Quote:
Originally Posted by -Thomas- View Post
Interesting backgound stuff!

But it's still unaccaptable if one preinstall script deletes the symlinks created by another preinstall script. The symlinks should only be created if not present. Example: if I release a package to install Lua, and install it from /mnt/free, it would remove the symlink to the cf card, and break the Ruby package and all programs that use Ruby.

What can we do about this?

Quote:
Originally Posted by -Thomas- View Post
But as the iLiad OS project evolves, maybe we can re-partition the root file system in some time to give / some more space to hold user apps. But that has to be seen.
Is the iLiad OS project still alive? It has been extremely quiet for some time... Anyhow, I've added some info in the wiki: https://wiki.mobileread.com/wiki/Application_Packaging Feel free to expand...


Quote:
Originally Posted by ericshliao View Post
To be honest, I seldom use installable package for iLiad, although it's convenient. I fear that it will make some unwanted modification to my system. Since I don't know what the installable package does, I have to spend some time to figure out what happens and its cause.
I agree! I would never install a package without knowing what it really does.
Quote:
Originally Posted by ericshliao View Post
Personally, I don't like to install anything to iLiad root file system, because it's not convenient to maintan with iLiad's input/output facility. Unless I have to replace/modify some files in root file system, I always put apps in MMC.
One reason to install stuff in the internal flash is that it is available at boot time (cf, mmc and usb are mounted later). I'm currently playing with Lua scripts that I want to run from start.sh... Maybe I shoul refrain from installing in /usr/local (linked to /mnt/free/local)? and install directly in /mnt/free?

Another reason te install in internal flash is the problems involving wifi when accesssing cf. I can solve that by buying a mmc card... B.t.w. Is there still a problem with Wifi and CF in 2.12? I never testetd this myself...

Last edited by hansel; 01-12-2009 at 08:22 AM.
hansel is offline   Reply With Quote
Old 01-12-2009, 09:45 AM   #12
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
Quote:
Originally Posted by hansel View Post
Maybe I shoul refrain from installing in /usr/local (linked to /mnt/free/local)? and install directly in /mnt/free?
I think it's an acceptable compromise to install to /mnt/free, if install to root file system is not so required. For example, I installed my TrueType font in /mnt/free/fonts, because it's too large (more than 20 mb) to fit in root file system and if installed to MMC/CF will prohibit runtime removal of MMC/CF. But there is a un-confirmed problem for installation to /mnt/free. I once put sshd apps to /mnt/free and then my system corrupted and I had to reflash. I don't know what's the cause. Maybe just co-incidence.
ericshliao is offline   Reply With Quote
Old 01-12-2009, 09:51 AM   #13
-Thomas-
Addict
-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.
 
-Thomas-'s Avatar
 
Posts: 325
Karma: 1725
Join Date: Dec 2007
Location: Münster, Germany
Device: iRex iLiad v2
Quote:
Originally Posted by hansel View Post
But it's still unaccaptable if one preinstall script deletes the symlinks created by another preinstall script. The symlinks should only be created if not present. Example: if I release a package to install Lua, and install it from /mnt/free, it would remove the symlink to the cf card, and break the Ruby package and all programs that use Ruby.
That's right. But for me it's the other way round: Let's assume I would install Lua to CF and Ruby to the internal memory, as it's of greater value for me. Then how would you compile both programs so that both of us can use it if not with --prefix=/usr/local? By choosing somethink like --prefix=/mnt/free/local you force users to use the internal memory, which could be something they don't want. In the end it's a trade-off between flexibility and package consistency, where I would prefer the flexible way. If we want to let the user choose which storage medium they want to use there is no way around symlinking IMO.

Of course symlinking breaks the ipkg mechanism in a serious way, but I think it's the most consumer-friendly way, if you stick with the assumptions I made in my last post.

Quote:
What can we do about this?
The only real solution would be if we had bigger storage in /, but that's not an option at the moment.

We should also think about the "legacy" software that is already out there, they were all compiled to use /usr/local. This software should still be useful in the future. Well, this should not be an argument for symlinking /usr/local somewhere, but /usr/local should be involved in some way.

Isn't there a file system that can mount several partitions transparently to the same directory? I think the Knoppix Live DVD is using something like this to assure "write access" to their read-only CD image. If this would be possible we could just mount all /media/*/_local to /usr/local and would be done.

Quote:
I'm currently playing with Lua scripts that I want to run from start.sh... Maybe I shoul refrain from installing in /usr/local (linked to /mnt/free/local)? and install directly in /mnt/free?
I'd better go for /usr/ if you want to run it from start.sh and it's an important script. Maybe I'm a bit conservative when it comes to changing the start.sh

Quote:
Another reason te install in internal flash is the problems involving wifi when accesssing cf. I can solve that by buying a mmc card... B.t.w. Is there still a problem with Wifi and CF in 2.12? I never testetd this myself...
It's still there (it's merely a hardware design flaw), but it's easy to work around. My Feedbooks plugin for example first downloads to /tmp and moves files to CF afterwards to avoid simultaneous Wifi and CF access.
-Thomas- is offline   Reply With Quote
Old 01-13-2009, 04:41 AM   #14
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Some more ticks about not installing in /usr/local...

Quote:
Originally Posted by -Thomas- View Post
  • [reasons to install in /usr/local]
  • (just a minor one) Compiling is much easier. Just do a ./configure --prefix=/usr/local and let preinstall do the rest
If you compile Ruby (or Lua; same issue) for /usr/local, and copy the whole tree to another location, it will have problems to find its libraries. HOWEVER this can be repaired (very probably, no time to test now for Ruby) at runtime by setting some enviroment variables.

For Ruby these are:
  • DLN_LIBRARY_PATH: Search path for dynamically loaded modules.
  • RUBYLIB: Additional search paths.
  • RUBYPATH: With -S, searches PATH, or this value for ruby programs.

PS: http://www.zenspider.com/Languages/Ruby/QuickRef.html is a nice quick reference for Ruby
hansel is offline   Reply With Quote
Old 01-14-2009, 01:47 AM   #15
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
symlinks on vfat

@Thomas: One more thing check: symlinks will not be created on vfat destinations when installing with ipkg on the Iliad. This might cause some libraries to be broken. (I had to repair this for Lua). You can check this by installing manually via ssh: ipkg gives an error message...

EDIT: Just discovered that tar can dereference symlinks when packing ('h' option). This converts symlink to copies. Handy because symlinks are not supported on vfat

Happy scripting!

PS: I decided to let my lua.ipk install evrything in /mnt/free/_local/, with the intention to run be run from there (without symlinks in /usr/local). The install size is less than 1 MB, and my /mnt/free has 100MB free...

Last edited by hansel; 01-14-2009 at 05:49 AM. Reason: tar can dereference symlinks
hansel is offline   Reply With Quote
Reply

Tags
iliad, ruby

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Book (Kindle) - Robin and Ruby Susan Crealock Deals and Resources (No Self-Promotion or Affiliate Links) 0 04-02-2010 06:46 AM
Quick n' dirty Ruby Program: convert text files (Kindle - others?) monojohnny Reading and Management 5 01-14-2009 08:32 AM
iLiad dancing Ruby on Iliad dzw! iRex Developer's Corner 8 08-29-2008 06:37 PM
Walk, Charles Edmonds: The Paternoster Ruby (Illustrated). v1. 4 Aug 07 HarryT BBeB/LRF Books 0 08-04-2007 06:03 AM
Free Ruby programming e-book TadW Deals and Resources (No Self-Promotion or Affiliate Links) 2 01-13-2007 01:50 AM


All times are GMT -4. The time now is 12:57 AM.


MobileRead.com is a privately owned, operated and funded community.