[SailfishDevel] How SB2 works ... was Re: QtContacts available

Marko Koschak marko.koschak at tisno.de
Wed Jan 1 14:13:04 UTC 2014


On Di, 2013-12-24 at 14:48 +0000, David Greaves wrote:
> > [...]
> 
> This is pretty much correct but not quite complete.

Thanks for correcting me ;)

> [...]
> 
> This isn't quite right. It doesn't use fakeroot as such. What it does is
> intercept system calls (using LD_PRELOAD) and, very efficiently, translates
> filesystem access (using lua if you must know!)
> 
> If you're using sb2 and you are in an ARM rootfs then when you access
> /usr/bin/myexecutable sb2 looks for the 'right' file to execute.
> First it considers that your target is in /srv/mer/target/jolla-arm so it has
> the option to look at /srv/mer/target/jolla-arm/usr/bin/myexecutable which is an
> ARM binary that could run using qemu. This would be the fallback location
> However it may see that file is in a list of 'accelerated' binaries. So it now
> looks in the 'host' filesystem (usually the host but more sophisticated
> solutions are available). So it runs the native /usr/bin/myexecutable - but it
> continues to intercept system calls.

Thank you for this detailed view. It makes the process much clearer to
me now.

> So if myexecutable open()s a /usr/share/mydata then sb2 translates that path to
> /srv/mer/target/jolla-arm/usr/share/mydata
> 
> Now, for some special binaries - like gcc, ld etc we don't want to use the
> /usr/bin/gcc - we use an x86 version of gcc which emits ARM code.

Isn't the last 'trick' the reason why we have a 'build engine' inside of
a virtualbox VM? I mean that makes sure that the Mer host tools (x86)
running in the VM are 100% compatible with the Mer target rootfs (arm)
running inside of SB2?

One could argue that why we are not just using SB2 directly on our host
(e.g. Ubuntu system) to compile our Sailfish RPM packages. But trying to
do that is just a nightmare to get it working on each linux
distribution ;) Thus the build engine inside the VM is an elegant
workaround to overcome that problem + it gives IDE support for Mac OS X
and Windows...

Happy new year to all,
Marko




More information about the Devel mailing list