vvidic/ cube

AOpen XC Cube EA65-IIa 2.0

This page contains info about my efforts to get Linux working on the aforementioned machine. Some of the relevant configuration files can be found here.

InstantOn

InstantOn is a small Linux distribution (350MB) that can be installed on the Cube hard disk to get fast access to be basic applications: DVD, MP3, TV and radio playback (no recording is possible in this mode). Since the Cube boots rater fast, it is possible to get the full UI in something like 10 seconds. Installation is supposed to consist of booting the installation CD, selecting the desired language and installing the distribution on a clean hard disk. Unfortunately, this didn't work for me. The partition gets created but it doesn't boot. It seems the problem is twofold:

  1. Filesystem magic (raiserfs) has been changed in order to prevent access using normal Linux utils.
  2. Bootloader (grub) is not installed correctly.

Filesystem magic can be fixed by copying the filesystem to a file, changing the magic and writing back the modified partition:

dd if=/dev/hda1 of=hda1
sed -i 's/JJReIsFs/ReIsErFs/g' hda1
dd if=hda1 of=/dev/hda1

Finally, grub can be installed from a live CD using something like this:

mount /dev/hda1 /mnt
grub-install --root-directory=/mnt /dev/hda
umount /mnt

After that, InstantOn should be able to boot from the disk. All applications except TV seem to work correctly. Using TV app it is possible to scan and change the channels, but VGA output shows only green background. The audio from the TV works though...

Remote control

Remote control and front panel buttons are connected to the second serial port (/dev/ttyS1). lirc can use them through ea65 driver. In Debian this means setting these lines in /etc/lirc/hardware.conf:

DRIVER=ea65
DEVICE=/dev/ttyS1

/etc/lirc/lircd.conf can be copied from /usr/share/lirc/remotes/ea65/lircd.conf.ea65. After restarting lircd, irw should give output like this when pressing buttons:

0000000000298103 00 vol+ EA65
00000000002a8143 00 vol- EA65

Front display

Cube has a 10 character display that can be controlled through the same serial port as the remote control. lcproc (v0.5.2 or newer) can access it through ea65 driver. Relevant parts of the /etc/LCDd.conf are shown below:

[server]
Driver=ea65
ServerScreen=no

[ea65]
Brightness=0
OffBrightness=0

The ea65 driver uses the /dev/ttyS1 by default and the Brightness lines are used to turn off the annoying blue light of the front panel buttons. After restarting LCDd, default server screen should be scrolling on the display. To get something useful, configure the screens in /etc/lcdproc.conf and start lcdproc.

Tuner video

lspci identifies my tuner card as:

01:04.0 Multimedia video controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
    Subsystem: AOPEN Inc. Unknown device 6f05
    Flags: bus master, medium devsel, latency 32, IRQ 185
    Memory at f8000000 (32-bit, non-prefetchable) [size=16M]
    Capabilities: [44] Vital Product Data
    Capabilities: [4c] Power Management version 2

This is supported in the recent kernels through the cx88 driver. In order to get it working, cx88xx module needs to be loaded with the parameter card=8. This option can be placed in /etc/modprobe.d/cx88xx. Loading the module produces the following output:

Linux video capture interface: v2.00
cx2388x v4l2 driver version 0.0.6 loaded
ACPI: PCI Interrupt 0000:01:04.0[A] -> GSI 18 (level, low) -> IRQ 185
CORE cx88[0]: subsystem: a0a0:6f05, board: Leadtek Winfast DV2000 [card=8,insmod option]
TV tuner 38 at 0x1fe, Radio tuner -1 at 0x1fe
cx88[0]/0: found at 0000:01:04.0, rev: 5, irq: 185, latency: 32, mmio: 0xf8000000
tuner 1-0043: chip found @ 0x86 (cx88[0])
tda9887 1-0043: tda988[5/6/7] found @ 0x43 (tuner)
tuner 1-0060: All bytes are equal. It is not a TEA5767
tuner 1-0060: chip found @ 0xc0 (cx88[0])
tuner 1-0060: type set to 38 (Philips PAL/SECAM multi (FM1216ME MK3))
cx88[0]/0: registered device video0 [v4l2]
cx88[0]/0: registered device vbi0
cx88[0]/0: registered device radio0

After this, the usual TV apps (tvtime, xawtv, mythtv) should be able to display the video.

Tuner audio

In my configuration, the tuner card sound output is connected to the CD input of the integrated sound card. In order to get the sound from the tuner, capture input needs to be set to CD and relevant channels need to be unmuted:

amixer set PCM,0 unmute 80%,80%
amixer set Master,0 unmute 80%,80%
amixer set Capture,0 cap unmute 100%,100%
amixer set CD,0 cap unmute 100%,100%

These options should be saved to /var/lib/alsa/asound.state so they get restored on reboot.

Disk tuning

It seems that by default disk and DVD hog the CPU because they have DMA turned off. Configure them through /etc/hdparm.conf:

/dev/hda {
    mult_sect_io = 16
    io32_support = 1
    interrupt_unmask = on
    dma = on
}

/dev/hdc {
    io32_support = 1
    interrupt_unmask = on
    dma = on
}

hdparm should then give reasonable timings:

# hdparm -tT /dev/hda
/dev/hda:
 Timing cached reads:   1214 MB in  2.00 seconds = 607.14 MB/sec
 Timing buffered disk reads:  170 MB in  3.02 seconds =  56.27 MB/sec

Disk monitoring

If the disk included in the Cube supports S.M.A.R.T. it is advisable to monitor it using smartd from smartmontools. smartd will then log any problems reported by the disk.

Hyper-threading

In order to see two CPUs hyper-threading needs to be enabled in BIOS and the machine booted with an SMP kernel. After that, /proc/cpuinfo should contain the following:

processor    : 0
vendor_id    : GenuineIntel
cpu family   : 15
model        : 4
model name   : Intel(R) Pentium(R) 4 CPU 3.20GHz
stepping     : 1
cpu MHz      : 3192.140
cache size   : 1024 KB
physical id  : 0
siblings     : 2
core id      : 0
cpu cores    : 1
fdiv_bug     : no
hlt_bug      : no
f00f_bug     : no
coma_bug     : no
fpu          : yes
fpu_exception: yes
cpuid level  : 5
wp           : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pni monitor ds_cpl cid xtpr
bogomips     : 6388.61

processor    : 1
vendor_id    : GenuineIntel
cpu family   : 15
model        : 4
model name   : Intel(R) Pentium(R) 4 CPU 3.20GHz
stepping     : 1
cpu MHz      : 3192.140
cache size   : 1024 KB
physical id  : 0
siblings     : 2
core id      : 0
cpu cores    : 1
fdiv_bug     : no
hlt_bug      : no
f00f_bug     : no
coma_bug     : no
fpu          : yes
fpu_exception: yes
cpuid level  : 5
wp           : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pni monitor ds_cpl cid xtpr
bogomips     : 6384.50

CPU speed

P4 in my Cube supports several CPU frequencies ranging from 400MHz - 3.2GHz. In order to get this working, p4-clockmod kernel module needs to be loaded and some userspace governor installed. I used powernowd because it is simple - it switches between the frequencies based on the machine load.