summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/insane.bbclass84
-rw-r--r--meta/lib/oe/qa.py21
2 files changed, 60 insertions, 45 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index b376470bd7..812438494b 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -32,58 +32,58 @@ PACKAGEFUNCS += " do_package_qa "
32def package_qa_get_machine_dict(): 32def package_qa_get_machine_dict():
33 return { 33 return {
34 "darwin9" : { 34 "darwin9" : {
35 "arm" : (40, 0, 0, True, True), 35 "arm" : (40, 0, 0, True, 32),
36 }, 36 },
37 "linux" : { 37 "linux" : {
38 "arm" : (40, 97, 0, True, True), 38 "arm" : (40, 97, 0, True, 32),
39 "armeb": (40, 97, 0, False, True), 39 "armeb": (40, 97, 0, False, 32),
40 "powerpc": (20, 0, 0, False, True), 40 "powerpc": (20, 0, 0, False, 32),
41 "i386": ( 3, 0, 0, True, True), 41 "i386": ( 3, 0, 0, True, 32),
42 "i486": ( 3, 0, 0, True, True), 42 "i486": ( 3, 0, 0, True, 32),
43 "i586": ( 3, 0, 0, True, True), 43 "i586": ( 3, 0, 0, True, 32),
44 "i686": ( 3, 0, 0, True, True), 44 "i686": ( 3, 0, 0, True, 32),
45 "x86_64": (62, 0, 0, True, False), 45 "x86_64": (62, 0, 0, True, 64),
46 "ia64": (50, 0, 0, True, False), 46 "ia64": (50, 0, 0, True, 64),
47 "alpha": (36902, 0, 0, True, False), 47 "alpha": (36902, 0, 0, True, 64),
48 "hppa": (15, 3, 0, False, True), 48 "hppa": (15, 3, 0, False, 32),
49 "m68k": ( 4, 0, 0, False, True), 49 "m68k": ( 4, 0, 0, False, 32),
50 "mips": ( 8, 0, 0, False, True), 50 "mips": ( 8, 0, 0, False, 32),
51 "mipsel": ( 8, 0, 0, True, True), 51 "mipsel": ( 8, 0, 0, True, 32),
52 "s390": (22, 0, 0, False, True), 52 "s390": (22, 0, 0, False, 32),
53 "sh4": (42, 0, 0, True, True), 53 "sh4": (42, 0, 0, True, 32),
54 "sparc": ( 2, 0, 0, False, True), 54 "sparc": ( 2, 0, 0, False, 32),
55 }, 55 },
56 "linux-uclibc" : { 56 "linux-uclibc" : {
57 "arm" : ( 40, 97, 0, True, True), 57 "arm" : ( 40, 97, 0, True, 32),
58 "armeb": ( 40, 97, 0, False, True), 58 "armeb": ( 40, 97, 0, False, 32),
59 "powerpc": ( 20, 0, 0, False, True), 59 "powerpc": ( 20, 0, 0, False, 32),
60 "i386": ( 3, 0, 0, True, True), 60 "i386": ( 3, 0, 0, True, 32),
61 "i486": ( 3, 0, 0, True, True), 61 "i486": ( 3, 0, 0, True, 32),
62 "i586": ( 3, 0, 0, True, True), 62 "i586": ( 3, 0, 0, True, 32),
63 "i686": ( 3, 0, 0, True, True), 63 "i686": ( 3, 0, 0, True, 32),
64 "x86_64": ( 62, 0, 0, True, False), 64 "x86_64": ( 62, 0, 0, True, 64),
65 "mips": ( 8, 0, 0, False, True), 65 "mips": ( 8, 0, 0, False, 32),
66 "mipsel": ( 8, 0, 0, True, True), 66 "mipsel": ( 8, 0, 0, True, 32),
67 "avr32": (6317, 0, 0, False, True), 67 "avr32": (6317, 0, 0, False, 32),
68 "sh4": (42, 0, 0, True, True), 68 "sh4": (42, 0, 0, True, 32),
69 69
70 }, 70 },
71 "uclinux-uclibc" : { 71 "uclinux-uclibc" : {
72 "bfin": ( 106, 0, 0, True, True), 72 "bfin": ( 106, 0, 0, True, 32),
73 }, 73 },
74 "linux-gnueabi" : { 74 "linux-gnueabi" : {
75 "arm" : (40, 0, 0, True, True), 75 "arm" : (40, 0, 0, True, 32),
76 "armeb" : (40, 0, 0, False, True), 76 "armeb" : (40, 0, 0, False, 32),
77 }, 77 },
78 "linux-uclibcgnueabi" : { 78 "linux-uclibcgnueabi" : {
79 "arm" : (40, 0, 0, True, True), 79 "arm" : (40, 0, 0, True, 32),
80 "armeb" : (40, 0, 0, False, True), 80 "armeb" : (40, 0, 0, False, 32),
81 }, 81 },
82 "linux-gnuspe" : { 82 "linux-gnuspe" : {
83 "powerpc": (20, 0, 0, False, True), 83 "powerpc": (20, 0, 0, False, 32),
84 }, 84 },
85 "linux-uclibcspe" : { 85 "linux-uclibcspe" : {
86 "powerpc": (20, 0, 0, False, True), 86 "powerpc": (20, 0, 0, False, 32),
87 }, 87 },
88 88
89 } 89 }
@@ -243,7 +243,7 @@ def package_qa_check_arch(path,name,d, elf):
243 return True 243 return True
244 244
245 #if this will throw an exception, then fix the dict above 245 #if this will throw an exception, then fix the dict above
246 (machine, osabi, abiversion, littleendian, bits32) \ 246 (machine, osabi, abiversion, littleendian, bits) \
247 = package_qa_get_machine_dict()[target_os][target_arch] 247 = package_qa_get_machine_dict()[target_os][target_arch]
248 248
249 # Check the architecture and endiannes of the binary 249 # Check the architecture and endiannes of the binary
@@ -251,6 +251,10 @@ def package_qa_check_arch(path,name,d, elf):
251 error_msg = "Architecture did not match (%d to %d) on %s" % \ 251 error_msg = "Architecture did not match (%d to %d) on %s" % \
252 (machine, elf.machine(), package_qa_clean_path(path,d)) 252 (machine, elf.machine(), package_qa_clean_path(path,d))
253 sane = package_qa_handle_error(4, error_msg, name, path, d) 253 sane = package_qa_handle_error(4, error_msg, name, path, d)
254 elif not bits == elf.abiSize():
255 error_msg = "Bit size did not match (%d to %d) on %s" % \
256 (bits, elf.abiSize(), package_qa_clean_path(path,d))
257 sane = package_qa_handle_error(4, error_msg, name, path, d)
254 elif not littleendian == elf.isLittleEndian(): 258 elif not littleendian == elf.isLittleEndian():
255 error_msg = "Endiannes did not match (%d to %d) on %s" % \ 259 error_msg = "Endiannes did not match (%d to %d) on %s" % \
256 (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d)) 260 (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d))
@@ -445,14 +449,12 @@ def package_qa_walk(path, funcs, package,d):
445 #if this will throw an exception, then fix the dict above 449 #if this will throw an exception, then fix the dict above
446 target_os = bb.data.getVar('TARGET_OS', d, True) 450 target_os = bb.data.getVar('TARGET_OS', d, True)
447 target_arch = bb.data.getVar('TARGET_ARCH', d, True) 451 target_arch = bb.data.getVar('TARGET_ARCH', d, True)
448 (machine, osabi, abiversion, littleendian, bits32) \
449 = package_qa_get_machine_dict()[target_os][target_arch]
450 452
451 sane = True 453 sane = True
452 for root, dirs, files in os.walk(path): 454 for root, dirs, files in os.walk(path):
453 for file in files: 455 for file in files:
454 path = os.path.join(root,file) 456 path = os.path.join(root,file)
455 elf = oe.qa.ELFFile(path, bits32) 457 elf = oe.qa.ELFFile(path)
456 try: 458 try:
457 elf.open() 459 elf.open()
458 except: 460 except:
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 01813931bb..7adf4d03ae 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -25,9 +25,9 @@ class ELFFile:
25 #print "'%x','%x' %s" % (ord(expectation), ord(result), self.name) 25 #print "'%x','%x' %s" % (ord(expectation), ord(result), self.name)
26 raise Exception("This does not work as expected") 26 raise Exception("This does not work as expected")
27 27
28 def __init__(self, name, bits32): 28 def __init__(self, name, bits = 0):
29 self.name = name 29 self.name = name
30 self.bits32 = bits32 30 self.bits = bits
31 31
32 def open(self): 32 def open(self):
33 self.file = file(self.name, "r") 33 self.file = file(self.name, "r")
@@ -38,10 +38,20 @@ class ELFFile:
38 self.my_assert(self.data[1], 'E') 38 self.my_assert(self.data[1], 'E')
39 self.my_assert(self.data[2], 'L') 39 self.my_assert(self.data[2], 'L')
40 self.my_assert(self.data[3], 'F') 40 self.my_assert(self.data[3], 'F')
41 if self.bits32 : 41 if self.bits == 0:
42 if self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS32):
43 self.bits == 32
44 elif self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS64):
45 self.bits == 64
46 else:
47 # Not 32-bit or 64.. lets assert
48 raise Exception("ELF but not 32 or 64 bit.")
49 elif self.bits == 32:
42 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32)) 50 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32))
43 else: 51 elif self.bits == 64:
44 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64)) 52 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64))
53 else:
54 raise Exception("Must specify unknown, 32 or 64 bit size.")
45 self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) ) 55 self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) )
46 56
47 self.sex = self.data[ELFFile.EI_DATA] 57 self.sex = self.data[ELFFile.EI_DATA]
@@ -60,6 +70,9 @@ class ELFFile:
60 def abiVersion(self): 70 def abiVersion(self):
61 return ord(self.data[ELFFile.EI_ABIVERSION]) 71 return ord(self.data[ELFFile.EI_ABIVERSION])
62 72
73 def abiSize(self):
74 return self.bits
75
63 def isLittleEndian(self): 76 def isLittleEndian(self):
64 return self.sex == "<" 77 return self.sex == "<"
65 78