Annvix:Documentation/Serial
|
This page contains content from the old Annvix.org wiki and has been moved here to preserve content. These pages have been retained for historical and nostalgic purposes only. |
Configuring Serial Connection Support
Author: Sean P. Thomas
Serial support is useful for connecting to and watching a remote machine that may not have network connectivity as you can use another machine, a null modem cable, and a terminal program such as minicom. This is a quick HOWTO on how to set this up with Annvix. This assumes that the baud rate is 38400 and the serial port to use is ttyS0.
First, create an agetty service to listen to the serial port:
# mkdir /var/service/agetty-ttyS0
# chmod 750 /var/service/agetty-ttyS0
# echo -e '#!/bin/execlineb\nchpst -P /sbin/agetty -L 38400 ttyS0 vt100' \
> /var/service/agetty-ttyS0/run
# chmod 700 /var/service/agetty-ttyS0/run
# chown -R root:admin /var/service/agetty-ttyS0/
Next, add the service:
# srv --add agetty-ttyS0
Then hook up a serial connection using a null modem cable between the server and a monitoring computer with minicom installed. Test the serial connection via the monitoring computer by starting minicom. Configure minicom by hitting:
- CTRL-A Z to go to the menu
- O for configuration
- Serial port setup (select this)
- A should list the attached serial port, generally /dev/ttyS0
- E for 'Bps/Par/Bits'
- G to set 38400 for the baud rate
- Q to set 8N1 for the Bps/Par/Bits
- ENTER twice to exit two screens
- Exit to quit
You should now see a login prompt in minicom for the server.
In order to configure the server to allow you to select the kernel and watch boot messages, you need to configure grub. Do so by editing /boot/grub/grub.conf and comment out the following lines:
#background 000000 #foreground 34d1c0 #color cyan/black yellow/black #splashimage (hd0,0)/grub/annvix-splash.xpm.gz
Now add the following lines below the commented lines above:
serial --unit=0 --speed=38400 terminal --timeout=15 console serial
Next, cut-and-paste the "Annvix" section below, call the copied section "Annvix - Serial". In the "Annvix" section, add the following arguments to the kernel:
console=ttyS0,38400n8r console=tty0
In the "Annvix - Serial" section add the following kernel arguments:
console=tty0 console=ttyS0,38400n8r
Next, reboot the computer and watch from minicom. You should see several messages saying hit any key. If you do, you will see the grub menu; select "Annvix - Serial" to see all the boot messages.
A full /boot/grub/grub.conf file looks like:
# This is the GRUB configuration file; it is extremely versatile so you may # want to read the grub infopage (info grub) # # The installer does it's best to setup a sane grub configuration file, but # you *will* need to make some modifications such as where you want your # bootloader to live. Remember, (hd0,0) is the same as /dev/hda1, (hd1,2) as # /dev/hdb3, etc. # # The following assumes some things; that you have a separate /boot partition # on /dev/hda1 (or (hd0,0) which is what the root keywords points to. This is # also reflected in the kernel and initrd keywords in that /vmlinuz is # relative to root so if your /boot directory is not on it's own partition but # rather is part of the / (root) filesystem, you need to change those stanzas # to /boot/vmlinuz... and /boot/initrd... instead. # # Once you have finished editing the file, execute the following commands to # install grub in the MBR. Once you have done this, you don't need to do it # again as grub dynamically reads the configuration file, unlike LILO. # # # grub --device-map=/boot/grub/device.map # grub> root (hd0,0) # grub> setup (hd0) # grub> quit default 0 timeout 10 fallback 1 #background 000000 #foreground 34d1c0 #color cyan/black yellow/black #splashimage (hd0,0)/grub/annvix-splash.xpm.gz serial --unit=0 --speed=38400 terminal --timeout=15 console serial title=Annvix # the root partition where the kernel image is located (ie. /boot) root (hd0,0) # the kernel and initrd are relative to the contents of the root partition kernel /vmlinuz ro root=/dev/hda2 vga=788 console=ttyS0,38400n8r console=tty0 initrd /initrd.img title=Annvix - Serial # the root partition where the kernel image is located (ie. /boot) root (hd0,0) # the kernel and initrd are relative to the contents of the root partition kernel /vmlinuz ro root=/dev/hda2 vga=788 console=tty0 console=ttyS0,38400n8r initrd /initrd.img title=2432-5205avx root (hd0,0) # assumes /dev/hda1 kernel /vmlinuz-2.4.32-5205avx ro root=/dev/hda2 vga=788 initrd /initrd-2.4.32-5205avx.img