aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-24 20:22:34 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-24 20:22:34 +0000
commitf84722e47772f130d523254df2b4ed276b3f1432 (patch)
treebd1154ed62e437a1750dcda379b20e66c0d24fd0 /platform_tools
parentb48be71be1ce8637621e626f10aa7c3ad7d536c3 (diff)
Build Skia for a bare-bones embedded Linux system.
Motivation: I have downloaded a barebones Linux system built for 64-bit ARM from linaro.org and a ARMv8 Foundation Model from arm.com to run it on. This will let us build and test Skia on ARM64 before we aquire hardware to allow that. This CL introduces the changes to the build files necessary to build Skia on a barebones embedded Linux system. I tested it with the aarch64 GCC compiler provided by linaro.org. Changes: Add a "barelinux" target_os for the DEPS file. Add an optional git download of zlib. Changes to gyp files: these changes abstract out libpng, libz, and giflib so that images.gyp doesn't know whether they are static or dynamically linked. I also add the variables skia_giflib_static, skia_libpng_static, skia_zlib_static, and skia_freetype_static, all of which default to false but when set to true will override the behavior of the giflib, libpng, zlib, and freetype build targets to require them to build statically. Also, the skia_no_fontconfig variable turns off use of the fontconfig service. Scripts in platform_tools/barelinux/bin: arm64_download - this script downloads the Linaro's ARMv8 Aarch64 toolchain and minimal embedded Linux system as well as ARM's foundation model. The required files are mirrored on Google Cloud. The script then starts a emulated Arm64 Linux system in the background. After the boot is complete, you can SSH into the system at port 8022 via user@localhost. The SSH key will be downloaded into the working directery as well. download_deps - Uses gclient to download Skia's dependencies for a bare Linux system (the normal dependecies plus giflib, libpng, and zlib.) barelinux_make - this script builds a version of skia that does not depend on external libraries, perfect for putting in an embedded system running Linux. Assumes you have run download_deps first. To test: To build a barelinux target, use the barelinux_make script. To build for a armv8 system: skia_arch_type=arm arm_neon=0 armv7=1 armv8=1 arm_thumb=0 skia_arch_width=64 and set the CC and CXX variables to point at the cross-compiler downloaded by arm64_download. R=djsollen@google.com, scroggo@google.com, borenet@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/152513007 git-svn-id: http://skia.googlecode.com/svn/trunk@13570 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'platform_tools')
-rwxr-xr-xplatform_tools/barelinux/bin/arm64_download167
-rwxr-xr-xplatform_tools/barelinux/bin/barelinux_make96
-rwxr-xr-xplatform_tools/barelinux/bin/download_deps29
3 files changed, 292 insertions, 0 deletions
diff --git a/platform_tools/barelinux/bin/arm64_download b/platform_tools/barelinux/bin/arm64_download
new file mode 100755
index 0000000000..598ee89452
--- /dev/null
+++ b/platform_tools/barelinux/bin/arm64_download
@@ -0,0 +1,167 @@
+#!/bin/sh
+
+# Copyright 2014 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+usage() {
+ cat >&2 <<EOF
+arm64_download - this script downloads the Linaro's ARMv8 Aarch64
+toolchain and minimal embedded Linux system as well as ARM's
+foundation model. The required files are mirrored on Google Cloud.
+
+If the files are already located in the working directory, the
+download can be skipped if the checksums match.
+
+The script then starts a emulated Arm64 Linux system in the
+background. After the boot is complete, you can SSH into the system
+at port 8022 via user@localhost. The SSH key will be downloaded into
+the working directery as well.
+
+Requires gsutil, xz, tar, and gunzip.
+
+Usage:
+ $0 WORKING_DIRECTORY
+ ssh-add WORKING_DIRECTORY/key
+ ...wait...
+ ssh -p 8022 user@localhost
+EOF
+ return 1
+}
+
+try() {
+ # print an error on nonzero return code
+ "$@"
+ local ret=$?
+ if [ $ret != 0 ] ; then
+ echo "'$@' failed and returned ${ret}." >&2
+ return $ret
+ fi
+}
+
+gsutil_check_get() {
+ local gurl="$1"
+ local file="$2"
+ if ! [ -f "$file" ] || \
+ [ "$(gsutil stat "$gurl" | sed -n 's/\W*Hash (md5):\W*//p')" \
+ != "$(md5sum < "$file" | sed 's/\W*-//')" ] ; then
+ try gsutil cp "$gurl" "$file" || return
+ fi
+}
+
+download_compiler() {
+ local working_dir="$1"
+ local location="$2"
+ local toolchain="$3"
+
+ try cd "$working_dir" || return
+
+ try gsutil_check_get "gs://${location}/${toolchain}.tar.xz" \
+ "${working_dir}/${toolchain}.tar.xz" || return
+ (
+ cd "$working_dir"
+ xz --decompress --stdout < "${toolchain}.tar.xz" | tar xf -
+ )
+ local dir="${working_dir}/${toolchain}"
+ try test -d "$dir" || return
+ try test -x "${dir}/bin/aarch64-linux-gnu-gcc" || return
+ try test -x "${dir}/bin/aarch64-linux-gnu-g++" || return
+}
+
+download_runtime() {
+ local working_dir="$1"
+ local location="$2"
+ local firmware="$3"
+ local compressed_rootfs="$4"
+ local compressed_foundation_model="$5"
+ local keyfile="$6"
+
+ try gsutil_check_get "gs://${location}/${firmware}" \
+ "${working_dir}/firmware" || return
+
+ try gsutil_check_get "gs://${location}/${compressed_rootfs}" \
+ "${working_dir}/${compressed_rootfs}" || return
+
+ try xz --decompress --stdout \
+ < "${working_dir}/${compressed_rootfs}" \
+ > "${working_dir}/rootfs" || return
+ try test -f "${working_dir}/rootfs" || return
+
+ try gsutil_check_get "gs://${location}/${compressed_foundation_model}" \
+ "${working_dir}/${compressed_foundation_model}" || return
+ (
+ try cd "$working_dir" || return
+ try gunzip -c "$compressed_foundation_model" | try tar xf - || return
+ try test -d "Foundation_v8pkg" || return # Assert.
+ )
+
+ try gsutil_check_get "gs://${location}/${keyfile}" \
+ "${working_dir}/key" || return
+ chmod go= "${working_dir}/key"
+}
+
+start_arm64_image() {
+ local working_dir="$1"
+ local foundation_dir="${working_dir}/Foundation_v8pkg"
+ local foundation="${foundation_dir}/models/Linux64_GCC-4.1/Foundation_v8"
+ local firmware="${working_dir}/firmware"
+ local rootfs="${working_dir}/rootfs"
+
+ try test -d "$foundation_dir" || return
+ try test -x "$foundation" || return
+ try test -f "$firmware" || return
+ try test -f "$rootfs" || return
+
+ for PID in $(ps -o 'pid=' -C 'Foundation_v8') ; do
+ kill $PID
+ done
+
+ DISPLAY='' nohup \
+ "$foundation" \
+ --image="${firmware}" \
+ --cores=4 \
+ --block-device="${rootfs}" \
+ --network="nat" \
+ --network-nat-subnet="192.168.31.0/24" \
+ --network-nat-ports="8022=22" \
+ > /dev/null 2>&1 &
+ echo 'Listening to SSH on port 8022.'
+}
+
+arm64_download() {
+ local working_directory="$1"
+ local location="chromium-skia-gm/arm64env"
+ try mkdir -p "$working_directory" || return
+
+ try download_compiler \
+ "$working_directory" \
+ "$location" \
+ 'gcc-linaro-aarch64-linux-gnu-4.8-2013.12_linux' \
+ || return
+
+ local rootfs='vexpress64-openembedded_lamp-armv8-gcc-4.8_20131215-557'
+ try download_runtime \
+ "$working_directory" \
+ "$location" \
+ 'img-foundation.axf' \
+ "${rootfs}.img.CLEAN_AND_CONFIGURED.xz" \
+ 'FM000-KT-00035-r0p8-52rel06.tgz' \
+ 'CLEAN_AND_CONFIGURED_key' \
+ || return
+
+ try start_arm64_image \
+ "$working_directory" \
+ || return
+
+}
+
+for command in gsutil xz tar gunzip; do
+ try command -v "$command" > /dev/null || usage || exit
+done
+
+if [ -z "$1" ] ; then
+ usage || exit
+fi
+try arm64_download "$1" || exit
diff --git a/platform_tools/barelinux/bin/barelinux_make b/platform_tools/barelinux/bin/barelinux_make
new file mode 100755
index 0000000000..03e1a4cbd2
--- /dev/null
+++ b/platform_tools/barelinux/bin/barelinux_make
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+# Copyright 2014 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+usage() {
+ cat >&2 <<EOF
+barelinux_make - this script builds a version of skia that does not
+depend on external libraries, perfect for putting in an embedded
+system running Linux.
+
+Assumes that you have already run the download_deps script.
+
+Usage:
+ $0 \\
+ [-o SKIA_OUT_DIR] [-c CC_EXE] [-x CXX_EXE] \\
+ [-t Debug | Release | Coverage | Release_Developer]\\
+ [GYP_DEFINES...]
+
+Example use:
+ $0 \\
+ -o ~/build/skia/arg64gcc \\
+ -c ~/local/arm64/bin/aarch64-linux-gnu-gcc \\
+ -x ~/local/arm64/bin/aarch64-linux-gnu-g++ \\
+ skia_gpu=0 skia_arch_type=arm skia_arch_width=64 \\
+ armv7=1 armv8=1 arm_neon=0 arm_thumb=0
+EOF
+ return 1
+}
+
+# BUILD_TYPE should be one of:
+# Coverage, Debug, Release, or Release_Developer
+BUILD_TYPE='Debug'
+
+unset OPTIND
+while getopts ":c:x:o:h" opt ; do
+ case $opt in
+ c) export CC="$OPTARG" ;;
+ x) export CXX="$OPTARG" ;;
+ o) export SKIA_OUT="$OPTARG";;
+ t) BUILD_TYPE="$OPTARG";;
+ h) usage || exit;;
+ ?) echo "unknown option '$OPTARG'" >&2;
+ usage || exit;;
+ esac
+done
+# Append exra arguments to GYP_DEFINES variable.
+shift $(( $OPTIND - 1 ))
+GYP_DEFINES="${GYP_DEFINES} $*"
+
+# If you move this script, this must be changed.
+SKIA_SRC_DIR="$(cd "$(dirname "$0")/../../.."; pwd)"
+
+try() {
+ # exit shell script on nonzero return code
+ "$@"
+ local ret=$?
+ if [ $ret != 0 ] ; then
+ echo "'$@' failed and returned ${ret}." >&2
+ return $ret
+ fi
+}
+is_set() {
+ test "$1" && test "$(eval echo \${$1})";
+}
+
+# Set a reasonable default.
+is_set SKIA_OUT || export SKIA_OUT="${SKIA_SRC_DIR}/out/barelinux"
+
+# Assume ninja is in your path
+try command -v ninja > /dev/null || exit
+
+try test -x "${SKIA_SRC_DIR}/gyp_skia" || exit
+try mkdir -p "$SKIA_OUT" || exit
+
+export GYP_GENERATORS="ninja"
+export GYP_GENERATOR_FLAGS=""
+export GYP_DEFINES="${GYP_DEFINES} \
+ skia_warnings_as_errors=0 \
+ skia_giflib_static=1 \
+ skia_libpng_static=1 \
+ skia_zlib_static=1 \
+ skia_freetype_static=1 \
+ skia_no_fontconfig=1 \
+ skia_poppler_enabled=0 \
+ skia_skip_gui=1 \
+ "
+
+try "${SKIA_SRC_DIR}/gyp_skia" || exit
+
+try test -d "${SKIA_OUT}/${BUILD_TYPE}" || exit
+
+try ninja -C "${SKIA_OUT}/${BUILD_TYPE}" || exit
+
diff --git a/platform_tools/barelinux/bin/download_deps b/platform_tools/barelinux/bin/download_deps
new file mode 100755
index 0000000000..06769613b3
--- /dev/null
+++ b/platform_tools/barelinux/bin/download_deps
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Copyright 2014 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# download_deps - download Skia's dependencies for a bare Linux system
+# (the normal dependecies plus giflib, libpng, and zlib.)
+
+try() {
+ # print an error on nonzero return code
+ "$@"
+ local ret=$?
+ if [ $ret != 0 ] ; then
+ echo "'$@' failed and returned ${ret}." >&2
+ return $ret
+ fi
+}
+
+try command -v gclient > /dev/null || exit
+cd "$(dirname "$0")/../../.."
+
+try gclient config --unmanaged --name . \
+ 'https://skia.googlesource.com/skia.git' || exit
+
+echo 'target_os = ["barelinux"]' >> ./.gclient
+
+try gclient sync --jobs=1 || exit