Sailfish Xiaomi kenzo port: aarch64 kernel with armv7hl rootfs

May 20, 2017


I’ve bought Xiaomi kenzo (Redmi Note 3) nextday after I’ve found XDA theme about the port and donated to Akhil (porter) to support him.

Akhil said he lost his xiaomi and stayed with some lumia, so his builds are requiring heavy testing (he just building it).

I created merproject wiki page to provide current status information.

I’ve never tried to port SFOS by myself yet, but I’ve found error with this port when using pkcon or qt creator Sailfish sdk:

Error: /home/nemo/RPMS/harbour-foobar-0.1-1.armv7hl.rpm has wrong architecture: armv7hl

But zypper worked fine (zypper, Jolla Store, WareHouse)


I’ve searched for code: for the pkcon backend backend_install_files_thread method:

    // check if the file has an acceptable architecture 
    if (rpmHeader->tag_arch() != ZConfig::defaultSystemArchitecture () &&
        rpmHeader->tag_arch() != Arch_noarch && 
        ! system_and_package_are_x86 (rpmHeader->tag_arch ())) {
            zypp_backend_finished_error (job, PK_ERROR_ENUM_LOCAL_INSTALL_FAILED,
            "%s has wrong architecture: %s", full_paths[i],
            rpmHeader->tag_arch ().asString (). c_str());

where system_and_package_are_x86 is some very stange method (because there are better separated compability methods in PackageKit afaik), but we are on ARM, so we are more interested in ZConfig::defaultSystemArchitecture ():

it is located in libzypp library, which are actually is outdated a little bit if you look at the port:

$ zypper if libzypp:

    Version: 12.2.0+git5...

so I’ve searched for 12.2.0+git5 tag and found it, there’s a defaultSystemArchitecture() method, which is requesting _autodetectSystemArchitecture() method with the part for ARM:

    Arch architecture( buf.machine );       MIL << "Uname architecture is '" << buf.machine << "'" << endl;
    else if ( architecture == Arch_armv7l || architecture == Arch_armv6l )   {
        std::ifstream platform( "/etc/rpm/platform" );
        if (platform) 	{
            for( iostr::EachLine in( platform ); in; ) {
                if ( str::hasPrefix( *in, "armv7hl-" ) ) {
                    architecture = Arch_armv7hl;
                    WAR << "/etc/rpm/platform contains armv7hl-: architecture upgraded to '" <<
                        architecture << "'" << endl;
                if ( str::hasPrefix( *in, "armv6hl-" ) ) {

my /etc/rpm/platform contains apropriate architecture info:


but uname -m is returning:


I guess it’s because my kernel is aarch64, but rootfs is armv7hl. And I’m not sure why some guys from redhat bugzilla declaring they are incompatible (maybe I’m missing something)

anyway, current libzypp is outdated, so there’s no headers for aarch64.

I’ve tried to build it from master merproject core branch, but updated boost-devel and libsolv-devel are required for that too.

So I’ve decided to patch it according to this example from vanilla libzypp manually with quilt

As you can see, there’s no autodetect support for aarch64 even for vanilla git opensuse branch of libzypp.

Don’t know why yet, but will try to figure it out.


So I’ve decided to add additional arch check manually for now at

    else if ( architecture == Arch_armv7l || architecture == Arch_armv6l || architecture == Arch_aarm64)

and added mentioned headers.

I’ve tried to build it manually via mer-sdk:

    # as user mersdk
    ssh -p 2222 -i ~/SailfishOS/vmshare/ssh/private_keys/engine/mersdk mersdk@localhost
    # Phone
    sb2 -t SailfishOS-armv7hl -R -m sdk-install
    git clone ...
    git submodule update --init --recursive

but it asked a lot of time with my laptop. So I’ve forked current legacy repo and used my obs account to build it.

Anyway, everything worked!

I’ve installed rpm with zypper and pkcon started working.

Now I’m able to use qt creator SDK without any problems with RPM deployment! :)

Future work

I’m archlinux user, so this environmet is not familiar for me yet.

And maybe I’m missing something general about ARM architecture.

Going to ask Andrew Branson about current status and will try to contribute to apropriate solution.

 █████╗  █████╗  ██╗██████╗  ██████╗ 
███████║███████║╚██║ █████╔╝██║   ██║
██╔══██║██╔══██║ ██║ ╚═══██╗██║▄▄ ██║
██║  ██║██║  ██║ ██║██████╔╝╚██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝ ╚═╝╚═════╝  ╚══▀▀═╝