Repair4Laptop: Do-It-Yourself Laptop and Notebook Upgrading, Modding and Repairing Digital Hinote VP575 > Picture Frame TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones
 
Last Updated: April 29, 2007

Contact: beakmyn <.at.> frontiernet <.dot.> net


ISO:  

RapidShare Link   
Another Link provided by a kind user



Overview

Background

A DPF (Digital Picture Frame) is really just a computer, usually a laptop, that's been re-purposed to show a slideshow of photos from a storage medium.

You can run your DPF with Windows, Linux or a Macintosh operating system. There are many versions out there including commercial units which cost many times more then if you were to do it yourself.

In my case I got ahold of old laptop and decided to dissassemble it and fit it into pretty frame. Is there anything special to it? Not really it's just some scripts and a couple programs but aside from that it's still a laptop, but a really cool one now.  

The key to all of this is the frugal installation. When you're done you'll have a read-only file system with automatic backup/restore for persistant storage of changes. And you can pull the plug and when you re-boot the frame will continue as normal.

Computer Specifications

  • Pentium 166 Mhz
  • 80 MB RAM
  • 4GB Hard drive
    • /dev/hda1 - 60 MB Damn Small Linux Frugal Install made read-only by boot command-line option
    • /dev/hda2 - 10 MB Backup/Persistant Storage
    • /dev/hda3 - Remainder of drive for pictures (moutned readonly at runtime)

Operating System

Due to its compact size and relatively simple installation procedure I chose Damn Small Linux  which is a Knoppix based Debian distribution. Since I have 80 MB of RAM I decided to forgo the creation of a swap drive.

What's Installed/used

  • Damn Small Linux - Frugal Install
    • Feh - Image viewer/slideshow
    • unclutter - hides mouse
    • SSH - administration/configuration via network
    • NFS - map to Windows shared drive (NFSAxe) or other Linux machine natively (easier then loading Samba, IMHO)
    • CRON - start/stop frame on a schecule
    • Custom Boot Command Line variables

Credits

You may also want to checkout EDGE's sub $100 Digital Picture Frame EDGE Digital Picture Frame
The current scripts are adapted from The Warehouse
There are many more frames like mine at likelysoft

How it Works

At startup the DPF boots DSL (Damn Small Linux) from the hard drive as if it were booting the CD-ROM this means at boot everything is read-only. At a certain portion in the boot process DSL will automagically mount and restore the saved settings from /dev/hda2. Further along in the boot process DSL will load the feh and unclutter (.dsl) programs. At this point we're practically ready to go once the system processes the bootlocal.sh and .xinitrc scripts, feh will run and we ceas

Software

First, you'll need to head over to the DSL website and download the latest iso of Damn Small Linux and burn it to CD. It's about 50MB so I'll wait.....Oh good your back.

Preparing the Disk

Boot the DSL liveCD. You should be at a boot command line where you can press F2 for more options. For my install I chose the following, your mileage may vary.

# fb800x600 noscsi nousb noagp noswap noapm noapic nomce noddc expert

A bit of booting you should get a screen that asks how you want to run X (Xvesa or Xfbdev). Since this is old hardware it’s safer to choose Xfbdev. Next you’ll be asked if you have a USB mouse, if you do you shouldn’t have booted with the nousb option, select no. You’ll now be asked if you have an IMPS2  mouse. I selected no, IMPS/2 is a Microsoft scroll mouse. Most mice run on the PS2 port so select PS2 at the next screen and then 2 buttons.

After a bit if all goes well X will start then you’ll see fluxbox run and your now running DSL off the CD. Now, we have to get it onto the harddrive.

If you’ve never used fluxbox before here’s the basics: Right click on the ‘desktop’ to get your menu and work from there. You shouldn’t have to fiddle with the slit on the bottom. If you think this interface is really cool and you’d like to have it for you windows machine then goto to www.bb4win.org it’s sister ‘blackbox’ has been ported to the windows platform and it’s got some extras. I’ve been using it at home since the first alpha.

Linux really doesn’t like it if you shutdown the computer by pulling the plug. In fact, you may end up with an umountable file system the next time you start up. So, we’re going to make the filesystem read-only. That way there’s no chance of Borking the filesystem by pulling the plug. Of course from time to time we’ll want to add pictures to our frame so we’ll need two partitions. One for DSL and antoher for data.

Press Ctrl+Alt+F1 to get TTY1 terminal and type the following

  # sudo passwd root
  # su
  # cfdisk

You’ll now be in the cfdisk editor. You’ll want to delete and partitions that currently exist, then create following three primary partitions

hda1 bootable 60MB
[NEW] [PRIMARY] Size (in mb) : 60 [Beginning] Bootable

hda2 10mb
[NEW] [PRIMARY] Size (in mb) : 10 [Beginning] 

hda3 rest of drive
[NEW] [PRIMARY] rest of disk 

Create the Filesystems
  # mke2fs /dev/hda1
  # mke2fs /dev/hda2
  # mke2fs /dev/hda3

Install DSL

Now, reboot the computer and at the boot prompt type
# install

Select option: 4
Target Partition: /hda1
Install from [l] : livecd
reboot

feh,unclutter,backup/restore, ssh,scripts

feh/unclutter

There's few ways of getting feh and unclutter
1. Using the menu items Enable Apt > Apt-get install feh unlcutter dpkg-tools
    Then use deb2dsl to create a .dsl package
    Save the .dsl to the root /hda2
    use Mydsl and do a load local
2. wget http://www.frontiernet.net/~pictureframe/mydsl/feh.dsl
    wget http://www.frontiernet.net/~pictureframe/mydsl/unclutter.dsl
There's a feh.unc available using the mydsl repository but I haven't tested this method yet.

Use method 2 I've already done the hard part for you

   
# sudo mount /dev/hda2
# cd /mnt/hda2
#
sudo wget http://www.frontiernet.net/~pictureframe/mydsl/feh.dsl
sudo wget http://www.frontiernet.net/~pictureframe/mydsl/unclutter.dsl
Use the MyDSL tool and select "load local"


ssh/grub - Custom Boot Command Line Variables

Since we'll be using ssh to be able to remote into the machine and run from a command line we'll need to set up a password for our users. DSL ships with the following users: root, dsl. Without this you won't be able to ssh into your machine!

# sudo passwd root
follow the prompts and choose a password for root

#
sudo passwd dsl
follow the prompts and choose a password for dsl


THIS NEEDS TO BE DONE FROM A LIVE-CD BOOT. You can't mount or remount the drive you've booted from. I.E. you can mount a currently active partition
To make your root drive read-only you'll need to mount and modify your grub command line and

# sudo mount /dev/hda1
#
 
sudo mount /dev/hda1 -o remount,rw
# cd /mnt/hda1  
# sudo nano /boot/grub/menu.lst
remove the frugal boot option
add  root=/dev/hda2 pictures=/path/to/pictures scripts=/path/to/scripts to the line under fb800x600 that starts with "kernel"
Under Timeout option type hiddenmenu

/boot/grub/menu.lst
default 0
timeout 0
hiddenmenu
title DSL fb800x600
kernel /boot/linux24 root=/dev/hda2 quiet vga=788 atapicd noideraid nosound noapic noacpi acpi=off noscsi noapm nofirewire noagp nomce pictures=/mnt/hda3/Pictures scripts=/mnt/hda3/scripts

This is my low memory minimal boot (WATCH FOR LINE WRAPPING)

Backup/restore

Now because we've chosen a frugal install its like runnin off the CD everytime so we have to backup/restore our changes. Luckily DSL has a utility to do this and it's called Backup/Restore.

In the fluxbox menu it can be found in System > Backup/Restore
start the utility and enter hda2 as the backup/restore location and click backup

In order for the frame to be bulle-proof you'll need to do a successful backup first.

The backup restore utility, backs up based on the .filetool.lst and the default it to backup everything in your home directory! Do not put large files in your home directory /home/dsl/* and whatever you do DO NOT map shared drives to a directory located in your home directory as the backup utility will go out and backup all the files on that shared drive!
This is what makes it a picture frame, the scripts.You can spend them to type these out by hand or just use your favorite method (dillo,wget,etc) to save the copies I've provided in the scripts directory. Depending on the version of DSL you have you may first want to compare the files and find the differences, lest my copy breaks something new.

I've highlighted in Red the new stuff
/opt/bootlocal.sh
#!/bin/bash
# put other system startup command here
mount /dev/hda3
sudo mount /dev/hda3 -o remount,ro
loadkeys us
/etc/init.d/ssh start
/opt/myiwconfig.sh
# for usb automount and copy
mount /dev/sda1
/mnt/dev/sda1/autorun.sh
sudo umount /dev/sda1
this script mounts the picture partition read-only, starts sshd and runs the script to configure the wireless card
~/.xinitrc - file is hidden so to use 'ls -a' to show hidden files
# put X windows programs that you want started here.
# Be sure to add at the end of each command the &

KEYTABLE="$(getknoppixparam.lua KEYTABLE)"
DESKTOP="$(getoption.lua $HOME/.desktop wm)"
ICONS="$(getoption.lua $HOME/.desktop icons)"

. /etc/init.d/dsl-functions

CMDLINE="$(cat /proc/cmdline)"

PICTURES="$(getbootparam pictures)"
[ -d "$PICTURES" ] || PICTURES="/var/Pictures"

SCRIPTS="$(getbootparam scripts)"
[ -d "$SCRIPTS" ] || scripts="/home/dsl/scripts"


# For non-US Keyboards
if [ ${KEYTABLE:0:2} != "us" ]; then
  xmodmap -e "clear Mod4" -e "add Mod5 = Mode_switch" &
fi

#if egrep -qv noicons /proc/cmdline 2>/dev/null; then
if [ "$ICONS" == 1 ]; then
  for x in `ls -1 .xtdesktop/*.hide 2>/dev/null`; do rm -f ${x%.*}; done
  iconsnap.lua &>/dev/null &
  xtdesk.sh
fi
#dillo /usr/share/doc/dsl/getting_started.html &>/dev/null &
torsmo 2>/dev/null &
xset s off
noblank
xset s off
"$SCRIPTS"/cron_start_frame.sh &

case $DESKTOP in
  fluxbox )
    fluxter &>/dev/null &
    wmswallow -geometry 70x80 docked  docked.lua &
    exec fluxbox 2>/dev/null 
  ;;
  jwm )
    ./.background
    sleep 2
    exec jwm 2>/dev/null
  ;;
  * )
    exec fluxbox 2>/dev/null
  ;;
esac

this script is called at the startup of X-windows and calls the script to start the slideshow
~/.bash_profile - file is hidden so to use 'ls -a' to show hidden files
#!/bin/bash
export IRCNICK=DSL
export DISPLAY=:0
SSH=`env | grep SSH_CONNECTION`
RUNLEVEL=`runlevel|cut -f2 -d' '`
if [ -z "$SSH" ]; then
   if [ $RUNLEVEL -eq 5 ]; then
       startx
   fi
fi

The "export DISPLAY=:0" line is very important. With out this line, any scripts run from a remote ssh connection will not show on the display.
~/.filetool.lst - file is hidden so to use 'ls -a' to show hidden files
opt/ppp
opt/bootlocal.sh
opt/myiwconfig.sh
opt/powerdown.sh
opt/.dslrc
opt/.mydsl_dir
home/dsl/
/etc/ssh/
/etc/shadow


This is used by the backup/restore utility to tell it what directories to backup/restore.
/opt/myiwconfig.sh
#!/bin/sh
#
# Script to set up wireless card
# beakmyn@frontiernet.net
#

# Set display so that script will effect the local screen
export DISPLAY=:0

sudo iwconfig eth0 essid "Your Essid" enc DE:AD:BE:EF:41

#sudo ifconfig eth0 10.10.0.10
#sudo route add default gw 10.10.0.1

sudo pump -i eth0
exit 0



This is used to automatically configure the wireless at boot

The Scripts

The following scripts/text are copied from The Warehouse and are localized. 
In his version he uses CRON to start/stop the picture show at a given time, if you're interested in that take a look. I won't go into that here, although it's a trivial operation. I've kept the same filenames for portability.
$SCRIPTS/cron_start_frame.sh
#!/bin/sh
#
# Script to run Digital Picture Frame using Feh
# drware@thewares.net
# Modified to add boot command line beakmyn@frontiernet.net

# Change number below to the duration, in seconds
# for each photo to be displayed
#DELAY="300"

# hide the cursor after 15 seconds
/usr/X11R6/bin/unclutter -idle 15 &
. /etc/init.d/dsl-functions
CMDLINE="$(cat /proc/cmdline)"

PICTURES="$(getbootparam pictures)"
[ -d "$PICTURES" ] || PICTURES="/var/Pictures"

SCRIPTS="$(getbootparam scripts)"
[ -d "$SCRIPTS" ] || scripts="/home/dsl/scripts"



# Start slide show
/usr/bin/feh -qzrZF -D 120 "$PICTURES" &

# Phone home and sync
#"$SCRIPTS"/rsync.sh

exit 0

this script mounts the picture partition read-only, starts sshd and runs the script to configure the wireless card
$SCRIPTS/cron_reload_frame.sh
#!/bin/sh
#
# Script to run Digital Picture Frame using Feh
# drware@thewares.net
#

# Change number below to the duration, in seconds
# for each photo to be displayed
#DELAY="300"

# Set display so that the script will effect
# the screen on the frame
export DISPLAY=:0
. /etc/init.d/dsl-functions
CMDLINE="$(cat /proc/cmdline)"

PICTURES="$(getbootparam pictures)"
[ -d "$PICTURES" ] || PICTURES="/var/Pictures"

SCRIPTS="$(getbootparam scripts)"
[ -d "$SCRIPTS" ] || scripts="/home/dsl/scripts"



# Stop the currently running Slide show
"$SCRIPTS"/kill.sh feh

sleep 10s

# Start slide show
feh -qzrZF -D 120 "$PICTURES" &

exit 0



The cron_reload_frame.sh script is used to restart the slide show on the frame via cron. Restarting the slide show will add any new photos that have been copied to the frame to the presentation.
$SCRIPTS/manual_restart.sh
#!/bin/sh
#
# Script to run Digital Picture Frame using Feh
# drware@thewares.net
# Modified to add boot command line beakmyn@frontiernet.net
#

# Set display so that the script will effect
# the screen on the frame
export DISPLAY=:0
. /etc/init.d/dsl-functions
CMDLINE="$(cat /proc/cmdline)"

PICTURES="$(getbootparam pictures)"
[ -d "$PICTURES" ] || PICTURES="/var/Pictures"

SCRIPTS="$(getbootparam scripts)"
[ -d "$SCRIPTS" ] || scripts="/home/dsl/scripts"

# Stop the currently running Slide show
"$SCRIPTS"/kill.sh feh

clear
echo ""
echo -n "Enter the number of seconds for photo rotation"
echo -n "and press [ENTER]: "
read var_seconds
echo ""

/usr/bin/feh -qzrZF -D $var_seconds "$PICTURES" &

exit 0



The manual_restart.sh script is used to restart the slide show from the command line. The script asks for input on the duration in seconds that each photo should be displayed.
$SCRIPTS/dir_frame.sh
#!/bin/sh
#
# Script to run Digital Picture Frame using Feh
# drware@thewares.net
# Modified to add boot command line beakmyn@frontiernet.net
#

# Set display so that the script will effect
# the screen on the frame
export DISPLAY=:0
. /etc/init.d/dsl-functions
CMDLINE="$(cat /proc/cmdline)"

PICTURES="$(getbootparam pictures)"
[ -d "$PICTURES" ] || PICTURES="/var/Pictures"

SCRIPTS="$(getbootparam scripts)"
[ -d "$SCRIPTS" ] || scripts="/home/dsl/scripts"

# Stop the currently running Slide show
"$SCRIPTS"/kill.sh feh

clear
echo ""
echo -n "Enter the number of seconds for photo rotation "
echo -n "and press [ENTER]: "
read var_seconds
echo ""
echo "Available options for the directory are:"
ls "$PICTURES"
echo ""
echo -n "Enter the directory of photos to display and "
echo -n "press [ENTER]: "
read var_dir
echo ""

/usr/bin/feh -qzrZF -D $var_seconds "$PICTURES"/$var_dir &

exit 0




The dir_frame.sh script is used to restart the slide show from the command line and will ask you which sub directory to display.
$SCRIPTS/kill.sh
#!/bin/bash

if [ ! -z "$1" ]; then
  PROCESS=$1

  PIDS=`ps -ax | grep $PROCESS | sed -e "s/.*killp.*//"
          -e "s/ *\([0-9]\{1,6\}\) .*/\1/" | grep -v "^$"`

  if [ ! -z "$PIDS" ]; then
    echo Killing $PROCESS pid=$PIDS
    kill -9 $PIDS
  else
    echo No process $PROCESS in process list
  fi

else
  echo Usage : $0 process_name
fi



The kill.sh script is called by other scripts so the slide shows can be stopped and restarted.
Beakmyn's Note: This script isn't the prettiest when it runs as it doesn't quite remove unneeded text and results benign error output
root of usb drive autorun.sh assumes pictures are on /mnt/hda3/Pictures
#!/bin/bash

echo Found USB Memory
sudo mount /dev/hda3 -o remount,rw
cd /mnt/sda1/
echo Updating Pictures
cp -u -r *.jpg /mnt/hda3/Pictures/
cd /
sudo mount /dev/hda3 -o remount,ro
echo File Copy Finished
exit 0

This is Beta script to automatically copy files from a USB memory drive to the picture drive. You must have the drive inserted at boot up as bootlocal.sh initiates it.

Getting Pictures to the frame

I use PuTTY on my windows machine to ssh into my DPF and then I mount a Network File System share to a shared drive on my windows machine. I use NFSAxe on the windows machine to provide a simple NFS server environment. To mount the share
# sudo mkdir /mnt/tmp
# sudo mount -t nfs 192.168.0.1:/pictures /mnt/tmp
Now /mnt/tmp is mapped to the shared folder in NFSAxe so you can copy the pictures your picture partition (/mnt/hda3/). The "free" version of NFSAxe will only run for 30 minutes which is usually enough time to copy your pictures over. If you were to purchase it you could conceivably mount the NFS share in a subdirectory of your picture partition and feh would grab pictures from it!
So that's pretty much it. You should now a picture frame that runs at boot-up automatically and you can pull the plug without worry about corrupting your installation.
MAKE: I'm a Maker!Last Updated Sept 28, 2007