Skip to content

Commit e680892

Browse files
Staphylolguohan
authored andcommitted
[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.
1 parent 1bcd54d commit e680892

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Makefile.work

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ SLAVE_IMAGE = sonic-slave-$(USER)
6161
SLAVE_DIR = sonic-slave
6262
endif
6363

64-
OVERLAY_MODULE_CHECK := lsmod | grep "^overlay " > /dev/null 2>&1 || (echo "ERROR: Module 'overlay' not loaded. Try running 'sudo modprobe overlay'."; exit 1)
64+
OVERLAY_MODULE_CHECK := \
65+
lsmod | grep -q "^overlay " &>/dev/null || \
66+
zgrep -q 'CONFIG_OVERLAY_FS=y' /proc/config.gz &>/dev/null || \
67+
grep -q 'CONFIG_OVERLAY_FS=y' /boot/config-$(shell uname -r) &>/dev/null || \
68+
(echo "ERROR: Module 'overlay' not loaded. Try running 'sudo modprobe overlay'."; exit 1)
6569

6670
BUILD_TIMESTAMP := $(shell date +%Y%m%d\.%H%M%S)
6771

0 commit comments

Comments
 (0)