diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh
index 8b6e0c2bc0dfe0f966a86fa68632d64db2f73411..383fd43ac6122247310720afc391ab2610bd9847 100755
--- a/kernel/gen_kheaders.sh
+++ b/kernel/gen_kheaders.sh
@@ -14,7 +14,12 @@ include/
 arch/$SRCARCH/include/
 "
 
-type cpio > /dev/null
+if ! command -v cpio >/dev/null; then
+	echo >&2 "***"
+	echo >&2 "*** 'cpio' could not be found."
+	echo >&2 "***"
+	exit 1
+fi
 
 # Support incremental builds by skipping archive generation
 # if timestamps of files being archived are not changed.