PrintLogo

Adding Serial Support on the Fly to the Linux Kernel




Most of our lab machine consoles are on serial ports, and controlled via minicom on Agatha's workstation using this device. Well, somehow during Agatha's recent kernel upgrade to 2.6.8.1, serial support was missed:

root@srv-1 usr-1 # minicom
minicom: cannot open /dev/ttyS0: No such file or directory

To add serial support quickly, we just added 8250/16550 and compatible serial support in device drivers / character devices / serial drivers as a module. Now, make the modules, (assuming you have module support in your kernel):

root@srv-1 linux-2.6.8.1 # make modules
SPLIT   include/linux/autoconf.h -> include/config/*
make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.
CC [M]  drivers/serial/serial_core.o
CC [M]  drivers/serial/8250.o
CC [M]  drivers/serial/8250_pci.o
CC [M]  drivers/serial/8250_pnp.o
Building modules, stage 2.
MODPOST
CC      drivers/serial/8250.mod.o
LD [M]  drivers/serial/8250.ko
CC      drivers/serial/8250_pci.mod.o
LD [M]  drivers/serial/8250_pci.ko
CC      drivers/serial/8250_pnp.mod.o
LD [M]  drivers/serial/8250_pnp.ko
CC      drivers/serial/serial_core.mod.o
LD [M]  drivers/serial/serial_core.ko
root@srv-1 linux-2.6.8.1 # 

Install the modules:

root@srv-1 linux-2.6.8.1 # make modules_install
INSTALL arch/i386/kernel/cpuid.ko
INSTALL arch/i386/kernel/microcode.ko
INSTALL arch/i386/kernel/msr.ko
INSTALL drivers/block/loop.ko
INSTALL drivers/char/lp.ko
INSTALL drivers/net/dummy.ko
INSTALL drivers/parport/parport.ko
INSTALL drivers/parport/parport_pc.ko
INSTALL drivers/scsi/ide-scsi.ko
INSTALL drivers/scsi/ppa.ko
INSTALL drivers/scsi/sr_mod.ko
INSTALL drivers/serial/8250.ko
INSTALL drivers/serial/8250_pci.ko
INSTALL drivers/serial/8250_pnp.ko
INSTALL drivers/serial/serial_core.ko
INSTALL fs/fat/fat.ko
INSTALL fs/msdos/msdos.ko
INSTALL fs/romfs/romfs.ko
INSTALL fs/vfat/vfat.ko
if [ -r System.map ]; then /sbin/depmod -ae -F System.map  2.6.8.1; fi
root@srv-1 linux-2.6.8.1 # 
root@srv-1 / # ls /lib/modules/2.6.8.1/kernel/drivers/serial
8250.ko  8250_pci.ko  8250_pnp.ko  serial_core.ko

Let's start up the modules and look at the results in the logs:

root@srv-1 / # 
root@srv-1 / # insmod /lib/modules/2.6.8.1/kernel/drivers/serial/serial_core.ko
root@srv-1 / # insmod /lib/modules/2.6.8.1/kernel/drivers/serial/8250.ko
root@srv-1 / # dmesg
.
.
.
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
root@srv-1 / # 

Now, can we get to our console?

root@srv-1 / # minicom
Welcome to minicom 2.00.0
OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n 
Compiled on May 21 2003, 07:02:24.
Press CTRL-A Z for help on special keys
Fedora Core release 1 (Yarrow)                       
Kernel 2.4.20 on an i586                             
srv-2 login: 

Yes we can. :)



This article comes from NetAdminTools:
http://www.netadmintools.com/

The URL for this story is:
http://www.netadmintools.com/art377.html

Copyright 1997-2008 NetAdminTools.com. Read our Terms of Use.