From e09a8fa931fe617afc05bd5e00dca5dd3fe386e8 Mon Sep 17 00:00:00 2001 From: Saul Wold Date: Wed, 12 Jan 2022 09:20:40 -0800 Subject: 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. Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/lib/oe/package.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'meta/lib') 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): # 8 - shared library # 16 - kernel module - (file, elftype, strip) = arg + if len(arg) == 3: + (file, elftype, strip) = arg + extra_strip_sections = '' + else: + (file, elftype, strip, extra_strip_sections) = arg newmode = None if not os.access(file, os.W_OK) or os.access(file, os.R_OK): @@ -40,6 +44,9 @@ def runstrip(arg): # shared or executable: elif elftype & 8 or elftype & 4: stripcmd.extend(["--remove-section=.comment", "--remove-section=.note"]) + if extra_strip_sections != '': + for section in extra_strip_sections.split(): + stripcmd.extend(["--remove-section=" + section]) stripcmd.append(file) bb.debug(1, "runstrip: %s" % stripcmd) -- cgit 1.2.3-korg