Skip to content

Commit

Permalink
Introducing 'debugging' and 'profiling' options in sonic build-infra (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rodnymolina authored and jleveque committed Jun 19, 2018
1 parent a8a7b79 commit b5f153b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
12 changes: 10 additions & 2 deletions rules/config
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ DEFAULT_PASSWORD = YourPaSsWoRd
# by default for TOR switch
# ENABLE_PFCWD_ON_START = y

# SONIC_CONFIG_DEBUG - install debug packages
# SONIC_INSTALL_DEBUG_TOOLS - installs debugging tools in baseline docker
# Uncomment next line to enable:
# SONIC_CONFIG_DEBUG = y
# SONIC_INSTALL_DEBUG_TOOLS = y

# SONIC_ROUTING_STACK - specify the routing-stack being elected to drive SONiC's control-plane.
# Quagga will be the default routing-stack for all the SONiC platforms. Other supported
Expand All @@ -56,5 +56,13 @@ SONIC_ROUTING_STACK = quagga
# Enable Origanization Extensions - Specific to the deployment scenarios of the Organization
ENABLE_ORGANIZATION_EXTENSIONS = y

# Debugging option allows sonic debian packages to get built including symbols
# information. Profiling option, disables compiler optimizations (-O0) as well
# as includes symbols information. Given that 'profiling' option is a superset
# of 'debugging' one, user should only enable either one option or the other --
# if both options are enabled, the 'profiling' one will prevail.
#SONIC_DEBUGGING_ON = y
#SONIC_PROFILING_ON = y

# ENABLE_SYSTEM_TELEMETRY - build docker-sonic-telemetry for system telemetry support
# ENABLE_SYSTEM_TELEMETRY = y
2 changes: 1 addition & 1 deletion rules/docker-base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base
$(DOCKER_BASE)_DEPENDS += $(SUPERVISOR)
$(DOCKER_BASE)_DEPENDS += $(LIBWRAP)

ifeq ($(SONIC_CONFIG_DEBUG),y)
ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y)
GDB = gdb
VIM = vim
OPENSSH = openssh-client
Expand Down
18 changes: 14 additions & 4 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ else
$(warning PASSWORD given on command line: could be visible to other users)
endif

ifeq ($(SONIC_DEBUGGING_ON),y)
DEB_BUILD_OPTIONS_GENERIC := "nostrip"
endif

ifeq ($(SONIC_PROFILING_ON),y)
DEB_BUILD_OPTIONS_GENERIC := "nostrip noopt"
endif

ifeq ($(SONIC_BUILD_JOBS),)
override SONIC_BUILD_JOBS := $(SONIC_CONFIG_BUILD_JOBS)
endif
Expand All @@ -109,13 +117,15 @@ $(info "PASSWORD" : "$(PASSWORD)")
$(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)")
$(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)")
$(info "ENABLE_PFCWD_ON_START" : "$(ENABLE_PFCWD_ON_START)")
$(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)")
$(info "SONIC_INSTALL_DEBUG_TOOLS" : "$(SONIC_INSTALL_DEBUG_TOOLS)")
$(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)")
$(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)")
$(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)")
$(info "HTTP_PROXY" : "$(HTTP_PROXY)")
$(info "HTTPS_PROXY" : "$(HTTPS_PROXY)")
$(info "ENABLE_SYSTEM_TELEMETRY" : "$(ENABLE_SYSTEM_TELEMETRY)")
$(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)")
$(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)")
$(info )

###############################################################################
Expand Down Expand Up @@ -201,7 +211,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(a
# Apply series of patches if exist
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi
# Build project and take package
make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG)
DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC}" make DEST=$(shell pwd)/$(DEBS_PATH) -C $($*_SRC_PATH) $(shell pwd)/$(DEBS_PATH)/$* $(LOG)
# Clean up
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi
$(FOOTER)
Expand All @@ -224,8 +234,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a
pushd $($*_SRC_PATH) $(LOG)
[ ! -f ./autogen.sh ] || ./autogen.sh $(LOG)
$(if $($*_DPKG_TARGET),
DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG),
DEB_BUILD_OPTIONS=$($*_DEB_BUILD_OPTIONS) dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG)
DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --as-root -T$($*_DPKG_TARGET) $(LOG),
DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS_GENERIC} ${$*_DEB_BUILD_OPTIONS}" dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG)
)
popd $(LOG)
# Clean up
Expand Down

0 comments on commit b5f153b

Please sign in to comment.