-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Image build time improvements #10104
Merged
saiarcot895
merged 4 commits into
sonic-net:master
from
saiarcot895:image-build-time-improvements
Apr 19, 2022
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3c0c85e
[build]: Patch debootstrap to not unmount the host's /proc filesystem
saiarcot895 eb257c0
[build_debian.sh]: Use eatmydata to speed up deb package installations
saiarcot895 35dd806
Merge remote-tracking branch 'origin/master' into image-build-time-im…
saiarcot895 3a273df
Change ln syntax to use chroot
saiarcot895 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
SPATH := $($(DEBOOTSTRAP)_SRC_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/debootstrap.mk rules/debootstrap.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
DEP_FILES += $(shell git ls-files $(SPATH)) | ||
|
||
$(DEBOOTSTRAP)_CACHE_MODE := GIT_CONTENT_SHA | ||
$(DEBOOTSTRAP)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
$(DEBOOTSTRAP)_DEP_FILES := $(DEP_FILES) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# debootstrap package | ||
|
||
DEBOOTSTRAP_VERSION = 1.0.123 | ||
|
||
export DEBOOTSTRAP_VERSION | ||
|
||
DEBOOTSTRAP = debootstrap_$(DEBOOTSTRAP_VERSION)_all.deb | ||
$(DEBOOTSTRAP)_SRC_PATH = $(SRC_PATH)/debootstrap | ||
SONIC_MAKE_DEBS += $(DEBOOTSTRAP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
debootstrap*.udeb | ||
debootstrap*.dsc | ||
debootstrap-*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.ONESHELL: | ||
SHELL = /bin/bash | ||
.SHELLFLAGS += -e | ||
|
||
MAIN_TARGET = debootstrap_$(DEBOOTSTRAP_VERSION)_all.deb | ||
|
||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : | ||
# Remove any stale files | ||
rm -rf ./debootstrap-$(DEBOOTSTRAP_VERSION) ./debootstrap*.{deb,udeb,dsc} | ||
|
||
# Get source package | ||
dget https://deb.debian.org/debian/pool/main/d/debootstrap/debootstrap_$(DEBOOTSTRAP_VERSION).dsc | ||
|
||
# Build source and Debian packages | ||
pushd debootstrap-$(DEBOOTSTRAP_VERSION) | ||
patch -p1 -i ../proc-mount.patch | ||
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) | ||
popd | ||
|
||
# Move the newly-built .deb packages to the destination directory | ||
mv $(DERIVED_TARGETS) $* $(DEST)/ | ||
|
||
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
From 87cdebbcad6f4e16ba711227cbbbd70039f88752 Mon Sep 17 00:00:00 2001 | ||
From: YunQiang Su <[email protected]> | ||
Date: Mon, 7 Sep 2020 09:29:37 +0800 | ||
Subject: [PATCH] stage1: re-mkdir /proc instead of umount if it is a symlink | ||
|
||
In docker, the TARGET/proc will be a symlink to /proc. | ||
And if the docker instance is called with --privileged, it will umount | ||
the /proc of the whole instance in setup_proc. | ||
--- | ||
debian/changelog | 3 +++ | ||
functions | 7 ++++++- | ||
2 files changed, 9 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/functions b/functions | ||
index 1ac63f7..065320d 100644 | ||
--- a/functions | ||
+++ b/functions | ||
@@ -1183,7 +1183,12 @@ setup_proc () { | ||
umount_on_exit /dev/shm | ||
umount_on_exit /proc | ||
umount_on_exit /proc/bus/usb | ||
- umount "$TARGET/proc" 2>/dev/null || true | ||
+ if [ -L "$TARGET/proc" ];then | ||
+ rm -f $TARGET/proc | ||
+ mkdir $TARGET/proc | ||
+ else | ||
+ umount "$TARGET/proc" 2>/dev/null || true | ||
+ fi | ||
|
||
# some container environment are used at second-stage, it already treats /proc and so on | ||
if [ -z "$(ls -A "$TARGET/proc")" ]; then | ||
-- | ||
GitLab | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
After removing in chroot, you have a dead symlink outside. #Closed
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.
The symlink is being created inside the chroot, and is being deleted on line 578, so there shouldn't be any dead symlink in the slave container.