summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@windriver.com>2022-01-12 09:20:40 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-13 13:57:26 +0000
commitd756b346f248df47b0540644adb1d0f17bcc4b6e (patch)
tree9acb73ee771be6fc4eb0d488f26f07d0df139bc7
parent987d30df5bb18de3cf17d38bbb745ea65cb86266 (diff)
downloadpoky-d756b346f248df47b0540644adb1d0f17bcc4b6e.tar.gz
package: Add support for kernel stripping
Extend runstrip() to accept additional argument to enable sharing it with the kernel do_strip() so that KERNEL_IMAGE_STRIP_EXTRA_SECTIONS can be passed. Since is_elf() understands kernel modules there is no need to keep a seperate list for kernmodules or hardcode the values to runstrip. (From OE-Core rev: e09a8fa931fe617afc05bd5e00dca5dd3fe386e8) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package.bbclass17
-rw-r--r--meta/lib/oe/package.py9
2 files changed, 13 insertions, 13 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 09cd376f4a..4927fb99ff 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -390,10 +390,6 @@ def splitdebuginfo(file, dvar, debugdir, debuglibdir, debugappend, debugsrcdir,
390 dvar = d.getVar('PKGD') 390 dvar = d.getVar('PKGD')
391 objcopy = d.getVar("OBJCOPY") 391 objcopy = d.getVar("OBJCOPY")
392 392
393 # We ignore kernel modules, we don't generate debug info files.
394 if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
395 return (file, sources)
396
397 newmode = None 393 newmode = None
398 if not os.access(file, os.W_OK) or os.access(file, os.R_OK): 394 if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
399 origmode = os.stat(file)[stat.ST_MODE] 395 origmode = os.stat(file)[stat.ST_MODE]
@@ -1122,7 +1118,6 @@ python split_and_strip_files () {
1122 # 1118 #
1123 elffiles = {} 1119 elffiles = {}
1124 symlinks = {} 1120 symlinks = {}
1125 kernmods = []
1126 staticlibs = [] 1121 staticlibs = []
1127 inodes = {} 1122 inodes = {}
1128 libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir")) 1123 libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir"))
@@ -1145,9 +1140,6 @@ python split_and_strip_files () {
1145 if file in skipfiles: 1140 if file in skipfiles:
1146 continue 1141 continue
1147 1142
1148 if file.endswith(".ko") and file.find("/lib/modules/") != -1:
1149 kernmods.append(file)
1150 continue
1151 if oe.package.is_static_lib(file): 1143 if oe.package.is_static_lib(file):
1152 staticlibs.append(file) 1144 staticlibs.append(file)
1153 continue 1145 continue
@@ -1164,8 +1156,11 @@ python split_and_strip_files () {
1164 if not s: 1156 if not s:
1165 continue 1157 continue
1166 # Check its an executable 1158 # Check its an executable
1167 if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH) \ 1159 if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) \
1168 or ((file.startswith(libdir) or file.startswith(baselibdir)) and (".so" in f or ".node" in f)): 1160 or (s[stat.ST_MODE] & stat.S_IXOTH) \
1161 or ((file.startswith(libdir) or file.startswith(baselibdir)) \
1162 and (".so" in f or ".node" in f)) \
1163 or (f.startswith('vmlinux') or ".ko" in f):
1169 1164
1170 if cpath.islink(file): 1165 if cpath.islink(file):
1171 checkelflinks[file] = ltarget 1166 checkelflinks[file] = ltarget
@@ -1312,8 +1307,6 @@ python split_and_strip_files () {
1312 elf_file = int(elffiles[file]) 1307 elf_file = int(elffiles[file])
1313 #bb.note("Strip %s" % file) 1308 #bb.note("Strip %s" % file)
1314 sfiles.append((file, elf_file, strip)) 1309 sfiles.append((file, elf_file, strip))
1315 for f in kernmods:
1316 sfiles.append((f, 16, strip))
1317 if (d.getVar('PACKAGE_STRIP_STATIC') == '1' or d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'): 1310 if (d.getVar('PACKAGE_STRIP_STATIC') == '1' or d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'):
1318 for f in staticlibs: 1311 for f in staticlibs:
1319 sfiles.append((f, 16, strip)) 1312 sfiles.append((f, 16, strip))
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index dd700cbb0c..7d387ee81d 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -16,7 +16,11 @@ def runstrip(arg):
16 # 8 - shared library 16 # 8 - shared library
17 # 16 - kernel module 17 # 16 - kernel module
18 18
19 (file, elftype, strip) = arg 19 if len(arg) == 3:
20 (file, elftype, strip) = arg
21 extra_strip_sections = ''
22 else:
23 (file, elftype, strip, extra_strip_sections) = arg
20 24
21 newmode = None 25 newmode = None
22 if not os.access(file, os.W_OK) or os.access(file, os.R_OK): 26 if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
@@ -40,6 +44,9 @@ def runstrip(arg):
40 # shared or executable: 44 # shared or executable:
41 elif elftype & 8 or elftype & 4: 45 elif elftype & 8 or elftype & 4:
42 stripcmd.extend(["--remove-section=.comment", "--remove-section=.note"]) 46 stripcmd.extend(["--remove-section=.comment", "--remove-section=.note"])
47 if extra_strip_sections != '':
48 for section in extra_strip_sections.split():
49 stripcmd.extend(["--remove-section=" + section])
43 50
44 stripcmd.append(file) 51 stripcmd.append(file)
45 bb.debug(1, "runstrip: %s" % stripcmd) 52 bb.debug(1, "runstrip: %s" % stripcmd)