Maemo 5 Final SDK 安装指南

m (Maemo SDK没有包含的内容)
m (Reverted edits by 154.125.111.93 (Talk) to last revision by foolegg)
 
(29 intermediate revisions not shown)
Line 1: Line 1:
-
=Documentation/Maemo 5 Final SDK安装指南=
+
=介绍=
 +
[[Category:Internationalization]]
 +
[[Category:Documentation]]
 +
本文是[[Documentation/Maemo 5 Final SDK Installation]]的简体中文翻译。
-
==介绍==
+
以下文档介绍了如何安装Maemo 5 Final SDK。Maemo SDK使用Scratchbox作为交叉编译环境,你还需要安装Maemo的开发文件。
-
 
+
-
以下文档介绍了如何安装Maemo 5 Final SDK。Maemo SDK,使用安装了Maemo特有的开发文件的Scratchbox,做为交叉编译环境。
+
在开始安装以前,先来看一下最小的系统需求。官方支持基于Debian的x86-32 Linux发行版,主要是Debian和Ubuntu。但在其他Linux发行版上安装Maemo SDK也是可以做到的。
在开始安装以前,先来看一下最小的系统需求。官方支持基于Debian的x86-32 Linux发行版,主要是Debian和Ubuntu。但在其他Linux发行版上安装Maemo SDK也是可以做到的。
Line 19: Line 20:
-
===Maemo SDK没有包含的内容===
+
==Maemo SDK没有包含的内容==
-
在你的主机上执行Maemo SDK程序需要Xephye这个X11服务器。这个X11服务器提供了设备屏幕,使得开发者可以在自己的主机上看到Maemo程序窗口和界面。这个软件没有包含在Maemo SDK内,因为绝大多数Linux发行版都提供了这个软件。
+
在你的主机上执行Maemo SDK程序需要Xephye这个X11服务器。这个X11服务器提供了一个窗口,显示设备屏幕和用户界面,使得开发者可以在自己的主机上看到Maemo程序窗口和界面。这个软件没有包含在Maemo SDK内,因为绝大多数Linux发行版都提供了这个软件。
如果你在基于Debian的Linux发行版上,通过图形界面的安装程序安装Maemo SDK,将为你提供安装Xephyr的选项。
如果你在基于Debian的Linux发行版上,通过图形界面的安装程序安装Maemo SDK,将为你提供安装Xephyr的选项。
Line 33: Line 34:
在Gentoo系统上,你需要添加kdrive这个useflag,再编译xorg-server,以获得Xephye。
在Gentoo系统上,你需要添加kdrive这个useflag,再编译xorg-server,以获得Xephye。
-
==通过图形界面的安装程序安装Maemo 5 SDK==
+
=通过图形界面的安装程序安装Maemo 5 SDK=
现在,Maemo 5 SDK拥有了使用方便的图形界面安装方式。这个安装程序可以在基于Debian的发行版上安装Scratchbox和Maemo 5 SDK。同时,也可以处理这个页面提供的Nokia最终用户协议,并安装Nokia的二进制开发工具包和应用程序。
现在,Maemo 5 SDK拥有了使用方便的图形界面安装方式。这个安装程序可以在基于Debian的发行版上安装Scratchbox和Maemo 5 SDK。同时,也可以处理这个页面提供的Nokia最终用户协议,并安装Nokia的二进制开发工具包和应用程序。
Line 50: Line 51:
图形界面安装程序提供了标准安装和自定义安装两种选择。标准安装使用默认设置,而自定义安装提供了更多的选择。需要注意的是,如果存在 FREMANTLE_X86和FREMANTLE_ARMEL的编译目标,标准安装将会覆盖这两个目标,不过Scratchbox的home目录将会被保留。如果你不想覆盖这两个编译目标,请使用自定义安装。
图形界面安装程序提供了标准安装和自定义安装两种选择。标准安装使用默认设置,而自定义安装提供了更多的选择。需要注意的是,如果存在 FREMANTLE_X86和FREMANTLE_ARMEL的编译目标,标准安装将会覆盖这两个目标,不过Scratchbox的home目录将会被保留。如果你不想覆盖这两个编译目标,请使用自定义安装。
-
安装程序是一个Qt程序,需要Qt的python绑定的支持。如果你的系统没有安装这些软件包,安装程序可以安装他们。
+
安装程序是一个python Qt程序,需要pyQt的支持。如果你的系统没有安装这些软件包,安装程序可以安装他们。
如果有需要,安装程序可以使用http代理。如果你的网络连接没有正常工作,安装程序将请求你手工设置代理。
如果有需要,安装程序可以使用http代理。如果你的网络连接没有正常工作,安装程序将请求你手工设置代理。
-
安装程序在Ubuntu Karmic和Debian Lenny上经受了测试,32位和64位版本都可以正常使用。安装程序需要下载Maemo SDK,因此你需要一个可用的Internet连接。
+
安装程序在Ubuntu Karmic和Debian Lenny上经受了测试,32位和64位版本都可以正常使用。安装程序需要下载Maemo SDK,因此你需要一个可用的互联网连接。
'''开始安装'''
'''开始安装'''
如果你要在一个非Debian系统上执行安装脚本,可能会缺少一些python的设置,从而无法自动定位scratchbox的安装路径。为了解决这个问题,你需要给这个脚本打一个补丁
如果你要在一个非Debian系统上执行安装脚本,可能会缺少一些python的设置,从而无法自动定位scratchbox的安装路径。为了解决这个问题,你需要给这个脚本打一个补丁
-
 
-
另外,你也必须去除安装Xephyr的选项,然后手工安装它。
 
以下是补丁文件。
以下是补丁文件。
Line 72: Line 71:
  2351a2353
  2351a2353
  > cmd = cmd +" -s /opt/scratchbox"
  > cmd = cmd +" -s /opt/scratchbox"
 +
 +
另外,你也应该去除安装Xephyr的选项,然后手工安装它。
使用wget下载安装程序。
使用wget下载安装程序。
Line 89: Line 90:
-
'''限制:'''
+
'''注意'''
* 因为安装程序需要进行软件包安装,你应该在安装前,先退出其他的包管理程序。
* 因为安装程序需要进行软件包安装,你应该在安装前,先退出其他的包管理程序。
Line 95: Line 96:
* 另外,安装程序需要pyQt的支持,老版本的Ubuntu和Debian可能没有提供pyQt。
* 另外,安装程序需要pyQt的支持,老版本的Ubuntu和Debian可能没有提供pyQt。
* 在64位系统上,安装程序将显示需要做哪些设置,但不会自动进行配置,你需要手工配置它们。
* 在64位系统上,安装程序将显示需要做哪些设置,但不会自动进行配置,你需要手工配置它们。
-
* 安装程序会DISPLAY环境变量设置为":2",如果你想使用其他值, 请手工更改。
+
* 安装程序会将DISPLAY环境变量设置为":2",如果你想使用其他值, 请手工更改。
-
==在基于Debian的x86-32位linux发行版上安装Maemo 5 SDK==
+
=在基于Debian的x86-32 linux发行版上安装Maemo 5 SDK=
1. 下载Scratchbox和Maemo SDK的安装脚本。你也可以在Nokia开发论坛[http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/Platforms/Maemo/ (Maemo SDK at Forum Nokia)]上下载到同样的脚本。
1. 下载Scratchbox和Maemo SDK的安装脚本。你也可以在Nokia开发论坛[http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/Platforms/Maemo/ (Maemo SDK at Forum Nokia)]上下载到同样的脚本。
Line 109: Line 110:
4. 安装脚本将会在“sbox”用户组中添加指定的用户。要使改设置在当前终端进程中生效,你需要执行以下命令。
4. 安装脚本将会在“sbox”用户组中添加指定的用户。要使改设置在当前终端进程中生效,你需要执行以下命令。
-
注意:如果你已经登录进了Scratchbox环境,这个命令将改变当前的用户组ID。如果你不想改变,只要从Scratchbox环境中注销再重新登录即可。
+
* 注意:如果你已经登录进了Scratchbox环境,这个命令将改变当前的用户组ID。如果你不想改变,只要从Scratchbox环境中注销再重新登录即可。
  $ newgrp sbox
  $ newgrp sbox
-
这时,你已经获得了一个可用的Scratchbox环境。
+
5. 这时,你已经获得了一个可用的Scratchbox环境。
-
5. 继续进行Maemo SDK的安装。这个脚本需要在Scratchbox环境外,以安装时指定的用户权限运行。首先,为脚本用户添加可执行权限。
+
6. 继续进行Maemo SDK的安装。这个脚本需要在Scratchbox环境外,以安装时指定的用户权限运行。首先,为脚本用户添加可执行权限。
  $ sudo chmod +x ./maemo-sdk-install_5.0.sh
  $ sudo chmod +x ./maemo-sdk-install_5.0.sh
Line 122: Line 123:
如果你将Scratchbox安装到了/scratchbox以外的目录,你需要用“-s PATH”选项来指定你的Scratchbox目录。你可以使用“--help”选项获得更多的命令行选项信息。
如果你将Scratchbox安装到了/scratchbox以外的目录,你需要用“-s PATH”选项来指定你的Scratchbox目录。你可以使用“--help”选项获得更多的命令行选项信息。
-
6. 脚本成功执行完成后,你就可以登录Scratchbox环境了。
+
7. 脚本成功执行完成后,你就可以登录Scratchbox环境了。
  $ /scratchbox/login
  $ /scratchbox/login
-
如果你无法登录,请看一下Scratchbox的限制。
+
如果你无法登录,请看一下[[Maemo_5_Final_SDK_安装指南#Scratchbox的问题|Scratchbox的问题]]。
-
7. 你需要接受Nokia的最终用户许可协议,才能够获取Nokia提供的二进制软件包。安装这些软件包后,你将会获得Maemo SDK的完整功能。
+
8. 你需要接受Nokia的最终用户许可协议,才能够获取Nokia提供的二进制软件包。安装这些软件包后,你将会获得Maemo SDK的完整功能。
-
7.1. 通过[http://tablets-dev.nokia.com/eula/index.php 这个页面],接受最终用户许可协议。
+
8.1. 通过[http://tablets-dev.nokia.com/eula/index.php 这个页面],接受最终用户许可协议。
-
7.2. 将接受最终用户许可协议后获得的软件源地址,分别添加到x86和armel两个编译目标环境的/etc/apt/source.list文件中。然后在两个目标的环境下,执行以下命令。
+
8.2. 将接受最终用户许可协议后获得的软件源地址,分别添加到x86和armel两个编译目标环境的/etc/apt/source.list文件中。在两个目标环境下,分别执行以下命令。
  [sbox-FREMANTLE_X86: ~] > sb-conf select FREMANTLE_ARMEL
  [sbox-FREMANTLE_X86: ~] > sb-conf select FREMANTLE_ARMEL
-
  [sbox-FREMANTLE_ARMEL: ~] > nano /etc/apt/sources.list # add deb line
+
  [sbox-FREMANTLE_ARMEL: ~] > nano /etc/apt/sources.list # 添加软件源地址
  [sbox-FREMANTLE_ARMEL: ~] > apt-get update
  [sbox-FREMANTLE_ARMEL: ~] > apt-get update
  [sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install nokia-binaries nokia-apps
  [sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install nokia-binaries nokia-apps
  [sbox-FREMANTLE_ARMEL: ~] > sb-conf select FREMANTLE_X86
  [sbox-FREMANTLE_ARMEL: ~] > sb-conf select FREMANTLE_X86
-
  [sbox-FREMANTLE_X86: ~] > nano /etc/apt/sources.list # add deb line
+
  [sbox-FREMANTLE_X86: ~] > nano /etc/apt/sources.list # 添加软件源地址
  [sbox-FREMANTLE_X86: ~] > apt-get update
  [sbox-FREMANTLE_X86: ~] > apt-get update
  [sbox-FREMANTLE_X86: ~] > fakeroot apt-get install nokia-binaries nokia-apps
  [sbox-FREMANTLE_X86: ~] > fakeroot apt-get install nokia-binaries nokia-apps
Line 145: Line 146:
以上步骤将安装Nokia的二进制文件包,一些开源工具包依赖它们。这样,你就完成了Maemo 5 SDK开发环境的配置,可以动手进行开发了。
以上步骤将安装Nokia的二进制文件包,一些开源工具包依赖它们。这样,你就完成了Maemo 5 SDK开发环境的配置,可以动手进行开发了。
-
==在openSUSE上安装Maemo 5 SDK==
+
=在openSUSE上安装Maemo 5 SDK=
这是来自[http://en.opensuse.org/Maemo5 opensuse.org]的安装指南。
这是来自[http://en.opensuse.org/Maemo5 opensuse.org]的安装指南。
-
==启动/停止SDK图形界面==
+
=启动/终止SDK图形用户界面=
-
在启动图形界面前,请先确认你已正确安装了以下内容:
+
在启动用户界面前,请先确认你已正确安装了以下内容:
* Scratchbox环境外,宿主系统上的Xephyr X11服务器
* Scratchbox环境外,宿主系统上的Xephyr X11服务器
Line 170: Line 171:
  [sbox-FREMANTLE_X86: ~] >export DISPLAY=:2
  [sbox-FREMANTLE_X86: ~] >export DISPLAY=:2
-
4. 启动图形界面
+
4. 启动用户界面。
  [sbox-FREMANTLE_X86: ~] >af-sb-init.sh start
  [sbox-FREMANTLE_X86: ~] >af-sb-init.sh start
5. 图形界面将出现在Xephyr窗口中。
5. 图形界面将出现在Xephyr窗口中。
-
6. 你可以用如下命令停止图形界面:
+
6. 你可以用如下命令终止用户界面:
  [sbox-FREMANTLE_X86: ~] >af-sb-init.sh stop
  [sbox-FREMANTLE_X86: ~] >af-sb-init.sh stop
-
==施工中==
+
=在基于Debian的x86-32 linux发行版上安装Maemo 5 SDK=
-
[edit] Installation of x86-64 Debian based distributions
+
-
Since Scratchbox only supports x86-32 bit Linux host systems, we need to force the installation of x86-32 Scratchbox packages on the x86-64 bit machines. Using the -F option with the Scratchbox installation script can do this.
+
由于Scratchbox只支持x86-32架构的linux宿主系统,因此,在x86-64系统中,我们需要强制安装x86-32的Scratchbox软件包。在执行Scratchbox的安装脚本时,添加“-F”选项即可。
-
[edit] Installation procedure
+
-
    * Download the Scratchbox installer and the Maemo SDK installer scripts.
+
安装流程
-
$ wget -c http://repository.maemo.org/stable/5.0/maemo-scratchbox-install_5.0.sh http://repository.maemo.org/stable/5.0/maemo-sdk-install_5.0.sh
+
* 下载Scratchbox和Maemo 5 SDK的安装脚本。
 +
$ wget -c http://repository.maemo.org/stable/5.0/maemo-scratchbox-install_5.0.sh http://repository.maemo.org/stable/5.0/maemo-sdk-install_5.0.sh
-
    * Set permissions to execute the scripts.
+
* 为脚本添加可执行权限
-
$ chmod a+x ./maemo-scratchbox-install_5.0.sh ./maemo-sdk-install_5.0.sh
+
$ chmod a+x ./maemo-scratchbox-install_5.0.sh ./maemo-sdk-install_5.0.sh
-
    * Run the Scratchbox installer script as 'root user' with -F option, specifying the username to be added to Scratchbox users group sbox group as follows:
+
* 以root权限运行Scratchbox安装脚本,并添加“-F”选项,同时指定需要添加到Scratchbox用户组的用户。该用户必须是宿主Linux系统中有效的用户。
-
$ sudo ./maemo-scratchbox-install_5.0.sh -F -u $USER
+
$ sudo ./maemo-scratchbox-install_5.0.sh -F -u $USER
 +
在成功安装Scratchbox后,请参照x86-32系统的安装指南,继续安装Maemo 5 Final SDK。
-
Upon successful installation of Scratchbox, continue to run the Maemo 5 Final SDK Installer as instructed in the x86-32 installation.
+
=在非Debian系统中启动Scratchbox=
-
==施工中==
+
如果通过Debian的deb包安装了Scratchbox,Scratchbox的启动脚本/etc/init.d/scratchbox-core将被正确安装,Scratchbox也会在系统重启时自动启动。
-
[edit] Starting Scratchbox on non-Debian based systems
+
-
If Scratchbox was installed from Debian packages, the /etc/init.d/scratchbox-core init script is installed and Scratchbox should start automatically when the system is rebooted. However, if you have installed Scratchbox from tarballs, then rebooting your machine will clear away all the mounts and binfmt_misc registrations that Scratchbox requires to work. To get your Scratchbox working again after reboot, you have to run the following command as root:
+
如果你通过tarballs的方式安装了Scratchbox,那么当系统重启后,Scratchbox需要的挂载配置和binfmt_misc都将被清除。
-
$ sudo /scratchbox/sbin/sbox_ctl start
+
-
Alternatively you can add sbox_ctl as an init script to the /etc/init.d directory and create the appropriate links at your system's runlevel directories. This procedure works on some systems:
+
要使Scratchbox在重启后继续工作,你需要以root权限执行以下命令:
-
$ ln -s /scratchbox/sbin/sbox_ctl /etc/init.d/scratchbox-core
+
-
$ /usr/sbin/update-rc.d scratchbox-core defaults
+
 +
$ sudo /scratchbox/sbin/sbox_ctl start
-
Refer to your system's documentation for the correct instructions.
+
此外,你也可以将sbox_ctl作为一个系统脚本,添加到/etc/init.d目录下,并在对应的运行等级目录中创建链接。在大多数系统中,方法如下:
 +
$ ln -s /scratchbox/sbin/sbox_ctl /etc/init.d/scratchbox-core
 +
$ /usr/sbin/update-rc.d scratchbox-core defaults
-
[edit] Upgrading from Maemo 5 Beta2 SDK
+
请查阅你的系统文档,以了解相应的方法。
-
A smooth upgrade from beta2 to Final SDK is unfortunately not possible. Hence it is advised to freshly install the Final SDK. Before you do so, read through the instructions below.
+
=自Maemo 5 Beta 2 SDK升级=
-
Some of the Nokia applications shipped with the final SDK use a hard coded path for user home directory which presents a problem since the default username on the device differs from the username on the developer’s machine. To make these applications work, it is required to create a home directory that matches the hard coded value. This needs to be done outside scratchbox using root privileges. The -u option in the Scratchbox installer has been updated to create the necessary symlinks. Running the installer with -u option when the Scratchbox has been already installed will just add the user and create symlinks. Running it for already existing user will check for the symlink and create it if needed.
+
不幸的是,从Beta 2平滑地升级到Final SDK是不可能的。因此我们建议你重新安装Final SDK。在你操作以前,请先看一下下列指引。
-
Run the command below to create the symlink for existing Scratchbox user:
+
一些随Final SDK附带的Nokia应用程序使用了固定的路径,来指定用户的home目录。为了使这些程序能够正常工作,你需要创建一个目录,路径与Nokia指定的路径相同。
-
$ sudo ./maemo-scratchbox-install_5.0.sh -u <EXISTING_USER>
+
 +
这需要在Scratchbox环境外,以root权限操作。
-
Alternatively, you can create the symlinks manually as follows, if Scratchbox is installed in the default location:
+
Scratchbox安装脚本的“-u”选项将更新环境并创建必要的链接。
-
$ sudo ln -s /scratchbox/users/<username>/home/<username> /scratchbox/users/<username>/home/user
+
 +
执行以下命令,为已有的Scratchbox用户创建必要的链接。
-
The Final SDK installer additionally creates a directory /opt under /target/<target_name>/. Reason: In order to facilitate installing applications under /opt on the device, a symlink /opt has been created pointing to /home/opt. The SDK inherits this feature. Under Scratchbox, /opt points to /target/links/opt which in turn points to /targets/<target_name>/opt. Installing the rootstraps makes this point to /home/opt, which is not what we want, since we need /opt to be target specific. In order to resolve this situation, we have to manually check whether /targets/<target_name>/opt is a symlink and if it is, remove it and create a directory with the same name.
+
$ sudo ./maemo-scratchbox-install_5.0.sh -u <EXISTING_USER>  
-
[edit] Upgrading from Maemo 4.x/Diablo SDK
+
-
Due to the fact that there are API breaks in Fremantle, we cannot upgrade Diablo SDK to Fremantle. We can however have Fremantle Scratchbox targets co-exist with Diablo targets.
+
此外,你也可以手动创建链接。如果Scratchbox被安装在了默认路径下,那么命令如下:
-
For this, we need to first upgrade the Scratchbox installation on our host machine.
+
$ sudo ln -s /scratchbox/users/<username>/home/<username> /scratchbox/users/<username>/home/user
-
    * Download the Maemo5 scratchbox installer.
+
Final SDK的安装脚本也在/target/<target_name>/目录下添加了/opt目录。
-
    * Set executable permissions and run it as follows:
+
为了便于在/opt路径下安装应用程序,一些linux系统会创建一个指向/home/opt的链接作为/opt目录。SDK也继承了这一特性。
-
$ chmod a+x ./maemo-scratchbox-install_5.0.sh
+
在Scratchbox环境下,/opt目录的路径是/target/<target_name>/opt。
-
$ sudo ./maemo-scratchbox-install_5.0.sh -U -u <EXISTING_USER> -s /scratchbox
+
-
Once the Scratchbox installation is done, run the Maemo 5 Final SDK installer.
+
安装基本系统包rootstraps后,所有编译目标环境的/target/<target_name>/opt都将被指向/home/opt。而/opt应该为每个编译目标环境分别指定。
-
[edit] Manual Installation
+
-
On x86-32 Debian based systems:
+
为了解决这个问题,我们需要手工检查/target/<target_name>/opt是否被链接了,如果是,那么删除这个链接,并且重新创建相应的目录。
-
    * You can add the following line into your host machine's /etc/apt/sources.list file.
+
=自Maemo 4.x/Diablo SDK升级=
-
deb http://scratchbox.org/debian/ maemo5-sdk main
+
事实上,由于API的变动,我们无法从Diablo升级到Fremantle。不过我们可以利用Diablo的Scratchbox环境,帮助配置Fremantle的Scratchbox环境。
 +
所以,我们可以升级Scratchbox。
-
    * Install the needed Scratchbox packages with root permission
+
* 下载Maemo 5的Scratchbox安装脚本
-
$ sudo apt-get update
+
$ chmod a+x ./maemo-scratchbox-install_5.0.sh
-
$ sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-qemu scratchbox-devkit-debian scratchbox-devkit-doctools scratchbox-devkit-perl scratchbox-toolchain-host-gcc scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486 scratchbox-devkit-svn scratchbox-devkit-git scratchbox-devkit-apt-https
+
 +
* 为脚本添加可执行权限,然后这样执行:
-
On x86-64 Debian based systems:
+
$ sudo ./maemo-scratchbox-install_5.0.sh -U -u <EXISTING_USER> -s /scratchbox
-
    * Download the Scratchbox packages from here.
+
当脚本执行成功后,继续进行Maemo 5 Final SDK的安装。
-
    * Force the installation of the x86-32 packages with root permission as follows:
+
=手工安装=
-
$ sudo dpkg -i --force-architecture scratchbox-core scratchbox-libs scratchbox-devkit-qemu scratchbox-devkit-debian scratchbox-devkit-doctools scratchbox-devkit-perl scratchbox-toolchain-host-gcc scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486 scratchbox-devkit-svn scratchbox-devkit-git scratchbox-devkit-apt-https
+
* 在基于Debian的x86-32系统上:
 +
** 你可以在你宿主机的/etc/apt/sources.list文件中,添加以下内容:
 +
deb http://scratchbox.org/debian/ maemo5-sdk main
 +
:* 然后以root权限,安装Scratchbox软件包。
 +
$ sudo apt-get update
 +
$ sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-qemu scratchbox-devkit-debian scratchbox-devkit-doctools scratchbox-devkit-perl scratchbox-toolchain-host-gcc scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486 scratchbox-devkit-svn scratchbox-devkit-git scratchbox-devkit-apt-https
-
The Scratchbox packages will be unpacked to /scratchbox directory and the installation procedure will ask you some questions about the group and user accounts. Default group to Scratchbox is 'sbox'.
+
* 在基于Debian的x86-64系统上:
 +
** 从[http://scratchbox.org/download/files/sbox-releases/branches/apophis/r4/deb/ 这里]下载Scratchbox软件包。
 +
:* 以root权限,强制安装这些x86-32软件包。
-
    * Users who will be using Scratchbox should be added using the following command with root permission:
+
$ sudo dpkg -i --force-architecture scratchbox-core scratchbox-libs scratchbox-devkit-qemu scratchbox-devkit-debian scratchbox-devkit-doctools scratchbox-devkit-perl scratchbox-toolchain-host-gcc scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486 scratchbox-devkit-svn scratchbox-devkit-git scratchbox-devkit-apt-https
-
$ sudo /scratchbox/sbin/sbox_adduser USER yes
+
* Scratchbox软件包将被解包安装到/scratchbox目录下。在安装过程中,会请求你回答一些关于用户组和用户的问题。默认的Scratchbox用户组是“sbox”。
 +
* 使用Scratchbox的用户需要被添加到Scratchbox用户组中,以root权限执行下列命令以添加用户:
-
It will automatically include the user to the Scratchbox group, create user directories under /scratchbox/users and mount several directories (/dev, /proc, /tmp) under the user directory.
+
$ sudo /scratchbox/sbin/sbox_adduser USER yes
-
    * Some of the Nokia applications shipped with the final SDK use a hard coded path for user home directory which presents a problem since the default username on the device differs from the username on the developer’s machine. To make these applications work, it is required to create a home directory that matches the hard coded value. This needs to be done outside scratchbox using root privileges.
+
:* 这将在Scratchbox用户组中添加用户,创建用户目录/scratchbox/<user_name>,并在用户目录下挂载系统目录(/dev,/proc,/tmp)。
-
$ sudo ln -s /scratchbox/users/<username>/home/<username> /scratchbox/users/<username>/home/user
 
 +
* 一些随Final SDK附带的Nokia应用程序使用了固定的路径,来指定用户的home目录。为了使这些程序能够正常工作,你需要创建一个目录,路径与Nokia指定的路径相同。这需要在Scratchbox环境外,以root权限操作。
-
    * For the group membership to be effective in the current terminal session, run the following command:
+
$ sudo ln -s /scratchbox/users/<username>/home/<username> /scratchbox/users/<username>/home/user
-
$ newgrp sbox
+
* 要使用户组设置在当前终端环境下生效,需要执行以下命令:
 +
** 注意:如果你已经登录进了Scratchbox环境,这个命令将改变当前的用户组ID。如果你不想改变,只要从Scratchbox环境中注销再重新登录即可。
-
Note: This command will change the existing group ID during the current login session to 'sbox'. If you do not want to change, simply logout and log back in for the group membership to be effective.
+
$ newgrp sbox
 +
* 登录Scratchbox环境。
-
    * Log-in to Scratchbox.
+
$ /scratchbox/login
-
$ /scratchbox/login
+
* 配置x86和armel编译目标:
 +
[sbox->:~]>sb-conf st FREMANTLE_X86 -c cs2007q3-glibc2.5-i486 -d perl:debian-etch:doctools:svn:git -t none
 +
[sbox->:~]>sb-conf st FREMANTLE_ARMEL -c cs2007q3-glibc2.5-arm7 -d qemu:perl:debian-etch:doctools:svn:git -t qemu-arm-sb
-
    * Configure the scratchbox x86 and armel targets as follows:
+
* 下载基本系统包rootstraps。
-
[sbox->:~]>sb-conf st FREMANTLE_X86 -c cs2007q3-glibc2.5-i486 -d perl:debian-etch:doctools:svn:git -t none
+
[sbox->:~]> wget http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz
-
[sbox->:~]>sb-conf st FREMANTLE_ARMEL -c cs2007q3-glibc2.5-arm7 -d qemu:perl:debian-etch:doctools:svn:git -t qemu-arm-sb
+
 +
* 切换到x86目标环境,解开x86的rootstraps,安装devkits,fakeroot,以及其他工具到目标环境。
-
    * Download the minimal rootstraps.  
+
[sbox->:~]> sb-conf se FREMANTLE_X86
 +
[sbox-FREMANTLE_X86: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_i386.tgz
-
[sbox->:~]> wget http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz
+
* 如果apt的apt http pipeline被配置为开启,一些用户可能会在使用apt下载文件时遇到问题。你可以用以下命令关闭这个设置:
 +
[sbox-FREMANTLE_X86: ~] > echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00maemo
-
    * Switch to x86 target, install the devkits, etc and fakeroot into the target, install the minimal rootstrap and finally the Maemo development files.
+
* 继续安装:
-
[sbox->:~]> sb-conf se FREMANTLE_X86
+
[sbox-FREMANTLE_X86: ~] > sb-conf in -edFL
-
[sbox-FREMANTLE_X86: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_i386.tgz
+
[sbox-FREMANTLE_X86: ~] > apt-get update
 +
[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install maemo-sdk-debug
-
    * Some users seem to have problems downloading all files with apt http pipelining enabled. If you want to make sure or you get download errors like "104 connection reset by peer" at the fakeroot steps below, then disable http pipelining with the next command:  
+
:* 虚拟包“maemo-sdk-debug”将为目标环境安装所有需要的开源运行库,开发文件和调试文件。如果你只需要运行库,你可以安装“maemo-sdk-runtime”包。如果你只需要运行库和开发文件,那么你应该安装“maemo-sdk-dev”包。
-
[sbox-FREMANTLE_X86: ~] > echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00maemo
+
* 通过[http://tablets-dev.nokia.com/eula/index.php 这个页面],接受Nokia的最终用户许可协议。
-
    * either way, continue here:
+
* 将接受最终用户许可协议后获得的软件源地址,添加到目标环境的/etc/apt/source.list文件中。然后执行以下命令。
-
[sbox-FREMANTLE_X86: ~] > sb-conf in -edFL
+
[sbox-FREMANTLE_X86: ~] >apt-get update
-
[sbox-FREMANTLE_X86: ~] > apt-get update
+
[sbox-FREMANTLE_X86: ~] >fakeroot apt-get install nokia-binaries nokia-apps
-
[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install maemo-sdk-debug
+
-
The meta-package 'maemo-sdk-debug' installs all needed open source runtime, development and debug pakcages into the target. Use maemo-sdk-runtime if you want only runtime packages to be installed or user maemo-sdk-dev if you want only the runtime + development packages to be installed.
+
:*为了便于在/opt路径下安装应用程序,一些linux系统会创建一个指向/home/opt的链接作为/opt目录。SDK也继承了这一特性。
 +
:*在Scratchbox环境下,/opt目录的路径是/target/<target_name>/opt。安装基本系统包rootstraps后,所有编译目标环境的/target/<target_name>/opt都将被指向/home/opt。而/opt应该为每个编译目标环境分别指定。
 +
:*为了解决这个问题,我们需要手工检查/target/<target_name>/opt是否被链接了,如果是,那么删除这个链接,并且重新创建相应的目录。
-
    * Accept the EULA from here to obtain the URL to access the Nokia binaries repository.
+
[sbox-FREMANTLE_X86: ~] >rm /targets/FREMANTLE_X86/opt
 +
[sbox-FREMANTLE_X86: ~] >mkdir /targets/FREMANTLE_X86/opt
-
    * Add the URL thus obtained to the Scratchbox target's /etc/apt/sources.list and do the following:
+
* 在armel目标环境下,进行类似的操作:
-
[sbox-FREMANTLE_X86: ~] >apt-get update
+
[sbox-FREMANTLE_X86: ~]> sb-conf se FREMANTLE_ARMEL
-
[sbox-FREMANTLE_X86: ~] >fakeroot apt-get install nokia-binaries nokia-apps
+
[sbox-FREMANTLE_ARMEL: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_armel.tgz
 +
* 如果你需要,下面的命令禁用apt http pipelining:
-
    * In order to facilitate installing applications under /opt on the device, a symlink /opt has been created pointing to /home/opt. The SDK inherits this feature. Under Scratchbox, /opt points to /target/links/opt which in turn points to /targets/<target_name>/opt. Installing the rootstraps makes this point to /home/opt, which is not what we want, since we need /opt to be target specific. In order to resolve this situation,
+
[sbox-FREMANTLE_X86: ~] > echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00maemo
-
[sbox-FREMANTLE_X86: ~] >rm /targets/FREMANTLE_X86/opt
+
* 继续……
-
[sbox-FREMANTLE_X86: ~] >mkdir /targets/FREMANTLE_X86/opt
+
 +
[sbox-FREMANTLE_ARMEL: ~] > sb-conf in -edFL
 +
[sbox-FREMANTLE_ARMEL: ~] > apt-get update
 +
[sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install maemo-sdk-debug
-
    * Execute similar steps on the armel target too to set it up:
+
* 将同样的Nokia软件源地址,添加到目标环境的/etc/apt/source.list文件中。然后执行以下命令。
-
[sbox-FREMANTLE_X86: ~]> sb-conf se FREMANTLE_ARMEL
+
[sbox-FREMANTLE_ARMEL: ~] >apt-get update
-
[sbox-FREMANTLE_ARMEL: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_armel.tgz
+
[sbox-FREMANTLE_ARMEL: ~] >fakeroot apt-get install nokia-binaries nokia-apps
-
    * again,the next command disables http pipelining, if you like:
+
* 创建/opt目录。
-
[sbox-FREMANTLE_X86: ~] > echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00maemo
+
[sbox-FREMANTLE_ARMEL: ~] >rm /targets/FREMANTLE_ARMEL/opt
 +
[sbox-FREMANTLE_ARMEL: ~] >mkdir /targets/FREMANTLE_ARMEL/opt
-
    * pipelining disabled or not, here we go again...
 
-
[sbox-FREMANTLE_ARMEL: ~] > sb-conf in -edFL
+
好了,你现在获得了一个可用的Maemo 5开发环境。
-
[sbox-FREMANTLE_ARMEL: ~] > apt-get update
+
-
[sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install maemo-sdk-debug
+
 +
下面可以[[#启动/终止SDK图形用户界面|启动用户界面]]了
-
    * Add the same URL obtained above to access the Nokia binaries repository under /etc/apt/sources.list file of the Scratchbox armel target.
+
=卸载=
-
[sbox-FREMANTLE_ARMEL: ~] >apt-get update
+
首先,确认没有任何进程运行在Scratchbox环境中。
-
[sbox-FREMANTLE_ARMEL: ~] >fakeroot apt-get install nokia-binaries nokia-apps
+
请先备份你需要的文件和目录。卸载Scratchbox会删除所有Scratchbox环境中的所有东西。
 +
在基于Debian的系统中,以root权限执行以下命令:
-
    * Create the /opt directory.
+
$ sudo apt-get remove scratchbox-* --purge
 +
$ sudo rm -rf /scratchbox
-
[sbox-FREMANTLE_ARMEL: ~] >rm /targets/FREMANTLE_ARMEL/opt
+
在非Debian的系统中,你需要手工停止Scratchbox进程,然后删除它:
-
[sbox-FREMANTLE_ARMEL: ~] >mkdir /targets/FREMANTLE_ARMEL/opt
+
 +
$ sudo /scratchbox/sbin/sbox_ctl stop
 +
$ sudo rm -rf /scratchbox
-
With this, you must now have both the targets setup and ready to use.
+
=Scratchbox的问题=
-
Start the UI framework.
+
你需要注意以下这些Scratchbox的问题:
-
[edit] Un-installation
+
-
Make sure that you have no process running inside Scratchbox. Uninstalling Scratchbox will remove everything that is installed and saved inside Scratchbox. Please take a backup of your files from Scratchbox user home directory if needed.
+
==VDSO支持==
-
On Debian based systems, do the following with root permissions:
+
当宿主机内核开启了VDSO后,Scratchbox无法正常工作。我们正在努力解决这个问题。
-
$ sudo apt-get remove scratchbox-* --purge
+
-
$ sudo rm -rf /scratchbox
+
 +
如果你的宿主机开启了VDSO32,在登录Scratchbox时会出现这样的错误:
-
On non-Debian based systems, you need to stop scratchbox as follows before removing it.
+
No directory, logging in with HOME=/
-
$ sudo /scratchbox/sbin/sbox_ctl stop
+
Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion `(void *)
-
$ sudo rm -rf /scratchbox
+
ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!
-
[edit] Limitations of Scratchbox
+
==x86-64内核==
-
 
+
-
The following limitations have been noted in the usage of Scratchbox:
+
-
[edit] VDSO support
+
-
 
+
-
Scratchbox does not work when VDSO32 support is enabled in the host's kernel. We're working on making it possible, but at the moment there are some workarounds, which are presented here.
+
-
 
+
-
If your host has VDSO32 turned on you will get an error like this when trying to login to Scratchbox.
+
-
No directory, logging in with HOME=/
+
-
Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion `(void *)
+
-
ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!
+
 +
在2.6.25版本以后的x86-64内核中,默认启用了VDSO32。执行以下命令可以暂时禁用该特性:
-
[edit] x86-64 kernel
+
sysctl abi.vsyscall32=0
-
x86-64 Linux kernels starting from version 2.6.25 enable VDSO32 by default. To temporarily disable VDSO32 execute
+
如果你的内核版本低于2.6.24,你可以执行:
-
sysctl abi.vsyscall32=0
+
sysctl vm.vdso_enabled=0
 +
或者
 +
sysctl kernel.vdso=0
-
On Linux kernel 2.6.24 <= you can disable VDSO32 by executing
+
sysctl可以配置VDSO32,只有0或2的取值与Scratchbox兼容。在我们的例子中使用0(禁用)。2将启用compat模式。
-
sysctl vm.vdso_enabled=0
+
-
or
+
你也可以将以下内容添加到/etc/sysctl.conf文件中
-
sysctl kernel.vdso=0
+
-
The current setting of VDSO32 can be verified by using sysctl. Only values 0 and 2 are compatible with Scratchbox. In our examples we use 0 (disable). 2 enables compat mode.
+
vm.vdso_enabled = 0
 +
abi.vsyscall32 = 0
 +
kernel.vdso = 0
-
You can set all of these permanently by adding the following lines to /etc/sysctl.conf
+
保存并执行:
-
vm.vdso_enabled = 0
+
-
abi.vsyscall32 = 0
+
-
kernel.vdso = 0
+
-
Save the file and run the command:
+
$ sudo sysctl -p
-
$ sudo sysctl -p
+
-
Please note the correct line depends on your Linux kernel version. When you execute sysctl -p you may get a warning about unknown keys. You can safely ignore those warnings as long as one of the 3 settings works.
+
需要注意的是,这三行配置中,具体哪一行正确取决与你的Linux内核版本。当你执行“sysctl -p”时可能会出现“unknown keys”的警告。你可以忽略这些警告,三行配置中只有正确的那个会被启用。
-
WARNING : You should try setting these values by echoing them to the given locations before adding them to sysctl.conf to see if they cause any problems. For example, in some Ubuntu Gutsy installations, it has been observed that changing the VDSO settings will hang the system and thus making permanent changes in sysctl.conf may, in these cases, make your system unbootable.
+
'''警告''':在把这些内容添加到sysctl.conf前,你应该尝试用echo配置他们,看看是否会引起一些特殊的问题。例如,在Ubuntu Gutsy中,曾经出现过VDSO的错误设置损害了系统,导致系统无法启动的情况。
 +
'''WARNING''' : You should try setting these values by echoing them to the given locations before adding them to sysctl.conf to see if they cause any problems. For example, in some Ubuntu Gutsy installations, it has been observed that changing the VDSO settings will hang the system and thus making permanent changes in sysctl.conf may, in these cases, make your system unbootable.
-
[edit] Known Issues in the SDK
+
(''译者:该警告我没有把握正确翻译,故而保留原文。'')
-
    * A list of issues and their solutions is http://wiki.maemo.org/Q%26A_-_SDK_and_Scratchbox
+
=已知问题=
-
    * Unnecessary warnings and debugging messages are printed out when the hildon application framework is started.
+
* 你可以在[[:Developer FAQ#Maemo SDK and Scratchbox|这里]]找到一份已知问题和解决办法的列表
-
    * Armel target does not bring up the UI framework
+
* 当用户界面启动时,会在终端显示一些不必要的警告和调试信息。
-
    * It has been noted that Xephyr dies with the application framework at times. The crash in question might even be Xephyr related since the application framework behaves differently with different versions/builds of Xephyr. The case seems to be worst on Xephyr that comes with Ubuntu Jaunty, there Xephyr will die when running any application that contains an input field and clicking on that field with a mouse to invoke the input method. On Fedora Code 10 the Xephyr does not mind the mouse clicks but dies when shutting down the application framework. On the other hand Xephyr on Ubuntu Intrepid or even the Intrepid version recompiled for Jaunty does not experience crashing in these situations.
+
* armel目标环境没有图形用户界面。
-
A patch is already available for the Xephyr on Ubuntu Jaunty and can be found at http://bugs.freedesktop.org/show_bug.cgi?id=21591. Binaries packages for xserver-xephyr package and its dependencies (libgpg-error0 and libcrypt11) can be download from Ubuntu Jaunty repositories.
+
* 当用户界面运行时,Xephye有可能僵死。这可能是Xephyr不同版本间的行为差异导致的界面问题。最糟糕的案例出现在Ubuntu Jaunty附带的Xephyr中。当用户界面中运行有输入区域的程序,并用鼠标点击切换输入法时,Xephyr都会僵死。在Fedora Core 10中,Xephyr会忽略鼠标的点击,但会在用户界面的程序退出时僵死。在其他Xephyr,例如Ubuntu Intrepid中的Xephyr,或是为Jaunty重编译的Intrepid版本Xephyr并没有出现这些冲突。
 +
**现在,已经有了一个为Ubuntu Jaunty的Xephyr提供的补丁,你可以在[http://bugs.freedesktop.org/show_bug.cgi?id=21591 这里]找到它。你也可以从Ubuntu Jaunty的launchpad源找到编译好的[http://launchpadlibrarian.net/30330126/xserver-xephyr_1.6.3-1ubuntu2_i386.deb 二进制包]以及它的依赖包([http://launchpadlibrarian.net/27533744/libgpg-error0_1.6-1ubuntu1_i386.deb libgpg-error0]和[http://launchpadlibrarian.net/28623981/libgcrypt11_1.4.4-2ubuntu2_i386.deb libcrypt11])
-
    * The performance of clutter can be improved by enabling hardware acceleration if not enabled already. In some cases, it would require installing restricted/proprietary drivers (Eg: on host machines with ATI or NVidia graphics card). Refer to Maemo5 clutter performance for more details.
+
* clutter的性能可以通过硬件加速获得提升。有些时候,这意味着你需要安装一些受限的驱动(例如宿主机上的ATI和NVidia图形加速卡)。请参阅[[Maemo5 clutter performance]]以获得更多细节。
-
    * Running Xephyr with -kb option disables entry of “@” symbol. However, removing -kb option disables cursor keys.
+
* 以“-kb”选项启动Xephyr将会禁止键盘输入“@”标志。但去除“-kb”则会禁用方向键。
-
    * Colours invert sometimes in some applications. (Browser and Photo's for example)
+
* 在某些程序(例如浏览器和照片)中,颜色有时会反转。

Latest revision as of 18:43, 20 February 2021

Contents

[edit] 介绍

本文是Documentation/Maemo 5 Final SDK Installation的简体中文翻译。

以下文档介绍了如何安装Maemo 5 Final SDK。Maemo SDK使用Scratchbox作为交叉编译环境,你还需要安装Maemo的开发文件。

在开始安装以前,先来看一下最小的系统需求。官方支持基于Debian的x86-32 Linux发行版,主要是Debian和Ubuntu。但在其他Linux发行版上安装Maemo SDK也是可以做到的。

当你确定你的开发设备符合这些要求后,你可以按照以下指南操作。

Maemo 5 SDK配备了两个命令行安装脚本,以及一个附带图形界面的安装程序(仍是beta版本),以简化SDK的安装。

  • Scratchbox安装脚本将在你的机器上自动下载、安装指定版本的Scratchbox。
  • Maemo SDK安装脚本将在Scratchbox里设置两个编译目标(armel和x86),为这两个目标下载最基本的开发文件包rootstraps,并安装用户指定的开源开发工具。
  • 图形界面的安装程序会同时安装Scratchbox和Maemo SDK。


Maemo 5 SDK通过一个需要认证的软件源,提供了开发者所需要的Nokia二进制开发文件包,以及附带的Nokia应用程序。为了获取这些文件,你需要接受 Nokia的最终用户许可协议。为了获得Maemo SDK的完整功能,你需要这些开源工具包以外的Nokia二进制文件包。


[edit] Maemo SDK没有包含的内容

在你的主机上执行Maemo SDK程序需要Xephye这个X11服务器。这个X11服务器提供了一个窗口,显示设备屏幕和用户界面,使得开发者可以在自己的主机上看到Maemo程序窗口和界面。这个软件没有包含在Maemo SDK内,因为绝大多数Linux发行版都提供了这个软件。

如果你在基于Debian的Linux发行版上,通过图形界面的安装程序安装Maemo SDK,将为你提供安装Xephyr的选项。

如果不是,你可以采用以下的方式,手工安装Xephyr。

在基于Debian的Linux系统上,可以在Scratchbox环境外,以root权限,使用apt-get安装Xephyr。

$ sudo apt-get install xserver-xephyr

在Gentoo系统上,你需要添加kdrive这个useflag,再编译xorg-server,以获得Xephye。

[edit] 通过图形界面的安装程序安装Maemo 5 SDK

现在,Maemo 5 SDK拥有了使用方便的图形界面安装方式。这个安装程序可以在基于Debian的发行版上安装Scratchbox和Maemo 5 SDK。同时,也可以处理这个页面提供的Nokia最终用户协议,并安装Nokia的二进制开发工具包和应用程序。

图形界面安装程序拥有以下功能。

  • 安装/升级Scratchbox
  • 安装Maemo 5 SDK
  • 安装Nokia的二进制文件包
  • 安装Nokia应用程序
  • 安装Xephye
  • 在桌面上创建Xephye启动器
  • 在桌面上创建Scrachbox Home目录的快捷方式
  • 在桌面上创建对开发者有用的Maemo 5信息页

图形界面安装程序提供了标准安装和自定义安装两种选择。标准安装使用默认设置,而自定义安装提供了更多的选择。需要注意的是,如果存在 FREMANTLE_X86和FREMANTLE_ARMEL的编译目标,标准安装将会覆盖这两个目标,不过Scratchbox的home目录将会被保留。如果你不想覆盖这两个编译目标,请使用自定义安装。

安装程序是一个python Qt程序,需要pyQt的支持。如果你的系统没有安装这些软件包,安装程序可以安装他们。

如果有需要,安装程序可以使用http代理。如果你的网络连接没有正常工作,安装程序将请求你手工设置代理。

安装程序在Ubuntu Karmic和Debian Lenny上经受了测试,32位和64位版本都可以正常使用。安装程序需要下载Maemo SDK,因此你需要一个可用的互联网连接。

开始安装

如果你要在一个非Debian系统上执行安装脚本,可能会缺少一些python的设置,从而无法自动定位scratchbox的安装路径。为了解决这个问题,你需要给这个脚本打一个补丁

以下是补丁文件。

129c129
< SB_PATH = "/scratchbox"
---
> SB_PATH = "/opt/scratchbox"
2297a2298
> opt = opt + "-s /opt/scratchbox"
2351a2353
> cmd = cmd +" -s /opt/scratchbox"

另外,你也应该去除安装Xephyr的选项,然后手工安装它。

使用wget下载安装程序。

$ wget http://repository.maemo.org/stable/5.0/maemo-sdk-install-wizard_5.0.py

为安装程序添加可执行权限

$ chmod a+x maemo-sdk-install-wizard_5.0.py


安装需要root权限。

Ubuntu
$ sudo ./maemo-sdk-install-wizard_5.0.py
Debian
$ su -c ./maemo-sdk-install-wizard_5.0.py


注意

  • 因为安装程序需要进行软件包安装,你应该在安装前,先退出其他的包管理程序。
  • 需要注意的是,Scratchbox的路径检测并不完美,你必须将它安装在/scratchbox目录下。
  • 另外,安装程序需要pyQt的支持,老版本的Ubuntu和Debian可能没有提供pyQt。
  • 在64位系统上,安装程序将显示需要做哪些设置,但不会自动进行配置,你需要手工配置它们。
  • 安装程序会将DISPLAY环境变量设置为":2",如果你想使用其他值, 请手工更改。

[edit] 在基于Debian的x86-32 linux发行版上安装Maemo 5 SDK

1. 下载Scratchbox和Maemo SDK的安装脚本。你也可以在Nokia开发论坛(Maemo SDK at Forum Nokia)上下载到同样的脚本。

$ wget http://repository.maemo.org/stable/5.0/maemo-scratchbox-install_5.0.sh http://repository.maemo.org/stable/5.0/maemo-sdk-install_5.0.sh

2. 为脚本添加可执行权限。

$ chmod a+x ./maemo-scratchbox-install_5.0.sh ./maemo-sdk-install_5.0.sh

3. 以root权限运行Scratchbox安装脚本,同时指定需要添加到Scratchbox用户组的用户。该用户必须是宿主Linux系统中有效的用户。这将下载大约420MB的内容,不支持断点续传。

$ sudo ./maemo-scratchbox-install_5.0.sh -u USER

4. 安装脚本将会在“sbox”用户组中添加指定的用户。要使改设置在当前终端进程中生效,你需要执行以下命令。

  • 注意:如果你已经登录进了Scratchbox环境,这个命令将改变当前的用户组ID。如果你不想改变,只要从Scratchbox环境中注销再重新登录即可。
$ newgrp sbox

5. 这时,你已经获得了一个可用的Scratchbox环境。

6. 继续进行Maemo SDK的安装。这个脚本需要在Scratchbox环境外,以安装时指定的用户权限运行。首先,为脚本用户添加可执行权限。

$ sudo chmod +x ./maemo-sdk-install_5.0.sh

然后运行。

$ ./maemo-sdk-install_5.0.sh

如果你将Scratchbox安装到了/scratchbox以外的目录,你需要用“-s PATH”选项来指定你的Scratchbox目录。你可以使用“--help”选项获得更多的命令行选项信息。

7. 脚本成功执行完成后,你就可以登录Scratchbox环境了。

$ /scratchbox/login

如果你无法登录,请看一下Scratchbox的问题

8. 你需要接受Nokia的最终用户许可协议,才能够获取Nokia提供的二进制软件包。安装这些软件包后,你将会获得Maemo SDK的完整功能。

8.1. 通过这个页面,接受最终用户许可协议。

8.2. 将接受最终用户许可协议后获得的软件源地址,分别添加到x86和armel两个编译目标环境的/etc/apt/source.list文件中。在两个目标环境下,分别执行以下命令。


[sbox-FREMANTLE_X86: ~] > sb-conf select FREMANTLE_ARMEL
[sbox-FREMANTLE_ARMEL: ~] > nano /etc/apt/sources.list # 添加软件源地址
[sbox-FREMANTLE_ARMEL: ~] > apt-get update
[sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install nokia-binaries nokia-apps
[sbox-FREMANTLE_ARMEL: ~] > sb-conf select FREMANTLE_X86
[sbox-FREMANTLE_X86: ~] > nano /etc/apt/sources.list # 添加软件源地址
[sbox-FREMANTLE_X86: ~] > apt-get update
[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install nokia-binaries nokia-apps

以上步骤将安装Nokia的二进制文件包,一些开源工具包依赖它们。这样,你就完成了Maemo 5 SDK开发环境的配置,可以动手进行开发了。

[edit] 在openSUSE上安装Maemo 5 SDK

这是来自opensuse.org的安装指南。

[edit] 启动/终止SDK图形用户界面

在启动用户界面前,请先确认你已正确安装了以下内容:

  • Scratchbox环境外,宿主系统上的Xephyr X11服务器
  • 之前提到的SDK
  • Nokia二进制工具包

1. 首先,在Scratchbox环境外,启动Xephyr:

Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -kb &

2. 登录Scratchbox的X86编译目标环境

$ /scratchbox/login
Welcome to Scratchbox, the cross-compilation toolkit!
Use 'sb-menu' to change your compilation target.
See /scratchbox/doc/ for documentation.
[sbox-FREMANTLE_X86: ~]>

3. 设置DISPLAY环境变量,使之与Xephyr的设置相符。

[sbox-FREMANTLE_X86: ~] >export DISPLAY=:2

4. 启动用户界面。

[sbox-FREMANTLE_X86: ~] >af-sb-init.sh start

5. 图形界面将出现在Xephyr窗口中。

6. 你可以用如下命令终止用户界面:

[sbox-FREMANTLE_X86: ~] >af-sb-init.sh stop

[edit] 在基于Debian的x86-32 linux发行版上安装Maemo 5 SDK

由于Scratchbox只支持x86-32架构的linux宿主系统,因此,在x86-64系统中,我们需要强制安装x86-32的Scratchbox软件包。在执行Scratchbox的安装脚本时,添加“-F”选项即可。

安装流程

  • 下载Scratchbox和Maemo 5 SDK的安装脚本。
$ wget -c http://repository.maemo.org/stable/5.0/maemo-scratchbox-install_5.0.sh http://repository.maemo.org/stable/5.0/maemo-sdk-install_5.0.sh
  • 为脚本添加可执行权限
$ chmod a+x ./maemo-scratchbox-install_5.0.sh ./maemo-sdk-install_5.0.sh
  • 以root权限运行Scratchbox安装脚本,并添加“-F”选项,同时指定需要添加到Scratchbox用户组的用户。该用户必须是宿主Linux系统中有效的用户。
$ sudo ./maemo-scratchbox-install_5.0.sh -F -u $USER

在成功安装Scratchbox后,请参照x86-32系统的安装指南,继续安装Maemo 5 Final SDK。

[edit] 在非Debian系统中启动Scratchbox

如果通过Debian的deb包安装了Scratchbox,Scratchbox的启动脚本/etc/init.d/scratchbox-core将被正确安装,Scratchbox也会在系统重启时自动启动。

如果你通过tarballs的方式安装了Scratchbox,那么当系统重启后,Scratchbox需要的挂载配置和binfmt_misc都将被清除。

要使Scratchbox在重启后继续工作,你需要以root权限执行以下命令:

$ sudo /scratchbox/sbin/sbox_ctl start

此外,你也可以将sbox_ctl作为一个系统脚本,添加到/etc/init.d目录下,并在对应的运行等级目录中创建链接。在大多数系统中,方法如下:

$ ln -s /scratchbox/sbin/sbox_ctl /etc/init.d/scratchbox-core
$ /usr/sbin/update-rc.d scratchbox-core defaults

请查阅你的系统文档,以了解相应的方法。

[edit] 自Maemo 5 Beta 2 SDK升级

不幸的是,从Beta 2平滑地升级到Final SDK是不可能的。因此我们建议你重新安装Final SDK。在你操作以前,请先看一下下列指引。

一些随Final SDK附带的Nokia应用程序使用了固定的路径,来指定用户的home目录。为了使这些程序能够正常工作,你需要创建一个目录,路径与Nokia指定的路径相同。

这需要在Scratchbox环境外,以root权限操作。

Scratchbox安装脚本的“-u”选项将更新环境并创建必要的链接。

执行以下命令,为已有的Scratchbox用户创建必要的链接。

$ sudo ./maemo-scratchbox-install_5.0.sh -u <EXISTING_USER> 

此外,你也可以手动创建链接。如果Scratchbox被安装在了默认路径下,那么命令如下:

$ sudo ln -s /scratchbox/users/<username>/home/<username> /scratchbox/users/<username>/home/user

Final SDK的安装脚本也在/target/<target_name>/目录下添加了/opt目录。

为了便于在/opt路径下安装应用程序,一些linux系统会创建一个指向/home/opt的链接作为/opt目录。SDK也继承了这一特性。

在Scratchbox环境下,/opt目录的路径是/target/<target_name>/opt。

安装基本系统包rootstraps后,所有编译目标环境的/target/<target_name>/opt都将被指向/home/opt。而/opt应该为每个编译目标环境分别指定。

为了解决这个问题,我们需要手工检查/target/<target_name>/opt是否被链接了,如果是,那么删除这个链接,并且重新创建相应的目录。

[edit] 自Maemo 4.x/Diablo SDK升级

事实上,由于API的变动,我们无法从Diablo升级到Fremantle。不过我们可以利用Diablo的Scratchbox环境,帮助配置Fremantle的Scratchbox环境。

所以,我们可以升级Scratchbox。

  • 下载Maemo 5的Scratchbox安装脚本
$ chmod a+x ./maemo-scratchbox-install_5.0.sh
  • 为脚本添加可执行权限,然后这样执行:
$ sudo ./maemo-scratchbox-install_5.0.sh -U -u <EXISTING_USER> -s /scratchbox

当脚本执行成功后,继续进行Maemo 5 Final SDK的安装。

[edit] 手工安装

  • 在基于Debian的x86-32系统上:
    • 你可以在你宿主机的/etc/apt/sources.list文件中,添加以下内容:
deb http://scratchbox.org/debian/ maemo5-sdk main
  • 然后以root权限,安装Scratchbox软件包。
$ sudo apt-get update
$ sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-qemu scratchbox-devkit-debian scratchbox-devkit-doctools scratchbox-devkit-perl scratchbox-toolchain-host-gcc scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486 scratchbox-devkit-svn scratchbox-devkit-git scratchbox-devkit-apt-https
  • 在基于Debian的x86-64系统上:
    • 这里下载Scratchbox软件包。
  • 以root权限,强制安装这些x86-32软件包。
$ sudo dpkg -i --force-architecture scratchbox-core scratchbox-libs scratchbox-devkit-qemu scratchbox-devkit-debian scratchbox-devkit-doctools scratchbox-devkit-perl scratchbox-toolchain-host-gcc scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486 scratchbox-devkit-svn scratchbox-devkit-git scratchbox-devkit-apt-https
  • Scratchbox软件包将被解包安装到/scratchbox目录下。在安装过程中,会请求你回答一些关于用户组和用户的问题。默认的Scratchbox用户组是“sbox”。
  • 使用Scratchbox的用户需要被添加到Scratchbox用户组中,以root权限执行下列命令以添加用户:
$ sudo /scratchbox/sbin/sbox_adduser USER yes
  • 这将在Scratchbox用户组中添加用户,创建用户目录/scratchbox/<user_name>,并在用户目录下挂载系统目录(/dev,/proc,/tmp)。


  • 一些随Final SDK附带的Nokia应用程序使用了固定的路径,来指定用户的home目录。为了使这些程序能够正常工作,你需要创建一个目录,路径与Nokia指定的路径相同。这需要在Scratchbox环境外,以root权限操作。
$ sudo ln -s /scratchbox/users/<username>/home/<username> /scratchbox/users/<username>/home/user
  • 要使用户组设置在当前终端环境下生效,需要执行以下命令:
    • 注意:如果你已经登录进了Scratchbox环境,这个命令将改变当前的用户组ID。如果你不想改变,只要从Scratchbox环境中注销再重新登录即可。
$ newgrp sbox
  • 登录Scratchbox环境。
$ /scratchbox/login
  • 配置x86和armel编译目标:
[sbox->:~]>sb-conf st FREMANTLE_X86 -c cs2007q3-glibc2.5-i486 -d perl:debian-etch:doctools:svn:git -t none
[sbox->:~]>sb-conf st FREMANTLE_ARMEL -c cs2007q3-glibc2.5-arm7 -d qemu:perl:debian-etch:doctools:svn:git -t qemu-arm-sb
  • 下载基本系统包rootstraps。
[sbox->:~]> wget http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz
  • 切换到x86目标环境,解开x86的rootstraps,安装devkits,fakeroot,以及其他工具到目标环境。
[sbox->:~]> sb-conf se FREMANTLE_X86
[sbox-FREMANTLE_X86: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_i386.tgz
  • 如果apt的apt http pipeline被配置为开启,一些用户可能会在使用apt下载文件时遇到问题。你可以用以下命令关闭这个设置:
[sbox-FREMANTLE_X86: ~] > echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00maemo
  • 继续安装:
[sbox-FREMANTLE_X86: ~] > sb-conf in -edFL
[sbox-FREMANTLE_X86: ~] > apt-get update
[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install maemo-sdk-debug
  • 虚拟包“maemo-sdk-debug”将为目标环境安装所有需要的开源运行库,开发文件和调试文件。如果你只需要运行库,你可以安装“maemo-sdk-runtime”包。如果你只需要运行库和开发文件,那么你应该安装“maemo-sdk-dev”包。
  • 通过这个页面,接受Nokia的最终用户许可协议。
  • 将接受最终用户许可协议后获得的软件源地址,添加到目标环境的/etc/apt/source.list文件中。然后执行以下命令。
[sbox-FREMANTLE_X86: ~] >apt-get update
[sbox-FREMANTLE_X86: ~] >fakeroot apt-get install nokia-binaries nokia-apps


  • 为了便于在/opt路径下安装应用程序,一些linux系统会创建一个指向/home/opt的链接作为/opt目录。SDK也继承了这一特性。
  • 在Scratchbox环境下,/opt目录的路径是/target/<target_name>/opt。安装基本系统包rootstraps后,所有编译目标环境的/target/<target_name>/opt都将被指向/home/opt。而/opt应该为每个编译目标环境分别指定。
  • 为了解决这个问题,我们需要手工检查/target/<target_name>/opt是否被链接了,如果是,那么删除这个链接,并且重新创建相应的目录。
[sbox-FREMANTLE_X86: ~] >rm /targets/FREMANTLE_X86/opt
[sbox-FREMANTLE_X86: ~] >mkdir /targets/FREMANTLE_X86/opt
  • 在armel目标环境下,进行类似的操作:
[sbox-FREMANTLE_X86: ~]> sb-conf se FREMANTLE_ARMEL
[sbox-FREMANTLE_ARMEL: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_armel.tgz
  • 如果你需要,下面的命令禁用apt http pipelining:
[sbox-FREMANTLE_X86: ~] > echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00maemo
  • 继续……
[sbox-FREMANTLE_ARMEL: ~] > sb-conf in -edFL
[sbox-FREMANTLE_ARMEL: ~] > apt-get update
[sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install maemo-sdk-debug
  • 将同样的Nokia软件源地址,添加到目标环境的/etc/apt/source.list文件中。然后执行以下命令。
[sbox-FREMANTLE_ARMEL: ~] >apt-get update
[sbox-FREMANTLE_ARMEL: ~] >fakeroot apt-get install nokia-binaries nokia-apps
  • 创建/opt目录。
[sbox-FREMANTLE_ARMEL: ~] >rm /targets/FREMANTLE_ARMEL/opt
[sbox-FREMANTLE_ARMEL: ~] >mkdir /targets/FREMANTLE_ARMEL/opt


好了,你现在获得了一个可用的Maemo 5开发环境。

下面可以启动用户界面

[edit] 卸载

首先,确认没有任何进程运行在Scratchbox环境中。 请先备份你需要的文件和目录。卸载Scratchbox会删除所有Scratchbox环境中的所有东西。

在基于Debian的系统中,以root权限执行以下命令:

$ sudo apt-get remove scratchbox-* --purge
$ sudo rm -rf /scratchbox

在非Debian的系统中,你需要手工停止Scratchbox进程,然后删除它:

$ sudo /scratchbox/sbin/sbox_ctl stop
$ sudo rm -rf /scratchbox

[edit] Scratchbox的问题

你需要注意以下这些Scratchbox的问题:

[edit] VDSO支持

当宿主机内核开启了VDSO后,Scratchbox无法正常工作。我们正在努力解决这个问题。

如果你的宿主机开启了VDSO32,在登录Scratchbox时会出现这样的错误:

No directory, logging in with HOME=/
Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion `(void *)

ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!


[edit] x86-64内核

在2.6.25版本以后的x86-64内核中,默认启用了VDSO32。执行以下命令可以暂时禁用该特性:

sysctl abi.vsyscall32=0

如果你的内核版本低于2.6.24,你可以执行:

sysctl vm.vdso_enabled=0

或者

sysctl kernel.vdso=0

sysctl可以配置VDSO32,只有0或2的取值与Scratchbox兼容。在我们的例子中使用0(禁用)。2将启用compat模式。

你也可以将以下内容添加到/etc/sysctl.conf文件中

vm.vdso_enabled = 0
abi.vsyscall32 = 0
kernel.vdso = 0

保存并执行:

$ sudo sysctl -p

需要注意的是,这三行配置中,具体哪一行正确取决与你的Linux内核版本。当你执行“sysctl -p”时可能会出现“unknown keys”的警告。你可以忽略这些警告,三行配置中只有正确的那个会被启用。

警告:在把这些内容添加到sysctl.conf前,你应该尝试用echo配置他们,看看是否会引起一些特殊的问题。例如,在Ubuntu Gutsy中,曾经出现过VDSO的错误设置损害了系统,导致系统无法启动的情况。

WARNING : You should try setting these values by echoing them to the given locations before adding them to sysctl.conf to see if they cause any problems. For example, in some Ubuntu Gutsy installations, it has been observed that changing the VDSO settings will hang the system and thus making permanent changes in sysctl.conf may, in these cases, make your system unbootable.

译者:该警告我没有把握正确翻译,故而保留原文。

[edit] 已知问题

  • 你可以在这里找到一份已知问题和解决办法的列表
  • 当用户界面启动时,会在终端显示一些不必要的警告和调试信息。
  • armel目标环境没有图形用户界面。
  • 当用户界面运行时,Xephye有可能僵死。这可能是Xephyr不同版本间的行为差异导致的界面问题。最糟糕的案例出现在Ubuntu Jaunty附带的Xephyr中。当用户界面中运行有输入区域的程序,并用鼠标点击切换输入法时,Xephyr都会僵死。在Fedora Core 10中,Xephyr会忽略鼠标的点击,但会在用户界面的程序退出时僵死。在其他Xephyr,例如Ubuntu Intrepid中的Xephyr,或是为Jaunty重编译的Intrepid版本Xephyr并没有出现这些冲突。
    • 现在,已经有了一个为Ubuntu Jaunty的Xephyr提供的补丁,你可以在这里找到它。你也可以从Ubuntu Jaunty的launchpad源找到编译好的二进制包以及它的依赖包(libgpg-error0libcrypt11)。
  • clutter的性能可以通过硬件加速获得提升。有些时候,这意味着你需要安装一些受限的驱动(例如宿主机上的ATI和NVidia图形加速卡)。请参阅Maemo5 clutter performance以获得更多细节。
  • 以“-kb”选项启动Xephyr将会禁止键盘输入“@”标志。但去除“-kb”则会禁用方向键。
  • 在某些程序(例如浏览器和照片)中,颜色有时会反转。