Sharp Zaurus C700 Debian <=> Qtopia

First of all, many thanks to Klaus Weidner for his work at [].
He's the author of fbvnc code, and of the original project [Debian on Handhelds].

--NEW-- Compiled new drivers for prism2 cards.
Now it's possible to sniff in true monitor mode, & spoof the MAC address. here

I've tested all the below stuff on my z, and all it's working ok,
never reflashed, never a problem or instability.
But be aware, if something goes wrong, it's possible that your z. wont boot anymore,
and that you need to re-flash it.
See also this "diary" if you want more detailed info on z. boot/init process.

Ok, here is the whole.

1] Download, from

1a] If you have a linux box, it's higly recommended that you install the usbdnet standalone module.
i.ex. or
The kernel module, on the other hand, is very unstable & kernelpanic prone.
[Of course it's possible also to do all the job via the Z keyboard]
Anyway, if you want to use the usb cradle connectivity, do something similar:

- create & chmod this on your pc [say you name it 'zaurus']:
#! /bin/bash
typeset -i num
num=`ifconfig | grep usb0 | wc -l`
if [ $num -eq 0 ] ; then
ifconfig usb0 netmask up
route add -host usb0

- add this to your pc '/etc/hosts': zaurus

this way, you can quickly execute 'zaurus' then 'telnet zaurus'.
[I assume that you've already modprobed usb-uhci & usbdnet]

2] Format with mke2fs your SD card.
mke2fs /dev/mmcda1

3] Cd in the SD card, and upload here the 2 tarball of 1]
[a little note: when I've dloaded the zaurus-debian-big-v0.15.tgz it was not gzipped, it was just a tar.
dunno if it's the broken brain of IE ;)]

- if you've the usb cradle inserted you can, via netcat, do something like:
nc -l -p 1234 > tarball.tar [zaurus side]
cat tarball.tar | nc zaurus 1234 [pc side]

- extract the tarball.

- edit /etc/sdcontrol:

--------BEGIN SNIP--------
FSTYPE="-t ext2"
FATOPTS="-o noatimei,quiet,umask=000,iocharset=utf8"
EXT2OPTS="-o noatime"
--------ENDOF SNIP--------

--------BEGIN SNIP--------
case "$ACTION" in
MOUNT_RES = `mount | grep $DEVICE`
if [ "$MOUNT_RES" = "" ]; then
--------ENDOF SNIP--------

- edit /etc/fstab, and in '/dev/mmcda1' line, add 'noatime'

--------BEGIN LINE--------
/dev/mmcda1 /usr/mnt.rom/card ext2 rw,noatime 0 0
--------ENDOF LINE--------

- execute ./debroot/INSTALL.d/

[during the execution of, answer YES at all, but NO at these 2:
Permit unsafe VNC connections without passwords?
Run 'Fbvnc' now?
--- Note: you can also safely answer yes at the 1st question, because, in this installation, the Xvnc server runs only locally. ---

- gunzip the fbvnc-arm-1.3.3beta.gz and copy to /mnt/card/debroot/usr/bin/fbvnc

- add "-w c700" in the last lines of /usr/local/bin/Fbvnc this way:

--------BEGIN SNIP--------
if [ -z "$1" ]; then
fbvnc -hw c700
fbvnc -hw c700 "$@"
--------ENDOF SNIP--------

- edit /etc/debroot.conf

--------BEGIN FILE--------
### /etc/debroot.conf
# Configuration for the Debian chroot environment startup process

# IMPORTANT: boolean settings (DEB_FOO=1) are true if not empty, so
# comment out the entry (put a '#' at the start of the line) if you
# want to deactivate it.



# Disable this if you have a fixed QPE that permits VT switching




#DEB_RUN_SERVICES="inetd ssh lpd"





--------ENDOF FILE--------

[comments stripped out ;)]

- find in the /etc/rc.d tree the symlink to zdebian and delete it.
[Note: don't delete the file. Only delete the symlink. Here below you'll need to edit it.]

- edit /etc/rc.d/init.d/zdebian

--------BEGIN SNIP--------

## sh [linked to ash] doesnt exec cleanly, so we set bash instead

[ ! -f $DEBCONF ] && {
echo "Can't find $DEBCONF, aborting..."
exit 1


[ "$DEBROOT" ] || exit 1
if [ ! -d "$DEBROOT" ]; then
echo "Waiting for $DEBROOT to be fscked..."
while ps ax | grep -v grep | grep e2fsck >/dev/null
sleep 1
sleep 1
if [ ! -d "$DEBROOT" ]; then
echo "Waiting for $DEBROOT to be mounted..."
sleep 10
cd $DEBROOT || exit 1


rootcmd_server_start () {
mkfifo -m 600 $ROOTCMD_FIFO

while true
read TTY CMD
sleep 1
) &
echo $! >/var/run/
--------ENDOF SNIP--------

[the real 2 changes are the 2 /bin/bash invocations at the beginning & at line 41.
the original '/bin/sh' fails to execute cleanly the exec fifo commands. it's an 'ash' issue
(/bin/sh is linked to 'ash', NOT to 'bash').
Many thanks to my brother, Davide, for helping in pointing out this.]

- cd in /home/zaurus, create & chmod 755 these 2 files:
--------BEGIN FILE--------
#! /bin/bash

echo "zdebian stop.."
/etc/rc.d/init.d/zdebian stop
echo "kill Xvnc.."
killall Xvnc
echo "change launch.default to 'q'"
echo q > /home/sharp/etc/launch.default
echo "DONE."
exit 0
--------ENDOF FILE--------
--------BEGIN FILE--------
#! /bin/bash

echo a > /home/sharp/etc/launch.default
killall qpe
killall qeserver
killall qtsamba
/home/root/usr/bin/chvt 2
sleep 4
/home/root/usr/bin/chvt 1

exit 0
--------ENDOF FILE--------

still in /home/zaurus, do a: echo a > what.txt

note: this file (what.txt) will be your 'boot flag'.
-> if it's "a" then the next boot will be debian
-> if it's "q" then the next boot will be qtopia

be sure to not edit or remove this file, because it's needed in the init process [see below]
[I mean, it must be absolutely "a" or "q", or you can byebye the z. and reflash it ;)]

still in /home/zaurus, do a: ln -s /etc/rc.d/init.d/zdebian

- edit /usr/mnt.rom/card/usr/local/bin/zvncserver
[security improvement]
I've changed also the '/bin/sh' first line in '/bin/bash'
And also in Fbvnc.
--------BEGIN SNIP--------
[ -f $AUTH_FILE ] && AUTH="-rfbauth $AUTH_FILE"

[ ."$DISPLAY" = .":0" ] && rm -f /tmp/.X0-lock
[ ."$DISPLAY" = .":1" ] && rm -f /tmp/.X1-lock
[ ."$DISPLAY" = .":2" ] && rm -f /tmp/.X2-lock

## with '-localhost' we allow only connection from the same machine on which Xvnc runs
## with '-nolisten tcp' [undocumented feature, at least with this goal] we stop Xvnc from listen also on 6000+DISPLAY port
Xvnc -localhost -nolisten tcp -geometry $GEOM -depth 16 -pixelformat RGB565 $AUTH $DISPLAY &
#-fp /usr/lib/vnc/fonts/misc \
#-co /usr/lib/vnc/rgb \

sleep 5
cd $HOME
--------ENDOF SNIP--------

[Note: about the '6000+DISPLAY port' issue, I've mailed also freebsd bug repos.]

- edit /etc/inetd.conf
[security improvement]

leave only this line uncommented:
--------BEGIN LINE--------
telnet stream tcp nowait root /usr/sbin.rom/tcpd /usr/sbin/in.telnetd
--------ENDOF LINE--------

after that, you must also create /etc/hosts.allow & /etc/hosts.deny, add 1 entry in /etc/hosts,
and update /usr/mnt.rom/card/etc/hosts


--------BEGIN FILE--------
### Do not edit this file - it was copied
### from /usr/mnt.rom/card/etc/hosts by ./zdebian
### Edit /etc/debroot.conf to deactivate this. localhost loopback yourpcname

### Do not edit this file - it was copied
### from /usr/mnt.rom/card/etc/hosts by ./zdebian
### Edit /etc/debroot.conf to deactivate this.
--------ENDOF FILE--------

Update your debroot hosts file:
cp /etc/hosts /usr/mnt.rom/card/etc/hosts

Set the allow/deny rules:

--------BEGIN FILE--------
--------ENDOF FILE--------

--------BEGIN FILE--------
ALL: yourpcname
--------ENDOF FILE--------

Now, do a /etc/rc.d/init.d/inet restart

and try to connect with a new 'telnet zaurus' from your PC,
and try also a 'telnet localhost' from inside the z.
you must connect from pc, and denied from the z.

- stop useless services from auto starting:
[as I said in the intro, I assume you're not so interested in syncing with outlook and other windoze stuff :)]
in /etc/rc.d/init.d
do a
chmod 000 portmap
chmod 000 samba

edit /etc/hotplug/usbdnet.conf
--------BEGIN FILE--------
--------ENDOF FILE--------

- if you want to change the 2nd splashscreen with your own:
* create an image 480x640, bitmap format.
[this is the output of 'file':
PC bitmap data, Windows 3.x format, 480 x 640 x 24
* copy in /home/QtPalmtop/pics144/Startup_screen.bmp


################### editing files in /dev/root ###################

before you can edit the files mounted in /dev/root, you must do an
mount -o rw,remount /dev/root /
[be aware to not make big mistakes from now.. :)]

this is my /root/etc/sysconfig/init,
don't remember if it's like the original
--------BEGIN FILE--------
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
--------ENDOF FILE--------

- edit /root/etc/rc.d/rc.sysinit
[with this change, we see at least some log msgs on the screen instead of the red/white sharp splashscreen :)]
--------BEGIN SNIP--------
# Print a banner. ;)
#if [ -z "$SILENT" ] ; then
echo -en $" Welcome to "
[ "$BOOTUP" != "serial" ] && echo -en $"\\033[1;31m"
echo -en $"WHATYOUWANT"
[ "$BOOTUP" != "serial" ] && echo -en $"\\033[0;39m"
echo $" Zaurus"
--------ENDOF SNIP--------

- edit /root/etc/rc.d/rc.rofilesys
[this is the trick for 'booting' in debian]
--------BEGIN SNIP--------
#echo $LAUNCH > /home/sharp/etc/launch.default
cat /home/zaurus/what.txt > /home/sharp/etc/launch.default
--------ENDOF SNIP--------

- edit /root/etc/inittab
[not so necessary]
--------BEGIN SNIP--------
# collie sp.
--------ENDOF SNIP--------

################### USAGE ###################

Ok now finally for the fun stuff ;)

1] /home/zaurus/what.txt

is your 'bootselect' flag.

a -> debian
q -> qtopia

2] Exiting/switching from Qtopia

- open Konsole
- su as root
- in /home/zaurus execute "./"
this will give you a console log.
login, become root.

Then if you want to start Debian, do a
./zdebian start

If you want to reboot:

If you want to halt:
[when all off, remember to switch for at least 5 secs the battery switch]

3] Exiting/switching from Debian

Menu -> Logout
press Fn+Shift+q
execute ./

If you want to start Qtopia, you must simply:

If you want to reboot:
[Note: if you boot in 'Debian mode' ('what.txt' == a), you'll get a login prompt.
After logged and 'su', do './zdebian start', he.. :)]

If you want to halt:
[when all off, remember to switch for at least 5 secs the battery switch]

4] Note on screen in console mode:

just type 'clear' + Enter
if you want to clean the screen in console mode.
Take a look here for further specs..

5] Executing command in debian:

using "cru" you can execute like in the 'original' environment.
--------BEGIN SNIP--------
~# cru ls /root
bin etc samba
~# ls /root
HELP.txt debian-faq.pdf
--------ENDOF SNIP--------

[see also this, for further specs, it's a little 'diary' I wrote trying the installation.. :)]

Updated drivers for prism2 cards.
How to permanently change your MAC address re-flashing the card [tested on prism2 cards]


Paolo Sarpi   []
Last updated: 2003/05/28