This is a detailed set of instructions (partly for my own future reference) on setting up mounted NFS folders on the Nokia N810 tablet.

Before we get started, this article makes a couple assumptions. First, that you already have a directory setup on a different computer as an NFS share. Second, that you've already got 'sudo gainroot' enabled. I don't recall exactly how I did that... but I believe it had something to do with taking the red pill (seriously, I'm not a big enough fan of that movie to make those kind of jokes, but obviously somebody at Nokia is). Also, I highly advise that before you do anything you make sure you can SSH into your device directly as root. In doing this myself I screwed up the sudoers file and couldn't 'gainroot' on the device anymore (meaning I couldn't even fix what I broke). Being able to SSH to the device allowed me to fix the file and saved me from having the reflash the OS and reinstall everything from scratch. If any of this scares you, take my advice and leave now. This is the deep end of the pool and there are no lifeguards on duty.

Ok, still here? That's too bad. I assume no responsibility for what you're about to try to do. If you do really, really screw up though, just download a new image of the OS from maemo.org and reflash the device and it should be good as new. Moving along.

First, from your xterm, type sudo gainroot, or just SSH to the device as root from a computer with a full size keyboard. cd to /etc, and open the 'sudoers' file in vi (maemo doesn't appear to come with emacs, so you may be stuck with vi). Add the following two lines to the very end of the file.

user ALL = NOPASSWD: /bin/mount -t nfs <remote_ip>\:/remote/path /mnt/mount_point
user ALL = NOPASSWD: /bin/umount /mnt/mount_point

Pay special attention to the '\:' in the first line, that backslash is important.

Next, create a file in /etc/rc2.d called 'S99mountmods' and add the following lines to it.

#! /bin/sh
insmod /lib/modules/2.6.21-omap1/extra/sunrpc.ko
insmod /lib/modules/2.6.21-omap1/extra/lockd.ko
insmod /lib/modules/2.6.21-omap1/extra/nfs.ko

Ok, now create your mount_point directory if you haven't already and go back to being a regular user for the rest of this.

The next few steps are a little more complicated than they probably need to be, but this job calls for aliases, and I prefer to always keep my aliases in their own .aliases file in my home directory. Here's how I figured out how to do that on the N810.

First, create a .profile file in your home directory, with the following lines...

ENV=$HOME/.ashrc
export ENV

Now, create a .ashrc file in the same place, with the line source ~/.aliases.

Alright, now we're ready for the .aliases file. You don't really need the first line unless you want to create more aliases easily and want to do it the same way I do. Otherwise, you can safely ignore it. You can also name the aliases anything you want, as long as you remember what the names are when you need to use them.

alias ea='vi ~/.aliases; source ~/.aliases'
alias umntr='sudo umount /mnt/mount_point'
alias mntr='sudo mount -t nfs :/remote/path /mnt/mount_point'

And that should be it. Reboot the device, and from xterm as the normal user run 'mntr'. It should pause for a moment and then go right back to the command prompt without any messages. You should now be able to cd into the mount point folder and see files from the remote machine as if that terrabyte drive were directly on your handheld device. Hopefully you got all the way through that without bricking your device. If not, well, don't say I didn't warn you earlier.

It should also be noted that next time you flash an OS upgrade onto the tablet, you'll probably have to do much of this all over again, so bookmark this page now.

Comments: 0 [add comment]

My Solstice Holidays present to myself this year was a Nokia N810 Internet Tablet. It's kinda like an IPhone, but without the phone part and especially without the locked down you-can-only-do-what-steve-jobs-says-you-can-do garbage. It runs on Linux and is wide open. I was very interested in getting one right up until I discovered that somebody had already ported Ruby to it... then I just HAD to have one. Don't hold your breath for Ruby to come to the IPhone. It'll never happen.

So, I've had it for about a week now, and have already been having way too much fun. It's got a built in GPS (yah that was another reason I HAD to have it), and I've been playing with that a bit. Naturally, I wanted to write stuff for it in Ruby, and naturally I wanted to take advantage of the GPS to do some location based stuff, so the first thing I needed was a Rubyish way to get at the GPS data in a friendly object-oriented fashion, which leads me to...

I just released Rupl, the RUby Personal Locator. It's a Ruby library for accessing the GPS. It's what I intend to use in any apps that I write for this thing that need to know where they are in the world within 20-30 feet. I put it up on RubyForge in hopes to attract more Ruby developers to this platform, as well as hope that they'll take it a run with it to create some cool location oriented apps that even I hadn't thought of (but can't live without).

Obviously, Rupl has a way to lookup where the unit is (Rupl.last_known_location) which will return a hash of data on where the GPS was the last time it got a GPS fix and what time that was at. So for instance, if you go inside a building and the GPS looses the satelite signal, last_known_location will return the latitude and longitude of the front door and whatever time it was that you were there.

Secondly, Rupl provides a few convenience functions to do related calculations such as computing the distance and direction between two given coordinates.

And last but not least is the Trigger class. Your application can create an arbitrary number of triggers and pass a block of code that will be fired whenever the trigger conditions are met. For instance, conditions can be based on the distance you've moved away from where you were the last time the trigger fired. So the trigger will fire every time you move another 42 feet, or whatever. Or, conditions can be based on how far away you are from some arbitrary hotspot and fire when you get within some set radius of that point.

Rupl can be found on RubyForge at the follow addresses and is released under the MIT license. Enjoy!

Project Page: http://rubyforge.org/projects/rupl/
Documentation: http://rupl.rubyforge.org/
SVN Repository: http://rupl.rubyforge.org/svn/trunk/
Comments: 0 [add comment]