Wednesday, February 27, 2013

Another Reason To Buy A Kindle

Because this advertisement pisses of "One Million Moms", who want to boycott Amazon for not being homophobic like them accepting of gays.

Order one here.

Monday, February 25, 2013

Ruby 2.0.0 Official Released

From the official Ruby language website:
We are pleased to announce the release of Ruby 2.0.0-p0.
Ruby 2.0.0 is the first stable release of the Ruby 2.0 series, with many new features and improvements in response to the increasingly diverse and expanding demands for Ruby.
Enjoy programming with Ruby 2.0.0!
Some of the features include:
  • Language core features
    • Keyword arguments, which give flexibility to API design
    • Module#prepend, which is a new way to extend a class
    • A literal %i, which creates an array of symbols easily
    • __dir__, which returns the dirname of the file currently being executed
    • The UTF-8 default encoding, which make many magic comments omissible
  • Built-in libraries
    • Enumerable#lazy and Enumerator::Lazy, for (possibly infinite) lazy stream
    • Enumerator#size and Range#size, for lazy size evaluation
    • #to_h, which is a new convention for conversion to Hash
    • Onigmo, which is a new regexp engine (a fork of Oniguruma)
    • Asynchronous exception handling API
  • Debug support
    • DTrace support, which enables run-time diagnosis in production
    • TracePoint, which is an improved tracing API
  • Performance improvements
    • GC optimization by bitmap marking
    • Kernel#require optimization which makes Rails startup very fast
    • VM optimization such as method dispatch
    • Float operation optimization
And it's promised that compatibility between 1.9 and 2.0 is going to be better than even from 1.8 to 1.9!

Tuesday, February 12, 2013

Terminator - Multiple Panes With No Pain

One of the habits I've adopted of the years is to keep multiple terminals open on my development desktop: one for compiling, one for running tests, one for listing and searching through code.

Similarly, for access email, I would do something similar to that, opening a separate terminal instance to run Mutt and one to run offlineimap.

When tabbed terminals started popping up, it made things easier to manage. I could have a single instance of a terminal for email, another for development, etc. This, however, had limits since I couldn't have everything easily visible at once.

Then, a while ago a friend at work turned me on to Terminator, a multi-paned terminal app. And I've easily incorporated that into my normal workflow.


The keys I commonly use for working with Terminator are ones to split the current pane vertically or horizontally, to maximize the current pane, and to switch back and forth between panes.

Splitting Panes

To split a pane vertically, creating two panes side by side, simply hit Shift+Ctrl+E. To split horizontally, creating two panes above and below, hit Shift+Ctrl+O. In both cases the newly created panes are equal in size.

Maximizing A Pane

To toggle maximizing the current pane, hit Shift+Ctrl+X. When a pane is maximized, you cannot move to a different pane, though this would be something I would add to the wish list.

Moving Between Panes

To move to the next pane, press Ctrl+Tab. To move to the previous tab, press Shift+Ctrl+Tab.

Note that the tabbing sequence appears to be defined by the creation order of the panes and not by their actual order in the window. So adding a new tab between panes 1 and 2 doesn't guarantee that this new tab will be the next tab after 1.

Programming Setup

My normal setup for programming is to open an instance of Terminator, then split it vertically once and then split the right pane horizontally once. This gives me the following layout:
Additionally, for development I use emacs as my primary editor.

When I'm writing code I hit Meta+CursorRight to move it to the right half of my display. This covers the compiling and miscellaneous panes, leaving the coding pane visible underneath. This allows me to look at other pieces of code in other source modules without leaving my editor.

When I'm fixing a compiler error, I can hit Meta+CursorLeft to move emacs to the other side of the desktop. Then I can see the compiler error as I'm fixing the code or build environment.

Also, on the fly, I can easily create temporary panes by hitting one of the split keys and then immediately maximizing that new pane. I use such panes to ssh into a build machine, to one of my other work boxes to, for example, test a new change on a different platform (such as my new Chromebook for ARM development). Then, when I'm done, simply exiting the pane restores my normal Terminator layout.


All in all, a highly useful terminal application. It provides me with the ability to have more than one piece of information on the screen at once. It works well with other tools that I use to produce code, which makes Terminator indispensable.

Wednesday, February 6, 2013

Fedora 18 For ARM Now Available

In case you missed it, I posted an article yesterday on how to load Fedora onto a Samsung Chromebook.

Today the official announcement of the release of Fedora 18 for ARM hits the 'net.
The Fedora 18 for ARM release includes pre-built images for Versatile Express (QEMU), Trimslice (Tegra), Pandaboard (OMAP4), GuruPlug (Kirkwood), and Beagleboard (OMAP3) hardware platforms. Fedora 18 for ARM also includes an installation tree in the yum repository which may be used to PXE-boot a kickstart-based installation on systems that support this option, such as the Calxeda EnergyCore (HighBank).

Tuesday, February 5, 2013

Loading Fedora On A Samsung Chromebook

Overview And Goals

The goal is to describe how to boot and run Fedora Linux on a Samsung Chromebook. Lots of thanks go to Chris Hewitt for laying the foundation for this page.

Equipment & Software

Hardware: Samsung Chromebook XE303C12 (ARM Exynos 5 processor)
Storage: Sandisk 32G card, which identifies as /dev/mmcblk0 (substitute your own drive's device in the instructions below)
Fedora Image: The generic hardware floating point image from here (or click here to download the image now).

Preparing The Disk

The first thing to do is to prepare the SD card. What we want to do is create two partitions for the kernel images and a partition for holding the root filesystem for Fedora.

You don't need a lot of space for the kernel images, so two 15MB partitions are find. You can either leave the remaining space for the root file system. Or, if you want to keep /home separate to protect it in case you have to redo the rootfs, you can create a fourth partition for the home file system. The latter is how I do things.

Partition The Drive

To partition the drive, first create the GPT partition table:

sudo gdisk /dev/mmcblk0
(parted) mktable gpt
(parted) w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/mmcblk0.
The operation has completed successfully.

Next you need to create the individual partitions. As Chris did, I'll just post what you need to type to create the partitions since it can be VERY verbose otherwise. Here we configure the geometry for the disk:

sudo gdisk /dev/mmcblk0

x # go into extra functionality/expert mode
l # set the sector alignment value
8192 # 8192 bytes
m # return to the main menu

Now we create the partitions. We'll create two 16MB partitions to hold the kernels from the Chromebook, a 15G partition for the root file system and use the remaining space for a home filesystem. If you don't want to have a separate home filesystem, then follow the instructions inline:

n # creates a new partition
1 # partition 1
(ENTER) # accept the default starting sector
+16M # make partition 1 16MB
7f00 # make the partition type "ChromeOS kernel"

n # creates a new partition
2 # partition 1
(ENTER) # accept the default starting sector
+16M # make partition 1 16MB
7f00 # make the partition type "ChromeOS kernel"

If you want the root filesystem to use the rest of the disk, then do this:

n # another partition
3 # partition 3
(ENTER) # accept the default starting sector
(ENTER) # go to the end of the free space
(ENTER) # use the default file system type

What I did was this:

n # another partition
3 # partition 3
(ENTER) # accept the default starting sector
+15G # make the root filesystem 16G
(ENTER) # use the default file system type

n # another partition
4 # partition 4
(ENTER) # accept the default starting sector
(ENTER) # go to the end of the free space
(ENTER) # use the default file system type

When it's all done, you need to update the disk:
w # writes the changes to disk

Format Root And Home

Now format the filesystems. Again, if you didn't create a home filesystem, then don't format it. And BE CAREFUL when specifying the device to format!

For me /dev/mmcblk0p3 is the root file system, while /dev/mmcblk0p4 is the home file system.

sudo mkfs -t ext4 /dev/mmcblk0p3
sudo mkfs -t ext4 /dev/mmcblk0p4

Extracting The Fedora Image

Now that you have a prepared disk, you need to first mount the file system and then extract the Fedora root filesystem onto it.

First thing is to mount the root filesystem:

sudo mount /dev/mmcblk1p3 /mnt

Now extract the file containing the image that you downloaded from Fedora:

sudo tar Jxvf Fedora-18-armhfp-rootfs.tar.xz -C /mnt

Fixing /etc/fstab In The Image

You'll want to now update the /etc/fstab file in the new image, comment out the existing entries and add a single one:

/dev/mmcblk1p3 / ext4 defaults 1 1

Using UUIDs Instead Of Device IDs

Thanks to Steve Falco for this.

To use the UUIDs, use the following command line:

dumpe2fs /dev/sdf3 | grep UUID

and then replace the UUIDs for each partition in /etc/fstabs with thes shown.

Installing The Chromebook Kernel

There is work being done to get a Fedora kernel to install on the Chromebook. But, for now, you have to work with the one that came with the Chromebook itself. To do this, you need to boot up your Chromebook into developer mode. To do this, hold down both the Escape and Refresh keys and press the Power button. When the system reboots it will say "To turn OS verification OFF, press ENTER".

Do this.

The system will then tell you that OS verification is off. This puts your Chromebook into developer mode. Don't get worried when it says your local data is being cleared, this is normal. You'll be able to dual boot your system, booting either Fedora from the SD card or ChromeOS from the SSD. It will take about 15 minutes or so to wipe the data, so be patient.

Once the system has finished clearing your data and restarting, it will reboot and show you a screen that says, "OS verification is OFF". Press Ctrl+D to boot the system at this point.

Log into the system (you will need to recreate your account). Once into the system, type Ctrl+Alt+T to launch a crosh box. Then type:

crosh> shell

Then type:

chronos@localhost / $ sudo -s 

Now lets create some bootable images!

To create a bootable image, which we'll copy to our two boot partitions, type the following:

 cd /tmp 

echo "console=tty1 debug verbose root=/dev/mmcblk1p3 rootwait rw lsm.module_locking=0" > /tmp/config vbutil_kernel --pack /tmp/newkern --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/tmp/config --vmlinuz /boot/vmlinuz-3.4.0 --arch arm  

 Now we need to copy that image onto our two boot partitions and enable booting from it. To do that, type the following:

dd if=/tmp/newkern of=/dev/mmcblk1p1 

dd if=/tmp/newkern of=/dev/mmcblk1p2 

crossystem dev_boot_usb=1

It's okay if you see the message "Unable to open FDT property nonvolatile-context-storage". Apparently this happens to everybody and is not a sign that something's gone wrong.

To mark the partitions as bootable, type:

cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/mmcblk1 

cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B /dev/mmcblk1

Copy the kernel firmware and libraries onto the new root filesystem.

Notice that I'm using "External Drive 3" here. That's because I'm using a separate filesystem for /home. If you went with just a single filesystem then you'll use "External Drive 2" here.

Again thanks to Steve Falco for pointing out that, in some cases, these drive letters might be reversed or different. Be sure, us ls to check both External Drive mounts to see which contains the actual root file system for Fedora.

After copying the files, you'll remount the partition and chroot it to isolate our new Fedora root filesystem:

cp -rf /lib/modules/* /media/removable/External\ Drive\ 3/lib/modules/ 

cp -rf /lib/firmware/* /media/removable/External\ Drive\ 3/lib/firmware/ 

mount -o remount,suid,exec /media/removable/External\ Drive\ 3/ 

chroot /media/removable/External\ Drive\ 3/

Next we will set a password for root, and then create the GUEST account. Don't try to create a normal user account at this point:

passwd adduser guest 


umount /media/removable/External\ Drive\ 3/

Now you're ready to boot your Chromebook into Fedora!

Booting Your Chromebook Into Fedora

Reboot the Chromebook. On the screen where it says OS verification is turned off, now you will type Ctrl+U to boot from the SD card. You should see the standard Fedora booting output which means you've successfully install Fedora. Once the system has booted, if you created a separate file system for /home, you can log in as guest, su to root, add the file system by UUID, then create a proper user account. Any feedback on these instructions, about how to fix problems that come up or how to make them more efficient, please send them to me or post them below as comments.