Archive: olpc

January 25, 2008

Use an SD card as swap space on the XO laptop

Xo-Mmcsd

I posted this over at the OLPC News Forums, and decided to share it with Hackszine readers as well.

Most of the time, the 256MB in the XO Laptop is sufficient. But I use yum to install software, and it can be very memory hungry. I often run out of RAM when installing more than a few packages at once (or a single package that decides it needs a bunch of other packages to work properly). There are two things I suggest before using yum: 1) quit all activities except terminal and cross your fingers or 2) enable some swap space and not worry.

The quick and dirty way to enable swap space is to put an SD card that you don't care about into the XO, and run one of these commands:

Note that this will destroy whatever's on the SD card, and in the long run is not good for it because it puts a lot of wear and tear on it.

On the default operating system that came with your XO:

su
mkswap /dev/mmcblk0
swapon /dev/mmcblk0
exit

On a joyride, Update.1, or later:

sudo mkswap /dev/mmcblk0
sudo swapon /dev/mmcblk0

You can replace swapon /dev/mmcblk0 with swapoff /dev/mmcblk0 when you are done and want to remove the SD card, or shut down the machine then remove the SD card. Don't remove it while you're using it as a swap drive or the system will probably crash.

As with anything that has "su" or "sudo" in it, if you mistype something, you may damage the operating system. One safety tip I can suggest is that you type the command like this:

swapon /dev/mmc[TAB][TAB]

That invokes tab filename completion, where it will either type out mmcblk0 for you, or show you a bunch of options. If you see anything other than mmcblk0, or mmcblk0p1/2/3, you might have mistyped the command. (The p1, p2, etc variants may appear if the SD card has multiple partitions on it).

I use this all the time to give myself some extra memory. It is slow because it's swapspace on an SD card, but it's much better than running out of memory while running yum. (The consequence of running out of memory is that you end up with improperly installed software). This is also handy if you are going to run a ton of activities at once, or if you are planning to use memory-intensive apps that you install with Yum, such as openoffice, gnumeric, etc.

Posted by Brian Jepson | Jan 25, 2008 05:23 AM
Linux, olpc | Permalink | Comments (5) | Digg It | Tag w/del.icio.us

January 18, 2008

XO hacking with Joel of Geek.com

xo-sensor.jpg

I had coffee recently with Joel of Geek.com, and we hung around a Panera Bread getting our XO laptops to do cool stuff and see if we could brick them. Joel has a complete write-up on the fun over at Geek.com:


...we had a good time playing around with the XO. I should also mention that we generated some interest in our local Panera as we completely took over an area by a fireplace and had some strange gadgetry flying high.

...The first thing we did, once the machines were powered up and connected to the available Wi-Fi, was set them to use XOChat.org. This is a service setup by Tom Hoffman which is basically a public ejabberd server. The coolest thing about it is that you're instantly connected with other XO users (provided they're also logged into the service).

Feature: Hacking the XO laptop - Link

Posted by Brian Jepson | Jan 18, 2008 10:30 AM
olpc | Permalink | Comments (1) | TrackBack | Digg It | Tag w/del.icio.us

January 6, 2008

HOWTO upgrade the XO Laptop's operating system

Xo-Devbuilds

If you've visited the OLPC Wiki, you've probably noticed the box on the right hand side that shows the latest releases (stable and development builds). Although the current stable build listed is 650, there's a newer one (653) that you might want to upgrade to. But if you want the latest, greatest, bleeding edge XO builds, you need to check out the "joyrides". However, these can be extremely unstable, so be warned.
Before you upgrade, there are a few things to know:

  • You can have two versions of the operating system installed at any time. By default, you'll boot into the one you installed most recently. So if you start out with build 650, then install build 653 and reboot, you'll start up in build 653. If you hold down the O key (on the keypad to the right of the screen) as you boot, you'll boot the alternate operating system (in this case, 650). (At this point, I believe that 650 becomes the default and 653 the alternate.)
  • At boot time, the XO laptop maps a pristine (see /versions/pristine) copy of the operating system into the running system's filesystem. Any changes you make to the filesystem are in another location (see /versions/run), but it all looks like one filesystem to you. When you reboot into an alternate operating system, any changes you had previously made to it are revived.
  • When you use the olpc-update command to update to a new version of the operating system, the alternate operating system is wiped out (both the pristine version and any modifications to it)
  • Through all of this, your home directory (/home/olpc) is left unchanged.

Update: Todd Norris wrote in with some important information. Some models of the XO laptop shipped with a version of firmware that is susceptible to a significant bug: if the real-time clock battery is physically removed or otherwise runs out of power, the machine may no longer boot. Even if you don't have an affected machine, this firmware update includes numerous bug fixes and is recommended for current models of XO laptops. For more information, including installation instructions, see the page for firmware version q2d07. However, this firmware will shortly be replaced by a newer release, so be sure to check the OLPC Wiki and look for the highlighted portion shown in the screenshot above. This will show you the newest version of firmware and operating system.

If you're ready to install the upgrades, read on.

Read full story

Posted by Brian Jepson | Jan 6, 2008 03:33 PM
Education, Linux, olpc | Permalink | Comments (8) | Digg It | Tag w/del.icio.us

December 28, 2007

xochat.org: make new friends

Xochat-Org-In-Action-1

My friend Tom Hoffman has set up a Jabber server for XO Laptop users:

I'm having a feeling I'll regret having done this, but xochat.org is now up and running. If you've got an XO you can point it at my Jabber server by popping open a terminal and typing this:
sugar-control-panel -s jabber xochat.org

Then hit ctrl+alt+erase to restart Sugar. You should then see the other people logged in to the server in the "Neighborhood" view. That is essentially the widest view. You should be able to see other users and shared activities, and share your own activities with them, including video.

This is, however, the bleeding edge of the bleeding edge, so don't expect perfection.

This isn't group chat; once you've got it set up, start the Chat activity, share it with your neighborhood, and like magic, you'll find all sorts of people and activities in your neighborhood. Very cool! Link and update

Posted by Brian Jepson | Dec 28, 2007 08:22 PM
Education, Linux, olpc | Permalink | Comments (4) | Digg It | Tag w/del.icio.us

December 23, 2007

Run a nested X11 desktop on the XO Laptop

Xo-Laptop-X11
The XO laptop continues to be very hackable. If you haven't ordered one already, you really should because you only have a few days. I've owned some pretty sweet devices in the past, but nothing compares to this. At every turn, I find something new and cool about it, and there always seems to be a way to do the things I want to do. The only thing I need to worry about is using up all my flash drive space, but that's what USB drives are for, I guess.

Because the Sugar interface includes an X11 window manager, you can't fire up your favorite window manager without killing Sugar... unless you run a nested X11 server. The Xephyr server is available in the XO's default package repository, and it can run as a client and a server at the same time: as a full-screen client of the XO's X11 server, and as an X11 server that can contain its own session, window manager and all. (Xephyr is similar to Xnest, but supports more X extensions.)
To get it up and running, I started the Terminal activity, used su to become root, and installed Xephyr and blackbox (a nice lightweight window manager):

$ su
# yum install xorg-x11-server-Xephyr blackbox
Next, exit out of the root shell, and create a file in your home directory called xephyr.xinitrc that launches the window manager of your choice:
# exit
$ echo exec /usr/bin/blackbox > ~/xephyr.xinitrc

Now, each time you want to run Xephyr, use xinit to start up Xephyr on display :1 (if you want to run more than one Xephyr session at once, use :2, then :3, etc):

$ xinit ~/xephyr.xinitrc -- /usr/bin/Xephyr :1 -ac -screen 1200x900

You should see your window manager start up; the screenshot above shows blackbox with a few clients running. I ran into a few oddities that will eventually send me running to X11 documentation; for example, arrow-up and arrow-down don't bring up my history in the bash shell (but Ctrl-P and Ctrl-N work fine). And the screen is pretty hard to read except in reflective mode... but wow, it's nice to have 1200x900 pixels on such a small screen!!!

Posted by Brian Jepson | Dec 23, 2007 06:52 AM
Education, Linux, olpc | Permalink | Comments (10) | Digg It | Tag w/del.icio.us

December 21, 2007

HOWTO run Arduino on the XO Laptop

Xo-Arduino-Screenshot

The XO Laptop comes with the drivers you need to talk to an Arduino board, but you need to do a few things before you can run the Arduino environment. Once you get it running, though, it works just fine. The first step is to install Java. To install Java on the XO Laptop, check out these instructions (the version of Java that you download will be different from what's listed on that page, so you'll need to modify the commands slightly to take that into account).
Once you've got Java up and running, you need to install the GNU C and C++ compilers as well as the LIBC for the AVR chip that the Arduino uses. To do this, open up the Terminal activity, su to root, and install avr-gcc, avr-libc, and avr-gcc-c++ using yum:

$ su
# yum install avr-gcc avr-libc avr-gcc-c++

While you're root, you may as well make one of the changes you need to make; add the olpc user to the lock and uucp groups. To do this, edit the /etc/group file with the /usr/sbin/vigr command and add the olpc user to the end of the lock group:

lock::54:olpc

and to the end of the uucp group:

uucp::14:uucp,olpc 

After you exit vigr (which is just a script that starts vi to safely edit the group file), decline its offer to edit the gshadow file, and type exit to get back to a normal (non-root) shell):

# /usr/sbin/vigr
You are using shadow groups on this system.
Would you like to edit /etc/gshadow now [y/n]? n
# exit
exit
$ 

Next, make sure you're in your home directory, download Arduino (there may be a more recent version of it, so check the Arduino page to be sure. Extract Arduino in your home directory (you'll be running it out of your home directory as well):

$ cd
$ wget http://www.arduino.cc/files/arduino-0010-linux.tgz
$ tar xvfz arduino-0010-linux.tgz

Now, you're all Arduino-fied. To run it, cd to the arduino-0010 and run the arduino script:

$ cd ~/arduino-0010
$ ./arduino

There is one last trick: you'll likely find that the Arduino user interface misbehaves quite a bit. To get it to work right, press the screen rotate button four times to get a nice 360 degree rotation. Arduino will redraw and start behaving itself as shown in the screenshot.

Update: As Seth points out in the comments, the Update.1 build that is coming out this month will do away with the su command, so you should use sudo -s instead of su (or simply prefix each superuser command with sudo).

Update 2: If you use JRE 5 from the Java technology archive instead of JRE 6, you won't need to use the screen rotation trick. You'll need to add these two lines to the .bashrc file in your home directory, and then stop and relaunch the Terminal activity:

export JAVA_HOME=/usr/java/jre1.5.0_13/
export PATH=$PATH:$JAVA_HOME/bin
You'll need to install Java and modify your ~/.bashrc before you try running ./arduino

Posted by Brian Jepson | Dec 21, 2007 06:35 PM
Education, Linux, olpc | Permalink | Comments (14) | Digg It | Tag w/del.icio.us

December 20, 2007

Copy and paste (sort of) into the XO laptop's Terminal activity

Xo-Pbpaste

According to ticket #5376, you can't copy and paste text between Terminal.activity and other applications. This became a problem for me this evening when I tried to copy a script from a web page into a file on the XO laptop. Fortunately, pygtk gives you access to the clipboard, and it's really easy to create a script that blasts the contents of the clipboard to stdout. I named it pbpaste after the Mac OS X utility of the same name. Save this file somewhere in your $PATH, make it executable, and you're all set.

#!/usr/bin/python

import pygtk
import gtk
cb = gtk.clipboard_get(selection = "PRIMARY")
print cb.wait_for_text()

It's not as flexible as a middle-click button would be, but it gets the job done, as shown in the figure above. And if I need to insert the contents of the clipboard into a file I'm editing in vi, I can always use :r!pbpaste

Posted by Brian Jepson | Dec 20, 2007 01:58 PM
Education, Linux, olpc | Permalink | Comments (3) | Digg It | Tag w/del.icio.us

December 19, 2007

Record more than 45 seconds of audio or video on the XO laptop

240Seconds
If you go into the Record activity on the XO laptop, you'll find that you can only record a maximum of 45 seconds of video and audio. But since almost everything in this little green wonder is written in Python, it's very easy to fix this. Open up the Terminal activity, cd to /usr/share/activities/Record.activity, and then use su to become root:

$ cd /usr/share/activities/Record.activity
$ su
#

Now, make a backup copy of constants.py:

# cp constants.py constants.py.orig

Open constants.py in vi, and look for these lines:

	DURATION_15 = 15
	DURATION_30 = 30
	DURATION_45 = 45

Add the following line right after the DURATION_45 line (you can put whatever you want instead of 240--this is the number of seconds):

	DURATION_240 =240

Next, find these lines:

	DURATIONS.append(DURATION_15)
	DURATIONS.append(DURATION_30)
	DURATIONS.append(DURATION_45)

And add the following line right after the DURATION_45 line:

	DURATIONS.append(DURATION_240)

Stop the Record activity if it's already running, restart it, and you'll now have an option to record for more than 45 seconds.

Posted by Brian Jepson | Dec 19, 2007 05:05 PM
Education, Linux, olpc | Permalink | Comments (1) | Digg It | Tag w/del.icio.us

December 12, 2007

XO laptops starting to arrive

Xo Intro V2

Doug Johnson reports on what may be the first G1G1 XO laptop to arrive:

The small box included the computer, the power adaptor, 2 sheets of paper with minimal instructions, and the battery which had to be installed. The package was shipped FedEx from Libertyville IL on Dec 7 and arrived on my doorstep at exactly 4:30PM yesterday, Dec 11. I had no advance notice and did not need to sign for the package.

Doug fields some questions from visitors to his site, and has a few pictures up there. Let us know if you got one, too! [via] Link

Posted by Brian Jepson | Dec 12, 2007 06:42 AM
Education, Linux, olpc | Permalink | Comments (0) | Digg It | Tag w/del.icio.us

Bloggers

Welcome to the Hacks Blog!

Brian Jepson.Brian Jepson


Jason Striegel.Jason Striegel


Philip Torrone.Phillip Torrone



See all of the books in the Hacks Series!
Advertise here.

Recent Posts

www.flickr.com
photos in Hacks More photos in Hacks