From 3d366f4953962566f33a3d77d65ed0bd2c48f922 Mon Sep 17 00:00:00 2001 From: Laurentiu Palcu Date: Tue, 31 Jul 2012 11:49:35 +0300 Subject: scripts: add script for relocating the SDK This script will be embedded in the SDK tarball and will be called by the SDK installer. It replaces the interpreter path in all binaries and it also changes the ld.so.cache and SYSDIRS in dynamic loader. Signed-off-by: Laurentiu Palcu Signed-off-by: Richard Purdie --- scripts/relocate_sdk.py | 200 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100755 scripts/relocate_sdk.py (limited to 'scripts/relocate_sdk.py') diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py new file mode 100755 index 0000000000..b247e65ce3 --- /dev/null +++ b/scripts/relocate_sdk.py @@ -0,0 +1,200 @@ +#!/usr/bin/env python +# +# Copyright (c) 2012 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# DESCRIPTION +# This script is called by the SDK installer script. It replaces the dynamic +# loader path in all binaries and also fixes the SYSDIR paths/lengths and the +# location of ld.so.cache in the dynamic loader binary +# +# AUTHORS +# Laurentiu Palcu +# + +import struct +import sys +import stat +import os +import re + +old_prefix = re.compile("##DEFAULT_INSTALL_DIR##") + +def get_arch(): + f.seek(0) + e_ident =f.read(16) + ei_mag0,ei_mag1_3,ei_class = struct.unpack("