#!/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 import errno 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("= p_filesz): print "ERROR: could not relocate %s, interp size = %i and %i is needed." % (elf_file_name, p_memsz, len(new_dl_path) + 1) break dl_path = new_dl_path + "\0" * (p_filesz - len(new_dl_path)) f.seek(p_offset) f.write(dl_path) break def change_dl_sysdirs(): if arch == 32: sh_fmt = "