Sunday, September 16, 2012

 

Ubuntu Precise (12.04) on Apple TV (1st generation)

I have an Apple TV(1st generation) that I use as a HTPC running XBMC. I planned to swap out the original hard drive with a compact flash card (poor man's SSD). One of the biggest issue with swapping the original hard drive out and replacing it with a compact flash card is to find a compact flash card that will boot. It is supposed that only compact flash card that identifies itself as "fixed disk" can boot as a replacement drive inside the Apple TV. Off late most vendors dont sell compact flash card that identifies itself as a "fixed disk" when using a compact flash to IDE adapter nor do they provide any utility to do the same as they have done in the past. Finding a compact flash card that will boot as a replacement drive has been the toughest part. After experimenting with a few myself and talking with other people who have tried I was close to giving up on using a compact flash card as the bootable drive. I finally found a card that did boot.

The devices I am using are:
Compact flash to IDE adapter: Syba SY-IDE2CF-NB25
Compact flash card: Maxell 8GB compact flash card maxdata 400x

In this post I will install a minimal base system that boots and starts a ssh-server. I will use IDE to USB adapter and linux system to do the installation.

In the rest of the post the compact flash device comes up as sdb, please use the appropriate device when you are trying it out.

First we will zero out the card.
# dd if=/dev/zero of=/dev/sdb bs=4096 count=2M

Create a GPT partition table
# partprobe /dev/sdb
# parted -s /dev/sdb mklabel gpt

Create the recovery partition
# parted -s /dev/sdb mkpart primary hfs 40s 69671s
# parted -s /dev/sdb set 1 atvrecv on

Create the swap partition
# parted -s /dev/sdb mkpart primary linux-swap 69672s 1118247s

Create the root partition
# parted -s /dev/sdb mkpart primary 1118248s 14909294s

Format the recovery partition
# partprobe /dev/sdb
# mkfs.hfsplus -v Recovery /dev/sdb1

Format the swap partition.
# mkswap /dev/sdb2

Format the root partition.
# mkfs.ext4 /dev/sdb3

Mount the root parition
# mount /dev/sdb3 tmp/

Install a minimal base system
debootstrap precise tmp/ http://us.archive.ubuntu.com/ubuntu/

Chroot into the base system
# mount -o bind /proc tmp/proc
# mount -o rbind /dev tmp/dev
# chroot tmp/ /bin/bash

Fix the locale warning like like "Locale not supported by C library." or "perl: warning: Setting locale failed."
# echo "en_US.UTF-8 UTF-8" > /var/lib/locales/supported.d/local
# dpkg-reconfigure locales

Setup the fstab, my fstab looks like this
# /etc/fstab: static file system information.
#
#                                                                
proc                                            /proc           proc    defaults                        0       0
# /dev/sda3
UUID=a0f8594c-fe28-4f6a-9312-ef684b4f5785       /               ext4    noatime,errors=remount-ro       0       1
# /dev/sda2
UUID=a3592f78-72fc-4cca-884d-b8bb4c26280f       none            swap    sw                              0       0

Setup apt sources.list, my sources.list looks like this
deb http://us.archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse

Create a user for login
# adduser foo --gecos "Foo Bar"

Install ssh server
apt-get install openssh-server

To boot linux on the apple tv one needs to use the atv-bootloader [1]. One can use the atv-bootloader to kexec into the stock distribution kernel. Since I dont upgrade my kernel often I would rather avoid the kexec step. I built my own kernel with using a config that works with the atv-bootloader. After I install that kernel I create the mach_kernel that I copied into the recovery partition. I am not covering the details in this post.
Now just go ahead and replace the stock IDE hard drive with this compact flash and now you have a poor mans SSD booting in your apple tv.


[1] Apple TV bootloader

Labels: , ,


Saturday, August 25, 2012

 

Setting up goobook in your home directory

My school uses Google Apps for education, so our email is hosted by Google. I also use mutt as my primary mail client on Linux and I love to use goobook to interface with my contacts store on Google. Ideally I would like to upgrade my goobook without worry about messing up my distributions python installation. This is where virtualenv turns out to be very useful to sandbox a python environment. In this post I will document how one can install virtualenv and goobook. These are the steps I used to setup goobook using virtualenv.
$ wget -O virtualenv-1.7.2.zip https://github.com/pypa/virtualenv/zipball/1.7.2
$ unzip virtualenv-1.7.2.zip
$ mv pypa-virtualenv-e517866 virtualenv
$ python virtualenv/virtualenv.py --distribute --no-site-packages ~/.virtualenv
$ VIRTUAL_ENV_DISABLE_PROMPT=true . ~/.virtualenv/bin/activate
$ pip install goobook

You can then edit your .bashrc and add the following lines
# source virtualev
if [ -d ~/.virtualenv ]; then
        VIRTUAL_ENV_DISABLE_PROMPT=1 source ~/.virtualenv/bin/activate
fi

Enjoy goobook installed locally without touching the distributions python installation.

Thursday, February 02, 2012

 

Setting up ARM chroot on Ubuntu Oneiric (11.10) for cross build

I recently ordered a Pandaboard ES so that I could learn a few things on ARM development. A caveat on ARM development, if you are going to compile anything on the device it takes significant time. When I am new to a platform, to gain experience, I build a bootable Linux kernel and install it. This lets me get a hang of recovering to a known working kernel if something screws up during a kernel upgrade. I started out building the kernel directly on the device but was bitten by a known bug which results in segfaults/sigbuses when running the Pandaboard using the entire 1GB of RAM it has. The workaround is to change the boot parameters so that only 768MB of 1GB of RAM is used. Considering the fact that it takes significant time to build things on the device, I thought why not use my old Pentium M laptop as cross compile build box. The first thing for that is to install a working ARM cross chroot environment. I contacted my good friend Google as ever. I found a lot of useful resources as usual. I thought I would document the approach that I used which worked for me.

I used EmDebian CrossDebootstrap wiki entry [1] as the starting point. I installed Ubuntu's Oneiric ARM port in the chroot and the steps are as follows:
  1. First and foremost is to install some of the required packages
    # apt-get install binfmt-support debootstrap qemu qemu-user-static
  2. Create an empty directory where the chroot will be installed
    # mkdir -p /chroot/oneiric_armel
  3. Now we bootstrap the chroot
    # debootstrap --arch=armel --foreign oneiric /chroot/oneiric_armel http://ports.ubuntu.com/
    This will take time depending on your network connection and drive speed, get yourself a sandwich or catch up on some email.
  4.  
  5. Since we passed the --foreign option to debootstrap the .deb files have been downloaded and unpacked, we are yet to configure the system and finalize the chroot installation. Before we can do anything we need to copy over the qemu binary into the chroot so that we can run ARM executables on the host system using emulation.
    # cp /usr/bin/qemu-arm-static /chroot/oneiric_armel/usr/bin/
    Now we are ready to configure and finalize the base system.
  6.  
  7. To configure the base system, first we need to chroot into and then execute the second stage of debootstrap.
    # chroot /chroot/oneiric_armel/
    /debootstrap/debootstrap --second-stage
    exit
  8. Now we have configured and working base system, we need to create a valid apt source list. The contents of /chroot/oneiric_armel/etc/apt/sources.list should resemble something like this.
    deb http://ports.ubuntu.com/ oneiric main restricted universe multiverse
    deb-src http://ports.ubuntu.com/ oneiric main restricted universe multiverse

With the chroot base system now setup one can use schroot/dchroot to chroot into the base system and install any other packages like a regular chroot. If you want to debootstrap to install a chroot to build packages one needs to just pass the --variant=buildd option to debootstrap in step 3.


[1] http://wiki.debian.org/EmDebian/CrossDebootstrap

Labels: , , , ,


Sunday, February 05, 2006

 

Plantronics Voyager™ 510 Bluetooth® Headset on Linux

I own a Plantronics Voyager™ 510 Bluetooth® Headset and I have been wanting to get it working on Linux for a quite sometime. I finally had some free time which utilizeded to get my headset working on Linux. The Bluetooth-alsa project provides support for Bluetooth headsets in Linux.

Requirements:
Installation:

Check out the btsco from CVS using the following commands
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bluetooth-alsa login
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bluetooth-alsa co btsco
Compile the userland application
./bootstrap
./configure
make install
make maintainer-clean
Compile the kernel module
cd kernel
make
make install
depmod -e
make clean
Now lets configure our headset so that we can test if our headset works.
Now for testing run "xmms" and go to the preferences (Ctrl-P), click configure, and choose the BT device. Now load a song and play it to your headset.

Thursday, November 10, 2005

 

Linux-on-Laptops contribution

I decided to write up the experiences that I had installing Gentoo Linux on my Dell Inspiron 9300. I decided that I should submit it to Linux-on-Laptop, which I did. With the update to Linux-on-Laptops on 11th November, 2005, my article on how to install Gentoo Linux on Dell Inspiron 9300 has been included. If anyone has any questions or suggestions please feel free to contact me. You can also find my experience on how to install the driver required to use the Creative WebCam Live! on Linux. I hope to soon get my Bluetooth device working with my Plantronics Voyager 510 Bluetooth® Headset. Keep checking my blog for updates on its progress.

This page is powered by Blogger. Isn't yours?