How to add a new locale to Nokia 770

Below are steps on how to add a new locale to Nokia 770. I have added "zh_CN" locale to my Nokia 770 successfully, but I think it's a "ugly" way to do this. Also note I only test this on IT OS 2006. So please do this on your own risk.

On your PC:

1. Prepare a Maemo development environment. Using ARMEL SDK rootstrap, install 'locales' package in scratchbox. After that, run 'localdef' to compile a new locale:
[sbox-SDK_ARMEL: ~] > apt-get update
[sbox-SDK_ARMEL: ~] > fakeroot apt-get install locales
[sbox-SDK_ARMEL: ~] > localedef -f UTF-8 -i zh_CN zh_CN

2. Verify it in sbox:
[sbox-SDK_ARMEL: ~] > localedef --list-archive
You should see the newly added locale in the output.
3. Copy /usr/lib/locale/locale-archive to your device.

On your device

4. Upgrade your device to Internet Tablet OS 2006.

5. Add Maemo Garage and Maemo respository to your Application Catalogue.

6. Follow this howto to get root access. You need install Xterm and Dropbear on your device.

7. Install 'locales' package by run this command in Xterm (as root):
# apt-get install locales
8. Copy your font files to /usr/share/fonts/truetype, you may create a subdirectory for your font files in it. Run following commands to add the fonts:
# fc-cache -f -v
# fc-list

9. Copy message files from 'en_GB' locale to your locale:
# cp -i /usr/share/locale/en_GB/LC_MESSAGES/*.mo \
/usr/share/locale/zh_CN/LC_MESSAGES/

Note: DON'T overwrite those existing mo files.

10. Overwrite existing locale-archive file. Backup the original /usr/lib/locale/locale-archive first, then overwrite it by the one from sbox. DON'T use 'cp' command directly. It may cause the device to reboot. I use following commands to avoid this:
# cp /media/mmc1/locale-archive /usr/lib/locale/locale-archive-new
# cd /usr/lib/locale
# echo ""> locale-archive \
&& mv locale-archive-new locale-archive

11. Verify it on your device:
# locale -a
Now, you should view characters in your language on Nokia 770, including Opera browser, Rss feed reader, File manager, etc. I put some screenshots on flickr.

In case something is wrong, you can reflash your device with the IT OS 2006 image.

Known issues:

  1. Web page title may not be displayed correctlly.
  2. DON'T change your region settings to your locale or you will NOT be able to input anything because the virtual keyboard disappears.

ubuntu下添加新的磁盘

昨天在VMware里安装了Ubuntu 6.06,硬盘空间是默认的4GB,安装了scratchbox和maemo SDK以后,磁盘基本上快满了。

从Ubuntu的Blog里找到添加磁盘并移动文件系统的方法:

修改虚拟机的设置,添加一个新的scsi硬盘

1. 用fdisk分区
$ sudo fdisk /dev/sdb
2. 建文件系统
$ sudo mkfs /dev/sdb1 -t ext3
3. mount上新的分区
$ sudo mkdir /mnt/newusr
$ sudo mount -t ext3 /dev/sdb1 /mnt/newusr

4. 复制/usr下的文件到新的分区(不能直接用cp命令)
$ cd /usr/
$ sudo find . -depth -print0 | sudo cpio --null --sprse -pvd /mnt/newusr

5. mount新的分区
$ sudo umount /mnt/newusr
$ sudo mv /usr /old_usr
$ /old_usr/bin/sudo mkdir /usr
$ /old_usr/bin/sudo mount /dev/sdb1 /usr

6. 修改/etc/fstab,告诉ubuntu启动时mount新的分区
$ sudo vi /etc/fstab
/dev/sdb1 /usr ext3 defaults 0 1

7. 重启ubuntu,一切正常的话,就可以删除旧的/usr目录了
$ sudo rm -r /old_usr
8. 如果有问题的话,可以试试到recover模式下去恢复,不过我没遇到这种情况。Good luck!

Ref: http://ubuntu.wordpress.com/2006/01/29/move-home-to-its-own-partition/

Ubuntu 初次使用记

为了准备Nokia 770的开发环境,决定在VMware里安装Ubuntu。老婆说她的同事那里有Ubuntu 6.06 TLS的光盘,于是决定不用手头现成的5.10版了(虽然我还没使用过)。

晚饭后开始安装,6.06只有一张光盘,即是LiveCD,又是安装盘。安装过程很顺利。初次登录,感觉确实很不错,就是还不太习惯sudo的方式(用su - 太久的缘故吧)。google到了一些有用的文章,比如Nicky's blog,还有UbuntuChina。参照着这些文章,更改了apt的source,使用速度很快的cn99.com。

接下来,赶紧开始安装scratchbox,可是下载速度有些慢,熬到快1点钟就去睡了,让我的“小黑”自己玩吧。

早上起来,发现已经装好了,一切正常。 到公司以后,又更新了一下中文配置环境(还是公司的网速快)。可是下载不了Maemo SDK(Service Temporarily Unavailable),只好继续熟悉Ubutu了。浏览UbuntuChina的FAQ,看了”在我安装好后root的密码是什么?“这个问题后,决定把我使用的帐号加到sudo组里,这样就可以省去每次输口令的麻烦了。于是,想当然的输入命令

$ sudo usermod -G sudo username

这下真正的麻烦来了:sudo是不要口令了,可是执行什么命令都不行,没有任何输出。陆续发现的现象有:重启后系统管理菜单里少了一些程序,比如包管理工具;还有音量控制的applet也不能运行。

想着先恢复回去吧,可是没法sudo,什么权限也没有了。还好可以用recover模式启动,进去修改/etc/group,把我的用户从sudo组里去掉了。没急着重启,先试了试。sudo报错,说此用户不在/etc/sudoers。又修改这个文件(不能用vi,用visudo),加入一行 username ALL=(ALL) ALL。再试,终于可以了。

可以回到正常模式里,发现后来的问题还存在:菜单少了,音量applet不能运行。郁闷了一上午,没找到解决办法。吃了午饭后,想到可以再建一个用户来比较一下。这时我已经搜索到可以直接运行管理工具的办法了: gksudo user-admin 添加新的用户时,终于发现了问题所在,恍然大悟!罪魁祸首就是我执行的那个修改用户组的命令(细节啊细节),我把我的用户原来所在的其他组全部去掉了,于是相应的权限全都没了,就这么简单。恢复权限,重启就一切ok了。

总结:

  • usermod -a -G
  • 没想清后果之前不要做操作,不然。。。(系统管理的大忌)
  • 解决问题是很好的学习过程