8000 strip kernel modules · Issue #36 · anatol/booster · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

strip kernel modules #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
oech3 opened this issue Feb 20, 2021 · 4 comments
Closed

strip kernel modules #36

oech3 opened this issue Feb 20, 2021 · 4 comments

Comments

@oech3
Copy link
Contributor
oech3 commented Feb 20, 2021

initramfs size is reduced by stripping kernel modules.
mkinitcpio has strip hook.

@anatol
Copy link
Owner
anatol commented Mar 2, 2021

Sounds like a good idea to decease size of the image.

And I think strip should be called for regular binaries as well.

@anatol
Copy link
Owner
anatol commented Mar 2, 2021

I am looking at the strip hook from mkinitcpio and it looks like stripping is not run for kernel modules. It is run for regular binaries and shared/static libraries only.

    find "$BUILDROOT" -type f -perm -u+w -print0 2>/dev/null | while read -d '' bin; do
        case $(file -bi "$bin") in
            *application/x-sharedlib*)
                # Libraries (.so)
                strip --strip-unneeded "$bin"
                ;;
            *application/x-archive*)
                # Libraries (.a)
                strip --strip-debug "$bin"
                ;;
            *application/x-executable*)
                # Binaries
                strip --strip-all "$bin"
                ;;
        esac
    done

@anatol
Copy link
Owner
anatol commented Mar 2, 2021

So for kernel modules and shared libraries we need to use --strip-unneeded and for ELF binaries --strip-all. I have a change locally that seems work fine.

Stripping ELF binaries decreases size of the final image by about 5%. It is because Arch binaries already exclude debug symbols and there is not that much to strip.

@anatol anatol closed this as completed in b9708be Mar 2, 2021
anatol added a commit that referenced this issue Mar 2, 2021
This helps to cut some amount of unneeded information from binaries and
reduce the final image size a bit. My tests show ~5% image size
reduction.

The feature can be either enabled with 'strip' config option or with '-strip'
command line flag.

Closes #36
@anatol
Copy link
Owner
anatol commented Mar 2, 2021

The functionality is implemented at master branch. PTAL and let me know if you see any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0