The calls to grep in the script do not find the byte sequences in a UTF-8 locale as the zImage file gets treated as a text file in the current locale. A workaround is to run the script in the C (or POSIX) locale. A fix is to prepend LANG=C to the grep commands in the script.