Commit Graph

7 Commits

Author SHA1 Message Date
Konrad Scherer 76e0ce8229 relocate_sdk.py: Allow script to work with Python 2.4 and 3.
Python 2.4 does not support the 'b' string literal or the
keyword 'as' in exception handling. Python 3 does not accept
the old method of exception handling and defaults to unicode.
The b() function converts strings to bytes on Python 3 and
using sys.exc_info() avoids the exception handling syntax.

(From OE-Core master rev: 1e2ec5f576f167673d7980737826987fefdc74a9)

(From OE-Core rev: 343127f2f81be337596d3eacbbc92278e82ce574)

Signed-off-by: Konrad Scherer <Konrad.Scherer@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-12 17:00:02 +00:00
Laurentiu Palcu 5b5e1b9008 relocate_sdk.py: make it work also with python 3
Strings in Python 3, by default, are assumed to contain unicode
characters. In previous versions of python (<3), unicode strings are
explicitly declared with u"abc". If not, than they're automatically
converted to bytes. This doesn't happen anymore in Python 3.

Since we're dealing with binary files, opened in byte mode, make sure
that we explicitly convert all strings to bytes to make both python 2
and 3 happy.

Other changes:
 * add a safety check to make sure relocation did not change the file
   size;
 * a couple of cosmetic changes (wrap long lines so that we don't have
   to scroll to reach the end of them);

(From OE-Core rev: 175f20e27eadc79df16109961f5ce6232705e96f)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-26 16:37:55 +01:00
Jason Wessel c160a98255 relocate_sdk.py: allow relocate_sdk.py to work with python 2.4.x
Avoid the chicken / egg problem of an SDK that provides a working
python but requires that version of python to extract itself.  The
RHEL 5.x systems and some other enterprise Linux systems ship with
python 2.4.x as the default python.  We need to at least be able to
extract work executables even if we never use the the host provided
python again.

(From OE-Core rev: e1d42db8749b0b965ddc6cfba4f3b93ee96ed4f4)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-12 13:11:22 +00:00
Jason Wessel 3eb70c067c relocate_sdk.py: Fix corruption of sdk binaries
There are two cases of corruption that the relocate_sdk.py was not correctly
dealing with.

1) SDK Extras should be left alone
   Extra external binaries included in an SDK that were linked against the
   host's version of /usr/lib/ld-so.so should not get a relocation applied.
   In the case that was discovered these were LSB compliant binaries that
   already worked on many hosts.

2) If the interp section is too small generate an error
   In the case of the qemu user code, it was using its own .ld file
   to link the executables which overrides the default in the nativesdk
   binutils.  This generated host executables which had a interp section
   that was too small to relocate.

   Now the relocate_sdk.py will print an error and continue on such that
   the error can be fixed by a developer without having to do the
   difficult task of debugging why it is crashing or not loading correctly.

(From OE-Core rev: 3752a9c6d772b39bbe04d62ef4d3527b4c7198c1)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-12 13:11:21 +00:00
Laurentiu Palcu d036724c0d relocate_sdk.py: new interpreter string was not '\0' terminated
The problem: SDK binaries were not properly relocated when the SDK
was installed into a path that had a length less than the default one.
Apparently, there were two problems here: the padding was done wrong
(the size of one program header table entry was used instead of the
program section size) and the new padded string was not used at all.

[YOCTO #3655]

(From OE-Core rev: 3815030c5f31c11495893c1ae28d56c1aff31d97)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-07 13:50:40 +00:00
Laurentiu Palcu 6bc5925ea9 SDK: trap any IO errors in the relocate script
If the files being relocated are already used by other processes the
relocate script will fail with a traceback. This patch will trap any IO
errors when opening such a file and gracefully report them to the user.

Also change the exit code from 1 to -1 for a better adt-installer user
experience (like pointing the user to the adt_installer.log).

[YOCTO #3164]

(From OE-Core rev: 26daec758b2eaeb208356d5aa8a9a191bd366751)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-26 15:02:28 +01:00
Laurentiu Palcu 749b8a52c6 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.

(From OE-Core rev: 3d366f4953962566f33a3d77d65ed0bd2c48f922)

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-02 15:28:38 +01:00