The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)
Platform SDK
(→Installation / setup) |
(→Entering chroot) |
||
Line 41: | Line 41: | ||
Additionally, if the user specified has a .mersdkrc in their $HOME, it will be sourced prior to entry and if an enter_sdk function is declared this will be run as root. | Additionally, if the user specified has a .mersdkrc in their $HOME, it will be sourced prior to entry and if an enter_sdk function is declared this will be run as root. | ||
As the user exits the chroot, if a leave_sdk function is declared, it will be executed. This could be used to create symlinks from any /parentroot/data type filesystems into the SDK root | As the user exits the chroot, if a leave_sdk function is declared, it will be executed. This could be used to create symlinks from any /parentroot/data type filesystems into the SDK root | ||
+ | |||
+ | Note: Be sure that the bind-mounts(especialy the home directory) are all umounted when you leave the chroot environment. You can use 'cat /proc/self/mountstatus' to check it. If it is not umounted, you should umount it manually before you delete the Platform SDK. | ||
+ | Note: On my ubuntu11.10, the umount is done automatically. | ||
== SDK contents == | == SDK contents == |
Revision as of 08:26, 21 February 2012
Contents |
Mer platform SDK
To avoid any confusion, there are two types of SDKs: Application SDKs and Platform SDKs. Application SDK's are the ones that deal with Qt applications and libraries, HTML5, etc, while Platform SDK's are for developing the platform, compiling native code and other things revolving around the platform developer/hacker needs.
The platform SDK aims to offer a installable disk image that can be run on virtual machines (typically) or actual hardware, which contains tools like Scratchbox2, MIC (image creator), spectacle, osc, qemu, etc preinstalled, to make it easier for a developer to work with Mer.
Please note that the platform SDK is a work on progress. The work for making the sdk was kicked off January 13 2012. If you are willing to contribute to the effort, please do so.
Using the platform SDK
Please note that this is a DRAFT and not all bits and pieces are in place yet. Also things might and most likely will change.
Installation / setup
The platform SDK is provided as a rootfs tarball that contains essential tools for Mer platform development along with a helper script to enter the rootfs.
Please note that the platform SDK requires that you're using a Linux distribution (one in a virtual machine works as well).
To setup the SDK:
- Create directory for the SDK rootfs and download the latest stable SDK rootfs tarball
mkdir $HOME/mer-sdk && cd $HOME/mer-sdk curl -O url_to_be_defined
- extract the tarball as root or with sudo
sudo tar xjvf mer-sdk.tar.bz2
Entering chroot
The platform SDK rootfs contains a helper script to enter the chroot named 'enter-chroot.sh'. The helper script is located the the root directory (/) of the rootfs.
to enter the rootfs with the helper script do
sudo $HOME/mer-sdk/enter-chroot.sh $HOME/mer-sdk
The usage is
enter-chroot.sh [-u <user>] [-m <all|none|home>] <SDK root path> Use the Mer SDK -u System user to link into SDK (not needed if using sudo) -m Devices to bind mount from host: none, all (default) or just $HOME
The script will bind mount any 'normal' mountpoints it finds into the chroot onto /parentroot in the SDK
Additionally, if the user specified has a .mersdkrc in their $HOME, it will be sourced prior to entry and if an enter_sdk function is declared this will be run as root. As the user exits the chroot, if a leave_sdk function is declared, it will be executed. This could be used to create symlinks from any /parentroot/data type filesystems into the SDK root
Note: Be sure that the bind-mounts(especialy the home directory) are all umounted when you leave the chroot environment. You can use 'cat /proc/self/mountstatus' to check it. If it is not umounted, you should umount it manually before you delete the Platform SDK. Note: On my ubuntu11.10, the umount is done automatically.
SDK contents
The platform SDK's rootfs has some useful packages preinstalled that are listed below. If you're missing something you can use zypper to install the needed extra packages or if not available in the repositories compile them yourself.
TODO
Compiling with the SDK
The SDK uses scratchbox2 for cross compilation and has the targets supported by Mer preconfigured. The target names are the names of the target architectures listed below. To cross compile one does something like this:
sb2 -t armv7hl gcc hello.c -o hello
You can also compile your sources without scratchbox2 by calling gcc directly inside the SDK chroot. Please note that binary from this compilation might not work with your target device.
gcc hello.c -o hello
scratchbox2 targets
TBD
Building an image
Mer images are build using mic image creator. Mic takes a kickstart file that defines the image to be created as input. To create a Mer image with the platform SDK simply call mic as you would do on any other system. For example
mic cr loop your-kickstart-file.ks -o image --pkgmgr=yum
Packaging
The SDK includes tools needed to create rpm packages for Mer.
TODO
Hosting repositories
To make installing created packages easier you can host your own rpm repository with the SDK and install packages to your target device from there.
TODO
Development Documentation
Below you will find information about the development of the platform SDK itself.
Requirements
The following requirements were agreed on the initial platform sdk brainstorming meeting (things may change)
- Platform SDK needs to be able to function without an OBS account or access to an OBS.
- Offline compilation must be possible
- Clearly document the difference between platform SDK and application SDK.
- Document the SDK tools for easier porting to new Linux distributions (if all SDK tools, and nothing else, comes from a single OBS project, that might be enough documentation).
- seperation of user /home and 'sdk'
- need short path from: code, build, deploy, boo
- minimal http server to SDK for built rpm repo serving
Goals for the first version (Proposal)
The target is to provide a Linux distribution agnostic SDK in form of rootfs image to enable people working on Mer to compile, package and hack on Mer offline and without OBS access.
The initial version should contain the following
- Mer rootfs
- working zypper, etc
- script to setup mounts
- Mounts host root and users home from host
- Cross compilers
- scratchbox2
- x86
- arm
- mips
- packaging tools
- spectacle, etc.
- image creation tools
- mic
- Documentation
- howtos, etc.
Work so far
- COBS project : Mer:Tools:Testing : https://build.pub.meego.com/project/monitor?project=Mer%3ATools%3ATesting
- basic kickstart: https://build.pub.meego.com/package/files?package=sdk-kickstarter-configs&project=home%3Albt%3Abranches%3AMer%3ATools%3ATesting
- rootfs an mount script: https://img.merproject.org/images/
QA
TBD
SDK team meeting minutes
- 13.1.2012 http://mer.bfst.de/meetings/mer-meeting/2012/mer-meeting.2012-01-13-18.02.html
- 28.1.2012 http://mer.bfst.de/meetings/mer-meeting/2012/mer-meeting.2012-01-28-10.04.log.html