Script Cleanup 2012-09-29

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.

I've pulled code to do this out into a separate file, It's listed below, but I've split it into sections here to make it easier to explain.

Old Skool Splash Screen 2012-09-22

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!

Quieter Boot 2012-09-16

One of my PCs has a rather unique boot sequence:

  1. Syslinux, from an SD card and configured to chain load the next stage.

  2. A pre-boot environment, FreeDOS, from the SD card. The pre-boot environment does the following:

    1. Check if a USB stick is inserted. If there is one inserted, then continue to the next stage in the boot sequence. Otherwise...
    2. Display a message asking the user to insert the USB stick.
    3. Wait 20 seconds for the USB stick to be inserted.
    4. 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...
    5. 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.

  3. 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.

  4. The fantastic Tiny Core Linux, from the USB stick, booting into X with some custom extensions.