在Ubuntu Lucid上成功安装了MeeGo SDK 1.1 beta 后,尝试按照MeeGo WiKi中的说明将其安装至Google Nexus One中。WiKi中的这篇文档中只是写了大致步骤,非常笼统,菜鸟级的我很难理解,于是自己动手吧!看了一周多的文档,下面是详细安装步骤,当MeeGo正式发布之后,如果要向Google Android手机中移植,步骤也是一样的。
- 系统要求:
仅支持以下几个平台:
l Fedora(9.0 及以上)
l Ubuntu(9.10;10.04; 10.10)
l Opensuse(10.03以上)
我是在Ubuntu 10.04下操作,其他平台类似。
2. 准备工作:
2.1 Add the Ubuntu MeeGo repositories to /etc/apt/sources.list
deb http://repo.meego.com/tools/repos/ubuntu/10.04/ /
如果是Ubuntu 10.10就将10.04改为10.10即可。其余平台类似。
2.2 安装必备的环境。
#Get python-elementtree
wget http://mirrors.kernel.org/ubuntu/pool/universe/e/elementtree/python-elementtree_1.2.6-14_all.deb
sudo dpkg -i python-elementtree_1.2.6-14_all.deb
sudo apt-get update
#install syslinux and dependencies
sudo apt-get install syslinux
sudo apt-get install mtd-utils qemu-arm-static git-core
#build latest meego-image-creator,
git clone git://gitorious.org/meego-developer-tools/image-creator.git
cd image-creator
sudo tools/mic-check-alldeps
make clean
make
sudo make install
这段代码我将其写成了脚本形式,也可以保存为Shell文件执行。内容见注释。
如果安装meego-image-creator有问题,参见
http://wiki.meego.com/Image_Creation_For_Beginners
一定要确保MIC2安装正确。否则下面的步骤无法进行。
2.3 工作原理。
Meego-image-creator是用来为移动设备创建系统镜像所使用的。其前身为Intel的moblin-image-creator,在moblin developer网页中有详细的文档说明。
http://moblin.org/projects/moblin-image-creator-2
meego-image-creator通过ks文件来配置镜像文件,对于不同的平台,只需要将ks文件更改即可。通过ks文件可以定制自己所需要的软件,安装包以及对系统的配置。
Meego-image-creator可以创建以下几种镜像,可以根据自己的需求选择一个即可。本文中创建liveusb的镜像。
-
- Live CD
- Live USB
- Loop image
- KVM image
- VMDK (Vmware)
- Nand image (for MID platforms)
- VirtualBox image (.vdi)
3. 移植步骤:
3.1 创建meego1.1_nexusone.ks文件。
以下为ks文件的全部,官方的ks文件有bug,Mitsutaka将其进行了纠正,并成功编译出适合Nexus one的镜像。
lang en_US.UTF-8
keyboard us
timezone --utc America/Los_Angeles
auth --useshadow --enablemd5
#part / --size=1600 --ondisk mmcblk0p --fstype=btrfs
part / --size=1900 --ondisk mmcblk0p --fstype=ext3
#part swap --size=256 --ondisk mmcblk0p --fstype=swap
rootpw meego
xconfig --startxonboot
desktop --autologinuser=meego --defaultdesktop=DUI --session=/usr/bin/mcompositor
user --name meego --groups audio,video --password meego
repo --name=core --baseurl=http://repo.meego.com/MeeGo/releases/1.1/core/repos/armv7l/packages/ --save --debuginfo --source --gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego01
repo --name=handset --baseurl=http://repo.meego.com/MeeGo/releases/1.1/handset/repos/armv7l/packages/ --save --debuginfo --source --gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego01
repo --name=non-oss --baseurl=http://repo.meego.com/MeeGo/releases/1.1/non-oss/repos/armv7l/packages/ --save --debuginfo --source --gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego01
repo --name=updates-core --baseurl=http://repo.meego.com/MeeGo/updates/1.1/core/repos/armv7l/packages/ --save --debuginfo --source --gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego01
repo --name=updates-handset --baseurl=http://repo.meego.com/MeeGo/updates/1.1/handset/repos/armv7l/packages/ --save --debuginfo --source --gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego01
repo --name=updates-non-oss --baseurl=http://repo.meego.com/MeeGo/updates/1.1/non-oss/repos/armv7l/packages/ --save --debuginfo --source --gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego01
%packages
@MeeGo Core
@MeeGo Base
@Minimal MeeGo X Window System
@MeeGo Compliance
@MeeGo Handset Desktop
@MeeGo Handset Applications
@MeeGo Handset Applications Branding
@X for Handsets
@MeeGo Handset Base Support
# Some development tools
openssh-server
wget
strace
bootchart
gdb
gdb-gdbserver
# Some extra tools/libs
connman-test
xorg-x11-utils-xev
# http://bugs.meego.com/show_bug.cgi?id=5651
-meegotouch-inputmethodbridges
-meegotouch-inputmethodframework
-meegotouch-inputmethodkeyboard
-meegotouch-inputmethodengine
# For nexusone
xorg-x11-drv-fbdev
mesa-dri-swrast-driver
yum
yum-utils
tar
%end
%post
set -x
# Prelink not included because of following bug
# http://bugs.meego.com/show_bug.cgi?id=5217
# make sure there aren't core files lying around
rm -f /core*
# open serial line console for embedded system
echo "s0:235:respawn:/sbin/agetty -L 115200 ttyS2 vt100" >> /etc/inittab
# work around for poor key import UI in PackageKit
rm -f /var/lib/rpm/__db*
rpm --rebuilddb
# Set up sane defaults for mthemedaemon settings
Config_Src=`gconftool-2 --get-default-source`
gconftool-2 --direct --config-source $Config_Src /
-s -t string /meegotouch/theme/target NexusOne
# By default N900 has different value than Aava for showStatusBar
sed -i 's!showStatusBar=false!showStatusBar=true!g' /etc/meegotouch/devices.conf
# Temporary fix to the meego-handset-fixup rpm package
sed -i 's!N900!NexusOne!g' /etc/gconf/gconf.xml.defaults/%gconf-tree.xml
#sed -i 's!//usr//sbin//meego-dm!//usr//bin//xinit //usr//bin//startdui!' /etc/inittab
echo "#x:5:respawn:/usr/bin/xinit /usr/bin/startdui" >>/etc/inittab
cat >>/etc/meegotouch/devices.conf <<EOF
[NexusOne]
resolutionX=480
resolutionY=800
ppiX=256
ppiY=256
showStatusBar=false
EOF
cat >/usr/bin/startdui <<EOF
#!/bin/sh
/usr/bin/mthemedaemon &
/usr/bin/sysuid -software -remote-theme &
/usr/bin/meego-im-uiserver -software -remote-theme &
/usr/bin/mdecorator -software -remote-theme &
/usr/bin/startphonesim
exec /usr/bin/duihome --desktop -software -remote-theme
EOF
chmod +x /usr/bin/startdui
cat >>/etc/rc.d/rc.sysinit <<EOF
# Power Management
echo 245000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 998400 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo ondemand >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 40000 >/sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
# Wakelock debug
echo 7 >/sys/module/wakelock/parameters/debug_mask
echo 1 >/proc/sys/kernel/panic_on_oops
echo 0 >/proc/sys/kernel/hung_task_timeout_secs
echo 4 >/proc/cpu/alignment
echo 10000000 >/proc/sys/kernel/sched_latency_ns
echo 2000000 >/proc/sys/kernel/sched_wakeup_granularity_ns
echo 1 >/proc/sys/kernel/sched_compat_yield
echo 0 >/proc/sys/kernel/sched_child_runs_first
# Write value must be consistent with the above properties.
# Note that the driver only supports 6 slots, so we have HOME_APP at the
# same memory level as services.
echo 0,1,2,7,14,15 >/sys/module/lowmemorykiller/parameters/adj
echo 1 >/proc/sys/vm/overcommit_memory
echo 4 >/proc/sys/vm/min_free_order_shift
echo 1536,2048,4096,5120,5632,6144 >/sys/module/lowmemorykiller/parameters/minfree
# Set init its forked children's oom_adj.
echo -16 >/proc/1/oom_adj
# Tweak background writeout
echo 200 >/proc/sys/vm/dirty_expire_centisecs
echo 5 >/proc/sys/vm/dirty_background_ratio
mkdir -p /mnt/sdcard /mnt/system /mnt/cache /mnt/userdata
(sleep 5; /sbin/adbd) &
EOF
mkdir -p /system/bin
ln -s /bin/bash /system/bin/sh
swprogs="
/usr/share/applications/dialer.desktop
/usr/share/applications/duicontrolpanel.desktop
/usr/share/applications/meego-handset-calendar.desktop
/usr/share/applications/meego-handset-chat.desktop
/usr/share/applications/meego-handset-people.desktop
/usr/share/applications/meego-handset-video.desktop
/usr/share/applications/meegomusic.desktop
/usr/share/applications/meegophotos.desktop
/usr/share/applications/settings.desktop
/usr/share/applications/sms.desktop
/etc/xdg/autostart/applauncherd.desktop
/etc/xdg/autostart/mdecorator.desktop
/etc/xdg/autostart/meego-im-uiserver.desktop
/etc/xdg/autostart/meegotouch-systemui.desktop
"
for prog in $swprogs; do
sed -e "s/Exec=.*$//0 -software/" -i $prog
done
sed 's!session=//usr//bin//mcompositor!session=//usr//bin//duihome -software /&!' -i /etc/sysconfig/uxlaunch
# Normal bootchart is only 30 long so we use this to get longer bootchart during startup when needed.
cat > /sbin/bootchartd-long << EOF
#!/bin/sh
exec /sbin/bootchartd -n 4000
EOF
chmod +x /sbin/bootchartd-long
# Temporary fix for BMC#8664 to get fennec startup time more reasonable.
mkdir -p /home/meego/.mozilla/
chown -R meego:meego /home/meego/.mozilla/
cat >>/etc/fstab << EOF
tmpfs /home/meego/.mozilla tmpfs size=20m 0 0
/dev/mmcblk0p1 /mnt/sdcard vfat defaults 0 0
/dev/mtdblock3 /mnt/system yaffs2 defaults 0 0
/dev/mtdblock4 /mnt/cache yaffs2 defaults 0 0
/dev/mtdblock5 /mnt/userdata yaffs2 defaults 0 0
EOF
%end
%post --nochroot
set -x
if [ -n "$IMG_NAME" ]; then
echo "BUILD: $IMG_NAME" >> $INSTALL_ROOT/etc/meego-release
fi
# Creating rootfs tar ball.
for dir in `mount | grep $INSTALL_ROOT// | awk '{ print $3 }' | sort -r`; do
umount $dir
done
outdir=`pwd`
(cd $INSTALL_ROOT; tar czvf $outdir/${IMG_NAME}-rootfs.tar.gz .)
%end
3.2 创建meego1.1_nexusone 内核镜像文件。
在meego1.1_nexusone.ks文件所在的目录下执行以下指令:
sudo mic-image-creator --run-mode=0 --cache=mycachedir --format=liveusb --arch=armv7l --save-kernel --config=meego-nexusone.ks
这时如果成功的话会产生一个meego1.1_nexusone_sda.img文件。
我到这一步失败, 终端报错:
Repo http://repo.meego.com/MeeGo/releases/1.1/handset/repos/armv7l/packages/ not found
exit
进入meego1.1_nexusone.ks文件中检查一下出错来源,发现以下代码段需要从http://repo.meego.com/MeeGo/releases/1.1/handset/repos/armv7l/packages/中下载配置文件
repo --name=updates-handset --baseurl=http://repo.meego.com/MeeGo/updates/1.1/handset/repos/armv7l/packages/ --save --debuginfo --source --gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego01
继而我在浏览器中查看是否还有此链接:发现handset子目录已经被删除;
后来发现了替代目录,http://repo.meego.com/MeeGo/releases/1.1/handset/repos/armv7l/packages/armv7l/ 将ks文件中的原来的repo目录用这个替换,是否可行我没有验证过。
非常无奈,看了好几天的各种文档说明终于搞清楚怎么装的,Nokia官方将手机版本的repo目录给删除了。就我的理解,单单将handset目录删除原因主要是MeeGo项目手机版进展缓慢,Nokia不愿在其未正式发布之前自毁声誉才不得已而为之。Netbook版本没删是因为netbook本身就比较完善。MeeGo来源于Intel的Moblin+Nokia的Maemo, 在os层主要使用Intel的moblin系统,而Intel moblin主要终端就是移动上网本,且已经开发3年有余,所以netbook版本会比较完善。我半年前在ASUS的EeePc上安装使用过MeeGo 1.0的netbook版本,界面很流畅,操作也很方便。
3.3 将meego1.1_nexusone_sda.img文件烧写至SD卡。
将SD卡插入USB接口,使用df命令查看其是哪个盘,本例中,其为sdb盘;
打开终端,输入:
sudo dd bs=4096 if=meego1.1_nexusone_sda.img of=/dev/sdb
等待约5分钟,将烧写完成。
3.4 Nexus one手机启动。
将SD卡插入Nexus one手机中,同时按住开机键和音量 - 键,选择进入fastboot模式;
在终端中输入:
fastboot -c 'init=/sbin/init rootwait root=/dev/sda rootfstype=ext3 rw' boot zImage
creating boot image...
creating boot image - 2240512 bytes
downloading 'meego1.1_nexusone_sda.img'... OKAY
booting... OKAY
至此,MeeGo向Nexus one手机中移植成功结束。
注:由于我的步骤停止在3.2节部分,因为Nokia官方将handset版本的内核文件repo目录删除了。但这一系列的步骤是可行的。如果有哪位按照此步骤成功移植了请将移植成功后的图片发送至waterfrogcdw@gmail.com 以便让我确认。