| 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. |
| 11 #@ It does NOT provide the actual cross compiler anymore. | 11 #@ It does NOT provide the actual cross compiler anymore. |
| 12 #@ The cross compiler is now comming straight from a debian package. | 12 #@ The cross compiler is now comming straight from a debian package. |
| 13 #@ So there is a one-time step required for all machines using this TC. | 13 #@ So there is a one-time step required for all machines using this TC. |
| 14 #@ Which is especially true for build-bots: | 14 #@ Which is especially true for build-bots: |
| 15 #@ | 15 #@ |
| 16 #@ tools/trusted_cross_toolchains/trusted-toolchain-creator.armel.precise.sh I
nstallCrossArmBasePackages | 16 #@ tools/trusted_cross_toolchains/trusted-toolchain-creator.armel.precise.sh I
nstallCrossArmBasePackages |
| 17 #@ | 17 #@ |
| 18 #@ | 18 #@ |
| 19 #@ Generally this script is invoked as: | 19 #@ Generally this script is invoked as: |
| 20 #@ tools/trusted_cross_toolchains/trusted-toolchain-creator.armel.precise.sh <m
ode> <args>* | 20 #@ tools/trusted_cross_toolchains/trusted-toolchain-creator.armel.precise.sh <m
ode> <args>* |
| 21 #@ Available modes are shown below. | 21 #@ Available modes are shown below. |
| 22 #@ | 22 #@ |
| 23 #@ | 23 #@ This Toolchain was tested with Ubuntu Precise |
| 24 #@ This Toolchain was tested with Ubuntu Lucid | |
| 25 #@ | 24 #@ |
| 26 #@ Usage of this TC: | 25 #@ Usage of this TC: |
| 27 #@ compile: arm-linux-gnueabi-gcc -march=armv7-a -isystem ${JAIL}/usr/include | 26 #@ compile: arm-linux-gnueabi-gcc -march=armv7-a -isystem ${JAIL}/usr/include |
| 28 #@ link: arm-linux-gnueabi-gcc -L${JAIL}/usr/lib -L${JAIL}/usr/lib/arm-linux
-gnueabi | 27 #@ link: arm-linux-gnueabi-gcc -L${JAIL}/usr/lib -L${JAIL}/usr/lib/arm-linux
-gnueabi |
| 29 #@ -L${JAIL}/lib -L${JAIL}/lib/arm-linux-gnueabi | 28 #@ -L${JAIL}/lib -L${JAIL}/lib/arm-linux-gnueabi |
| 30 #@ | 29 #@ |
| 31 #@ Usage of QEMU | 30 #@ Usage of QEMU |
| 32 #@ TBD | 31 #@ TBD |
| 33 #@ | 32 #@ |
| 34 #@ List of modes: | 33 #@ List of modes: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 54 ###################################################################### | 53 ###################################################################### |
| 55 # Package Config | 54 # Package Config |
| 56 ###################################################################### | 55 ###################################################################### |
| 57 | 56 |
| 58 # this where we get the cross toolchain from for the manual install: | 57 # this where we get the cross toolchain from for the manual install: |
| 59 readonly CROSS_ARM_TC_REPO=http://archive.ubuntu.com/ubuntu | 58 readonly CROSS_ARM_TC_REPO=http://archive.ubuntu.com/ubuntu |
| 60 # this is where we get all the armel packages from | 59 # this is where we get all the armel packages from |
| 61 readonly ARMEL_REPO=http://ports.ubuntu.com/ubuntu-ports | 60 readonly ARMEL_REPO=http://ports.ubuntu.com/ubuntu-ports |
| 62 | 61 |
| 63 readonly PACKAGE_LIST="${ARMEL_REPO}/dists/precise/main/binary-armel/Packages.bz
2" | 62 readonly PACKAGE_LIST="${ARMEL_REPO}/dists/precise/main/binary-armel/Packages.bz
2" |
| 63 readonly PACKAGE_LIST2="${ARMEL_REPO}/dists/precise-security/main/binary-armel/P
ackages.bz2" |
| 64 | 64 |
| 65 # Packages for the host system | 65 # Packages for the host system |
| 66 # NOTE: at one point we should get rid of the 4.5 packages | 66 # NOTE: at one point we should get rid of the 4.5 packages |
| 67 readonly CROSS_ARM_TC_PACKAGES="\ | 67 readonly CROSS_ARM_TC_PACKAGES="\ |
| 68 libc6-armel-cross \ | 68 libc6-armel-cross \ |
| 69 libc6-dev-armel-cross \ | 69 libc6-dev-armel-cross \ |
| 70 libgcc1-armel-cross \ | 70 libgcc1-armel-cross \ |
| 71 libgomp1-armel-cross \ | 71 libgomp1-armel-cross \ |
| 72 linux-libc-dev-armel-cross \ | 72 linux-libc-dev-armel-cross \ |
| 73 libgcc1-dbg-armel-cross \ | 73 libgcc1-dbg-armel-cross \ |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 # | 523 # |
| 524 # Looks up package names in ${TMP}/Packages and write list of URLs | 524 # Looks up package names in ${TMP}/Packages and write list of URLs |
| 525 # to output file. | 525 # to output file. |
| 526 # | 526 # |
| 527 GeneratePackageList() { | 527 GeneratePackageList() { |
| 528 local output_file=$1 | 528 local output_file=$1 |
| 529 echo "Updating: ${output_file}" | 529 echo "Updating: ${output_file}" |
| 530 /bin/rm -f ${output_file} | 530 /bin/rm -f ${output_file} |
| 531 shift | 531 shift |
| 532 for pkg in $@ ; do | 532 for pkg in $@ ; do |
| 533 local pkg_full=$(grep -A 1 "${pkg}\$" ${TMP}/Packages | egrep -o "pool/.*") | 533 local pkg_full=$(grep -A 1 "${pkg}\$" ${TMP}/Packages | tail -1 | egrep -o "
pool/.*") |
| 534 if [[ -z ${pkg_full} ]]; then | 534 if [[ -z ${pkg_full} ]]; then |
| 535 echo "ERROR: missing package: $pkg" | 535 echo "ERROR: missing package: $pkg" |
| 536 exit 1 | 536 exit 1 |
| 537 fi | 537 fi |
| 538 echo $pkg_full | sed "s/^pool\///" >> $output_file | 538 echo $pkg_full | sed "s/^pool\///" >> $output_file |
| 539 done | 539 done |
| 540 # sort -o does an in-place sort of this file | 540 # sort -o does an in-place sort of this file |
| 541 sort $output_file -o $output_file | 541 sort $output_file -o $output_file |
| 542 } | 542 } |
| 543 | 543 |
| 544 #@ | 544 #@ |
| 545 #@ UpdatePackageLists | 545 #@ UpdatePackageLists |
| 546 #@ | 546 #@ |
| 547 #@ Regenerate the armel package lists such that they contain an up-to-date | 547 #@ Regenerate the armel package lists such that they contain an up-to-date |
| 548 #@ list of URLs within the ubuntu archive. | 548 #@ list of URLs within the ubuntu archive. |
| 549 #@ | 549 #@ |
| 550 UpdatePackageLists() { | 550 UpdatePackageLists() { |
| 551 local package_list="${TMP}/Packages.precise.bz2" | 551 local package_list="${TMP}/Packages.precise.bz2" |
| 552 local package_list2="${TMP}/Packages.precise-security.bz2" |
| 552 DownloadOrCopy ${PACKAGE_LIST} ${package_list} | 553 DownloadOrCopy ${PACKAGE_LIST} ${package_list} |
| 553 bzcat ${package_list} | egrep '^(Package:|Filename:)' > ${TMP}/Packages | 554 DownloadOrCopy ${PACKAGE_LIST2} ${package_list2} |
| 555 bzcat ${package_list} ${package_list2} | egrep '^(Package:|Filename:)' > ${TMP
}/Packages |
| 554 | 556 |
| 555 GeneratePackageList ${ARMEL_BASE_DEP_LIST} "${ARMEL_BASE_PACKAGES}" | 557 GeneratePackageList ${ARMEL_BASE_DEP_LIST} "${ARMEL_BASE_PACKAGES}" |
| 556 GeneratePackageList ${ARMEL_EXTRA_DEP_LIST} "${ARMEL_EXTRA_PACKAGES}" | 558 GeneratePackageList ${ARMEL_EXTRA_DEP_LIST} "${ARMEL_EXTRA_PACKAGES}" |
| 557 } | 559 } |
| 558 | 560 |
| 559 if [[ $# -eq 0 ]] ; then | 561 if [[ $# -eq 0 ]] ; then |
| 560 echo "ERROR: you must specify a mode on the commandline" | 562 echo "ERROR: you must specify a mode on the commandline" |
| 561 echo | 563 echo |
| 562 Usage | 564 Usage |
| 563 exit -1 | 565 exit -1 |
| 564 elif [[ "$(type -t $1)" != "function" ]]; then | 566 elif [[ "$(type -t $1)" != "function" ]]; then |
| 565 echo "ERROR: unknown function '$1'." >&2 | 567 echo "ERROR: unknown function '$1'." >&2 |
| 566 echo "For help, try:" | 568 echo "For help, try:" |
| 567 echo " $0 help" | 569 echo " $0 help" |
| 568 exit 1 | 570 exit 1 |
| 569 else | 571 else |
| 570 ChangeDirectory | 572 ChangeDirectory |
| 571 SanityCheck | 573 SanityCheck |
| 572 "$@" | 574 "$@" |
| 573 fi | 575 fi |
| OLD | NEW |