Sometimes I like to write complicated Bash scripts. You know the ones - multiple background subprocesses,
communicating through pipes or fifos. In fact, my next post will be about
one I've written recently.
At the end of the script, you have to make sure all those background processes
are killed.
rkill.sh
I've pulled code to do this out into a separate file, rkill.sh.
It's listed below, but I've split it into sections here to make it easier to
explain.
After I got rid of most boot messages, I wanted to display a
splash screen.
Syslinux can show a splash screen but it doesn't stay around until X starts.
I could have taken the easy route and put Usplash
or Splashy into Tiny Core Linux
on my USB stick.
But no! I took another route. I used
Zgv. Zgv is an SVGAlib-based image viewer,
so it runs on the Linux console. Feed it an image early on in the Tiny
Core init.d scripts and voila, a splash screen!
One of my PCs has a rather unique boot sequence:
Syslinux, from an SD card and configured to chain
load the next stage.
-
A pre-boot environment, FreeDOS, from the SD card.
The pre-boot environment does the following:
- Check if a USB stick is inserted. If there is one inserted, then continue
to the next stage in the boot sequence. Otherwise...
- Display a message asking the user to insert the USB stick.
- Wait 20 seconds for the USB stick to be inserted.
- If the USB stick is inserted within those 20 seconds, then continue to
the next stage in the boot sequence, but pass a flag indicating to boot
into a maintenance mode. Otherwise...
- Go to a DOS prompt.
FreeDOS makes a great pre-boot environment - it's super fast to boot, very
small and you don't have to faff about producing custom initrds. I used
Bret Johnson's USBDOS drivers to do the USB stick
detection.
kexec-loader, from the SD card
(via Linld) and configured to boot the next
stage from the USB stick. I used kexec-loader here because it contains
USB 2.0 drivers, so loading the next stage is much faster than using the
BIOS's legacy emulation mode.
The fantastic Tiny Core Linux,
from the USB stick, booting into X with some custom extensions.