Sunday, June 17, 2007

Prevent Auto-Loading by Udev

1. To prevent services like net.eth0 from autoloading:

- Edit the file /etc/conf.d/rc
- Look for the line RC_PLUG_SERVICES=""
- Enter the name of the service that you don't want to be autoloaded in front of an exclamation sign: RC_PLUG_SERVICES="!net.eth0 !service2 !service3"

2. To prevent
modules like bcm43xx from autoloading:

- $mkdir /etc/modprobe.d (if the direcotry does not exist)
- create the file /etc/modprobe.d/blacklist
- Enter the name of the module: blacklist bcm43xx

Saturday, June 16, 2007

Information on Kernel Parameters

It can be found in this file:

/usr/src/linux/Documentation/kernel-parameters.txt

lspci: Unknown Device

If lspci shows a list of Unknown Device e.g.:

00:02.2 RAM memory: nVidia Corporation Unknown device 03ba (rev a1)
00:03.0 PCI bridge: nVidia Corporation Unknown device 03b7 (rev a1)


run "update-pciids" without the quotes. This will download a new version of the PCI ID list.

Friday, June 15, 2007

Installation of Wireless Card

After hours of trawling and sorting through the vast amount of information regarding this topic, I've finally managed to install my wireless card and get it working! First of all, some specs:

- lspci dermined the card to be: Broadcom Corporation BCM94311MCG WLAN Mini-PCI (rev 01) It is an 802.11 b/g WLAN
- PCI ID is 14e4:4311
- Laptop is Compaq Presario v3252AU running on AMD Turion 63 X2 and nVidia chipset

Two important things to do. Configure the driver from the kernel AND install the firmware with bcm43xx-fwcutter.

1. Using the driver provided by the kernel. Ndiswrapper is not needed. Configure the kernel to enable Generic IEEE 802.11 Networking Stack and the Software Mac add-on. This is important, because if the Software Mac is not included, the Broadcom driver will not be displayed in the kernel.

Networking --> [*] Networking support
Networking options --->
[ ] Amateur Radio support --->
< > IrDA (infrared) subsystem support --->
< > Bluetooth subsystem support --->
<*> Generic IEEE 802.11 Networking Stack
[ ] Enable full debugging output (NEW)
--- IEEE 802.11 WEP encryption (802.1x)
<*> IEEE 802.11i CCMP support
<*> IEEE 802.11i TKIP encryption
<*> Software MAC add-on to the IEEE 802.11 networking stack
[ ] Enable full debugging output
After that, check the Broadcom driver:

Device Drivers --> Network device support -->
Wireless LAN drivers (non-hamradio) & Wireless Extensions
<M> Broadcom BCM43xx wireless support
[ ] Broadcom BCM43xx debugging (RECOMMENDED)

(I'll update this part later. Not on my AMD com right now. So I am not sure if the display is the correct kernel configuration)
No 1 not finished.

2. After configuring the kernel to get bcm43xx loaded as module, install bcm43xx-fwcutter. We need to install the firmware using bcm43xx-fwcutter to make it work.

$ emerge bcm43xx-fwcutter (have to add net-wireless/bcm43xx-fwcutter ~amd64 to /etc/portage/package.keywords)

3. Installing the firmware
a. Get firmware from http://linuxwireless.org/en/users/Drivers/bcm43xx
The file is called wl_apsta.o
b. mkdir /lib/firmware
c. bcm43xx-fwcutter -w /lib/firmware /path/to/wherever_you_saved_the_firmware

- Either udev or hotplug is needed to load the firmware.

4. modprobe bcm43xx

Note:
1. The wireless toggle button and LED actually work. If I toggle the button to 'on', the LED changes from amber to blue when the module is loaded. If button is 'off', module loaded, card detected, but naturally the interface cannot detect any access point. I can also switch off the wireless using the button AFTER the interface has been detected. The only thing I cannot do, is to toggle the button to 'on' after booting and expect the interface to activate automatically. I have to reload the module again then, I think. Or restart net.eth1. I have to check which.

2. To do: Try to set up the wireless configuration. At the moment, very confused regarding iwconfig and wpa_supplicant.

Get rid of 'clock skew detected' error message

# go to your kernel source directory
cd /usr/src/
# update timestamp of all files
find . -exec touch \{\} \;
# delete old compiled stuff
make clean
# compile from scratch
make bzImage modules_install or whatever

Tuesday, June 05, 2007

Extract and cut audio from avi file

There's this particular clip in an avi file, whose audio I want to extract and convert to mp3.

1. mplayer movie.avi -edlout temp
- I can press 'i' to start to skip the sections that I don't want and 'i' again to 'unskip' the sections that I want.

2. mplayer -vc null -vo null -ao pcm -benchmark -edl temp movie.avi
- This will dump the audio as audiodump.wav according to the sections that I want in the edl file

* If I know the starting and stopping time of the section that I want extracted, I can skip step one and run this: (For example -ss 10 -endpos 26 = Stop at 1 minute 56 second... I think. Haven't tried this yet. Read it somewhere)

mplayer -vc null -vo null -ao pcm -benchmark -ss movie.avi

3. Then encode as mp3:

lame -h -b 128 audiodump.wav audio.mp3

Saturday, June 02, 2007

k3b cdrecord and cdrdao permission

K3b needs cdrecord and cdrdao to be given root permission. This can usually be done by clicking on k3bsetup. However, k3bsetup is only available when k3b is emerged with the kde flag, which will include the installation of kdesu which amounts to more than 23MB. I set the permission manually instead:

chown root:cdrom /usr/bin/cdrdao
chown root:cdrom /usr/bin/cdrecord

chmod 4755 /usr/bin/cdrdao
chmod 4755 /usr/bin/cdrecord

The first digit (4) after chmod selects the set-user-ID. What in the world does that mean? I found this explanation which I think is pretty clear:

SUID stands for Set User ID. This means that if the SUID bit is set for any application then your user ID would be set as that of the owner of application/file rather than the current user, while running that application. That means in case I have an application whose owner is ' root ' and it has its SUID bit set, then when I run this application as a normal user, that application would still run as root. Since the SUID bit tells Linux that the the User ID root is set for this application and whenever this application executes it must execute as if root was executing it (since root owns this file).

Just like SUID, setting the SGID bit for a file sets your group ID to the file's group while the file is executing. IT is really useful in case you have a real multi-user setup where users access each others files. As a single homeuser I haven't really found a lot of use for SGID. But the basic concept is the same as the SUID, the files whose SGID bit are set would be used as if they belong to that group rather than to that user alone.