From patchwork Fri Jul 27 11:21:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/6] scripts: add script for relocating the SDK Date: Fri, 27 Jul 2012 11:21:44 -0000 From: Laurentiu Palcu X-Patchwork-Id: 33197 Message-Id: <370f089c241234b0455729c8c4129c7e35ef0989.1343387245.git.laurentiu.palcu@intel.com> To: openembedded-core@lists.openembedded.org 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 --- scripts/relocate_sdk.py | 200 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100755 scripts/relocate_sdk.py diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py new file mode 100755 index 0000000..0668600 --- /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("\/opt\/poky") + +def get_arch(): + f.seek(0) + e_ident =f.read(16) + ei_mag0,ei_mag1_3,ei_class = struct.unpack("