diff --git a/Makefile b/Makefile
index 695b1bc73cf43c0cdfb86d776f0f45d6883bfca2..758d9a93e25440e9ef60e0d4aded7629a1deb7b9 100644
--- a/Makefile
+++ b/Makefile
@@ -170,7 +170,8 @@ $(LUA):
 
 	scripts/module_check.sh
 
-	[ -e openwrt/.config ] || $(OPENWRTMAKE) defconfig
+	$(GLUON_ENV) scripts/basic_openwrt_config.sh > openwrt/.config
+	$(OPENWRTMAKE) defconfig
 	$(OPENWRTMAKE) tools/install
 	$(OPENWRTMAKE) package/lua/host/compile
 
diff --git a/scripts/basic_openwrt_config.sh b/scripts/basic_openwrt_config.sh
new file mode 100755
index 0000000000000000000000000000000000000000..105386febf5b02a64b8c75a67cf5a84e0a11ad8e
--- /dev/null
+++ b/scripts/basic_openwrt_config.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+echo "CONFIG_DEVEL=y"
+if [ "$GLUON_AUTOREMOVE" != "0" ]; then
+	echo "CONFIG_AUTOREMOVE=y"
+else
+	echo "# CONFIG_AUTOREMOVE is not set"
+fi