m (→QEMU share on Windows) |
m |
||
| (10 intermediate revisions not shown) | |||
| Line 1: | Line 1: | ||
| - | <span style="color:#ff0000"> | + | <span style="color:#ff0000"> </span> |
Author: Edmondas Girkantas | Author: Edmondas Girkantas | ||
| Line 17: | Line 17: | ||
** 1st presentation - [[Media:Sysroot-extension.pdf|QEMU+rsync]] | ** 1st presentation - [[Media:Sysroot-extension.pdf|QEMU+rsync]] | ||
** 2nd presentation - [[Media:Sysroot-extension2.pdf|Windows and other sync. tools]] | ** 2nd presentation - [[Media:Sysroot-extension2.pdf|Windows and other sync. tools]] | ||
| - | ** 3rd presentation - [[Media:Sysroot-extension3.pdf|Samba and shared folders]] | + | ** 3rd presentation - [[Media:Sysroot-extension3.pdf|Samba and shared folders]] (Updated on 28th April) |
* some PoF scripts on [https://www.gitorious.org/sysroot-extend Gitorious] | * some PoF scripts on [https://www.gitorious.org/sysroot-extend Gitorious] | ||
| Line 68: | Line 68: | ||
=== Extract RPM to sysroot === | === Extract RPM to sysroot === | ||
==== Description ==== | ==== Description ==== | ||
| + | |||
| + | '''Note:''' this feature is already implemented in [https://meego.gitorious.org/meego-developer-tools/madde/blobs/master/src/madlib/xrpm.pl madde]. | ||
Implement extra rpm package (mad-admin xrpm) installation/removal interface (like existing xdpkg) | Implement extra rpm package (mad-admin xrpm) installation/removal interface (like existing xdpkg) | ||
| Line 689: | Line 691: | ||
Command to sync: | Command to sync: | ||
| - | rsync -a -L --exclude '/proc' --exclude '/dev' --exclude '/mnt' --exclude '/sys' /MOUNT_POINT | + | rsync -a -L --exclude '/proc' --exclude '/dev' --exclude '/mnt' --exclude '/sys' / /MOUNT_POINT |
Note: symlinks transformed into referent file/dir, block or character special files are not copied (not required for sysroot) | Note: symlinks transformed into referent file/dir, block or character special files are not copied (not required for sysroot) | ||
| Line 695: | Line 697: | ||
rsync speed ~600KB/s | rsync speed ~600KB/s | ||
| - | + | === Mac OS X share in QEMU === | |
| + | |||
| + | Command to sync: | ||
| + | rsync -a -L --no-p --no-g --chmod=ugo=rwX --exclude '/proc' --exclude '/dev' --exclude '/mnt' --exclude '/sys' / /MOUNT_POINT | ||
| + | |||
| + | rsync speed ~900KB/s | ||
| + | |||
| + | Issues: rsync can't change ownership (chown) of copied files while using native Windows sharing service on Mac OS X, e.g.: | ||
| + | rsync: chown "/mnt/bin" failed: Permission denied (13) | ||
| + | |||
| + | I can't test it fully (using Qt-creator) because MeeGo SDK porting to Mac OS X is still in progress. | ||
=== QEMU share on Windows === | === QEMU share on Windows === | ||
| Line 824: | Line 836: | ||
* [http://www.blisstonia.com/eolson/notes/smboverssh.php Sharing (tunneling) Samba/CIFS/SMB file systems over SSH] | * [http://www.blisstonia.com/eolson/notes/smboverssh.php Sharing (tunneling) Samba/CIFS/SMB file systems over SSH] | ||
* [http://qemu-forum.ipi.fi/viewtopic.php?f=22&t=4494 Building Qemu on Mac OS X on different architectures] | * [http://qemu-forum.ipi.fi/viewtopic.php?f=22&t=4494 Building Qemu on Mac OS X on different architectures] | ||
| + | |||
| + | [[Category:SDK]] | ||
Author: Edmondas Girkantas
Interested parties: Veli Kaksonen
The developer shall be able to extend the sysroot with additional libraries.
See http://bugs.meego.com/show_bug.cgi?id=9427
Main assets are:
Sysroots can be in a form of:
Libraries can be in a form of:
Possible environments (that can be used to build sysroot and install library):
For RPM packages
For source tarballs:
Copying options:
Note: this feature is already implemented in madde.
Implement extra rpm package (mad-admin xrpm) installation/removal interface (like existing xdpkg)
It is possible to download single rpm package and extract content to sysroot:
rpm2cpio LIBRARY.rpm | cpio -idmv
Note: probably need to create symlinks from /usr/lib to /lib
If package has other dependencies then it is possible to use QEMU/device:
zypper install --download-only <package_name>
Packages will be placed (on device/vm) in
/var/cache/zypp/packages/
Download existing library (rpm) and put it to sysroot, then use mic-chroot to enter sysroot environment.
Note: this is only for meege-core-* sysroots, because zypper is available on other sysroots
Fetch prebuilt package (on MeeGo emulator/device):
# zypper install --download-only <package_name>
The package and all dependencies will be stored (on Linux) in this directory:
/var/cache/zypp/packages/
copy all files to sysroot, e.g.
/usr/lib/madde/linux-i686/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/
enter sysroot environment:
$ sudo mic-chroot <path_to_sysroot>
install package manually:
$ sudo rpm -i <package>
exit from chrooted environment:
$ exit
Use ssh protocol and rsync to copy files from QEMU to host system.
Idea: Maybe we don't need to sync full filesystem, in most cases /usr/lib and /usr/include are enough
Note: Perhaps it's possible to improve rsync performance by changing buffer size, e.g.:
$ rsync -a --sockopts=SO_SNDBUF=2000000,SO_RCVBUF=2000000 ...
Note: rsync exists by default only on handset qemu image
file has vanished: "/home/meego/.cache/tracker/fulltext.db-journal" file has vanished: "/home/meego/.cache/tracker/meta.db-journal" rsync warning: some files vanished before they could be transferred (code 24) at main.c(1526) [generator=3.0.7]
Use madde cross compilation target and installation prefix.
An example:
$ wget http://sqlite.org/sqlite-autoconf-3070500.tar.gz $ tar xvzf sqlite-autoconf-3070500.tar.gz $ cd sqlite-autoconf-3070500/ $ mad -t meego-handset-ia32-1.1.2 ./configure --prefix \ /usr/lib/madde/linux-i686/sysroots/meego-handset-ia32-madde-sysroot-1.1.20110106.1204-fs/ $ mad -t meego-handset-ia32-1.1.2 make $ sudo mad -t meego-handset-ia32-1.1.2 make install
Other interesting way:
mad -t <target> bash --noprofile --norc
Fetch library source-code and build it in chrooted environment.
An example:
$ sudo mic-chroot /usr/lib/madde/linux-i686/sysroots/meego-core-ia32-madde-sysroot-1.1-fs # cd /root # curl -o sqlite-autoconf-3070500.tar.gz http://sqlite.org/sqlite-autoconf-3070500.tar.gz # tar xvzf sqlite-autoconf-3070500.tar.gz # cd sqlite-autoconf-3070500 # ./configure --prefix /usr # make && make install # exit
Same as for RPM
Testing plan - install 5 different libraries, measure installation and synchronisation time.
List of libraries used in this test:
Note: packages are listed without dependencies
Results table for netbook vm (without stopping vm every time before installing new library, install/sync times is better because of os caching):
| Library | RPMs count | Used space | 1 test: install time | 1 test: sync time | 2 test: install time | 2 test: sync time | 3 test: install time | 3 test: sync time | Average install time | Average sync time |
| Initial sync | - | 1414 mb | - | 164 s | - | 180 s | - | 165 s | - | 169 s (2m49s) |
| json-glib | 11 | 1455 mb (+41) | 60 s | 6 s | 113 s | 6 s | 77 s | 6 s | 83 s (1m23s) | 6 s |
| wx | 35 | 1537 mb (+82) | 152 s | 7 s | 293 s | 8 s | 177 s | 7 s | 207s (3m27s) | 7 s |
| boost | 18 | 1758 mb (+221) | 275 s | 22 s | 269 s | 23 s | 262 s | 19 s | 268 s (4m28s) | 21 s |
| apr | 13 | 1771 mb (+13) | 52 s | 3 s | 59 s | 3 s | 67 s | 4 s | 59 s | 3 s |
| uuid | 6 | 1771 mb (<+1) | 13 s | 2 s | 12 s | 1 s | 17 s | 2 s | 14 s | 2 s |
Note: rpm installation time depends on network connectivity
Note: vm startup & shutdown time is not counted
Results table for netbook vm (stopping and starting vm before each installation):
| Library | Used space | 1 test: install time | 1 test: sync time | 2 test: install time | 2 test: sync time | 3 test: install time | 3 test: sync time | Average install time | Average sync time | sync speed mb/s |
| Initial sync | 1414 mb | - | 181 s | - | 170 s | - | 181 s | - | 177 s (2m57s) | ~8.0 |
| json-glib | 1455 mb (+41) | 80 s | 10 s | 50 s | 10 s | 80 s | 10 s | 70 s (1m10s) | 10 s | ~4.1 |
| wx | 1537 mb (+82) | 181 s | 11 s | 116 s | 14 s | 181 s | 11 s | 159 s (2m39s) | 12 s | ~6.8 |
| boost | 1758 mb (+221) | 219 s | 31 s | 141 s | 27 s | 219 s | 31 s | 193 s (3m13s) | 29 s | ~7.6 |
| apr | 1771 mb (+13) | 50 s | 6 s | 38 s | 7 s | 50 s | 6 s | 46 s | 6 s | ~2.2 |
| uuid | 1771 mb (<+1) | 15 s | 5 s | 11 s | 5 s | 15 s | 5 s | 13 s | 5 s | - |
Note: vm startup & shutdown time is not counted
Results table for netbook vm (stopping and starting vm before each installation):
| Library | Used space | 1 test: install time | 1 test: sync time | 2 test: install time | 2 test: sync time | 3 test: install time | 3 test: sync time | Average install time | Average sync time | sync speed mb/s |
| Initial sync | 1414 mb | - | 172 s | - | 202 s | - | 193 s | - | 189 s (3m9s) | ~7.5 |
| json-glib | 1455 mb (+41) | 64 s | 13 s | 54 s | 12 s | 62 s | 13 s | 60 s | 13 s | ~3 |
| wx | 1537 mb (+82) | 125 s | 11 s | 139 s | 17 s | 141 s | 10 s | 135 s | 13 s | ~6.3 |
| boost | 1758 mb (+221) | 127 s | 28 s | 170 s | 29 s | 160 s | 29 s | 152 s | 29 s | ~7.6 |
| apr | 1771 mb (+13) | 36 s | 6 s | 55 s | 7 s | 41 s | 7 s | 44 s | 7 s | ~1.9 |
| uuid | 1771 mb | 12 s | 5 s | 21 s | 6 s | 12 s | 6 s | 15 s | 6 s | - |
Note: vm startup & shutdown time is not counted
Untested
There is rsync version for Windows (uses cygwin libs) - cwrsync
Another option is to install full cygwin environment, which has rsync package
Performance of rsync on Windows OS is really bad (from cygwin):
time rsync --exclude '/proc' --exclude '/dev' --exclude '/sys' \ -a -e 'ssh -p 6666' root@127.0.0.1:/ sysroot real 20m43.933s user 1m23.660s sys 4m26.541s
du -h --max-depth=0 sysroot 1.6G sysroot/
sync speed is only ~1.4 MB/s
Question: why it is so slow? Possible answers: Antivirus / SSH protocol / Cygwin / Other?
Use rsync (TCP/873) protocol (rsync --daemon) to copy files from QEMU to host system.
Used commands:
rsync -a \
--exclude '/proc' \
--exclude '/dev' \
--exclude '/sys' \
rsync://root@127.0.0.1:1873/rsync sysroot
du -h --max-depth=0 ./sysroot/
Initial copy time:
$ time ./rsync-rsyncd.sh real 4m56.249s user 0m8.997s sys 0m23.113s
1.7G ./sysroot/
I found that initial copying of files using rsync protocol is slower than using ssh protocol.
rsync + ssh ~3m 20s rsync + rsyncd ~4m 56s diff ~1m 36s
Mount existing QEMU image (with installed library) then copy files (changes) to selected sysroot.
Options to install library - in a running QEMU machine or using chroot.
Tools for mounting QEMU images (ext3 is used):
There are different tools to mount remote file system (e.g. using ssh protocol)
Tools for mounting remote file systems via ssh:
Cygwin simulates POSIX-compliant symbolic links in the Microsoft Windows file system. It uses identical programming and user utility interfaces as Unix (see above), but creates Windows shortcuts (.lnk files) with additional information used by Cygwin at the time of symlink resolution. Cygwin symlinks are compliant with both Windows and POSIX standards. Some differences exist, however. Cygwin has no way to specify shortcut-related information - such as working directory or icon - as there is no place for such parameters in ln -s command. To create standard Microsoft .lnk files Cygwin provides the mkshortcut and readshortcut utilities.
Tools to create symlinks on Windows file system:
unison - a file-synchronization tool for Unix and Windows
zsync - rsync over HTTP
robocopy (standard feature of Windows Vista, 7 and Server 2008) command-line directory replication command
TODO: try to use unison, check performance
idea: install & configure samba on QEMU machine then try to mount this share and use as sysroot
need to disable some services (on Windows 7). 1st issue - LanmanServer binds to 0.0.0.0:445, there is no way to bind to another interface
manual stopping will not help:
sc stop Browser sc stop LanmanServer
need to disable service and restart system:
sc config LanmanServer start= disabled shutdown -r -t 01
restore service if needed:
sc config LanmanServer start= auto
start qemu with forwarded 139 & 445 ports:
hostfwd=tcp:127.0.0.1:139-:139,hostfwd=tcp:127.0.0.1:445-:445
mount share to disk
net use m: \\127.0.0.1\disk
map disk to sysroot? (Use mklink):
mklink /D c:\MeeGoSDK_1.1\MADDE\sysroots\SYSROOT_NAME m:
Idea: Try to mount QEMU image using filedisk and then map partition using ext2 driver
It's pretty simple to mount QEMU image:
filedisk /mount 0 "FULL_PATH_TO_DISK_IMAGE" LETTER:
But then it's impossible to map this partition to drive, because Ext2 Volume Manager doesn't see it as a physical disk (volume).
List of tools for accessing Ext2 file systems on Windows:
Tools to access qcow2 format images:
TODO: check availability on different OS and test performance
Idea: mount shared folder from Windows onto QEMU then rsync files
Command for testing:
smbclient -U DOMAIN\\user \\\\10.0.2.2\\SHARE
Command for mounting:
mount -t cifs -o username=DOMAIN\\user,password=PASSWORD //10.0.2.2/SERVICE MOUNT_POINT
Note: 10.0.2.2 is special IP address used in QEMU for networking
Command to sync:
rsync -a -L --exclude '/proc' --exclude '/dev' --exclude '/mnt' --exclude '/sys' / /MOUNT_POINT
Note: symlinks transformed into referent file/dir, block or character special files are not copied (not required for sysroot)
rsync speed ~600KB/s
Command to sync:
rsync -a -L --no-p --no-g --chmod=ugo=rwX --exclude '/proc' --exclude '/dev' --exclude '/mnt' --exclude '/sys' / /MOUNT_POINT
rsync speed ~900KB/s
Issues: rsync can't change ownership (chown) of copied files while using native Windows sharing service on Mac OS X, e.g.:
rsync: chown "/mnt/bin" failed: Permission denied (13)
I can't test it fully (using Qt-creator) because MeeGo SDK porting to Mac OS X is still in progress.
Idea: use samba to create Windows share in QEMU, then use QEMU port forwarding feature and map it on Windows
Required steps:
Set proxy server (if needed)
export http_proxy=XXX.XXX.XXX.XXX:8080
Install Samba tools:
zypper install samba samba-client
Create new user and set password
smbpasswd -a root
Configuration file is in:
/etc/samba/smb.conf
Create share with access to filesystem:
[meego] comment = Meego path = / writable = yes write list = root
Start Samba server:
/etc/init.d/smb start
Testing (from cygwin or QEMU):
smbclient -U root -L 127.0.0.1
Map disk:
net use M: \\127.0.0.1\meego /user:root password
To build application against some external non-qt library (uses pkg-config) you need to set additional qmake options in project file (project_name.pro):
For example for C uuid library:
CONFIG += link_pkgconfig PKGCONFIG += uuid
For C++ uuid lib:
CONFIG += link_pkgconfig PKGCONFIG += ossp-uuid LIBS += -lossp-uuid++
I found that these directories are required in Qt-Creator to compile application:
/lib /usr/lib /usr/include /usr/share
time utility was used to measure performance, e.g.:
$ time sudo mad-admin create -e -f meego-handset-ia32-qemu-1.1.20101031.2201-sda-runtime Extracting QEMU runtime meego-handset-ia32-qemu-1.1.20101031.2201-sda-runtime .....9....8....7....6....5....4....3....2....1....0 Creating missing links... done. real 2m54.520s user 2m15.132s sys 0m4.608s
rsync has --stats option, which gives information about copying speed and etc.
Description of hardware used in this study
Linux machine:
Windows machine:
QEMU raw image (3GB) conversion time to qcow2 format (qemu version 0.12.5)
time qemu-img convert -O qcow2 meego-netbook-ia32-qemu-1.1.20110110.1049-sda.raw meego.qcow2
real 25m54.360s user 0m2.596s sys 0m17.045s
Size after conversion - 1.8GB
Note: qemu-img version (0.14.50) from git repository is much faster - the same conversation takes only ~1m30s
IN PROGRESS
Because there are different types of libraries (RPM or source tarball), therefore real implementation of this sysroot extension could differ.
TBD
At the moment there is no target milestone for this feature.