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.
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
My own build process for creating a rEFInd release involves two scripts, which are in the rEFInd git repository:
mkdistrib
andmkcdimage
. 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. Themkcdimage
script relies on the actions ofmkdistrib
, so they must be run in order --mkdistrib
first and thenmkcdimage
.The
mkcdimage
script copies therefind.conf-sample
file in the source toEFI\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 torefind.conf
, you should be able to simply editrefind.conf-sample
and run both scripts.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:refind-cd-0.13.3.1.iso
torefind-test.iso
.refind-test.iso
using UltraISO as follows:REFIND_TEST
./EFI/boot/refind.conf
torefind.conf.NOT
./EFI/boot/refind.conf-sample
and rename torefind.conf
.refind.conf
: Set timeout = 100.refind.conf
into/EFI/boot/
.refind-test.iso
, which creates a modified ISO file with the same properties as the original.When I booted from it the timeout was still 20 seconds, and it had an Install button bottom left (
showtools
inrefind.conf.NOT
includes this but the newrefind.conf
does not). Both these facts strongly suggest it wasn't using the newrefind.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?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.