diff --git a/Makefile b/Makefile
index e3aa596f5a404498f9b5e52058b77aa58e954266..565a32a08d9579ac8ec3210b93e2389aef62b61d 100644
--- a/Makefile
+++ b/Makefile
@@ -181,6 +181,7 @@ config: $(LUA) FORCE
 		$(call CheckSite,$(conf)); \
 	)
 
+	$(OPENWRTMAKE) prepare-tmpinfo
 	$(GLUON_ENV) $(LUA) scripts/target_config.lua > openwrt/.config
 	$(OPENWRTMAKE) defconfig
 	$(GLUON_ENV) $(LUA) scripts/target_config_check.lua
diff --git a/scripts/target_config_lib.lua b/scripts/target_config_lib.lua
index 7e41f883887201421b2d4c77a430da435da88531..ef487f061433904a61406542da85d45136552e04 100644
--- a/scripts/target_config_lib.lua
+++ b/scripts/target_config_lib.lua
@@ -154,12 +154,31 @@ local function handle_target_pkgs(pkgs)
 	end
 end
 
+local function get_default_pkgs()
+	local targetinfo_target = string.gsub(openwrt_config_target, '_', '/')
+	local target_matches = false
+	for line in io.lines('openwrt/tmp/.targetinfo') do
+		local target_match = string.match(line, '^Target: (.+)$')
+		if target_match then
+			target_matches = (target_match == targetinfo_target)
+		end
+
+		local default_packages_match = string.match(line, '^Default%-Packages: (.+)$')
+		if target_matches and default_packages_match then
+			return split(default_packages_match)
+		end
+	end
+
+	io.stderr:write('Error: unable to get default packages for OpenWrt target ', targetinfo_target, '\n')
+	os.exit(1)
+end
+
 lib.include('generic')
 lib.include(target)
 
 lib.check_devices()
 
-handle_target_pkgs(lib.target_packages)
+handle_target_pkgs(concat_list(get_default_pkgs(), lib.target_packages))
 
 for _, dev in ipairs(lib.devices) do
 	local device_pkgs = {}