More compatible use of mktemp

This is taken from FILO and slightly enhanced.

Signed-off-by: Stefan Reinauer <>

Change-Id: Ieadd9db3f1013ec1cd9f5a1dc44e17587617f1d1
Original-Change-Id: I961a7ddcd39657c9463806d7b82757eff0a4ac57
Original-Signed-off-by: Patrick Georgi <>
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <>
Reviewed-by: Patrick Georgi <>
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile
index e1fcb31..2479c39 100755
--- a/util/xcompile/xcompile
+++ b/util/xcompile/xcompile
@@ -51,7 +51,7 @@
 # Create temporary file(s).
-TMPFILE="$(mktemp /tmp/temp.XXXX 2>/dev/null || echo /tmp/temp.78gOIUGz)"
+TMPFILE="$(mktemp /tmp/temp.XXXXXX 2>/dev/null || echo /tmp/temp.coreboot.$RANDOM)"
 touch "$TMPFILE"
 trap clean_up EXIT