Update /boot/uInitrd automatically after update-initramfs

Put the following to /etc/initramfs/post-update.d/99-uInitrd, and chmod +x to make it executable:

#!/bin/sh
set -e
# $1 = version, $2 = full path to initrd.img-xxx
echo "update-initramfs: Converting to /boot/uInitrd" >&2
temp="/boot/uInitrd-$1"
mkimage -A arm64 -O linux -T ramdisk -C gzip -n uInitrd -d $2 $temp 1> /dev/null
mv $temp /boot/uInitrd

This is how update-initramfs -u looks like now:

# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.20.0
update-initramfs: Converting to /boot/uInitrd

Reference: Chapter 8. Package maintainer scripts and hooks.

2 thoughts on “Update /boot/uInitrd automatically after update-initramfs”

  1. I’d like to add, that using this script has to be in another folder
    It should be in /usr/share/initramfs-tools/hooks

    The enumeration of the version and the output path doesn’t work either, do you have an idea what can be done about that?

    The output is:
    update-initramfs: Generating /boot/initrd.img-5.4.102-odroidxu4
    update-initramfs: Converting to /boot/uInitrd
    Error: Missing output filename

    1. This is likely a difference between distros.

      I’d suggest you to check the man page for your version of update-initramfs. It looks like that update-initramfs on your system is providing different arguments to hook script from what’s seen in my distro. Specifically, it either does not provide the second argument, or the one provided is not a valid file name.

Leave a Reply to Ludwig Cancel reply

Your email address will not be published. Required fields are marked *