9/04/2011

How to Install Ubuntu11.04 on Mac mini

This guide will explain how to install Ubuntu 11.04 on an external USB HDD.
  1. Download and install rEFIt under OSX.
  2. Insert Ubuntu Installation CD to an external USB CD drive.
  3. Reboot and hold Alt key to boot from the CD drive.
  4. Before installing Ubuntu, press F6 and select each options except the last one.
  5. Some options, noapci nopic nomodeset, should be turned off otherwise Linux will halt during the installation.There options would be disabled as well after the installation.
  6. Install Ubuntu on the USB HDD drive and do remember to install grub on the USB HDD as well.
  7. After the first reboot of installation, rEFIt should detect Linux.
  8. Choice to boot from Linux, GRUB will be loaded.
  9. Press "E" to edit boot options of GRUB.
  10. Find and add options to Linux boot arguments:
    linux /boot/vmlinuz-2.6.32-24-generic \
    root=UUID=xxxx-xxx-xxx-xxxx ro quiet \
    nosplash noapci nopci nomodeset reboot=apci
    
    Press Ctrl+X to boot Ubuntu after the modification.
  11. Install NVIDIA proprietary driver to enable 3D/OpenGL.
  12. Enjoy Ubuntu 11.04.

9/03/2011

How to transfer Ununtu11.04/Pandaboard to USB HDD

The pre-built Ubuntu 11.04/Pandaboard image is designed to be installed on a SD card. It could be transfer to the USB HDD with some extra efforts. Typically, a bootable OMAP4/Ubuntu SD card contains two partitions: boot and rootfs. Only rootfs should immigrate to a USB drive since Pandaboard requires booting form SD card.
  1. Prepares a bootable Ubuntu11.04 SD card. howto
  2. Create a ext3/4 partition on a USB HDD labeled "ubuntu".
  3. # /dev/sdXX should be the partition to be formatted,
    # for example /dev/sdc2
    $ sudo mkfs.ext3 -L ubuntu /dev/sdXX
    
  4. Copy rootfs on the SD card to USB HDD
  5. # Suppose USB is mounted on /mnt/ubuntu
    # and rootfs of SD is on /mnt/sd
    $ cd /mnt/ubuntu
    $ sudo cp -a /mnt/sd/* .
    
  6. Boot from SD card
  7. In order to mount USB HDD as rootfs, It'd update parameters that passed to the kernel. The configuration file is located at /boot/boot.script
    $ sudo vi /boot/boot.script
    
    You'd find bootargs have something like this:
    root=UUID=XXXX-XXXX-XXXX-XXXX
    
    Replace it to
    root=LABEL=ubuntu
    
    Then update boot.scr for uboot using:
    $ sudo flash-kernel
    
  8. Reboot it and Ubuntu should use USB HDD as root filesystem. :)

8/31/2011

To install Ubuntu 11.04 on PandaBoard

1. Download a prebuilt Ubuntu 11.04 image from here.
2. Create a bootable SD card(capacity >= 4GB).
    zcat ubuntu-11.04-preinstalled-netbook-armel+omap4.img.gz | \
    sudo dd of=/dev/sdX
    ## sdX should be the actual device node of SD card
3. Bring up PandaBoard with the SD card and enjoy it.

6/28/2011

To cross-compile glib to arm-linux-gnueabi platform

Some variables should be given during configuration stage in order to cross-compile glib to ARM/linux platform using the tool chain(s) that come from Linaro or CodeSourcery.
> export glib_cv_stack_grows=no; \
  export glib_cv_uscore=no; \
  export ac_cv_func_posix_getpwuid_r=no; \
  export ac_cv_func_posix_getgrgid_r=no; \
  CFLAGS=-I$(TARGET_DIR)/usr/include \
  LDFLAGS=-L$(TARGET_DIR)/usr/lib \
  ./configure --host=arm-linux-gnueabi --prefix=$(TARGET_DIR)/usr

More information can be found at here.

6/25/2011

GObject 入門 (Part 7) - 發送與接收訊息

訊息發送系統(messaging system)是GObject system內建功能之一,它讓物件於事件發生時,用來發送訊息給其他註冊該訊息者。這樣的設計可以避免系統或物件過於耦合(coupling),大型系統裡常可見到這樣的設計(Mediator pattern)。


在GObject system裡,物件(GObject)可透過g_signal_new()g_signal_newv()註冊新的信號;並以g_signal_emit()發送信號。爾後,經由g_signal_connect()即可連結(connect)或接收某物件發出的信號。

6/19/2011

Compressing Images into WebP format using libwebp

libwebp is a software implementation of WebP, a lossy compression picture format which is introduced by Google. It provides a set of lean APIs that are easy to encode and decode WebP images. libwebp comes with two demo program: cwebp and dwebp. It could use cwebp to transform JPEG/ PNG images into WebP format.  And dwebp takes decoding jobs in contrast.
cwebp is a good example to study encoder part of libwebp. Here is a handy class to do the same job.

WebP/HTTP Push on Google Chrome

Google Chrome browser, and it borther Chromium browser, seems the only web browser that supports WebP server push at this moment. Opera 11 can display WebP image frame by frame but not in server push mode according to my experiments. By the way, I found that Opera 11 cannot recognize MIME type: image/webp.