Scaling / Changing the System Fonts
April 21, 2006 on 10:19 am | In maemo, nokia770 | No CommentsI would like to add yet one more thing to the list of things that should be user configurable (on the 770), but is not. The selection of System Fonts and System Font sizes. The 770 display has one of the highest pixel densities available, yet the system font is 16.75 points. For everything. Yes, I may be getting old and my eyes arent as sharp as they used to be, but I would like the option of tweaking the system font to fit how i see. Not some demographic profile. I would also like to be able to do in a few easy steps without having to write my own theme.
At some point, i may write a script for this (or maybe somebody else will). Until then i have the following process.
NOTE - Before you start editing your favorite theme, make sure it is NOT the current and active theme.
- Open a xterm window and enter ’sudo gainroot’
- Enter ’su -’
- Enter ‘cd /usr/share/themes’
- Select your current favorite theme. The directory names are not exactly right, and you may have to examine ‘index.theme’ in each directory to determine the theme name (clue in line 3 of the file).
- When you have selected your favorite theme, enter the matchbox directory within that theme.
- enter ‘cp theme.xml theme.xml.baseline’ to make a backup.
- Edit theme.xml, and find ‘ font id=”osso-TitleFont” def=”Nokia Sans-16.75:30px” ‘ at about line 13.
- Change the def entry to something like ‘def=”Nokia Sans-14″ />”‘. The fonts are TTF fonts and scalable, and I am not sure what the px entry does, but it worked fine without it.
- Save and exit the file. Enter ‘cd ../gtk-2.0′
- Enter ‘cp gtkrc gtkrc.baseline’ to make a backup.
- Enter ‘rm gtkrc.cache’ to delete the current cached resources.
- Edit gtkrc.
- Find a font definition section from lines 253 to 294.
- Change all of the 16.75 fonts to 14. I left the rest alone.
- Save and exit the file.
- Reselect this modified theme from the home tab, and all of your system fonts should be noticably smaller but still readable (for most of us).
Of course, you can adjust as necessary to any miniscule or monstrous font of your choosing.
ubergEEk
PS - Like everything else on this blog, use at your own risk. Just because it worked for me, does not mean I assume responsibility for anything you do.
Maemo Shell Environment Fixups
April 20, 2006 on 2:28 pm | In maemo, nokia770 | 2 CommentsI am Linux geek and by definition that makes me a shell geek also. My (formerly) greatest frustration was entering long strings of commands through the pickboard interface on the 770 everytime i had to reflash it. Of course i wouldn’t have to reflash it so often if i wasn’t breaking the root filesystem so often. But i do.
As a result i developed a fairly consistent set of procedures for reinstallation with a supporting script. The overall impact to the root filesystem is minimal (nothing like the ravenwolf script - however i did borrow a few lines of script from it). Here it is:
Activating Debug / Root Mode (every install)
In order to place the 770 in root mode, you have to use the Linux Flasher.
- Boot to linux, download the linux flasher from http://maemo.org/downloads/d3.php.
- Connect the 770 to the USB cable (to the PC).
- Enter ‘chmod +x flasher’ to make sure it is executable.
- Enter ‘./flasher –enable-rd-mode –reboot‘
- Place the 770 in ‘brick mode’ by (a) powering it down (b) hold the home button down, (c) press the power button until the USB symbol appears at the upper right corner of the display. This mode places the internal flash memory on the USB interface so it can be updated from the PC.
- The 770 will reboot when it is completed.
Repartioning External Flash (as necessary)
In order to extend the root file system and create a swapspace on the external flash card, we need to repartition the card. The first partition must be the VFAT partition. Maemo treats this partiton as special, in that it maps into the file manager directly and will map to the USB interface when the connected to a PC (but only if it is VFAT). Any other Linux partition can be persistantly mounted by the 770. By creating symbolic links from this partition back to the root file system, we can offload the internal memory.
- Boot your PC to Linux. Login as root.
- Connect the 770 to the USB.
- enter ‘mkdir /mnt/770′ to create a mount point.
- enter ‘fdisk /dev/sda’ to repartition the card. Delete the current vfat partition, create a new (smaller) vfat partition1 and a linux partition for the balance of the card. Write the partition table and exit.
- enter ‘mkfs.vfat /dev/sda1 to create the vfat filesystem.
- enter ‘mkfs.ext2 /dev/sda2 to create the ext2 filesystem. ext3 is not appropriate for a flash file system.
- enter ‘mount /dev/sda2 /mnt/770′ to mount the ext2 partition.
- enter ‘dd if=/dev/zero of=/mnt/770/swapfile bs=1024 count=24576′ to create a swapfile.
- enter ‘mkswap /mnt/770/swapfile’ to format it as a swapfile
- enter ‘umount /mnt/770′ to unmount the partition.
- unplug the 770 from the computer and reboot the 770.
Installations Part 1 (every install)
Before we can do anything interesting with our Nokia 770 we need to have the following mimimal applications installed. These include:
- osso-xterm at http://770.fs-security.com/xterm/
These tools will allow you to open a terminal and edit. After installation follow these steps to configure and verify operation.
Updating Passwords
There are two users defined on the maemo image. These would be ‘user’ with no password , and ‘root’ with a password of ‘rootme’. Update the passwords as follows:
- Open xterm.
- enter ’sudo gainroot’ to change user to root.
- enter ’su -’
- enter ‘passwd -l root’ to lock the root account.
- enter ‘passwd root’ to change the root password
- enter ‘passwd user’ to change the user password
Installing Apps Part 1
In this section we will install the baseline applications for the nokia 770. These include:
- bluetooth keyboard plugin at http://770.fs-security.com/keyboards.html
- iputils at http://www.opbyte.it/maemo/
- openssh at ftp://ftp.infradead.org/pub/maemo
- python runtime at http://pymaemo.sourceforge.net/
- sbnetmon at http://tabletcorner.com - Status bar Network Monitor
- slocate at http://lucidvisions.com/
- vim at http://www.bleb.org/software/770/#vim
- mug-usbnet at http://maemo.feelslikeburning.com/
- mug-pkgtools at http://maemo.feelslikeburning.com/
Running the Filesystem Fixups
Copy the following script into a file and execute from the root of the filesystem. It creates a number of symbolic links so that all of the binaries are now in the path, the lib paths are updated and a few files in the ‘wrong place’ are linked to the more appropriate location. The most invasive fixup is to automount /dev/mmcblk0p2 (as ext2 filesystem) at /MMC, if it exists.
Each fixup tests to determine if it has already been ‘fixed’, and only applies the fixup if necessary, so it can be run multiple times without impact.
#!/bin/sh
MMC_Mount=/MMC
MMC_Device=/dev/mmcblk0p2
#
# test if user is root / exit if not
#
if [ `id -u` != 0 ]; then
echo $0: only root can do that && exit
fi
#
# MMC automount code
#
if [ ! -e $MMC_Mount -a -b MMC_Device ]; then
echo "creating $MMC_Mount mountpoint and automounting $MMC_Device"
cd /
echo $0: save | tee -a $MMC.log
cp -p /etc/fstab /etc/fstab.baseline
echo /dev/mmcblk0p2 $MMC ext2 defaults,noatime 0 0 >>/etc/fstab
cp -p /etc/init.d/minircS /etc/init.d/minircS.baseline
sed -ir 's|(/sbin/udevstart)$|1;mount /dev/mmcblk0p2|' /etc/init.d/minircS
cp -p /etc/init.d/minireboot /etc/init.d/minireboot.baseline
sed -ir 's|(/media/mmc1)|/dev/mmcblk0p1 /dev/mmcblk0p2|' /etc/init.d/minireboot
cp -p /etc/init.d/minishutdown /etc/init.d/minishutdown.baseline
sed -ir 's|(/media/mmc1)|/dev/mmcblk0p1 /dev/mmcblk0p2|' /etc/init.d/minishutdown
mkdir -p $MMC && mount /dev/mmcblk0p2
else
echo "either $MMC_Mount already exists or $MMC_Device does not exist - bypassing automount scripts"
fi
#
# linking the install directories into the path
#
if [ ! -d /usr/local ]; then
echo "/usr/local does not appear to exist - creating"
mkdir /usr/local
else
echo "/usr/local appears to exist"
fi
#
if [ ! -h /usr/local/bin ]; then
echo "/usr/local/bin symbolic link does not appear to exist - creating"
ln -s /var/lib/install/usr/bin /usr/local/bin
else
echo "/usr/local/bin symbolic link appears to exist"
fi
#
if [ ! -h /usr/local/sbin ]; then
echo "/usr/local/sbin symbolic link does not appear to exist - creating"
ln -s /var/lib/install/usr/sbin /usr/local/sbin
else
echo "/usr/local/sbin symbolic link appears to exist"
fi
#
if [ ! -h /usr/local/lib ]; then
echo "/usr/local/lib symbolic link does not appear to exist - creating"
ln -s /var/lib/install/usr/lib /usr/local/lib
echo "refreshing lib cache"
ldconfig
else
echo "/usr/local/lib symbolic link appears to exist"
fi
#
# Linking the MMC and / directories into the File Manager
#
if [ ! -h /home/user/MyDocs/Root ]; then
echo "/home/user/MyDocs/Root symbolic link does not appear to exist - creating"
ln -s / /home/user/MyDocs/Root
else
echo "/home/user/MyDocs/Root symbolic link appears to exist"
fi
#
if [ ! -h /home/user/MyDocs/MMC ]; then
echo "/home/user/MyDocs/MMC symbolic link does not appear to exist - creating"
ln -s /MMC /home/user/MyDocs/MMC
else
echo "/home/user/MyDocs/MMC symbolic link appears to exist"
fi
#
# Fixing up slocate
#
if [ ! -d /var/lib/slocate ]; then
echo "/var/lib/slocate does not appear to exist - creating"
mkdir /var/lib/slocate
groupadd slocate
usermod -G slocate user
else
echo "/var/lib/slocate appears to exist"
fi
#
# Fixing up dpkg
#
if [ ! -h /var/lib/dpkg ]; then
echo "/var/lib/dpkg symbolic link does not appear to exist - creating"
ln -s /var/lib/install/var/lib/dpkg /var/lib/dpkg
else
echo "/var/lib/dpkg symbolic link appears to exist"
fi
#
# Fixing up OpenSSH application links
#
if [ ! -h /var/lib/install/usr/bin/scp ]; then
echo "/var/lib/install/usr/bin/scp symbolic link does not appear to exist - creating"
ln -s /var/lib/install/bin/scp /var/lib/install/usr/bin/scp
else
echo "/var/lib/install/usr/bin/scp symbolic link appears to exist"
fi
#
if [ ! -h /var/lib/install/usr/bin/ssh ]; then
echo "/var/lib/install/usr/bin/ssh symbolic link does not appear to exist - creating"
ln -s /var/lib/install/bin/ssh /var/lib/install/usr/bin/ssh
else
echo "/var/lib/install/usr/bin/ssh symbolic link appears to exist"
fi
#
if [ ! -h /var/lib/install/usr/bin/skey ]; then
echo "/var/lib/install/usr/bin/skey symbolic link does not appear to exist - creating"
ln -s /var/lib/install/bin/skey /var/lib/install/usr/bin/skey
else
echo "/var/lib/install/usr/bin/skey symbolic link appears to exist"
fi
#
if [ ! -h /var/lib/install/usr/sbin/sshd ]; then
echo "/var/lib/install/usr/sbin/sshd symbolic link does not appear to exist - creating"
ln -s /var/lib/install/sbin/sshd /var/lib/install/usr/sbin/sshd
else
echo "/var/lib/install/usr/sbin/sshd symbolic link appears to exist"
fi
Configure the ssh server
- Open xterm.
- enter ’sudo gainroot’ to change user to root.
- enter ’su -’
- enter ‘cd /var/lib/install/sbin’
- enter ’sh ./setup.sh’
- reboot the 770. open a network connection on the 770, and ssh to the 770 from a PC.
- complete any command line configuration from the ssh session.
Configuration Part 2
- Open an xterm session
- enter ’sudo gainroot’ to change user to root
- enter ’su -’ to get the full environment
- FYI - most applications install everything under /var/lib/install/usr/, and that is not in the path. So we create a symbolic link into a section of the path this is appropriate.
- enter ’slocate -u’ to update the locate database. (takes a long time)
- enter ‘cd ~’
- enter ‘vim .vimrc’
- within vim insert ’set nocompatible’, and then save and exit.
We now have installed a xterm, vim and mapped the directories so these applications are directly invokable.
Of course the fixup script is available at maemo.feelslikeburning.com
ubergEEk
Maemo Package Management Tools
February 21, 2006 on 8:38 pm | In maemo, nokia770, packaging | No CommentsI looked at the dearth of GNU Maemo packages and recall the vast number of comparable packages for the Zaurus. I then recall that the Zaurus packages are a special flavor of debian packages designed to be lightweight and without ‘extras’. And they are arm binaries. My favorite source of packages was at IpkgFind. I did some research and found that standard deb packages are basically a pair of tar.gz files inside of an ar package. Ipk packages started out as a the same tar.gz files inside of a tar.gz archive instead of an ar archive. But that changed over time, and the ipk file format changed back to a standard deb file format. The net result is that most ipk packages are structurally the same as deb packages and work with dpkg-deb.
Then is started thinking about the arm packages at the packages.debian.org So at this point i have access to two relatively large debian ARM binary package sources, but neither of them will work directly on the Nokia 770 (mostly the dependancies and the pre/post scripts).
My thoughts were that it should be relatively straightforward to extract the packages from the ipkg feed or the debian arm packages, restructure the contents, rewrite the control file for maemo and repackage. Towards this end i have written a few scripts that do the easy parts of this. These scripts are:
- mug-pkgextract.sh - extracts a ipk or deb package into a directory
- mug-pkgcleanup.sh - removes the pre and post scripts from a package DEBIAN directory
- mug-packager.sh - creates a maemo package from a build directory.
- mug.control.template - a maemo control template.
These 4 files are packaged into a deb package or available separately.
The process is to:
- Get the desired package from some ARM debian source.
- Extract it to a directory using ‘mug-pkgextract.sh packagename targetdir’
- Run ‘mug-pkgcleanup.sh targetdir’ to cleanup.
- Copy the mug.control.template file into the targetdir/DEBIAN directory and edit appropriately.
- Overwrite the old control file with the new control file.
- Go into the targetdir/usr directories and make sure that the organization is consistent with maemo packages. This may be the challenging part.
- After all of the touch work has been done, run the mug-packager.sh script to build the maemo package.
This process and these tools are not intended to port GUI or hardware specific binaries to the maemo. It won’t work and may break something. This process is good for things like GCC, make, thttpd, etc. Stuff that runs as a service or within a bash console.
ubergEEk
PS - Like everything else on this blog, use at your own risk. Just because it worked for me, does not mean i assume responsibility for anything you do.
USBNet with Nokia770 / WinXP
February 21, 2006 on 6:46 pm | In maemo, nokia770, winxp | 1 CommentBack when I was coding for the Zaurus, the easiest method for coding was to SSH into the Zaurus over the USB network interface. With SSH and SCP I could code on the Zaurus from any platform. Even my corporate Win2k system.
Well that Zaurus is dead and gone, and now I have the 770. Now i do concede that the USB flash drive interface is a lowest common denominator mdel, and perhaps more appealing to the non-geek, but TCP over USB is much more functional for any interactive coding / development.
Since the USB interface on the 770 has been designed to support both the flash memory interface and the TCP over USB interface the hard part has already been done. So now our problem becomes two separate problems. The first is to manage the interface on the Nokia so it looks like a USBNet interface. The second is to get the WinXP system to configure to talk over it.
In order to enable the USBNet interface on the 770, the g_ether module needs to be loaded and the usbnet interface needs to be enabled. This displaces the g_memory module that would normally be hooked in when the USB interface is connected to a master device.
The manual process for enabling and managing the USBNet interface and Linux hosts has been defined and discussed on at least two other maemo.org pages (http://maemo.org/maemowiki/HowTo). So if you are interested in how it works, look at those pages.
Based on the content of the pages I have written a bash script (usbnet) and packaged it for the 770. It places a the usbnet script on the /var/lib/install/usr/sbin directory and supports service like commands such as ‘usbnet start|stop|restart|status’. However it should be noted that Nokia has indicated that the USBNet interface is not particularly stable. I believe it is related to conflicts associated with the automatic enabling / disabling the g_memory module when the usbcable is connected (when the g_ether module owns the usb interface).
On WinXP (sp2) hosts, it already has usbnet drivers installed. However you have to follow a certain process in order to create a virtual network device for the USBNet interface.
- copy the linux.inf file to the some convenient location on the WinXP host
- put the Nokia 770 in USBNet mode.
- connect it to the WinXP host.
- When prompted for the device driver point windows as the linux.inf file/
- it should load the driver. name the interface something salient, like Nokia770 USB.
- Set the IP address staticly to 192.168.2.1 / subnet 255.255.255.
- SSH to address 192.168.2.15 (Nokia 770). If your SSH server is running you should get a login prompt.
That should work.
Right now if the script indicates that the usbnet interface is up on the Nokia 770, but WinXP does not recognize it on connection, try ‘usbnet restart’. That forces re-initalization of the g_ether module. This is usually associated with disconnection of the usb cable (and the event drives some code). If i get around to it, i will try to dig into the event response code and find out what is going on and update my script to deal better with it.
ubergEEk.
PS - Like everything else on this blog, use at your own risk. Just because it worked for me, does not mean i assume responsibility for anything you do.
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^