Overview
When building or deploying custom kernels on Ubuntu, the installkernel utility handles placing kernel artifacts into their proper system locations. This hands-on walkthrough examines how the tool is structured under the hood, demonstrates its required arguments and custom target directory behavior, and shows how it preserves existing binaries with .old backups before triggering post-installation hooks.
Locating installkernel and Inspecting Its Script
Before experimenting with installkernel, ensure the debianutils package—which provides the utility—is available on your system.

Next, locate the binary on your PATH by running which installkernel.
The output confirms that the executable resides at /usr/sbin/installkernel.

Inspect the opening 35 lines of the file with head -n 35 /usr/sbin/installkernel.
As the header and comments reveal, installkernel is actually a /bin/sh shell script rather than a compiled binary. When you run make install from a Linux kernel source tree, the build system invokes this script to copy the compiled kernel image and metadata into the standard Debian-style directories.

Understanding Required Arguments and Preparing Test Artifacts
Invoking installkernel 2>&1 || true with no parameters prints its usage signature.
The message Usage: installkernel <version> <image> <System.map> <directory> indicates that the script expects four positional arguments: a kernel version string, the kernel image file, the corresponding System.map file, and a destination directory.

To keep the experiment isolated from the host’s /boot partition, create a dedicated staging directory using mkdir -p /tmp/kernel_lab/boot_target.

Generate a placeholder kernel image file for testing with echo "dummy_kernel_binary" > /tmp/kernel_lab/bzImage-test.

Create a matching mock System.map file alongside it by running echo "00000000 T _text" > /tmp/kernel_lab/System.map-test.

Deploying to a Custom Directory and Observing .old Backups
Now pass the 6.8.0-custom version string, the dummy kernel image, the mock System.map, and /tmp/kernel_lab/boot_target to the script via installkernel 6.8.0-custom /tmp/kernel_lab/bzImage-test /tmp/kernel_lab/System.map-test /tmp/kernel_lab/boot_target || true.
The command completes silently without errors, copying the artifacts into the specified target path.

Verify the deployment by listing the target folder with ls -la /tmp/kernel_lab/boot_target.
Notice that the script automatically renames the files using the supplied version string, producing vmlinuz-6.8.0-custom and System.map-6.8.0-custom.

To see how the utility handles overwriting an identical kernel version, execute installkernel 6.8.0-custom /tmp/kernel_lab/bzImage-test /tmp/kernel_lab/System.map-test /tmp/kernel_lab/boot_target || true a second time.
Rather than discarding the previous files, installkernel rotates them into backups before writing the new copies.

Check the directory contents again with ls -la /tmp/kernel_lab/boot_target.
The earlier artifacts are preserved as vmlinuz-6.8.0-custom.old and System.map-6.8.0-custom.old right alongside the newly installed files.

Post-Installation Hooks (/etc/kernel/postinst.d) and Cleanup
After placing the kernel files, installkernel looks for hook scripts to run automatically—such as initramfs generators or bootloader updaters. Inspect the hook directory using ls -la /etc/kernel/postinst.d/.
In this environment, only . and .. appear, confirming that no custom scripts are currently registered inside /etc/kernel/postinst.d/.

Finally, remove the temporary workspace and mock files by running rm -rf /tmp/kernel_lab.

Understanding how installkernel names, backs up, and hooks kernel artifacts makes manual kernel compilation and deployment on Ubuntu much more predictable. With these mechanics clear, you can safely test custom builds or troubleshoot make install behavior whenever needed.