Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 #@ This script builds the (trusted) cross toolchain for arm. | 6 #@ This script builds the (trusted) cross toolchain for arm. |
| 7 #@ It must be run from the native_client/ directory. | 7 #@ It must be run from the native_client/ directory. |
| 8 #@ | 8 #@ |
| 9 #@ The toolchain consists primarily of a jail with arm header and libraries. | 9 #@ The toolchain consists primarily of a jail with arm header and libraries. |
| 10 #@ It also provides additional tools such as QEMU. | 10 #@ It also provides additional tools such as QEMU. |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 # Historic Notes: | 399 # Historic Notes: |
| 400 # Traditionally we were builidng static 32 bit images of qemu on a | 400 # Traditionally we were builidng static 32 bit images of qemu on a |
| 401 # 64bit system which would run then on both x86-32 and x86-64 systems. | 401 # 64bit system which would run then on both x86-32 and x86-64 systems. |
| 402 # The latest version of qemu contains new dependencies which | 402 # The latest version of qemu contains new dependencies which |
| 403 # currently make it impossible to build such images on 64bit systems | 403 # currently make it impossible to build such images on 64bit systems |
| 404 # We can build a static 64bit qemu but it does not work with | 404 # We can build a static 64bit qemu but it does not work with |
| 405 # the sandboxed translators for unknown reason. | 405 # the sandboxed translators for unknown reason. |
| 406 # So instead we chose to build 32bit shared images. | 406 # So instead we chose to build 32bit shared images. |
| 407 # | 407 # |
| 408 | 408 |
| 409 readonly QEMU_TARBALL=$(readlink -f ../third_party/qemu/qemu-1.0.1.tar.gz) | 409 readonly QEMU_TARBALL=qemu-1.0.1.tar.gz |
| 410 readonly QEMU_PATCH=$(readlink -f ../third_party/qemu/qemu-1.0.1.patch_arm) | 410 readonly QEMU_SHA=4d08b5a83538fcd7b222bec6f1c584da8d12497a |
| 411 readonly QEMU_DIR=qemu-1.0.1 | 411 readonly QEMU_DIR=qemu-1.0.1 |
| 412 | 412 |
| 413 # TODO(sbc): update to version 2.3.0 | |
| 414 #readonly QEMU_TARBALL=qemu-2.3.0.tar.bz2 | |
| 415 #readonly QEMU_SHA=373d74bfafce1ca45f85195190d0a5e22b29299e | |
| 416 #readonly QEMU_DIR=qemu-2.3.0 | |
| 417 | |
| 418 readonly QEMU_URL=http://wiki.qemu-project.org/download/${QEMU_TARBALL} | |
| 419 readonly QEMU_PATCH=$(readlink -f ../third_party/qemu/${QEMU_DIR}.patch_arm) | |
| 420 | |
| 421 | |
| 413 BuildAndInstallQemu() { | 422 BuildAndInstallQemu() { |
| 414 local saved_dir=$(pwd) | 423 local saved_dir=$(pwd) |
| 415 local tmpdir="${TMP}/qemu.nacl" | 424 local tmpdir="${TMP}/qemu.nacl" |
| 416 | 425 |
| 426 set -x | |
| 417 Banner "Building qemu in ${tmpdir}" | 427 Banner "Building qemu in ${tmpdir}" |
| 418 | 428 |
| 419 if [[ -z "$QEMU_TARBALL" ]] ; then | 429 if [ -n "${QEMU_URL}" ]; then |
| 420 echo "ERROR: missing qemu tarball: ../third_party/qemu/qemu-1.0.1.tar.gz" | 430 if [[ ! -f ${TMP}/${QEMU_TARBALL} ]]; then |
| 421 exit 1 | 431 wget -O ${TMP}/${QEMU_TARBALL} $QEMU_URL |
|
bradn
2015/04/28 20:46:16
curl?
Sam Clegg
2015/04/28 21:08:32
Any reason why thats better?
bradn
2015/04/28 21:11:08
consistency, I thought we use curl in most places.
| |
| 432 fi | |
| 433 | |
| 434 echo "${QEMU_SHA} ${TMP}/${QEMU_TARBALL}" | sha1sum --check - | |
| 435 else | |
| 436 if [[ ! -f "$QEMU_TARBALL" ]] ; then | |
| 437 echo "ERROR: missing qemu tarball: $QEMU_TARBALL" | |
| 438 exit 1 | |
| 439 fi | |
| 422 fi | 440 fi |
| 423 | 441 |
| 424 rm -rf ${tmpdir} | 442 rm -rf ${tmpdir} |
| 425 mkdir ${tmpdir} | 443 mkdir ${tmpdir} |
| 426 cd ${tmpdir} | 444 cd ${tmpdir} |
| 427 SubBanner "Untaring ${QEMU_TARBALL}" | 445 SubBanner "Untaring ${QEMU_TARBALL}" |
| 428 tar zxf ${QEMU_TARBALL} | 446 tar xf ${TMP}/${QEMU_TARBALL} |
| 429 cd ${QEMU_DIR} | 447 cd ${QEMU_DIR} |
| 430 | 448 |
| 431 SubBanner "Patching ${QEMU_PATCH}" | 449 SubBanner "Patching ${QEMU_PATCH}" |
| 432 patch -p1 < ${QEMU_PATCH} | 450 patch -p1 < ${QEMU_PATCH} |
| 433 | 451 |
| 434 SubBanner "Configuring" | 452 SubBanner "Configuring" |
| 435 env -i PATH=/usr/bin/:/bin LIBS=-lrt \ | 453 env -i PATH=/usr/bin/:/bin LIBS=-lrt \ |
| 436 ./configure \ | 454 ./configure \ |
| 437 --extra-cflags="-m32" \ | 455 --extra-cflags="-m32" \ |
| 438 --extra-ldflags="-Wl,-rpath=/lib32" \ | |
| 439 --disable-system \ | 456 --disable-system \ |
| 440 --disable-docs \ | 457 --disable-docs \ |
| 441 --enable-linux-user \ | 458 --enable-linux-user \ |
| 442 --disable-darwin-user \ | |
| 443 --disable-bsd-user \ | 459 --disable-bsd-user \ |
| 444 --target-list=arm-linux-user \ | 460 --target-list=arm-linux-user \ |
| 445 --disable-smartcard-nss \ | 461 --disable-smartcard-nss \ |
| 446 --disable-sdl | 462 --disable-sdl |
| 447 | 463 |
| 448 # see above for why we can no longer use -static | 464 # see above for why we can no longer use -static |
| 449 # --static | 465 # --static |
| 450 | 466 |
| 451 SubBanner "Make" | 467 SubBanner "Make" |
| 452 env -i PATH=/usr/bin/:/bin \ | 468 env -i PATH=/usr/bin/:/bin V=99 make MAKE_OPTS=${MAKE_OPTS} |
| 453 V=99 make MAKE_OPTS=${MAKE_OPTS} | |
| 454 | 469 |
| 455 SubBanner "Install ${INSTALL_ROOT}" | 470 SubBanner "Install ${INSTALL_ROOT}" |
| 456 cp arm-linux-user/qemu-arm ${INSTALL_ROOT} | 471 cp arm-linux-user/qemu-arm ${INSTALL_ROOT} |
| 457 cd ${saved_dir} | 472 cd ${saved_dir} |
| 458 cp tools/trusted_cross_toolchains/qemu_tool_arm.sh ${INSTALL_ROOT} | 473 cp tools/trusted_cross_toolchains/qemu_tool_arm.sh ${INSTALL_ROOT} |
| 459 ln -sf qemu_tool_arm.sh ${INSTALL_ROOT}/run_under_qemu_arm | 474 ln -sf qemu_tool_arm.sh ${INSTALL_ROOT}/run_under_qemu_arm |
| 460 } | 475 } |
| 461 | 476 |
| 462 #@ | 477 #@ |
| 463 #@ BuildJail <tarball-name> | 478 #@ BuildJail <tarball-name> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 elif [[ "$(type -t $1)" != "function" ]]; then | 537 elif [[ "$(type -t $1)" != "function" ]]; then |
| 523 echo "ERROR: unknown function '$1'." >&2 | 538 echo "ERROR: unknown function '$1'." >&2 |
| 524 echo "For help, try:" | 539 echo "For help, try:" |
| 525 echo " $0 help" | 540 echo " $0 help" |
| 526 exit 1 | 541 exit 1 |
| 527 else | 542 else |
| 528 ChangeDirectory | 543 ChangeDirectory |
| 529 SanityCheck | 544 SanityCheck |
| 530 "$@" | 545 "$@" |
| 531 fi | 546 fi |
| OLD | NEW |