-
Notifications
You must be signed in to change notification settings - Fork 60
hook: introduce post-linuxkit initramfs compressor/optimizer/reporter #299
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
hook: introduce post-linuxkit initramfs compressor/optimizer/reporter #299
Conversation
|
Done a week of tests, this seems to be working fine. Will force-push with Sign-off's and undraft. |
- for each linuxkit/<xyz> image used: - auto-generate Dockerfile under images/hook-linuxkit-xyz - build it as regular lk_containers for the arch - replace usage in hook.template.yaml with HOOK_CONTAINER_LINUXKIT_XYZ_IMAGE - this way we capitalize on the caching mechanisms already in place Signed-off-by: Ricardo Pardini <[email protected]>
- to make the (rather large) Armbian kernel's modules fit in 2gb RAM machines, we used to (quite bluntly) remove modules that weren't strictly needed for Hook: - drivers/net/wireless - kernel/sound - drivers/media - drivers/infiniband - with the initramfs optimization work, we can stop removing those - this fixes certain video/DRM problems - opens up the wireless path for the future Signed-off-by: Ricardo Pardini <[email protected]>
- squash out some instances of `SC2268 (style): Avoid x-prefix in comparisons` - I'm too old and it shows, I wrote _all_ of them - squash one unused var and wrong comment ref Signed-off-by: Ricardo Pardini <[email protected]>
- otherwise contents wouldn't be shown at all - maybe it's time to add bat to downloaded dependencies (like linuxkit)? Signed-off-by: Ricardo Pardini <[email protected]>
- this is done via - `./build.sh kernel-config hook-latest-lts-amd64` - `./build.sh kernel-config hook-default-amd64` - `./build.sh kernel-config hook-default-arm64` - `./build.sh kernel-config hook-latest-lts-arm64` - and then making no changes and exiting - here, `ARM_SDE_INTERFACE=y` is being removed as it is implied by having `ACPI_APEI_GHES=y`, `ACPI=y`, `ACPI_APEI=y` and `ARM64=y` Signed-off-by: Ricardo Pardini <[email protected]>
- turns out LinuxKit ends up producing initramfs's that are very large
- multiple copies of exact same files in different fs paths
- gzip compression
- multiple cpio layers causing multiple instances of same filepath stored
- add a Docker-based postprocess step that does multiple tricks to fix it
- extract/repack cpio to flatten it
- rdfind to replace duplicates with hardlinks
- zstd (-9, multithread) compression
- reports usage and large duplicate files in different paths
- so we can optimize our lk containers for better dedupe
- gains are at
- 25% for zstd compression (meson64)
- 10Mb for rdfind, without any lk optimization yet
Signed-off-by: Ricardo Pardini <[email protected]>
- unpack and repack cpio's like the kernel does; order vs timestamps matter, since the kernel overwrites without mtime comparision Signed-off-by: Ricardo Pardini <[email protected]>
- 'peg' has served its purpose, should we remove it? Signed-off-by: Ricardo Pardini <[email protected]>
- this way we drastically reduce the number of different binaries found in the final initramfs, allowing the initramfs compressor to deduplicate them into hardlinks - libssl / libcrypto - busybox - musl Signed-off-by: Ricardo Pardini <[email protected]>
Signed-off-by: Ricardo Pardini <[email protected]>
Signed-off-by: Ricardo Pardini <[email protected]>
…ramfs Signed-off-by: Ricardo Pardini <[email protected]>
535e12d to
a57e278
Compare
jacobweinstock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @rpardini !
Merge Queue Status🚫 The pull request has left the queue (rule: This pull request spent 4 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
|
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
Merge Queue Status🚫 The pull request has left the queue (rule: This pull request spent 3 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
hook: introduce post-linuxkit initramfs compressor/optimizer/reporter
Signed-off-by: Ricardo Pardini [email protected]
machines, we used to (quite bluntly) remove modules that weren't
strictly needed for Hook:
Signed-off-by: Ricardo Pardini [email protected]
SC2268 (style): Avoid x-prefix in comparisonsSigned-off-by: Ricardo Pardini [email protected]
catifbatis missing inlog_file_bat()Signed-off-by: Ricardo Pardini [email protected]
./build.sh kernel-config hook-latest-lts-amd64./build.sh kernel-config hook-default-amd64./build.sh kernel-config hook-default-arm64./build.sh kernel-config hook-latest-lts-arm64ARM_SDE_INTERFACE=yis being removed as it is impliedby having
ACPI_APEI_GHES=y,ACPI=y,ACPI_APEI=yandARM64=ySigned-off-by: Ricardo Pardini [email protected]
Signed-off-by: Ricardo Pardini [email protected]
matter, since the kernel overwrites without mtime comparision
Signed-off-by: Ricardo Pardini [email protected]
Signed-off-by: Ricardo Pardini [email protected]
found in the final initramfs, allowing the initramfs compressor
to deduplicate them into hardlinks
Signed-off-by: Ricardo Pardini [email protected]
Signed-off-by: Ricardo Pardini [email protected]
Signed-off-by: Ricardo Pardini [email protected]
Signed-off-by: Ricardo Pardini [email protected]