[202305] Add build option to reduce final image size#16948
[202305] Add build option to reduce final image size#16948StormLiangMS merged 1 commit intosonic-net:202305from
Conversation
|
@StormLiangMS @lipxu this is the backport of #16729 for 202305 since the introduction staged debian build conflicts |
6011e42 to
878aba7
Compare
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Add a build option to reduce the image size. The image reduction process is affecting the builds in 2 ways: - change some packages that are installed in the rootfs - apply a rootfs reduction script The script itself will perform a few steps: - remove file duplication by leveraging hardlinks - under /usr/share/sonic since the symlinks under the device folder are lost during the build. - under /var/lib/docker since the files there will only be mounted ro - remove some extra files (man, docs, licenses, ...) - some image specific space reduction (only for aboot images currently) The script can later be improved but for now it's reducing the rootfs size by ~30%.
878aba7 to
cbb95a9
Compare
|
@Staphylo , Please inform does this image size reduction feature is applicable for all platform builds (i.e. VS, Broadcom, Marvell etc) or restricted to particular version of platform/ASIC in 202305 release ? |
|
Hi @Staphylo / @StormLiangMS , I tried to generate Virtual Switch VM build from 202305 source with this build option. But, didn't notice any difference in the final image size (i.e. sonic-vs.img.gz). Steps followed:
|
Why I did it
Running SONiC releases past 202012 has become really challenging on system with small storage devices (4GB).
Some of these devices can also be limited by only having 4GB of RAM which complicates mitigations.
The main contributor to these issues is the SONiC image growth.
Being able to reduce it by some decent amount should allow these systems to run SONiC longer.
It would also reduce some impacts related to space savings mitigations.
Work item tracking
How I did it
Add a build option to reduce the image size.
The image reduction process is affecting the builds in 2 ways:
The script itself will perform a few steps:
The script can later be improved but for now it's reducing the rootfs size by ~30%.
How to verify it
Compare the size of an image with this option enabled and this option enabled.
Expect the fully extracted content to be ~30% less.
Which release branch to backport (provide reason below if selected)
This is a backport of #16729
Description for the changelog
Add build option to reduce final image size