summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/staging.bbclass96
-rw-r--r--meta/recipes-core/glibc/glibc-package.inc2
2 files changed, 98 insertions, 0 deletions
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 57b2743196..967eddd605 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -57,6 +57,101 @@ sysroot_stage_all() {
57 sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR} 57 sysroot_stage_dirs ${D} ${SYSROOT_DESTDIR}
58} 58}
59 59
60python sysroot_strip () {
61 import stat, errno
62
63 dvar = d.getVar('SYSROOT_DESTDIR', True)
64 pn = d.getVar('PN', True)
65
66 os.chdir(dvar)
67
68 # Return type (bits):
69 # 0 - not elf
70 # 1 - ELF
71 # 2 - stripped
72 # 4 - executable
73 # 8 - shared library
74 # 16 - kernel module
75 def isELF(path):
76 type = 0
77 ret, result = oe.utils.getstatusoutput("file \"%s\"" % path.replace("\"", "\\\""))
78
79 if ret:
80 bb.error("split_and_strip_files: 'file %s' failed" % path)
81 return type
82
83 # Not stripped
84 if "ELF" in result:
85 type |= 1
86 if "not stripped" not in result:
87 type |= 2
88 if "executable" in result:
89 type |= 4
90 if "shared" in result:
91 type |= 8
92 return type
93
94
95 elffiles = {}
96 inodes = {}
97 libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir", True))
98 baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir", True))
99 if (d.getVar('INHIBIT_SYSROOT_STRIP', True) != '1'):
100 #
101 # First lets figure out all of the files we may have to process
102 #
103 for root, dirs, files in os.walk(dvar):
104 for f in files:
105 file = os.path.join(root, f)
106
107 try:
108 ltarget = oe.path.realpath(file, dvar, False)
109 s = os.lstat(ltarget)
110 except OSError as e:
111 (err, strerror) = e.args
112 if err != errno.ENOENT:
113 raise
114 # Skip broken symlinks
115 continue
116 if not s:
117 continue
118 # Check its an excutable
119 if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \
120 or ((file.startswith(libdir) or file.startswith(baselibdir)) and ".so" in f):
121 # If it's a symlink, and points to an ELF file, we capture the readlink target
122 if os.path.islink(file):
123 continue
124
125 # It's a file (or hardlink), not a link
126 # ...but is it ELF, and is it already stripped?
127 elf_file = isELF(file)
128 if elf_file & 1:
129 if elf_file & 2:
130 bb.warn("File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dvar):], pn))
131 continue
132
133 if s.st_ino in inodes:
134 os.unlink(file)
135 os.link(inodes[s.st_ino], file)
136 else:
137 inodes[s.st_ino] = file
138 # break hardlink
139 bb.utils.copyfile(file, file)
140 elffiles[file] = elf_file
141
142 #
143 # Now strip them (in parallel)
144 #
145 strip = d.getVar("STRIP", True)
146 sfiles = []
147 for file in elffiles:
148 elf_file = int(elffiles[file])
149 #bb.note("Strip %s" % file)
150 sfiles.append((file, elf_file, strip))
151
152 oe.utils.multiprocess_exec(sfiles, oe.package.runstrip)
153}
154
60do_populate_sysroot[dirs] = "${SYSROOT_DESTDIR}" 155do_populate_sysroot[dirs] = "${SYSROOT_DESTDIR}"
61do_populate_sysroot[umask] = "022" 156do_populate_sysroot[umask] = "022"
62 157
@@ -91,6 +186,7 @@ def sysroot_checkhashes(covered, tasknames, fnids, fns, d, invalidtasks = None):
91 186
92python do_populate_sysroot () { 187python do_populate_sysroot () {
93 bb.build.exec_func("sysroot_stage_all", d) 188 bb.build.exec_func("sysroot_stage_all", d)
189 bb.build.exec_func("sysroot_strip", d)
94 for f in (d.getVar('SYSROOT_PREPROCESS_FUNCS', True) or '').split(): 190 for f in (d.getVar('SYSROOT_PREPROCESS_FUNCS', True) or '').split():
95 bb.build.exec_func(f, d) 191 bb.build.exec_func(f, d)
96 pn = d.getVar("PN", True) 192 pn = d.getVar("PN", True)
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index 984362e3ce..8ea591502b 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -17,6 +17,8 @@ python __anonymous () {
17# Set this to zero if you don't want ldconfig in the output package 17# Set this to zero if you don't want ldconfig in the output package
18USE_LDCONFIG ?= "1" 18USE_LDCONFIG ?= "1"
19 19
20INHIBIT_SYSROOT_STRIP = "1"
21
20PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode ${PN}-utils glibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" 22PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode ${PN}-utils glibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc"
21 23
22# The ld.so in this glibc supports the GNU_HASH 24# The ld.so in this glibc supports the GNU_HASH