faith's blog

気まぐれ日記

【Tizen】Jetson TK1でcrosswalkが動いた【じゃない】

こんばんは。

久しぶりの更新になります、faithです。

Linux4Tegra(Ubuntu, X11)でcrosswalkが動きました。

Aauarium (GoogleWebGLサンプルアプリ)が動きました。

特にちらつき等は発生していません。

f:id:faith0x7dc:20140909200003j:plain

fpsは安定はしていませんが、20台後半〜40台前半ぐらいですね。

X11で動いたということは、Tizenで動かなかったのは、Ozone/Wayland周りに問題があるんですかね・・・。

書き溜めておいたメモをもとに、ビルド手順を書き出しておきます。

Linux4Tegraのrootfs取得、apply_binary.sh実行については省略します。 rootfsが/path/to/rootfsにあることを前提として記載します。

また、crosswalkのcross compile方法がわからないので、 qemu-arm-staticを使用して、chroot環境でビルドします。

Core i7 4771, RAM 32GB, Intel SSD 335 Series環境でも、 一晩で終わるか終わらないかというレベルでした。 (trial & errorだったので、正確な時間はわかりませんが)

Tizen-IVI 3.0 M3-June2014のninja, crosswalkを取得

$ cd /path/to/rootfs/home/ubuntu
$ sudo mkdir work.crosswalk

$ git clone ssh://review.tizen.org/platform/upstream/ninja
$ cd ninja
$ git checkout 133f21133f7f84019b192f59b178a16d5a11365e

$ git clone ssh://review.tizen.org/platform/framework/web/crosswalk
$ cd crosswalk
$ git checkout 5fabe5fb1f490490fab842be91d0c92975631008

chroot

$ cd ~/work.tegra/crosswalk/work/rootfs
$ sudo cp /usr/bin/qemu-arm/static usr/bin
$ sudo chroot . /bin/bash

パッケージの追加インストール

chroot # apt-add-repository universe
chroot # apt-add-repository multiverse
chroot # apt-get update
chroot # apt-get install g++ g++-multilib libgtk2.0-dev libxss-dev libxtst-dev libedbus-dev libdrm-dev libgnome-keyring-dev libpci-dev libudev-dev icu-devtools libicu-dev libxml2-dev libpulse-dev libnss3-dev libxslt-dev gperf bison flex libcap-dev libasound2-dev

hack

/usr/include/zconf.hが無くてビルドエラーになるので、それを回避する為にシンボリックリンクを張る

chroot # ln -s /usr/include/arm-linux-gnueabihf/zconf.h /usr/include/zconf.h

/usr/include/libxml2/libxml/tree.hがcrosswalk内のtree.hと衝突を起こして、xmlIO.hでビルドエラーが発生するため、それを回避する為にxmlIO.hを直接修正する

--- xmlIO.h.orig        2014-09-07 14:58:13.448544350 +0900
+++ xmlIO.h     2014-09-07 14:59:05.652544547 +0900
@@ -17,6 +17,11 @@
 extern "C" {
 #endif
 
+#if 1
+typedef struct _xmlBuf xmlBuf;
+typedef xmlBuf *xmlBufPtr;
+#endif
+
 /*
  * Those are the functions and datatypes for the parser input
  * I/O structures.

normal userに切り替え

chroot # su ubuntu

ninjaのビルド

chroot $ cd ~/work.crosswalk/ninja
chroot $ python ./bootstrap.py
chroot $ mkdir ~/bin
chroot $ cp ~/bin

crosswalkのビルド

chroot $ cd ~/work.crosswalk/crosswalk
chroot $ ./build_xwalk.sh

build_xwalk.shの中身

Tizenのcrosswalkビルドログからビルド用のコマンドを抜き出したものです。

#!/bin/bash

export PATH=${HOME}/bin:${PATH}

export LANG=C
unset DISPLAY

export LD_AS_NEEDED=1
export LDFLAGS=' -Wl,--no-keep-memory'

export CFLAGS='-O2 -g2 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -fmessage-length=0 -marc
h=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=hard -g'
export CXXFLAGS='-O2 -g2 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -fmessage-length=0 -ma
rch=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=hard -g'
export FFLAGS='-O2 -g2 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -fmessage-length=0 -marc
h=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=hard -g -I%_fmoddir'

# wayland
#GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Duse_ozone=1 -Denable_ozone_wayland_vkb=1 -Denable_xdg_shell=1"

# Force gold binary from chroot ld.gold provided by binutils-gold
GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_nacl=1 -Dlinux_use_bundled_binutils=0 -Dlinux_use_bundled_gold=0 "

# Linking fails in Tizen Common when fatal ld warnings are enabled. XWALK-1379.
GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_fatal_linker_warnings=1"

GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Dsysroot= "

# --no-parallel is added because chroot does not mount a /dev/shm, this will
# cause python multiprocessing.SemLock error.
export GYP_GENERATORS='ninja'
./src/xwalk/gyp_xwalk src/xwalk/xwalk.gyp \
--no-parallel \
${GYP_EXTRA_FLAGS} \
-Dchromeos=0 \
-Dpython_ver=2.7 \
-Duse_aura=1 \
-Duse_cups=0 \
-Duse_gconf=0 \
-Duse_gnome_keyring=0 \
-Duse_kerberos=0 \
-Duse_system_bzip2=1 \
-Duse_system_libexif=1 \
-Duse_system_libxml=1 \
-Duse_system_nspr=1 \
-Denable_hidpi=1

ninja -j8 -C ./src/out/Release xwalk

実機動作

UbuntuGUIから、ターミナルを立ち上げて、以下を実行すると、 Aauariumが表示されます。

$ cd ~/work.crosswalk/crosswalk/src/out/Release
$ exec ./xwalk https://webglsamples.googlecode.com/hg/aquarium/aquarium.html