Archive

Archive for the ‘Linux Kernel’ Category

Automounting USB Drives in Debian Linux

August 16th, 2007 jesse 1 comment

Prior to kernel version 2.6 automounting USB devices in Linux was cumbersome at best.

sandisk_2gb_titanium_usb_flash_drive1.gif

The situation was greatly simplified withthe 2.6 Linux kernel and the inclusion of the udev device manager. udev manages device nodes in user-space, meaning that ordinary users (and not system administrators) can modify the system hardware (like adding USB drives.)

New installations of Debian Linux Etch start with the 2.4 series kernel and require upgrading. However, adding udev plus support for USB flash drives is a relatively straightforward procedure.

Upgrade to the 2.6 kernel and reboot.

Then install the udev and usbmount packags. You’re almost there.

Most USB flash drives are formatted with a Windows files system, either FAT16 [typical] or FAT32. Because FAT filesystems are less robust to un-prepared removal than the Linux EXT2 & 3, the usbmount package does not automout FAT by default. It’s a simple configuration edit to correct this.

% vi /etc/usbmount/usbmount.conf
// replace
FILESYSTEMS="ext2 ext3"
// with
FILESYSTEMS="ext2 ext3 vfat"

By default, usb disks will be mounted to /media/usb0 to usb7, if you want to change that replace :

MOUNTPOINTS="/media/usb0 /media/usb1 /media/usb2 /media/usb3
/media/usb4 /media/usb5 /media/usb6 /media/usb7"

with what you want (do not forget to create the directories)

Note: FAT filesystems require synchronization prior to removal. Either use the “Umount Drive” option in Nautilus or “sync and unmount” at the command prompt before removing FAT formatted USB disks from a Linux system.

References

Device manager for the Linux 2.6 kernel. Its primary function is managing device nodes in /dev. It is the successor of devfs and hotplug, and handles the /dev directory and all user space actions when adding/removing devices, including firmware load.

Categories: Linux Kernel Tags:

Debian: No sound after upgrading to kernel 2.6

July 11th, 2007 jesse No comments

After upgrading a debian-based system from vmlinuz-2.4.27-3-386 to vmlinuz-2.6.18-4-686 there are a few other items you must attend to. For me, the sound card was detected but did not work properly: no sound came out.

UDEV

The 2.4 installation contains all the necessary devices compiled into the kernel or loaded as modules. 2.6 does the same, but employs a user-space device management scheme to detect and create device files when the system starts. This adds flexibility (think autodetect new hardware) but can cause problems if you’re not aware.

Install udev and reboot.

% apt-get install udev

Sound

2.6 typicall uses ALSA – you need to install it.

% apt-get install alsa-base

% apt-get install alsa-oss

Of couse, alsa requires configuration. Do this with the alsaconf command:

% /usr/sbin/alsaconf

Reboot. All your devices should be accounted for and audio should be working again.

Note: This applies to any debian-based distribution: debian, ubuntu, foresight, etc.

Categories: Linux Kernel Tags:

How to Compile a Debian Kernel

April 25th, 2007 jesse No comments

Compiling a custome linux kernel is quite easy (make menuconfig, make bzImage, cp bzImage, reboot….)

But what if you want the debian-”family” of software management tools to know about your new kernel and it’s associated modules?

Falko Timme has written a very good How-To for building your custom kernel into a debian package, which you can then install and manage with dpkg.

Falko’s web site How-To is here.

I’ve also captured a PDF version in case that goes away.

Categories: Linux Kernel Tags:

How a Computer Boots

April 24th, 2007 jesse No comments

A short while back I wrote a paper summarizing how a computer boots. This is an extract of about a hundred other (and more informed) HOW-TO documents describing the process. However, I needed to know the big picture plus the details, and so wrote a document describing the level of detail relevant to someone working on building their own Linux Live CD.

The document is attached in PDF format.

Here is an abstract:

All x86-based personal computers (Intel plus AMD) follow the same process from power-on to window presentation.

  1. POST: Power On Self Test
  2. Boot Loader
  3. Load Kernel
  4. Copy Initial RAM Disk (initrd) into memory
  5. Execute init program
  6. Execute pivot-root and enter default run level

Categories: Linux Kernel, Linux Misc Tags:

r1000 Kernel Module

April 18th, 2007 jesse No comments

or: How to build a kernel module for a “non-native” kernel version.

I’m working on an embedded system based upon the ECS AMD690GM-M2 (V1.0A) main board. This board has the Realtek RTL8110SC Giga LAN Controller on board.

This device hasn’t been included in the standard linux kernel distribution yet, and I needed a way to get the r1000 Ethernet kernel module from my build machine to the dev box.

  • Build machine is a P4 running Ubuntu with kernel 2.6.17-11-generic
  • Dev box is an AMD X2 64 running a temp kernel 2.6.18-4-486

Solution was to build the kernel module in a chroot environment, manually editing the makefile to use the correct kernel header files.

I then transferred the r1000.ko module between boxes via usb flash stick.

Worked perfectly first time.

Steps taken on the build box

  • chroot to 2.6.18-4-486 environment
  • download linux-headers
  • download gcc & make
    • % apt-get install -y linux-headers-2.6-486 gcc make
  • Edit r1000 make file to use 2.6.18-4-486 instead of `uname -r` to determine the kernel version
  • Make the module (make clean modules)
  • Copy module to flash drive

On the dev box

  • Copy module from flash drive to modules directory
    • /lib/modules/2.6.18-4-486/kernel/net/r1000/r1000.ko
  • Load the module
    • % depmod -a
    • % insmod r1000
  • Restart networking
    • % /etc/init.d/networking restart
Categories: Linux Kernel Tags: