QmlBook Making Progress

It has been a long time since the last update of QmlBook was announced – but the project is definitely live and kicking. Jürgen has put in a lot of great work into the contents and gotten the collaborative work over on github started. To simplify the publication, the contents has been moved to github hosting, but you can still use the old qmlbook.org (and qmlbook.com) addresses to get there.

qmlbook-screenshotThe reason for the standstill on the qmlbook.org/com sites, and much of the perceived lack of progress is due to my personal time situation. Small children and family life takes time, as does my work (which is awesome and includes Qt/QML – go Pelagicore). Unfortunately, I’m a bit of an optimist, so I want to, and truly believe that I will have time to work on side projects such as this book. But the 24h/day limit sucks, so sometimes I realize that I fail to do so.

However, this is not a post where I complain over my own situation – instead – I want to thank all the contributors who keep feeding us issue tickets via github! I would also like to thank our readers – it is great to hear from you! And finally, I’d like to thank Jürgen who has put down a lot of work and kept the project moving forward.

It is not my intention to leave this project, I’m just short on time at the moment due to other awesome things in my life (kids, wife, work) – I’ll be back!

Plex and Chromecast

It seems that everyone has their little magic transcoding line for having Plex and Chromecast to play nice, as everyone runs an underpowered server that cannot do live transcoding. My line follows here:

ffmpeg -i big_buck_bunny_720p_surround.avi -c:v libx264 -profile:v high -level 4.2 -crf 18 -maxrate 10M -bufsize 16M -pix_fmt yuv420p -vf "scale=iw*sar:ih, scale='if(gt(iw,ih),min(1920,iw),-1)':'if(gt(iw,ih),-1,min(1080,ih))'" -x264opts bframes=3:cabac=1 -movflags faststart -c:a libfdk_aac -b:a 320k -ac 2 -y big_buck_bunny_720p_stereo.mp4

The key points here are:

  • h.264 for video.
  • AAC for audio, I use stereo as I don’t use the Chromecast for my 5.1 setup.
  • Name the output *.mp4 to get an mp4 container.
  • -movflags faststart to “optimize for streaming”.

There are a number of similar magic lines floating around on the web, including on the plex forum. There is no way to tell which is the original, so I’ll let everyone Google around instead of explicitly giving credit to the thread I found first.

Some comments from my side:

  • Despite the Chromecast docs claiming to support h.264 level 5, the Chromecast.xml shipped with Plex limits the level to 4.2. Beware. This cost me an evening of transcoding.
  • ffmpeg has its own expression language with
    if, gt and min. Bloody amazing. I wonder if it does email.

Also, I learned that Big Buck Bunny consists of 14315 frames…

Hacking in Gothenburg

I just wanted to mention that foss-gbg has started again after the summer break. If you’re in the vicinity of Gothenburg October 28, you are welcome to learn about open hardware and security. Get your free tickets from eventbrite.

meta-kf5 usable

Finally I’ve had the time to work over the final issues in meta-kf5. Right now, I build most tier 1 and tier 2 components. I’ve packaged most functional modules and integration modules from these tiers.

When it comes to integration modules, there might be missing dependencies that need to be added – but that should not be too hard to add.

To be able to create useable cmake files, I had to employ a small hack modifying the cmake-files from KF5 before installing and packaging them. This seems to work (i.e. tier 2 builds), but there might be other sed-expressions that are needed.

Also, the autotests are not built as long at Qt5Test is left out form the build. If you would add Qt5Test, I believe that the unit tests will be included in the same package as the libs. I’ll address this as I integrate the autotests into ptest.

Summing up all of this, I’d say that the meta-kf5 layer now is usable!

That is all for now. As always, contributions are welcome! If you find a use for this, I’d be happy to add your project as a reference to the layer!

meta-kf5 – almost there…

So, as of tonight, all but three tier 1 modules from kf5 are built in meta-kf5. The ones remaining are KApiDox, which does not really apply, and KConfig and Sonnet, which both needs to be part built for the native host environment, and part cross compiled. So, any Yocto hackers out there, please have a look at the issues linked to from the meta-kf5 status page.

meta-kf5 progress report

The meta-kf5 Yocto  layer is coming along nicely. Most of the modules are proving to be fairly easy to integrate, much thanks to the excellent ground work in meta-qt5, including the cmake_qt5 bbclass.

My plan for the summer vacation was to do one module a day, so around 5 would be ok. Until now I’ve done 9. Only KConfig has been providing any resistance (it does not like QT_NO_SESSIONMANAGER). My current pipe for tier 1 modules has 6 more candidates in it, so hopefully I can say that I’ve done 15 modules tomorrow night.

Right now, I have only one big worry – I have no code using the packages, so it is a bit of a if-it-compiles-it-works mentality right now. This should be fixed by integrating the test cases from the KF5 modules with ptest and building a test image. This is something that I’ll have to look at further along the road.

KF5 in Yocto

KDE recently released the first version of KDE Frameworks 5, or shorter KF5. This is a set of add on modules extending and improving Qt, forming the base on which the Plasma Desktop is built. The nice thing is that KF5 is very modular and very reuseable.

Recently I’ve spent some time working with Yocto (yes, the series will continue – I just need time to do a couple of clean builds). So, I thought this was the perfect little summer vacation project for me. So, the plan is to package one module a day of KF5 for Yocto. The layer resides on github as meta-kf5.

This is a release early, release often project, so I’ve just gotten KAchive and ECM integrated. You can follow the progress from the project status page.

Introducing Grapher

I just found myself in the situation where i need to be able to create bargraphs.

part-i

The design is fairly limited: a row of stacked bars with optional labels under and inside each bar.

part-ii

I also want to be able to color the bars.

part-iii

I wrote a quick little PyQt-based Python program. It lets you write things like this:

bs = BarGraphStack()
bg = BarGraph()
bg.setTitle("Image Size")
bg.addBar(Bar(6349, Qt.Qt.darkGray, "6 349KiB", "kernel(bz)"))
bg.addBar(Bar(25240, Qt.Qt.lightGray, "25 240KiB", "rootfs"))
bs.addBarGraph(bg)
i = bs.render();
# i is a QImage

You can get the latest source code from the Grapher github repository. It is probably obvious that this is Python code written by a C++ guy, but I hope that it still might be useful.

Now I need to add some steps to feed it data automatically, but that is for another day.

Yocto part IV – going on a diet

This time we will start looking at how we can reduce the image size of the diet-image. Before we start, lets do a super-quick recap of the first three installments (i, ii, iii):

Start by creating and populating a project area:

mkdir minimal
cd minimal/
git clone git://git.yoctoproject.org/poky
cd poky/
git checkout -b daisy origin/daisy
source oe-init-build-env minimal-qemu
cd ..
git clone https://github.com/e8johan/meta-diet.git
cd minimal-qemu/
vim conf/local.conf

Add the following lines at the end of conf/local.conf.

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""

INHERIT += "buildhistory"
BUILDHISTORY_COMMIT = "1"

Add the meta-diet layer to BBLAYERS in conf/bblayer.conf, and build the image.

bitbake diet-image

And now, lets get back to business.

Today, I will demonstrate how to modify an existing package through a bbappend file, but first, some background.

Back in part ii, I presented a list of the packages included on the image. Something that surprised me was the inclusion of libx11-6 and libxcb. Both associated with the X windowing system which the image does not include. Using the depents.dot file, I found that the source of this dependency was the dbus package. To be more exact, this line from meta/recipes-core/dbus/dbus.inc:

PACKAGECONFIG[x11] = "--with-x --enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm"

The nice thing about PACKAGECONFIG lines like the one above, is that they contain two halves – one to use if the feature is enabled, and one to use if the feature is disabled. So, what we need to do, is to ensure that PACKAGECONFIG does not include “x11”. I prefer to do this using a bbappend file.

A bbappend file is used to override, or append, configuration options to an existing bb file, i.e. a package recipe. At the time of writing, the d-bus package is named dbus_1.6.18.bb, so the corresponding append file is named dbus_1.6.18.bbappend. I put it in the recipes-core/dbus subdirectory, inside the meta-diet layer.

As we want to remove the dependency on X11, I create an append file with the following line:

PACKAGECONFIG_remove = "x11"

The file is available from the meta-diet layer on github. Use the tag part-iv to get the right version.

Building the image again, we can see that the libx11-6 and libxcb references are gone from the installed-package-sizes.txt build statistics file:

8637 KiB systemd
4487 KiB udev-hwdb
3042 KiB libc6
1221 KiB e2fsprogs-e2fsck
1153 KiB shadow
789 KiB dbus-1
547 KiB kmod
532 KiB busybox
398 KiB udev
349 KiB libkmod2
297 KiB libext2fs2
296 KiB libdbus-1-3
261 KiB libmount1
249 KiB udev-utils
241 KiB libblkid1
233 KiB systemd-analyze
161 KiB liblzma5
159 KiB libexpat1
110 KiB v86d
94 KiB util-linux-fsck
86 KiB libz1
83 KiB libgcc1
36 KiB systemd-binfmt
32 KiB kernel-module-uvesafb
31 KiB util-linux-mount
31 KiB libwrap0
30 KiB libacl1
29 KiB util-linux-agetty
27 KiB libe2p2
23 KiB netbase
20 KiB kernel-3.14.0-yocto-standard
16 KiB libattr1
15 KiB libcap2
14 KiB libuuid1
11 KiB kernel-module-binfmt-misc
10 KiB libcom-err2
5 KiB update-rc.d
4 KiB update-alternatives-opkg
4 KiB base-files
3 KiB busybox-udhcpc
2 KiB shadow-securetty
2 KiB run-postinsts
1 KiB systemd-serialgetty
1 KiB busybox-syslog
0 KiB systemd-compat-units
0 KiB packagegroup-core-boot
0 KiB base-passwd

Comparing this to the previous list, we just shaved off 1423 KiB. Lets call that a success for today, and we will have a good look at udev next time.

Update! Thanks Erik, for telling me about the *_remove. I only knew about *_append. Also, fixed the quotation marks in the snippet for enabling build history. Again, well spotted by Erik.