+define Quilt/RefreshDir
+ mkdir -p $(1)
+ -rm -f $(1)/* 2>/dev/null >/dev/null
+ @( \
+ for patch in $$($(if $(2),grep "^$(2)",cat) $(PKG_BUILD_DIR)/patches/series | awk '{print $$1}'); do \
+ $(CP) -v "$(PKG_BUILD_DIR)/patches/$$patch" $(1); \
+ done; \
+ )
+endef
+
+define Quilt/Refresh/Package
+ $(call Quilt/RefreshDir,$(PATCH_DIR))
+endef
+
+define Quilt/Refresh/Kernel
+ @[ -z "$$(grep -v '^generic/' $(PKG_BUILD_DIR)/patches/series | grep -v '^platform/')" ] || { \
+ echo "All kernel patches must start with either generic/ or platform/"; \
+ false; \
+ }
+ $(call Quilt/RefreshDir,$(GENERIC_PATCH_DIR),generic/)
+ $(call Quilt/RefreshDir,$(PATCH_DIR),platform/)
+endef
+
+quilt-check: $(STAMP_PREPARED) FORCE