From e680892f390d2135e8741894aee62db464c32022 Mon Sep 17 00:00:00 2001 From: Samuel Angebault Date: Thu, 20 Jun 2019 09:20:34 -0700 Subject: [PATCH] [build] Improve overlay check in Makefile (#3050) Some kernels are built with overlayfs as a builtin and not a module. For these the check via lsmod currently fails. This improvement now checks the kernel configuration for the CONFIG_OVERLAY_FS entry. Depending on the OS and kernel version the build configuration can be in multiple places. --- Makefile.work | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.work b/Makefile.work index 2cb6eae1258f..88780724ea76 100644 --- a/Makefile.work +++ b/Makefile.work @@ -61,7 +61,11 @@ SLAVE_IMAGE = sonic-slave-$(USER) SLAVE_DIR = sonic-slave endif -OVERLAY_MODULE_CHECK := lsmod | grep "^overlay " > /dev/null 2>&1 || (echo "ERROR: Module 'overlay' not loaded. Try running 'sudo modprobe overlay'."; exit 1) +OVERLAY_MODULE_CHECK := \ + lsmod | grep -q "^overlay " &>/dev/null || \ + zgrep -q 'CONFIG_OVERLAY_FS=y' /proc/config.gz &>/dev/null || \ + grep -q 'CONFIG_OVERLAY_FS=y' /boot/config-$(shell uname -r) &>/dev/null || \ + (echo "ERROR: Module 'overlay' not loaded. Try running 'sudo modprobe overlay'."; exit 1) BUILD_TIMESTAMP := $(shell date +%Y%m%d\.%H%M%S)