Software & AppsOperating SystemLinux

Creating an EFI-Bootable ISO of Customized Ubuntu

Ubuntu 5

In this article, we will walk through the process of creating an EFI-bootable ISO of a customized version of Ubuntu. This can be particularly useful if you have created your own spin of Ubuntu and need to make it bootable on systems that use the EFI (Extensible Firmware Interface) standard.

Quick Answer

To create an EFI-bootable ISO of a customized Ubuntu distribution, you need to obtain the Ubuntu ISO file, mount it, extract its contents, add the EFI boot files, modify the boot configuration, and create the EFI-bootable ISO using the mkisofs command. Finally, verify the ISO to ensure it is correctly configured.

Prerequisites

Before we begin, ensure that you have the following:

  • A standard Ubuntu ISO file or the ISO file of your customized Ubuntu distribution.
  • A system running Ubuntu or another Linux distribution.
  • Basic knowledge of the command line and Linux filesystem.

Step 1: Obtain the Ubuntu ISO

The first step is to get the ISO file of Ubuntu. You can download the standard Ubuntu ISO file from the Ubuntu website or use the ISO file of your customized distribution.

Step 2: Mount the ISO

Next, we need to mount the ISO file. This can be done using the loopback device. First, create a directory to mount the ISO:

sudo mkdir -p /mnt/iso

Then, mount the ISO file:

sudo mount -o loop ubuntu.iso /mnt/iso

In the above command, sudo is used to execute the command with root privileges, mount is the command to mount filesystems, -o loop specifies that the filesystem is a loop device, and ubuntu.iso is the ISO file.

Step 3: Extract the ISO Contents

After mounting the ISO, we need to extract its contents. Create a new directory for this:

sudo mkdir -p /tmp/ubuntu

Then, copy all the files from the mounted ISO to this new directory:

sudo cp -rT /mnt/iso /tmp/ubuntu

The cp command is used to copy files and directories, -r is for recursive copying, and -T treats the destination as a normal file.

Step 4: Add EFI Boot Files

To make the ISO bootable on EFI systems, we need to add the EFI boot files. These files are located in the EFI/BOOT directory in the standard Ubuntu ISO.

Copy this directory to the corresponding location in your customized ISO:

sudo cp -r /mnt/iso/EFI/BOOT /tmp/ubuntu/EFI

Step 5: Modify the Boot Configuration

Next, we need to modify the boot configuration file to ensure it points to the correct EFI boot files.

Open the file /tmp/ubuntu/boot/grub/grub.cfg in a text editor and make any necessary changes to the paths of the EFI boot files.

Step 6: Create the EFI-Bootable ISO

Now we are ready to create the EFI-bootable ISO. We can use the mkisofs command for this. This command creates an ISO9660/Joliet/HFS filesystem with optional Rock Ridge attributes.

Here is an example command:

sudo mkisofs -o custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -r -J /tmp/ubuntu

In this command:

  • -o custom.iso specifies the output file.
  • -b isolinux/isolinux.bin specifies the boot image for BIOS systems.
  • -c isolinux/boot.cat specifies the boot catalog for BIOS systems.
  • -no-emul-boot specifies that the boot image is not emulated.
  • -boot-load-size 4 specifies the number of sectors to load for the initial boot image.
  • -boot-info-table specifies that a boot information table should be created.
  • -eltorito-alt-boot starts an alternative El Torito boot parameters.
  • -e boot/grub/efi.img specifies the boot image for EFI systems.
  • -r enables Rock Ridge extensions.
  • -J enables Joliet naming (for long filenames).

Step 7: Verify the ISO

Finally, we should verify the ISO to ensure it is correctly configured. We can use the dumpet command for this:

dumpet -i custom.iso

The dumpet command dumps information about an ISO file. -i custom.iso specifies the input file.

Ensure that the EFI boot entry is present and correctly configured.

Conclusion

You now have an EFI-bootable ISO of your customized Ubuntu distribution. You can use this ISO to boot your distribution on EFI systems, including on a Mac. You can burn it to a USB drive or use it in a virtual machine to test the EFI boot functionality.

Remember to always test your ISO in a safe environment before deploying it to production systems.

What is EFI?

EFI stands for Extensible Firmware Interface. It is a specification that defines the interface between the operating system and the firmware on a computer. EFI is the successor to the traditional BIOS and is used in modern systems to initialize hardware and load the operating system.

Why do I need to create an EFI-bootable ISO?

You need to create an EFI-bootable ISO if you have customized your own version of Ubuntu and want to make it bootable on systems that use the EFI standard. EFI-bootable ISOs are required for EFI systems, including newer PCs and Macs.

Can I use this method for other Linux distributions?

Yes, you can use a similar method for other Linux distributions. The steps may vary slightly depending on the distribution, but the general process of mounting the ISO, extracting its contents, adding EFI boot files, modifying the boot configuration, and creating an EFI-bootable ISO should be applicable to most distributions.

Can I use this method on Windows or macOS?

This method is specifically designed for Linux distributions, so it may not work directly on Windows or macOS. However, you can create a bootable USB drive using the EFI-bootable ISO and then use that USB drive to boot your customized Ubuntu distribution on Windows or macOS systems.

Can I use a different text editor to modify the boot configuration file?

Yes, you can use any text editor of your choice to modify the boot configuration file. The example in the article uses the default Ubuntu text editor, but you can use alternatives like Nano or Vim. Just make sure you have the necessary permissions to edit the file.

How can I test the EFI boot functionality of the ISO?

You can test the EFI boot functionality of the ISO by either burning it to a USB drive or using it in a virtual machine. To burn it to a USB drive, you can use tools like Rufus or Etcher. To use it in a virtual machine, you can use software like VirtualBox or VMware. Make sure to follow the appropriate steps for each method to ensure proper testing.

What should I do if the EFI boot entry is not present or incorrectly configured?

If the EFI boot entry is not present or incorrectly configured, you may need to go back and check the steps you followed. Make sure that you correctly added the EFI boot files and modified the boot configuration file. You can also try re-creating the EFI-bootable ISO using the provided mkisofs command. Double-checking your steps and verifying the ISO again using the dumpet command should help identify any issues.

Leave a Comment

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