Custom Syslinux Splash Screens
While rolling a custom CentOS 5.2 distribution, I wanted to create a custom splash screen rather than use the vanilla CentOS jpg file. Since the existing splash screen was a JPEG file with a size of 640x480, I created my own JPEG file with the same dimensions. It didn't work. Just showed a blank background.
There seems to be little documentation on this problem, at least that I could find. Those with a problem who posted to a forum on the web never seemed to get a good response from the community. Hints were few. Saw a few about a special file format (lss, I believe it was). There were some comments about 8-bit color. There were some posts that said that syslinux couldn't display PNG files.
Finally, I created a 8-bit PNG file and just tried it and it worked! At least for syslinux 3.36. I believe the latest version as of this writing is 3.75, but I can't use that because of dependencies I don't want to resolve in the distro.
SOLUTION: 8-big PNG, 640x480.
Labels: Linux, syslinux
Removable Devices & udev
The Linux udev capability provides naming support for dynamic devices such as USB drives, cameras, etc. udev rules follow a simple syntax to match a dynamic device when it is first "plugged in" and subsequently name it based on parameters in the matching rule. For the following example, I used CentOS 5.2 and a SanDisk compact flash reader connected via USB.
The first step is to plug the device into your computer and query its characteristics. In my case, when I plugged in the CF reader, it was auto-mounted as /dev/sdb1. Use the udevinfo command to identify the characteristics of the device: udevinfo -a -p $(udevinfo -q path -n /dev/sdb1). This prints a long list of characteristics for the device itself, as well as the "parent" devices. The key is to use these characteristics to generate a rule that matches only the CF reader.
I identified a section from the output of the udevinfo command that seemed to have characteristics that would be unique to the reader. These were the idVendor value of "0781" and the idProduct value of "b4b5". I then went to the udev rules folder (/etc/udev/rules.d) and created a 10-local.rules file. Inside the rules file, I added the following rule: BUS=="usb", SYSFS{idVendor}=="0781", SYSFS{idProduct}="b4b5", NAME+="cf%n". This rule matches on a dynamic device on the usb bus with a Vendor ID of 0781 and a Product ID of b4b5. The output of this rule is defined by the NAME parameter, which simply states to create a device named /dev/cf1, where 1 could vary if other /dev/cf? devices are already in use.
It sometimes takes a few tries to properly define the rule so that it matches the desired devices and performs the desired naming. Two commands are very useful to help you debug and test. The first is the 'udevtest dev-path' command. udevtest takes the device path of the device in question and outputs the actions that would be performed. I used the command 'udevtest /block/sdb/sdb1' for my particular device. If you need to add, delete, or modify a rule, make the change in the file (10-local.rules) and then run 'udevcontrol reload_rules'.
To also define the mount point, I created a mount point in the /media folder named "cfboot" and entered the following line in the /etc/fstab file: /dev/cf1 /media/cfboot ext3 defaults,user 0 0. Note that the 'user' option is required if you wish any user other than root to be able to mount this device. The combination of the udev rule and the fstab line, when the CF reader is plugged in, creates a device node named /dev/cf1 and mounts the device on /media/cfboot.
Resources which I found useful are:
- http://linux.die.net/man/8/udev
- http://reactivated.net/writing_udev_rules.html
- http://ubuntuforums.org/showthread.php?t=168221
- http://www.linuxjournal.com/article/7316
Labels: Linux, udev, usb