Menu

Build custom .iso with customized config

2021-05-14
2023-02-20
  • Blake Garner

    Blake Garner - 2021-05-14

    I have been looking at building a customized reefind .iso for an automation
    project I'm working on. After some trial and error, I can now rebuild the
    .iso and it results in a correctly booting system.

    Now I need some details on how to rebuild the image inside the .iso with a
    custom refind.conf file. Is there any docs for that? Specifically, what is
    the location of the refind.conf file? Same as the example one?

    My goal here is to build an .iso that boots into macOS recovery partition
    without any user intervention. Suggestions on how to do that are
    appreciated as well.

    Thanks,
    Blake

     
  • Roderick W. Smith

    My own build process for creating a rEFInd release involves two scripts, which are in the rEFInd git repository: mkdistrib and mkcdimage. Both scripts are created for my convenience, and neither is well-documented, so you may need to experiment and reverse-engineer what they're doing to get them to work. In particular, they build files in the ../snapshots/{version} directory, where {version} is a version number that's specified on the command line passed to the scripts. The mkcdimage script relies on the actions of mkdistrib, so they must be run in order -- mkdistrib first and then mkcdimage.

    The mkcdimage script copies the refind.conf-sample file in the source to EFI\BOOT\refind.conf in the FAT filesystem that is ultimately written to the USB flash drive and CD-R image files. Thus, if all you want to do is to create a CD-R image with some changes to refind.conf, you should be able to simply edit refind.conf-sample and run both scripts.

     
  • Wonderer

    Wonderer - 2023-01-18

    I tried creating a simple example of a custom refind.iso with custom refind.conf as follows, but it doesn't seem to make any difference:

    • Copy refind-cd-0.13.3.1.iso to refind-test.iso.
    • Edit refind-test.iso using UltraISO as follows:
    • Change its labels to REFIND_TEST.
    • Rename /EFI/boot/refind.conf to refind.conf.NOT.
    • Extract a copy of /EFI/boot/refind.conf-sample and rename to refind.conf.
    • Edit refind.conf: Set timeout = 100.
    • Add refind.conf into /EFI/boot/.
    • Save refind-test.iso, which creates a modified ISO file with the same properties as the original.
    • Burned it to a CD.

    When I booted from it the timeout was still 20 seconds, and it had an Install button bottom left (showtools in refind.conf.NOT includes this but the new refind.conf does not). Both these facts strongly suggest it wasn't using the new refind.conf. How do I make it use a custom config file?

    It also remained the same after I deleted /EFI/boot/refind.conf.NOT from the ISO. Is the installation version of the config file hard coded into rEFInd? If so is there any way to override it?

     
    • Roderick W. Smith

      rEFInd's ISO file includes both an ISO-9660 filesystem and an embedded FAT filesystem using the El Torito format. I'm not familiar with the tools you used, but my suspicion is that they modified the ISO-9660 filesystem but not the El Torito image. This is a problem because most EFIs use the El Torito image to boot, not the ISO-9660 filesystem.

      Unfortunately, creating a bootable CD image is a bit of a mysterious art; there are too many tricky things that can go wrong. Creating a bootable USB flash drive is a bit easier, especially on EFI, since you just need to create a FAT filesystem that holds the key boot loader file under the name EFI\BOOT\bootx64.efi (on x86-64 systems).

      As I wrote in my original reply in 2021, the rEFInd git repository includes various scripts that I use to prepare a rEFInd distribution. Those are likely the easiest way to create a customized image, although as I noted, these scripts are not well-documented, and you may have to experiment before you get something that works.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.