Skip to content

Instantly share code, notes, and snippets.

@Zrubi
Created July 27, 2018 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Zrubi/47274c7e1f89efc9a7887ac48a3976b5 to your computer and use it in GitHub Desktop.
Save Zrubi/47274c7e1f89efc9a7887ac48a3976b5 to your computer and use it in GitHub Desktop.
#!/bin/sh
# uImage generator for U-Boot
# place this file to /etc/kernel/postinst.d/ directory,
# and make it executable
# reference: https://forum.doozan.com/read.php?2,12096
uImage="/boot/uImage"
die () {
echo >&2 "Error: $@"
echo >&2 "uImage generation failed - exiting."
exit 1
}
echo "Generating uImage for U-Boot:"
if [ "$#" -eq 2 ]; then
if [ ! -z "$1" ] && [ -f "$2" ];then
name="Linux-$1"
file="$2"
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n ${name} -d ${file} ${uImage}
else
die "wrong arguments: '$1', '$2'"
fi
else
die "2 arguments required, $# provided"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment