Saturday, November 18, 2006

Backport 'MPD' to Dapper using Edgy source package


# sudo -i
# vi /etc/apt/sources.list

deb-src http://mirrors.kernel.org/ubuntu/ edgy universe

# apt-get update
# apt-get build-dep mpd
# apt-get source --build mpd
# dpkg -i mpd_0.12.1-1ubuntu1_i386.deb

Thursday, November 16, 2006

Compile 'darkice' with mp3 support


# sudo apt-get install liblame-dev
# sudo vi /etc/apt/sources.list

deb-src http://archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse

# sudo apt-get update
# sudo apt-get build-dep darkice

# vi darkice-0.16/debian/rules

#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

DEB_CONFIGURE_EXTRA_FLAGS := --prefix=/usr --sysconfdir=/usr/share/doc/darkice/examples --with-lame


# sudo apt-get source --build darkice
# sudo dpkg -i darkice_0.16-1_i386.deb

Monday, November 13, 2006

Chaintech AV-710 (VIA ICEnsemble Envy24HT-S VT1721) digital optical output SPDIF


# sudo vi /var/lib/alsa/asound.state

state.AV710 {
control.1 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Master Playback Switch'
value true
}
control.2 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Master Playback Volume'
value.0 15
value.1 15
}
control.3 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Center Playback Switch'
value false
}
control.4 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'Center Playback Volume'
value 0
}
control.5 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'LFE Playback Switch'
value false
}
control.6 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'LFE Playback Volume'
value 0
}
control.7 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 2
iface MIXER
name 'Surround Playback Switch'
value.0 false
value.1 false
}
control.8 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Surround Playback Volume'
value.0 0
value.1 0
}
control.9 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Headphone Playback Switch'
value false
}
control.10 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Headphone Playback Volume'
value.0 0
value.1 0
}
control.11 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Master Mono Playback Switch'
value false
}
control.12 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'Master Mono Playback Volume'
value 0
}
control.13 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'PC Speaker Playback Switch'
value false
}
control.14 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 15'
iface MIXER
name 'PC Speaker Playback Volume'
value 0
}
control.15 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Phone Playback Switch'
value false
}
control.16 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'Phone Playback Volume'
value 0
}
control.17 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Mic Playback Switch'
value false
}
control.18 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 31'
iface MIXER
name 'Mic Playback Volume'
value 0
}
control.19 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Mic Boost (+20dB)'
value false
}
control.20 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Line Playback Switch'
value false
}
control.21 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Line Playback Volume'
value.0 0
value.1 0
}
control.22 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'CD Playback Switch'
value false
}
control.23 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'CD Playback Volume'
value.0 0
value.1 0
}
control.24 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Video Playback Switch'
value false
}
control.25 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Video Playback Volume'
value.0 0
value.1 0
}
control.26 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Aux Playback Switch'
value false
}
control.27 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'Aux Playback Volume'
value.0 0
value.1 0
}
control.28 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'PCM Playback Switch'
value true
}
control.29 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 31'
iface MIXER
name 'PCM Playback Volume'
value.0 15
value.1 15
}
control.30 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 2
comment.item.0 Mic
comment.item.1 CD
comment.item.2 Video
comment.item.3 Aux
comment.item.4 Line
comment.item.5 Mix
comment.item.6 'Mix Mono'
comment.item.7 Phone
iface MIXER
name 'Capture Source'
value.0 Mix
value.1 Mix
}
control.31 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Capture Switch'
value true
}
control.32 {
comment.access 'read write'
comment.type INTEGER
comment.count 2
comment.range '0 - 15'
iface MIXER
name 'Capture Volume'
value.0 0
value.1 0
}
control.33 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name '3D Control - Switch'
value false
}
control.34 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 Mix
comment.item.1 Mic
iface MIXER
name 'Mono Output Select'
value Mix
}
control.35 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 Mic1
comment.item.1 Mic2
iface MIXER
name 'Mic Select'
value Mic1
}
control.36 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 15'
iface MIXER
name '3D Control - Center'
value 0
}
control.37 {
comment.access 'read write'
comment.type INTEGER
comment.count 1
comment.range '0 - 15'
iface MIXER
name '3D Control - Depth'
value 0
}
control.38 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Alternate Level to Surround Out'
value false
}
control.39 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Downmix LFE and Center to Front'
value false
}
control.40 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Downmix Surround to Front'
value false
}
control.41 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'External Amplifier'
value false
}
control.42 {
comment.access read
comment.type BYTES
comment.count 52
iface CARD
name 'ICE1724 EEPROM'
value '172414121c01020210c1ff0000ff0000ff0000000101010001000000000000000000000000000000ff000000ff000000ff000000'
}
control.43 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 '8000'
comment.item.1 '9600'
comment.item.2 '11025'
comment.item.3 '12000'
comment.item.4 '16000'
comment.item.5 '22050'
comment.item.6 '24000'
comment.item.7 '32000'
comment.item.8 '44100'
comment.item.9 '48000'
comment.item.10 '64000'
comment.item.11 '88200'
comment.item.12 '96000'
comment.item.13 '176400'
comment.item.14 '192000'
comment.item.15 'IEC958 Input'
iface MIXER
name 'Multi Track Internal Clock'
value '44100'
}
control.44 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Multi Track Rate Locking'
value true
}
control.45 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'Multi Track Rate Reset'
value true
}
control.46 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 'PCM Out'
comment.item.1 'H/W In 0'
comment.item.2 'H/W In 1'
comment.item.3 'IEC958 In L'
comment.item.4 'IEC958 In R'
iface MIXER
name 'H/W Playback Route'
value 'PCM Out'
}
control.47 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 'PCM Out'
comment.item.1 'H/W In 0'
comment.item.2 'H/W In 1'
comment.item.3 'IEC958 In L'
comment.item.4 'IEC958 In R'
iface MIXER
name 'H/W Playback Route'
index 1
value 'PCM Out'
}
control.48 {
comment.access read
comment.type INTEGER
comment.count 22
comment.range '0 - 255'
iface MIXER
name 'Multi Track Peak'
value.0 189
value.1 192
value.2 0
value.3 0
value.4 0
value.5 0
value.6 0
value.7 0
value.8 0
value.9 0
value.10 44
value.11 43
value.12 0
value.13 0
value.14 0
value.15 0
value.16 0
value.17 0
value.18 0
value.19 0
value.20 0
value.21 0
}
control.49 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 'PCM Out'
comment.item.1 'H/W In 0'
comment.item.2 'H/W In 1'
comment.item.3 'IEC958 In L'
comment.item.4 'IEC958 In R'
iface MIXER
name 'IEC958 Playback Route'
value 'H/W In 0'
}
control.50 {
comment.access 'read write'
comment.type ENUMERATED
comment.count 1
comment.item.0 'PCM Out'
comment.item.1 'H/W In 0'
comment.item.2 'H/W In 1'
comment.item.3 'IEC958 In L'
comment.item.4 'IEC958 In R'
iface MIXER
name 'IEC958 Playback Route'
index 1
value 'H/W In 1'
}
control.51 {
comment.access 'read write'
comment.type BOOLEAN
comment.count 1
iface MIXER
name 'IEC958 Output Switch'
value true
}
control.52 {
comment.access 'read write'
comment.type IEC958
comment.count 1
iface PCM
device 1
name 'IEC958 Playback Default'
value '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
}
control.53 {
comment.access read
comment.type IEC958
comment.count 1
iface PCM
device 1
name 'IEC958 Playback Con Mask'
value '3fff000f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
}
control.54 {
comment.access read
comment.type IEC958
comment.count 1
iface PCM
device 1
name 'IEC958 Playback Pro Mask'
value df00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
}
}


# aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: CK804 [NVidia CK804], device 0: Intel ICH [NVidia CK804]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: CK804 [NVidia CK804], device 2: Intel ICH - IEC958 [NVidia CK804 - IEC958]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: AV710 [Chaintech AV-710], device 0: ICE1724 [ICE1724]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: AV710 [Chaintech AV-710], device 1: IEC1724 IEC958 [IEC1724 IEC958]
Subdevices: 1/1
Subdevice #0: subdevice #0


# sudo vi /etc/asound.conf

# /etc/asound.conf
# ~/.asoundrc
#
# 2006-11-18

################################################################################
# Chaintech AV-710 (IC Ensemble/VIA VT1721)

#
# HW definition for raw communication with ALSA kernel driver
#
pcm.chaintech {
type hw
card 2
device 1

#mmap_emulation true # for ro/wo devices, increases latency
#nonblock true # force non-blocking open mode
}

#
# SPDIF output
#
pcm.!spdif {
type plug
slave.pcm "chaintech"
}

#
# Analog output
#
pcm.analog {
type plug
slave {
pcm "surround51"
format S32_LE
}
}

#
# Upmix stereo to 5.1
#
pcm.upmix {
type plug
slave.pcm "surround51"
slave.channels 6
route_policy duplicate
}

#
# DMIX output device
#
pcm.output {
type dmix
ipc_key 10001 # in integer, unique IPC key for each dmix definition
ipc_key_add_uid false # Don't add current UID to unique IPC key
ipc_perm 0666 # Share mixer with all users, default permissions = 0600
slave {
pcm "chaintech"
buffer_size 8192 # in bytes, power of 2, for dmix OSS emulation
period_size 1024 # in bytes, power of 2, (OSS emu), default = 125000
period_time 0 # in usec, apparently unnecessary since ALSA 1.0pre
#periods 128 # power of 2, if 'buffer_size' or 'buffer_time' is not specified
rate 44100 # in Hz, default = 48000
format S32_LE # Required for ICE1724 digital output, default = S16_LE
}
bindings {
0 0
1 1 # dmix will use only the first 2 channels
}
#slowptr true # Slow but more precise pointer updates
}

#
# DSNOOP input device
#
pcm.input {
type dsnoop
ipc_key 10002
ipc_key_add_uid false
ipc_perm 0666
slave {
pcm "chaintech"
channels 2
#buffer_size 4096
#period_size 1024
#rate 44100
}
}

#
# ASYM duplex device
#
pcm.duplex {
type asym
playback.pcm "output"
capture.pcm "input"
}

#
# SOFTwareVOLume for digital output
#
pcm.vol {
type softvol
slave.pcm "chaintech"
control.name "Master"
min_dB -65.0 # Minimal dB value in REAL num (default: -51.0)
}

#
# JACKplug device
#
pcm.jackplug {
type plug
slave.pcm "jack"
}

pcm.jack {
type jack
playback_ports {
0 alsa_pcm:playback_1
1 alsa_pcm:playback_2
}
capture_ports {
0 alsa_pcm:capture_1
1 alsa_pcm:capture_2
}
}

#
# default device ###############################################################
#
pcm.!default {
type plug
slave.pcm "duplex" # spdif, analog, upmix, duplex, vol
}

#
# OSS Compability
#
pcm.!dsp2 {
type plug
slave.pcm "default"
}

ctl.!mixer2 {
type hw
card 2
}

Monday, November 06, 2006

autofs: mounting iPod & USB


1. Install the goodies:

# aptitude install autofs pmount


2. Edit autofs config file:

# sudo vi /etc/auto.master

/media /etc/auto.media --ghost


3. Get your device ID:

# ls /dev/disk/by-id/ | grep iPod

usb-Apple_iPod_000A270012E6900E
usb-Apple_iPod_000A270012E6900E-part1
usb-Apple_iPod_000A270012E6900E-part2


4. Create custom config for media:

# sudo vi /etc/auto.media


dvd -fstype=auto,ro :/dev/dvd
usb -fstype=vfat :/dev/disk/by-id/usb-KINGMAX_USB2.0_Flashdisk_00000000000064-part1
ipod -fstype=vfat,iocharset=iso8859-1,fmask=0117,dmask=0007,gid=plugdev :/dev/disk/by-id/usb-Apple_iPod_000A270012E6900E-part2


You can use UUID instead of ID to identify your device. It's shorter. You could also use LABEL but there would be a chance of a conflict.

ipod -fstype=vfat :/dev/disk/by-uuid/A5D3-DF28


5. Reload autofs:

# sudo /etc/init.d/autofs reload


6. Start gtkpod or just check out /media/ipod and witness the magic.

Saturday, November 04, 2006

VNC (a.k.a. KDE 'Desktop Sharing') crashing and slow performance workaround


Disable the built-in 'Desktop Sharing' and install x11vnc:

# apt-get install x11vnc

If you have an existing VNC password file:

# x11vnc -display :0 -rfbauth ~/.vnc/passwd


To set the password (not my preferred way):

# x11vnc -storepasswd yourpassword /path/to/password

Or set the password using vncpasswd (part of vnc-common):

# vncpasswd

***

Alternatively, create ~/.x11vncrc with all the options you need and then just start 'x11vnc'.

# ~/.x11vncrc
# ** uncomment options you need **

# password file must use full path
rfbauth /home/user/.vnc/passwd

display :0
forever
shared

# keyboard repeat
repeat

# visual speed tweak
nodragging

# CPU performance tweak (?)
threads

# be less verbose
quiet

# put process in background
#bg

# show GUI
#gui


To stop x11vnc running in background ('bg' option):

# x11vnc -remote stop

Thursday, October 26, 2006

Dapper directory sizes


Just for reference for someone who wants to set up multiple partitions but has no clue how much space is required.

This is what my file system currently looks like (fresh Kubuntu install a year ago, a few essential apps + dist-upgrade to some recent stuff):

/bin 4.5M
/boot 9.4M
/dev 5.5M
/etc 40M
/home 862M
/lib 110M
/proc 900M
/root 24M
/sbin 8.5M
/tmp 31M
/usr 2.8G
/var 1.3G

Initializing existing RAID-0 setup to install Ubuntu on it


If you have your root partition on RAID-0 and for some reason decided to delete the system while keeping /home (or any other directories) and start over, here's how to do it:

1. Boot the 'alternate' disc.
2. Go through the setup until you get to partitioning.
3. Switch to console (for example: ALT+F2).
4. Issue the following commands, replacing hde3 and hdg8 with your RAID partitions:

# modprobe md
# mdadm --assemble /dev/md0 /dev/hde3 /dev/hdg8
# mount /dev/md0 /mnt

You can now access your stuff in /mnt. Delete what you need, keep the rest. Then:

# umount /mnt
# mdadm --stop /dev/md0

Go on with the installation. Make sure not to format your RAID!

Saturday, September 09, 2006

nvidia-glx 1.0.8762 binary driver fix


After upgrading from Breezy to Dapper, Xorg failed to work with the new nVIDIA binary driver on my BenQ FP731 LCD at its native resolution of 1280x1024.

Quick fix #1:

Edit /etc/X11/xorg.conf and add the section in bold, then restart X (Ctrl+Alt+Backspace will do).

Section "Device"
Identifier "NVIDIA Corporation NV43 [GeForce 6200]"
Driver "nvidia"
BusID "PCI:1:0:0"
Option "UseEDID" "false"
EndSection

"By default, the NVIDIA X driver makes use of a display device's EDID, when available, during construction of its mode pool. The EDID is used as a source for possible modes, for valid frequency ranges, and for collecting data on the physical dimensions of the display device for computing the DPI. However, if you wish to disable the driver's use of the EDID, you can set this option to False."
(from nVIDIA Accelerated Linux Driver Set README and Installation Guide)


Quick fix #2:

Edit /etc/X11/xorg.conf and add the section in bold to force 60Hz refresh rate, then restart X.

Section "Screen"
Identifier "Default Screen"
Device "NVIDIA Corporation NV43 [GeForce 6200]"
Monitor "BenQ FP731"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1280x1024_60" "1024x768" "800x600" "640x480"
EndSubSection
EndSection

Sunday, April 16, 2006

Firefox - Flash audio fix


# vi ~/.mozilla/firefox/rc

FIREFOX_DSP="none"

iPod - safe remove fix


Unmouting iPod from a user's account doesn't completely work. iPod will still be showing "Do not disconnect". Fix (insecure, I know):

# sudo chmod +s /usr/bin/eject

Friday, March 24, 2006

prelinking


# sudo apt-get install prelink
# sudo vi /etc/default/prelink

PRELINKING=yes

# sudo /etc/cron.daily/prelink

Saturday, March 04, 2006

multi source audio


- ALSA

# sudo apt-get install libesd-alsa0

- OSS

# sudo apt-get install libesd0

Wednesday, February 22, 2006

sudo settings


- remember password in all terminals:

# sudo visudo

Defaults !lecture,!tty_tickets


- expire sudo session immediately:

# sudo visudo

Defaults !lecture,tty_tickets,timestamp_timeout=0


- keep sudo password for the session:

# sudo visudo

Defaults !lecture,tty_tickets,timestamp_timeout=-1

Tuesday, February 14, 2006

Firefox - compiling from source


# wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/1.5.0.1/linux-i686/en-US/firefox-1.5.0.1.tar.gz
# tar xzvvf firefox-1.5.0.1.tar.gz
# cd mozilla
# vi .mozconfig

---8<---
# mozilla/.mozconfig
# Firefox 1.5.0.1 compile options

. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-build
ac_add_options --enable-official-branding
#ac_add_options --disable-official-branding

#ac_add_options --enable-default-toolkit=qt
#ac_add_options --with-qtdir=/usr/share/qt3
ac_add_options --enable-default-toolkit=gtk2
ac_add_options --enable-xft --disable-freetype2

ac_add_options --enable-static --disable-shared
ac_add_options '--enable-optimize=-Os -freorder-blocks -fno-reorder-functions -gstabs+'
#ac_add_options --enable-optimize="-O6 -march=k8"
#ac_add_options --enable-optimize="-O2 -msse -mmmx -m3dnow -mfpmath=sse"
#ac_add_options '--enable-optimize=-pipe\ -w\ -O2\ -DDEBIAN\ -fno-strict-aliasing'

ac_add_options --enable-strip
ac_add_options --disable-debug
ac_add_options --disable-logging
ac_add_options --disable-tests
ac_add_options --disable-pedantic
ac_add_options --disable-long-long-warning

ac_add_options --enable-svg
ac_add_options --enable-svg-renderer-cairo
ac_add_options --enable-canvas
ac_add_options --enable-mathml
ac_add_options --enable-postscript
ac_add_options --enable-crypto

ac_add_options --enable-single-profile --disable-profilesharing
#ac_add_options --enable-extensions=cookie,xml-rpc,xmlextras,pref,transformiix,universalchardet,webservices,inspector,auth
ac_add_options --enable-xinerama
ac_add_options --enable-pango
ac_add_options --enable-gnomevfs
ac_add_options --enable-gnomeui

ac_add_options --disable-installer
ac_add_options --disable-updater
ac_add_options --disable-xprint
ac_add_options --disable-ldap
ac_add_options --disable-accessibility
ac_add_options --disable-oji
ac_add_options --disable-jsd

ac_add_options --with-default-mozilla-five-home=/usr/lib/mozilla-firefox
ac_add_options --with-user-appdir=.mozilla
ac_add_options --with-system-zlib=/usr
ac_add_options --with-system-jpeg=/usr
ac_add_options --with-system-png=/usr
ac_add_options --with-system-mng=/usr
ac_add_options --without-system-nspr
ac_add_options --with-pthreads
--->8---

# make -f client.mk build

* takes 30-60 min on AMD64 3000+ with 1G RAM

# make -C firefox-build/browser/installer
# sudo mv firefox-build/dist/firefox-1.5.0.1.en-US.linux-i686.tar.gz /opt
# sudo tar xzvf firefox-1.5.0.1.en-US.linux-i686.tar.gz
# cd firefox
# sudo ./firefox

***

- for a static build:

# vi browser/app/Makefile
:94
$(MOZ_XFT_LIBS)

Wednesday, February 01, 2006

Bootable CD/DVD with GRUB


# mkdir -p BOOT_CD/boot/grub
# cp /lib/grub/i386-pc/stage2_eltorito BOOT_CD/boot/grub/
# mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o BOOT_CD.iso BOOT_CD
# cdrecord -v -sao CD_BOOT_GRUB.iso

Friday, January 27, 2006

Slipstreaming Windows CD under Linux


required tools: mkisofs, cdrecord, dd, mount, lcab, text editor
optionally: hex viewer, hex->dec converter

1. Create an image of Windows CD.

# dd if=/dev/dvd of=win_xp.iso bs=2048 conv=noerror,notrunc

2. Extract files from the image.

# sudo mount -o loop win_xp.iso /mnt
# cp -a /mnt win_xp_slipstream
# chmod -R +w win_xp_slipstream
# sudo umount /mnt

3. Extract the CD boot image and add it to the root of Windows directory. The value of the 'skip' parameter needs to be found. More info below.

# dd if=win_xp.iso of=boot.img bs=2048 count=1 skip=375
# mv boot.img win_xp_slipstream/

4. Add your RAID driver files in $OEM$/$1/drivers/

# mkdir -p 'win_xp_slipstream/$OEM$/$1/drivers/sii680r'
# unzip -j sii680r.zip -d 'win_xp_slipstream/$OEM$/$1/drivers/sii680r'

5. Create a .cab archive of the RAID driver's .sys file in the i386 directory.

# cp 'win_xp_slipstream/$OEM$/$1/drivers/sii680r/pnp680r.sys' win_xp_slipstream/i386/
# lcab win_xp_slipstream/i386/pnp680r.sys win_xp_slipstream/i386/pnp680r.sy_
# rm win_xp_slipstream/i386/pnp680r.sys

6. Get the RAID driver ID info.

# cat 'win_xp_slipstream/$OEM$/$1/drivers/sii680r/txtsetup.oem' | grep 'PCI\\VEN'

---8<---
id = "PCI\VEN_1095&DEV_0680&SUBSYS_36801095", "PnP680r"

--->8---

7. Add the RAID driver info to the bottom of txtsetup.sif before the last EOF. You'll need the .sys file name, "PCI\VEN" string, device ID and name.

# vi win_xp_slipstream/i386/txtsetup.sif

---8<---
[SourceDisksFiles]
pnp680r.sys = 1,,,,,,3_,4,1

[HardwareIdsDatabase]
PCI\VEN_1095&DEV_0680&SUBSYS_36801095 = "PnP680r"

[SCSI.load]
PnP680r = pnp680r.sys,4

[SCSI]
PnP680r = "Silicon Image Ultra-133 Medley ATA RAID Controller"

--->8---

8. Create a winnt.sif file and add the info below with the right driver path.

# vi win_xp_slipstream/i386/winnt.sif

---8<---
[Data]
UnattendedInstall=Yes
MSDosInitiated=No
AutoPartition=0

[Unattended]
OemPnPDriversPath="Drivers\sii680r"

--->8---

9. Re-create the CD image, now with the included driver.

# mkisofs -v -volid "XP_RAID" -d -D -l -N -relaxed-filenames -no-iso-translate -no-emul-boot -boot-load-size 4 -b boot.img -c boot.cat -hide boot.img -hide boot.cat -J -hide-joliet boot.img -hide-joliet boot.cat -o win_xp_slipstream.iso win_xp_slipstream

10. Finally, write the image to a CD.

# sudo cdrecord -v -sao win_xp_slipstream.iso


***

Finding the CD boot image


I. The quick and easy way.

1a. Dump ISO info from CD.

# isoinfo -d

---8<---
Eltorito defaultboot header:
Bootid 88 (bootable)
Boot media 0 (No Emulation Boot)
Load segment 0
Sys type 0
Nsect 4
Bootoff 177 375

--->8---

1b. Alternatively, dump ISO info from the image file.

# isoinfo -d -i win_xp.iso

2a. Extract the boot image from CD. Use the second value from the "Bootoff" line in the 'skip' parameter.

# dd if=/dev/dvd of=boot.img bs=2048 count=1 skip=375

2b. Same as above but from an ISO image.

# dd if=win_xp.iso of=boot.img bs=2048 count=1 skip=375


II. The real hacker's way ;)

1a. Dump a chunk of the CD to a file. Increase 'count=' to 2000 or more if the boot image is not found at first.

# dd if=/dev/dvd of=dump.img bs=2048 count=500

1b. Alternatively, dump data from an ISO image.

# dd if=os_image.iso of=dump.img bs=2048 count=500

2a. Look for the boot image string. Note the starting address in hex. If there are multiple matches, start with the first and complete all steps. If the CD doesn't boot, try the second matching address, and so on.

# xxd dump.img | grep '007c fb8c'

2b. Alternate method using 'hexdump' and visual examination. Look for a string "fa33 c08e d0bc 007c fb8c".

# hexdump -C dump.img | less

---8<--- 00bb800: fa33 c08e d0bc 007c fb8c c88e d852 e800 .3.....|.....R..
00bb810: 005e 81ee 1100 7412 81fe 007c 7575 8cc8 .^....t....|uu..
00bb820: 3d00 0075 7fea 3700 c007 c606 ae01 3390 =..u..7.......3.
00bb830: 8cc8 3dc0 0775 7e8c c88e d8c6 06ae 0134 ..=..u~........4
00bb840: 9080 fa80 726f c606 ae01 3590 bbfe 078b ....ro....5.....
00bb850: 073d 55aa 755f 5a88 1699 0468 8a04 6a0b .=U.u_Z....h..j.
00bb860: 6800 20e8 7603 0f82 0f00 601e 068a 1699 h. .v.....`.....
00bb870: 049a 0000 0020 071f 6168 7e04 6a0c 6800 ..... ..ah~.j.h.

--->8---

3. Convert the address from hex to decimal.

# echo $((16#bb800))

4a. Finally, extract the boot image from CD. Note the 'skip' parameter!

# dd if=/dev/dvd of=boot.img bs=1 count=2048 skip=768000

4b. Same as above but from an ISO image.

# dd if=os_image.iso of=boot.img bs=1 count=2048 skip=768000

4c. Alternatively, calculate and use LBA to make things look pretty. 0xbb800 = 768,000 -> 768,000 / 2,048 = 375 (R/LBA)

# dd if=os_image.iso of=boot.img bs=2048 count=1 skip=375

Another example: Windows 2000 CD.

---8<--- 000a000: fa33 c08e d0bc 007c fb8c c88e d852 e800 .3.....|.....R..
--->8---

0xa000 = 40,960 -> 40,960 / 2,048 = 20 (R/LBA)

# dd if=/dev/dvd of=boot.img bs=2k count=1 skip=20

Tuesday, January 24, 2006

X performace tweak


- set higher process priority for Xorg binary

# sudo vi /etc/X11/Xwrapper.config

nice_value=-10

Monday, January 23, 2006

aptitude - purge old config files


- purge config files belonging to packages which were removed

# dpkg -l | grep '^rc\b' | awk '{print $2}' | xargs sudo aptitude purge