summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorsbc <sbc@chromium.org>2015-04-10 15:38:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-10 22:39:28 +0000
commit11ef8b42644fbc8426838d9032bc073c010a98a4 (patch)
treed066fd9ae37d971cf1e08a068674a9680afcf51e /native_client_sdk
parent193bfb62b066894a13b56c8bc780571af4a5b59e (diff)
downloadchromium_src-11ef8b42644fbc8426838d9032bc073c010a98a4.zip
chromium_src-11ef8b42644fbc8426838d9032bc073c010a98a4.tar.gz
chromium_src-11ef8b42644fbc8426838d9032bc073c010a98a4.tar.bz2
[NaCl SDK] Add ARM linux libraries for running sel_ldr under qemu
Previously we were relying on the user having both qemu and and an ARM sysroot image. Since sel_ldr only requires a few system libraries to run we can simply ship them with the SDK. BUG=475992 CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:linux_nacl_sdk;tryserver.chromium.mac:mac_nacl_sdk TEST=nacl_io_test$ make NACL_ARCH=arm TOOLCHAIN=newlib STANDALONE=1 run Review URL: https://codereview.chromium.org/936163002 Cr-Commit-Position: refs/heads/master@{#324698}
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-xnative_client_sdk/src/build_tools/build_sdk.py54
-rw-r--r--native_client_sdk/src/build_tools/sdk_files.list8
-rwxr-xr-xnative_client_sdk/src/tools/sel_ldr.py17
3 files changed, 65 insertions, 14 deletions
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py
index 4cb9d53..f424d3d 100755
--- a/native_client_sdk/src/build_tools/build_sdk.py
+++ b/native_client_sdk/src/build_tools/build_sdk.py
@@ -170,14 +170,24 @@ def BuildStepDownloadToolchains(toolchains):
if 'bionic' in toolchains:
build_platform = '%s_x86' % getos.GetPlatform()
args.extend(['--append', os.path.join(build_platform, 'nacl_arm_bionic')])
+ if getos.GetPlatform() == 'linux':
+ # TODO(sbc): remove this once this change makes it into chrome
+ # https://codereview.chromium.org/1080513003/
+ args.extend(['--append', 'arm_trusted'])
args.extend(['sync', '--extract'])
buildbot_common.Run(args, cwd=NACL_DIR)
def BuildStepCleanPepperDirs(pepperdir, pepperdir_old):
buildbot_common.BuildStep('Clean Pepper Dirs')
- buildbot_common.RemoveDir(pepperdir_old)
- buildbot_common.RemoveDir(pepperdir)
+ dirs_to_remove = (
+ pepperdir,
+ pepperdir_old,
+ os.path.join(OUT_DIR, 'arm_trusted')
+ )
+ for dirname in dirs_to_remove:
+ if os.path.exists(dirname):
+ buildbot_common.RemoveDir(dirname)
buildbot_common.MakeDir(pepperdir)
@@ -234,6 +244,12 @@ def BuildStepUntarToolchains(pepperdir, toolchains):
tcname % {'platform': platform})
extract_packages.append(package_tuple)
+
+ # On linux we also want to extract the arm_trusted package which contains
+ # the ARM libraries we ship in support of sel_ldr_arm.
+ if platform == 'linux':
+ extract_packages.append((os.path.join(build_platform, 'arm_trusted'),
+ 'arm_trusted'))
if extract_packages:
# Extract all of the packages into the temp directory.
package_names = [package_tuple[0] for package_tuple in extract_packages]
@@ -1019,6 +1035,7 @@ def main(args):
options.build_app_engine = False
print 'Building: ' + ' '.join(toolchains)
+ platform = getos.GetPlatform()
if options.archive and not options.tar:
parser.error('Incompatible arguments with archive.')
@@ -1033,7 +1050,7 @@ def main(args):
if options.bionic:
tarname = 'naclsdk_bionic.tar.bz2'
else:
- tarname = 'naclsdk_' + getos.GetPlatform() + '.tar.bz2'
+ tarname = 'naclsdk_%s.tar.bz2' % platform
tarfile = os.path.join(OUT_DIR, tarname)
if options.release:
@@ -1059,6 +1076,31 @@ def main(args):
oshelpers.Copy(['-r', srcdir, bionicdir])
else:
BuildStepUntarToolchains(pepperdir, toolchains)
+ if platform == 'linux':
+ buildbot_common.Move(os.path.join(pepperdir, 'toolchain', 'arm_trusted'),
+ os.path.join(OUT_DIR, 'arm_trusted'))
+
+
+ if platform == 'linux':
+ # Linux-only: Copy arm libraries from the arm_trusted package. These are
+ # needed to be able to run sel_ldr_arm under qemu.
+ arm_libs = [
+ 'lib/arm-linux-gnueabihf/librt.so.1',
+ 'lib/arm-linux-gnueabihf/libpthread.so.0',
+ 'lib/arm-linux-gnueabihf/libgcc_s.so.1',
+ 'lib/arm-linux-gnueabihf/libc.so.6',
+ 'lib/arm-linux-gnueabihf/ld-linux-armhf.so.3',
+ 'lib/arm-linux-gnueabihf/libm.so.6',
+ 'usr/lib/arm-linux-gnueabihf/libstdc++.so.6'
+ ]
+ arm_lib_dir = os.path.join(pepperdir, 'tools', 'lib', 'arm_trusted', 'lib')
+ buildbot_common.MakeDir(arm_lib_dir)
+ for arm_lib in arm_libs:
+ arm_lib = os.path.join(OUT_DIR, 'arm_trusted', arm_lib)
+ buildbot_common.CopyFile(arm_lib, arm_lib_dir)
+ buildbot_common.CopyFile(os.path.join(OUT_DIR, 'arm_trusted', 'qemu-arm'),
+ os.path.join(pepperdir, 'tools'))
+
BuildStepBuildToolchains(pepperdir, toolchains,
not options.skip_toolchain,
@@ -1081,14 +1123,14 @@ def main(args):
if options.tar:
BuildStepTarBundle(pepper_ver, tarfile)
- if options.build_ports and getos.GetPlatform() == 'linux':
+ if options.build_ports and platform == 'linux':
ports_tarfile = os.path.join(OUT_DIR, 'naclports.tar.bz2')
BuildStepSyncNaClPorts()
BuildStepBuildNaClPorts(pepper_ver, pepperdir)
if options.tar:
BuildStepTarNaClPorts(pepper_ver, ports_tarfile)
- if options.build_app_engine and getos.GetPlatform() == 'linux':
+ if options.build_app_engine and platform == 'linux':
BuildStepBuildAppEngine(pepperdir, chrome_revision)
if options.qemu:
@@ -1099,7 +1141,7 @@ def main(args):
if options.archive:
BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision,
tarfile)
- if options.build_ports and getos.GetPlatform() == 'linux':
+ if options.build_ports and platform == 'linux':
BuildStepArchiveBundle('naclports', pepper_ver, chrome_revision,
nacl_revision, ports_tarfile)
BuildStepArchiveSDKTools()
diff --git a/native_client_sdk/src/build_tools/sdk_files.list b/native_client_sdk/src/build_tools/sdk_files.list
index 442af85..c117f79 100644
--- a/native_client_sdk/src/build_tools/sdk_files.list
+++ b/native_client_sdk/src/build_tools/sdk_files.list
@@ -530,6 +530,13 @@ tools/httpd.py
[linux]tools/irt_core_arm.nexe
tools/irt_core_x86_32.nexe
tools/irt_core_x86_64.nexe
+[linux]tools/lib/arm_trusted/lib/ld-linux-armhf.so.3
+[linux]tools/lib/arm_trusted/lib/libc.so.6
+[linux]tools/lib/arm_trusted/lib/libgcc_s.so.1
+[linux]tools/lib/arm_trusted/lib/libm.so.6
+[linux]tools/lib/arm_trusted/lib/libpthread.so.0
+[linux]tools/lib/arm_trusted/lib/librt.so.1
+[linux]tools/lib/arm_trusted/lib/libstdc++.so.6
tools/lib/elf.py
tools/lib/get_shared_deps.py
tools/lib/quote.py
@@ -547,6 +554,7 @@ tools/ncval.py
[linux]tools/nonsfi_loader_arm${EXE_EXT}
[linux]tools/nonsfi_loader_x86_32${EXE_EXT}
tools/oshelpers.py
+[linux]tools/qemu-arm
tools/run.py
tools/sel_ldr.py
[linux]tools/sel_ldr_arm
diff --git a/native_client_sdk/src/tools/sel_ldr.py b/native_client_sdk/src/tools/sel_ldr.py
index 8cc49eb..5d1a6220 100755
--- a/native_client_sdk/src/tools/sel_ldr.py
+++ b/native_client_sdk/src/tools/sel_ldr.py
@@ -116,15 +116,16 @@ def main(argv):
if arch == 'arm':
# Use the QEMU arm emulator if available.
qemu_bin = FindQemu()
- if qemu_bin:
- qemu = [qemu_bin, '-cpu', 'cortex-a8', '-L',
- os.path.abspath(os.path.join(NACL_SDK_ROOT, 'toolchain',
- 'linux_arm_trusted'))]
- # '-Q' disables platform qualification, allowing arm binaries to run.
- cmd = qemu + cmd + ['-Q']
- else:
+ if not qemu_bin:
raise Error('Cannot run ARM executables under sel_ldr without an emulator'
- '. Try installing QEMU (http://wiki.qemu.org/).')
+ '. Try installing QEMU (http://wiki.qemu.org/).')
+
+ arm_libpath = os.path.join(NACL_SDK_ROOT, 'tools', 'lib', 'arm_trusted')
+ if not os.path.isdir(arm_libpath):
+ raise Error('Could not find ARM library path: %s' % arm_libpath)
+ qemu = [qemu_bin, '-cpu', 'cortex-a8', '-L', arm_libpath]
+ # '-Q' disables platform qualification, allowing arm binaries to run.
+ cmd = qemu + cmd + ['-Q']
if dynamic:
if options.debug_libs: