[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Slackware installation using a serial terminal on an embedded system

I'll describe here what steps are required to install Slackware to a machine, using a serial terminal. The boot medium used here is a usb-key, but I think that these steps could be customized for booting from a CD-ROM (or PXE). I installed to a PC Engines APU (http://www.pcengines.ch/apu.htm), but most of these steps should be compatible for other systems. I've noted things special for this machine.

Prerequisites

  • Machine with a serial port you want to install to
  • Machine with a serial port you use to install the other machine
  • A cable betweeen them ;)
  • usbboot.img from slackware(64)?-$version/usb-and-pxe-installers/

Preparation of the boot image

To install using a serial line, syslinux on the boot image must be configured to use the serial line for the menu itself and also append the right parameters to the booted kernel. To do this, mount the usbboot.img somewhere like this:

# mount -o loop usbboot.img /mnt/tmp

Now that the image is mounted, you can change the syslinux.cfg found in /mnt/tmp. Insert as a first line:

serial 0 115200

This enables the serial line for syslinux with 115200 bauds (parity and stopbit are hardcoded to n8). While the bootloader is now using the serial, the kernel still doesn't. Add

console=ttyS0,115200

To the append-line of the first kernel image (huge.s).

I have had problems with the keyboard input in syslinux using the serial line. To speed the things up you can set another timeout (in s/10) after which the default image (huge.s) is booted.

When you are done with the changes, you can unmount the image as usual. Like recommended by Eric install the syslinux bootloader to the image:

$ syslinux -s usbboot.img

The image is ready now to be dd'd onto a usb-key:

# dd if=usbboot.img of=/dev/myusbkey

Installation

Connect the serial ports of your two machines with a null-modem cable, and run

minicom -D /dev/ttyS0 -b 115200

on the machine you will use as your terminal. Now boot the machine you are installing Slackware to from the usb-key. You should see the usual booting on the terminal screen including the key map selection. After you have logged in as root, partition your disks as you would normally do.

APU special: You should also format and set a label to your partitions so that they show up in /dev/disk/by-label, it makes stuff a lot easier later e.g:
# mke2fs -L root /dev/sdb1

Don't let the Slackware installer format them then of course.

Before you run setup run this command to get a nicer looking output from dialog:

export DIALOGOPTS="--ascii-lines"

The rest of the installation should work as usual (“special” keys like page up don't seem to work correctly though..). But instead of rebooting after the installation has finished, we need to set the installed system to also use the serial line. Chroot into the installation:

# chroot /mnt

Now edit your /etc/lilo.conf and insert a line

serial= 0,115200n8

right at the top. The global append line needs the addition like the one used for the usbboot.img:

console=ttyS0,115200

to let it come up before the init system tries to mount it.

APU special: If you have installed onto a usb medium (the SD-card reader on the APU is connected by usb) you should also add:
rootdelay=10

The device order on the APU is likely to change. So you should /dev/disk/by-label or /dev/disk/by-uuid paths for your root partition statements in /etc/lilo.conf.

Furthermore you'll have to generate an initrd so that the device drivers for the card reader are avaiable at boot time. Here also use a /dev/disk/by-label or /dev/disk/by-uuid path cause of the changing device order.

If you want to reinstall lilo after the installation, you probably also have to change the boot= device.

Save the lilo configuration and reinstall lilo. But don't reboot now, one more step before we are finished!

Uncomment the line enabling serial login in your inittab and change the speed to 115200:

[...]

# Local serial lines:

s1:12345:respawn:/sbin/agetty -L ttyS0 115200 vt100

[...]
Uncomment ttyS0 in /dev/securetty or you will not be able to login as root from the serial line!

This should be all. Exit the chroot and reboot your system!

 howtos:hardware:serial_installation ()