Eee PC Linux

From ivc wiki
Jump to navigationJump to search

I decided to ditch the standard Eee Xandros Linux distribution and go for the more user centric Ubuntu distro. At the time of writing the current release is 7.10, codename Gusty Gibbons.

For the installation I used a regular Pretec i-Disk Tiny 1 GB USB 2.0 flash drive. Almost all flash drives are either formatted as FAT16 or FAT32. For a computer to be able to boot from a flash drive it has to have support in the bios for USB drives and the flash drive has to have a master boot record (MBR), i.e a entry-point to load code.

I'm using a Windows machine to perform the preparation, but it's fully possible to do it on a Linux machine.

Make Flash Drive Bootable

To install a Linux bootloader on a flash drive, there is a wonderful tool called syslinux. I'm installing t

  1. Download the latest syslinux (3.61 or later) zip-archive from syslinux.zytor.com under the kernel.org link
  2. Extract the sysliunx.exe in the win32 directory from the zip-archive
  3. Open a command-promt and execut 'syslinux -s g:'. Where g: is the flash drive
  4. The tool will install a bootloader and a hidden ldlinux.sys file in the root directory
  5. Try to boot from the drive, a 'boot:' prompt should appear

Copy Install Files

The normal way to install a distro is either via a CD/ISO or netinstall by downloading the files. This method will use the CD/ISO method and copy the files from the CD/ISO over the the flash drive.

  1. Download the ISO-file for the latest Ubuntu release. As of writing it's Gusty Gibbon, e.g ubuntu-7.10-desktop-i386.iso. Fortunately, I ordered the free retail Ubuntu install disc and got it in the mail
  2. Either mount the ISO or insert the CD, and select all the files and copy them over to the root of the flash drive, or use 'xcopy /e /h /k f:\*.* g:' in a command-prompt
  3. To allow the syslinux bootloader to load the installation, rename the 'isolinux' directory to 'syslinux'
  4. And inside the 'syslinux' directory, rename 'isolinux.bin' and 'isolinux.cfg' to 'syslinux.bin' and 'syslinux.cfg' respectively
  5. Now, the flash drive is ready

Installation

The installation should work as if it was running form a CD. Nothing special is done to make it run from a flash drive other than renaming the directory and files mentioned above.

  1. Insert the flash drive, start the machine, press ESC to show the boot device list, and select the flash drive
  2. When the 'boot:' prompt is shown, press enter, ignore the unknown keywords errors
  3. After a few minutes the Ubuntu splash screen should appear and the desktop, double click the 'Install' application
  4. Since the Eee screen resolution is only 800x480, the installation screen will be cut off, but there's a trick
  5. It's holding ALT+dragging the window, but to make the trick work properly the Compiz effects has to be disable
  6. From the System menu, select Preferences and Appearance, then Visual Effects and None. Close the window.
  7. Now, in the installation window hold ALT+drag the window upwards to reveal the buttons, follow the normal installation
  8. Once at the paritioning screen, select 'Manual' and pick the correct drive and click 'New paritions'. My drive was the VoyagerGT 4 GB on /dev/sdd.
  9. I created one primary parition, selecting 'ext2' as the filesystem. It's not journaled will supposedly use less write cycles and spare the flash drive for excessive use. 'Mount point' should be '/'.
  10. When prompted to select a swap-memory parition, ignore and continue. Swap will use excessive flash write cycles and my machine already has 2 GB of physical memory.
  11. After rebooting I got a 'No operating system found' error message by the boot loader. I installed again and at the end of the installation, in 'Advanced Options' changed boot loader disk to '(hd1)'. It let me in to the Grub bootloader where I could select which option to boot but I had to change back to '(hd0)' by typing 'e' and 'e' again, then 'b' to finally boot. After that I fixed the /boot/grup/menu.lst configuration file to make it permanent.

Tweaks

Post Install

A few quick things to get rid off after installing from a USB drive.

Remove the cdrom references in /etc/fstab.

$ sudo pico /etc/fstab
# Disable by adding a # before:
/dev/sdd        /media/cdrom0   udf,iso9660 user,noauto,exec 0       0

Next, when installing packages apt-get tries to load packages from the cdrom, and the package download might be disabled if the installer didn't detect any Internet connection.

$ sudo pico /etc/apt/sources.list
# Disable the first line, add a # to the start
deb cdrom:[Ubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted

# Also remove any # for any lines with the pretext 'Line commented out by installer because it failed to verify:' 

To make the following confirmation easier and to avoid constrain your hands when typing on the Eee PC keyboard, install SSH and login remotely. Use the ethernet-port to get a network connection, works right out-of-the-box.

$ apt-get install ssh

Ubuntu Kernel

The tweaks below will correct some of the faults and limitations with the default kernel. It's recommended to go with a custom kernel, se below.

Wireless

I replaced the default mini PCI-express card for a new Intel 4965AGN adapter, and I had problems with the Linux driver in kernel 2.6.22. It keept deauthorizing and authorizing when I tried to connect to a WPA access point. It worked once but never after that.

If you're using the default mini PCI-express adapter, try one of these these methods.

While trying to compile the latest Linux driver released by Intel, I couldn't get passed the last step to compile the new mac80211 module.

$ sudo make modules modules_install
~
make[1]: *** No rule to make target `arch/i386/kernel/asm-offsets.c', needed by `arch/i386/kernel/asm-offsets.s'. Stop.

I tried to use the existing 2.6.22 mac80211 module and continue to compile the iwl4965 module, but it didn't turn out good. The driver complained about missing functions and 'timed out' when trying to bring it up.

A last thing could try was to test the ndiswrapper driver hackery trick and use a Windows driver. Fortunately, it turned out very well and I finally got a stable wireless connection. [1]

Install the necessary packages. The ndisgtk is a graphical utility to set up ndiswrapper.

$ sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9 ndisgtk

Disable the Linux drive by blacklisting it in modprobe.

$ sudo echo 'blacklist iwl4965' | sudo tee -a /etc/modprobe.d/blacklist

Download the driver for Intel 4965AGN v11.1.1.0 for XP. Extract the files to a directory and if necessary upload them to the Eee PC.

Either use the ndisgtk utility or ndiswrapper to install the driver via the correct '.inf'-file. For this adapter there were two '.inf'-files, NETw4k32.INF for Windows 2000 (k) and NETw4x32.INF for Windows XP (x). I used the last one, the first gave me a 'invalid driver'-message.

$ sudo ndiswrapper -i ~/driver/NETw4x32.INF

After a short while the driver should've been installed successfully.

$ ndiskwrapper -l

netw4x32 : driver installed
        device (8086:4229) present (alternate driver: iwl4965)

Install the ndiswrapper wlan0 alias for modprobe.

$ sudo ndiswrapper -m

And add the ndiswrapper module to automatically load on startup.

$ sudo echo ndiswrapper >> /etc/modules

Reboot the system and the adapter should come up and be available from the network-admin systray icon.

Eee Network Admin.png

My system hang and crashed when I tried to 'modprobe ndiswrapper' but I think that had something to do with the old Linux driver still being loaded. After a few reboots and tries it worked.

Use the network-admin systray icon to access the available wireless networks.

To remove the ndis driver to start over, try:

$ sudo ndiswrapper -r ntw4w32

Microphone

The Eee PC microphone is not detected correctly and a quick fix is to add the line below to /etc/modprobe.d/alsa-base.

$ sudo pico /etc/modprobe.d/alsa-base
# Eee PC microphone fix
options snd-hda-intel model=3stack-dig

And reboot to load. To test that the microphone works, use the Sound Recorder program under Applications and Sound & Video. It seems whichever input source you select it records the microphone.

Eee sound recorder.png

Custom Eee Kernel

There are a few kinks with the stock Ubuntu kernel resulting in unstable wireless networking, no suspend and hibernate, no working HPET clocksource, SD-card corruption, and more.

If the default Ubuntu kernel was used before and the tweaks above as apply, try to revert and remove the changes done, like the wireless and audio fix. These will interfere with the new custom kernel as it will fix most of the problems.

Install Custom Kernel

mbm has compiled a new 2.6.24-2 kernel with enabled USB persist to allow suspend and hibernate, patch atl2 ethernet driver, patched asus_acpi for the Eee (hotkeys, leds, wlan enable, monitor swap, etc), and compiled to save space.

Download the kernel headers (both) and image deb packages.

$ wget http://downloads.openwrt.org/people/mbm/eee/kernel/linux-headers-2.6.24-2-generic_2.6.24-2.4_i386.deb
$ wget http://downloads.openwrt.org/people/mbm/eee/kernel/linux-headers-2.6.24-2_2.6.24-2.4_all.deb
$ wget http://downloads.openwrt.org/people/mbm/eee/kernel/linux-image-2.6.24-2-generic_2.6.24-2.4_i386.deb

Install the packages.

$ dpkg -i linux-image-2.6.24-2-generic_2.6.24-2.4_i386.deb linux-headers-2.6.24-2-generic_2.6.24-2.4_i386.deb 
  linux-headers-2.6.24-2_2.6.24-2.4_all.deb    

During the installation, the GRUB configuration will include the new kernel and updated the boot menu. Reboot to try out the kernel. It's possible to revert back to the old kernel at any time.

Clock Source

All Intel processors has a special clock generator. The Linux kernel can use this clock to improve the accuracy of the ticks use to drive the system.

Open the /boot/grub/menu.lst file and add "clocksource=hpet" to the line below.

$ sudo pico /boot/grub/menu.lst

 # defoptions=quiet splash clocksource=hpet

$ sudo update-grub

Notice that it's normal for the GRUBE settings to be commented out, that's how update-grup reads the settings and compiles the final lins at the end of the file.

On the next reboot the kernel will use the new clock. Verify it be checking the special system file below.

$ sudo cat /sys/devices/system/clocksource/clocksource0/current_clocksource

Fix AppArmor

AppArmor is a security framework and not generally needed. The custom kernel will complain when it first loads with a brief message. It's a minor thing.

[49.115327] AppArmor: Unable to Register AppArmor.

To suppress this message edit the /boot/grub/menu.lst configuration and add "capability.disable=1".

$ sudo pico /boot/grub/menu.lst

 # defoptions=quiet splash capability.disable=1

AppArmor is built into the kernel and can not be disabled. To fix this problem, the AppArmor application has to be updated to match the new kernel.

Either compile from source or download the already compiled AppArmor packages and install them the normal way [2].

$ wget http://www.chromakode.com/misc/eee/apparmor_2.1+1075-0ubuntu2_i386.deb
$ wget http://www.chromakode.com/misc/eee/apparmor-utils_2.1+1075-0ubuntu2_i386.deb

$ sudo dpkg -i apparmor_2.1+1075-0ubuntu2_i386.deb apparmor-utils_2.1+1075-0ubuntu2_i386.deb

Reboot and the error message should've gone away, and when restarting AppArmor it should succeed.

$ sudo /etc/init.d/apparmor restart
Reloading AppArmor profiles : done.

Webcam

The webcam is not active and the uvcvideo module has bee excluded from the custom kernel. Fortunately, it's possible to use the modules package for 2.6.24-2 and load the correct module [3].

$ wget http://launchpadlibrarian.net/11015312/linux-ubuntu-modules-2.6.24-2-generic_2.6.24-2.5_i386.deb (mirror)

Make the module load on startup.

$ sudo echo uvcvideo >> /etc/modules

Reboot or load the module directly to activate the webcam.

$ sudo modprobe uvcvideo

Verify that the video stream works by downloading the Skype Ubuntu Linux beta release with video support. Go into Options and Video Devices, click Test and the webcam stream should show.

The /proc/acpi/camera special file is deprecated in this kernel.

Bluetooth

I think Bluetooth is so standardized that every adapter you through at it will work, at least my adapter did.

To get my Logitech V470 Bluetooth mouse, I just had to enable/insert the Bluetooth adapter, make the mouse discoverable by pressing the Connect-button, and enter the simple commands below

Scan for devices.

$ hcitool scan
Scanning ...
        00:07:61:A6:84:15       Bluetooth Laser Travel Mouse
        00:07:61:45:9E:C3       AGANDHJIN

Connect to MAC address of the mouse.

$ sudo hidd --connect 00:07:61:a6:84:15

And it just works! To make the changes active over reboots, enter these lines into /etc/default/bluetooth.

$ sudo pico /etc/default/bluetooth
HIDD_ENABLED=1
HIDD_OPTIONS="--search --server"
HIDD_OPTIONS="--connect 00:07:61:A6:84:15 --server"

On the next reboot, the Bluetooth manager might ask you to authorize that the mouse is permanently granted to automatically connect.

Eee Control

kiwidrew has written a eee.ko module to control the fan, FSB, and voltage, and read out the CPU temperature. Future versions will hopefully allow brightness and LED control.

Compile from sources or download the pre-compiled modules for 2.6.22-2 or 2.6.24-2 ([http://beta.ivancover.com/eee/ubuntu/eee.ko_v0.2-kernel-2.6.24-2.tar.gz mirror).

$ tar zxvf eee.ko_v0.2-kernel-2.6.24-2.tar.gz
$ sudo cp eee.ko /lib/modules/2.6.24-2-generic/
$ sudo depmod -a
$ sudo modprobe i2c-i801
$ sudo modprobe eee

To load it on start-up, remove the black list and add the modules to /etc/modules.

$ sudo pico /etc/modprobe.d/blacklist
# Comment this line
blacklist i2c_i801

$ sudo pico /etc/modules
# Add the modules, in that order
i2c-i801
eee

When the module is loaded, a bunch of special files is available via /proc/eee/.

CPU Temperature

The processor sensor temperature is available via /proc/eee/temperature and /proc/acpi/thermal_zone/TZ00/temperature, the former seems to be more accurate.

$ cat /proc/eee/temperature
59

Processor Speed

The Front-Side-Bus (FSB) controls the frequency of the processor. The processor speed is calculated by multiplying the FSB with the CPU multiplier, e.g 100 x 9 = 900.

On the Eee PC, a PLL (Phase Locked Loop) is used to generate the FSB frequency. It has a base frequency of 24 MHz. The raw configuration of the PLL can be dumped from /proc/eee/pll. Another special file is used to program the PLL, /proc/eee/fsb.

$ sudo cat /proc/eee/pll
eÃÿÿ÷àZ

$ cat /proc/eee/fsb
100 24 1

To change the processor speed, the Eee module expect 3 parameters to be passed to /proc/eee/fsb. The first is the new FSB speed, ranging from e.g. 70 for 630 MHz and up to 100 for 900 MHz. Everything above or below those values are regarded as overclocking or underclocking, respectively.

Second, a variable "M-divisor" to match the PLL base frequency, i.e 24 / 100 * 24 MHz base frequency = 100 [4].

Third, to select CPU voltage mode, 1 for "high" or 0 for "low" (the exact voltage values are unknown). It's advised to alter the FSB speed in jumps, i.e. not straight from 70 to 100, but 70, 85, and then 100. The parameter can be set to '0' (low) when running 900 MHz, but '1' (high) CPU voltage is what the 8801 BIOS tells the embedded controller when changing the CPU speed in the BIOS [5] to 900 MHz.

Set the processor speed to 900 MHz (from 630 MHz):

$ sudo sh -c 'echo 85 24 1 > /proc/eee/fsb'
$ sudo sh -c 'echo 100 24 1 > /proc/eee/fsb'

And reverse:

$ sudo sh -c 'echo 85 24 0 > /proc/eee/fsb'
$ sudo sh -c 'echo 70 24 0 > /proc/eee/fsb'

There is currently no way to check the system if the speed change has been committed. The information in /proc/cpuinfo is invalid and not updated. Benchmarking before and after is the easiest way to check if there is any change in processing power.

Little script to quickly switch between 630 MHz and 900 MHz:

#!/bin/bash

if [ -z "$1" ]; then
 echo "Usage: $0 <70|100>"
fi

if [ "$1" == "100" ]; then
 sudo sh -c 'echo 85 24 1 > /proc/eee/fsb'
 sudo sh -c 'echo 100 24 1 > /proc/eee/fsb'
 echo "FSB changed to 100 MHz (900 MHz CPU speed)"
fi

if [ "$1" == "70" ]; then
 sudo sh -c 'echo 85 24 0 > /proc/eee/fsb'
 sudo sh -c 'echo 70 24 0 > /proc/eee/fsb'
 echo "FSB changed to 70 MHz (630 MHz CPU speed)"
fi

Fan

The control of the fan is done through /proc/eee/fan_manual and /proc/eee/fan_speed. A third /proc/eee/fan_rpm is used to report the speed in rotations.

Turn on manual override and full fan speed:

$ sudo sh -c 'echo 1 > /proc/eee/fan_manual'
$ sudo sh -c 'echo 100 > /proc/eee/fan_speed'

Turn off fan completely:

$ sudo sh -c 'echo 1 > /proc/eee/fan_manual'
$ sudo sh -c 'echo 0 > /proc/eee/fan_speed'

Automatic fan control:

$ sudo sh -c 'echo 0 > /proc/eee/fan_manual'

Check fan speed:

$ cat /proc/eee/fan_speed
2259

If you get a 'Permission denied'-message when reading or writing to the special files, try the sudo sh -c method.

Freeing Space

The flash drive is only 4 GB and I need all the space I can get, removing i.g. OpenOffice.org will free some space.

sudo apt-get -y remove openoffice.org openoffice.org-base openoffice.org-calc openoffice.org-common 
 openoffice.org-core openoffice.org-draw openoffice.org-evolution openoffice.org-filter-mobiledev 
 openoffice.org-gnome openoffice.org-gtk openoffice.org-help-en-us openoffice.org-impress openoffice.org-java-common 
 openoffice.org-l10n-common openoffice.org-l10n-en-gb openoffice.org-l10n-en-za openoffice.org-math 
 openoffice.org-style-human openoffice.org-writer openoffice.org-hyphenation

More Desktop Space

The default desktop theme is somewhat large and occupies prescious work space. These commands will make the fonts and panels smaller, and fix a few other things [6].

Setting smaller font sizes.

$ gconftool-2 --set /apps/nautilus/preferences/desktop_font --type string "Sans 8"
$ gconftool-2 --set /desktop/gnome/interface/document_font_name --type string "Sans 8"
$ gconftool-2 --set /desktop/gnome/interface/font_name --type string "Sans 8"
$ gconftool-2 --set /apps/metacity/general/titlebar_font --type string "Sans Bold 8"
$ gconftool-2 --set /desktop/gnome/interface/monospace_font_name --type string "Monospace 8"

All applications can go full-screen using F11.

$ gconftool-2 --set /apps/metacity/window_keybindings/toggle_fullscreen --type string "<Alt>F11"

Smaller toolbars using icons only.

$ gconftool-2 --set /desktop/gnome/interface/toolbar_style --type string "icons"

Setting the right mixer (fixes the mute key).

$ gconftool-2 --set /desktop/gnome/sound/default_mixer_tracks --type list --list-type string "[PCM]"

Do not display the incorrect battery warning at login.

$ gconftool-2 --set /apps/gnome-power-manager/notify/low_capacity --type bool 0

Unconstrain windows to the top of the screen.

$ gconftool-2 --set /apps/compiz/plugins/move/allscreens/options/constrain_y --type bool 0

Making the top & bottom panels smaller.

$ gconftool-2 --set /apps/panel/toplevels/top_panel_screen0/size --type integer 19
$ gconftool-2 --set /apps/panel/toplevels/bottom_panel_screen0/size --type integer 19

These commands will be saved and survive a reboot.

Boot Speed-up

The Ubuntu boot up is not exact fast compared to the Xandros install. Mine takes a little over 60 seconds with 8 USB devices connected.

In addition to the new Clock Source mentioned above, changing the concurrency line below from 'none' to 'shell' will allow the startup script to start simuntaniously and in parallel. This will squeeze the most out of the CPU to lower the boot-up time a few seconds.

$ sudo pico /etc/init.d/rc
# Specify method used to enable concurrent init.d scripts.
# Valid options are 'none' and 'shell'.
CONCURRENCY=shell

But there is a bug, HAL (Hardware abstraction layer) and D-Bus is started at the same time which causes HAL to fail as it depends on D-Bus. The system will boot but devices will stop working, e.g. wireless adapter. To fix this, move the HAL script to start at a later step [7]

$ sudo mv /etc/rc2.d/S12hal  /etc/rc2.d/S13hal
$ sudo mv /etc/rc3.d/S12hal  /etc/rc3.d/S13hal
$ sudo mv /etc/rc4.d/S12hal  /etc/rc4.d/S13hal
$ sudo mv /etc/rc5.d/S12hal  /etc/rc5.d/S13hal

Shutdown Fix

When shutting down the machine, it won't power off properly because a audio module was still loaded. Add a line in /etc/init.d/halt to unload the module during shutdown.

$ sudo pico /etc/init.d/halt
# Add this line right after do_stop()
modprobe -r snd-hda-intel

The next shutdown should power off the machine completely.

Increase Battery Life

Powertop

There is a handy tool called 'powertop' that will monitor and analyze Intel-based systems, and recommend things to change to increase the battery life.

Since the syste is installed on a USB drive, its the one thing.

Wakeups-from-idle per second : 158.4    interval: 15.0s
Top causes for wakeups:
  68.9% (108.3)       <interrupt> : uhci_hcd:usb1, ehci_hcd:usb5 
  13.8% ( 21.7)       <interrupt> : iwl4965 
   6.9% ( 10.8)             udevd : ehci_work (ehci_watchdog) 

With the Bluetooth hcid_usb unloaded, the flash drive is pulled somewhat less for some reason.

Wakeups-from-idle per second : 59.9     interval: 15.0s
Top causes for wakeups:
  37.5% ( 21.9)       <interrupt> : iwl4965 
  18.0% ( 10.5)             udevd : ehci_work (ehci_watchdog) 
  16.4% (  9.6)       <interrupt> : uhci_hcd:usb1, ehci_hcd:usb5

USB

The Eee PC and my modifications heavily rely on USB and it's important that the devices is suspended once they're idle. Use the commands below to verify that USB suspend is enabled. The default Ubuntu kernel has it enabled by default.

Check if enabled, 2 shows it's enabled.

$ cat /sys/module/usbcore/parameters/autosuspend
2

Check all connected devices, 1 or 2 means 'wait that amount of time when idle before suspending'.

$ cat /sys/bus/usb/devices/*/power/autosuspend
0 
1
1
~

Bluetooth

For some some reason Bluetooth pulls the system constantly.

Wireless

The iwl4965 driver is active and continuously searching for beacons from access points.

Less Disk Writes

To limit the number of writes necessary, it's possible to disable the atime bit that updates the attribute when the file was last access or opened.

In /etc/fstab, add noatime to the root filesystem and remount.

$ sudo pico /etc/fstab

# Add noatime to root filesystem
UUID=a40d5e42-78e1-412b-b0eb-6148f27483b1 / ext3 defaults,errors=remount-ro,noatime 0 1

$ sudo mount -o,remount rw /

References