Editing Maemo软件开发工具包
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
Warning: This page is 39 kilobytes long; some browsers may have problems editing pages approaching or longer than 32kb. Please consider breaking the page into smaller sections.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 21: | Line 21: | ||
在GNU/Linux桌面系统上,Maemo SDK使用[http://scratchbox.org/ Scratchbox]这个开源交叉编译工具,创建了一个沙盒环境。 | 在GNU/Linux桌面系统上,Maemo SDK使用[http://scratchbox.org/ Scratchbox]这个开源交叉编译工具,创建了一个沙盒环境。 | ||
- | + | 在大多数情况下,这个环境就象普通操作一样运行,只不过添加了一些开发工具。 | |
这意味着Maemo软件的开发流程与普通桌面Linux程序十分相似。麻烦的嵌入式开发过程,例如交叉编译,都由Scratchbox自动进行。 | 这意味着Maemo软件的开发流程与普通桌面Linux程序十分相似。麻烦的嵌入式开发过程,例如交叉编译,都由Scratchbox自动进行。 | ||
Line 31: | Line 31: | ||
'''而''ARMEL目标环境''仅用于进行交叉编译,使程序可以手持设备上运行。''' | '''而''ARMEL目标环境''仅用于进行交叉编译,使程序可以手持设备上运行。''' | ||
- | + | 另外,值得提醒的是,qemu(一个Linux下常用的虚拟机,被Scratchbox用作CPU指令译码器)无法在''ARMEL''目标环境下运行用户界面。 | |
当你的程序在''X86''环境中顺利编译运行后,你可以在''ARMEL''环境下重新编译程序。编译与打包过程与在''X86''环境中完全相同,不过会慢一些,因为一些操作需要软件模拟执行。Scratchbox会进行交叉编译,开发者无须考虑这些问题。 | 当你的程序在''X86''环境中顺利编译运行后,你可以在''ARMEL''环境下重新编译程序。编译与打包过程与在''X86''环境中完全相同,不过会慢一些,因为一些操作需要软件模拟执行。Scratchbox会进行交叉编译,开发者无须考虑这些问题。 | ||
Line 37: | Line 37: | ||
当程序在''ARMEL''环境中编译完成后,就可以在手持设备上直接运行了。由于SDK提供的模拟器并不完善,所以实际的测试必须在真实设备上进行。 | 当程序在''ARMEL''环境中编译完成后,就可以在手持设备上直接运行了。由于SDK提供的模拟器并不完善,所以实际的测试必须在真实设备上进行。 | ||
- | == Scratchbox == | + | == 施工中 Scratchbox == |
Scratchbox是一个特定的“沙盒”环境,提供了一个与真实的Linux系统(通常被称为host machine,宿主机)隔离的开发环境。 | Scratchbox是一个特定的“沙盒”环境,提供了一个与真实的Linux系统(通常被称为host machine,宿主机)隔离的开发环境。 | ||
Line 43: | Line 43: | ||
Scratchbox也简化了交叉编译:软件直接被编译成可以在目标设备上运行的二进制格式。 | Scratchbox也简化了交叉编译:软件直接被编译成可以在目标设备上运行的二进制格式。 | ||
- | + | The name "Scratchbox" comes from "Linux from scratch" + "chroot jail" (sandbox). This also explains its implementation and intended use. While working inside Scratchbox, programs will be running in a changed root environment (chroot). In Linux systems, it is possible to change the file paths that a process will see. Scratchbox uses this mechanism on startup to switch its root directory (/) to something other than the real root. This is part of the isolation technique used. Because of this, the environment is called a sandbox, a private area where it is possible to play around without disturbing the environment, and without all the mess that real sand would cause. The other parts of the isolation technique are library call diversions (using LD_PRELOAD), wrapping of compiler executables and other commands. | |
- | + | Scratchbox: | |
- | + | * Is a software package to implement development sandboxes (for isolation) | |
+ | * Contains easy-to-use tools to assist cross-compilation | ||
+ | * Supports multiple developers using the same development system | ||
+ | * Supports multiple configurations for each developer | ||
+ | * Supports executing target executables on the hardware target, via a mechanism called sbrsh | ||
+ | * Supports running non-native binaries on the host system via instruction set emulators ([http://bellard.org/qemu Qemu] is used). | ||
- | + | Besides these main features, it is possible to develop your own software packages that can be installed and used inside a Scratchbox environment. Scratchbox also includes some integration of Debian package management, so that once the source files are set up correctly and a couple of configuration files have been written, binary distribution packages can be created for various architectures (similar to .msi files in Windows, or .rpm files in Fedora Core, RHEL and SUSE). These tools are also used to provide the environment with a packaging database so that other development packages can be installed over the Internet when needed (by using standard Debian package management tools). | |
- | + | Fremantle also uses a similar packaging system, and this means that packages built using Scratchbox and the SDK can be installed on the real device. | |
- | + | Scratchbox is licensed under the GPL and it is open for outside contributions. For in-depth coverage on Scratchbox and its capabilities, please visit the [http://scratchbox.org project website]. | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | This material discusses only the Scratchbox capabilities that are necessary to use the Maemo SDK. | |
- | |||
- | + | ===Scratchbox In-Depth=== | |
- | Maemo | + | Scratchbox is Maemo SDK's cross-compiling environment. The default Scratchbox installation works as-is under most conditions, but some details are good to know for more specialized usage. |
- | + | The ''target'' inside Scratchbox contains a root file system. When you create a new target inside Scratchbox, specify the ''toolchain'' you will use to build applications. Examples of a ''target'' include X86 and ARMEL, provided by Maemo SDK on top of Scratchbox. | |
+ | ''Host tools'' are native to the host, provided for convenience and speed. They are always transparently preferred over target tools. For example, cross-compiling applications to the target architecture. Host tools consist of devkits and ''toolchains''. | ||
- | + | A toolchain provides the minimal set of tools for compiling binaries for the target. Each scratchbox target must have one and only one toolchain selected. | |
- | + | ''CPU transparency methods'' take care of running the applications on an emulator, target device or directly on the host transparently from the user's perspective. The available CPU transparency methods come from a special ''devkit'' called ''cputransp''. For each of Maemo SDK's pre-defined targets, a CPU transparency method is selected and defined. | |
- | '' | + | A ''toolchain'' is a collection of tools used to produce binaries for the target environment. In addition to a compiler (''gcc''), the toolchain contains a linker (''ld'') and other ''binutils'', such as ''strip'', ''objdump'' and ''strings''. |
- | '' | + | A ''devkit'' is a collection of tools native to the host. A devkit can be selected or disabled for a target. An example of a devkit is the doctools devkit, which provides tools (like doxygen) for building documentation. |
- | '' | + | A ''rootstrap'' is a root file system for the target device. Maemo SDK provides root file systems for both targets (X86 and ARMEL) inside Scratchbox. Note that the user's home directory is shared for all targets. The ''/tmp'' directory is shared for all targets and also with the host. |
- | '' | + | From Scratchbox's point of view, Maemo SDK is a set of preconfigured ''targets'' and ''root file system''s. One set is provided for both ''X86'' and ''ARMEL'' architectures on top of a working Scratchbox installation. |
- | |||
- | + | ==Development on Maemo SDK== | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | == | + | |
The Maemo SDK provides all of its development tools inside Scratchbox. Also the UI framework is started with a single command, ''af-sb-init'', run within Scratchbox. However, it needs a secondary X server of proper size and bit-depth to be displayed on. | The Maemo SDK provides all of its development tools inside Scratchbox. Also the UI framework is started with a single command, ''af-sb-init'', run within Scratchbox. However, it needs a secondary X server of proper size and bit-depth to be displayed on. | ||
Learn more about Contributing to the wiki.