Skip to content

Instantly share code, notes, and snippets.

@Zrubi
Created July 27, 2018 11:36
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/bf38fbf1a88befb0cee3d0a05b9b2d4d to your computer and use it in GitHub Desktop.
Save Zrubi/bf38fbf1a88befb0cee3d0a05b9b2d4d to your computer and use it in GitHub Desktop.
#!/bin/sh
# uInitrd generator for U-Boot
# place this file to /etc/initramfs/post-update.d/ directory,
# and make it executable
# reference: https://forum.doozan.com/read.php?2,12096
uInitrd="/boot/uInitrd"
die () {
echo >&2 "Error: $@"
echo >&2 "uInitrd generation failed - exiting."
exit 1
}
echo "Generating uInitrd for U-Boot:"
if [ "$#" -eq 2 ]; then
if [ ! -z "$1" ] && [ -f "$2" ];then
name="initramfs-$1"
file="$2"
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n ${name} -d ${file} ${uInitrd}
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