Sometimes a developer would want to test his/her executable (which might contain some bug fix or could be a debug binary). And if this binary needs to be executed during Operating System Install process, then this binary will have to be inserted into the install media (the iso image). The iso media is having its own filesystem layout and we cannot add anything to it directly. The user will have to extract the contents of the iso, edit it and then again convert it back to iso form. Here below I explain a step-by-step mechanism to achieve this.
Login to a Solaris machine, download the Solaris Install DVD image (ISO format) and save it to a local folder.
Solaris Install DVD images can be downloaded from: https://www.oracle.com/solaris/solaris11/downloads/solaris11-install-downloads.html
Path to the Solaris Install ISO image that I downloaded and saved on my system: /var/tmp/sol-11_4_24_72_0-text-x86.iso
Please note that, all the commands need root or superuser authorization.
Create 3 temporary directories /root/ai, /root/ai/image and /mnt/ai. We use these temporary directories to mount the ISO filesystem and extracting its contents.
# mkdir /root/ai /root/ai/image /mnt/ai
The following command mounts the ISO image at /mnt/ai:
# mount -F hsfs $(lofiadm -a /var/tmp/sol-11_4_24_72_0-text-x86.iso) /mnt/ai
Now copy the filesystem mounted at /mnt/ai to /root/ai/image using cpio command:# cd /mnt/ai
# find . -depth -print | cpio -pdm /root/ai/image
Create the temporary directories /root/ai/zlib and /mnt/zlib for next stage of processing:
# mkdir /root/ai/zlib /mnt/zlib
The following command mounts the zlib image at /mnt/zlib:
# mount -F hsfs $(lofiadm -a /root/ai/image/solaris.zlib) /mnt/zlib
Now copy the contents of /mnt/zlib to /root/ai/zlib using cpio command:
# cd /mnt/zlib
# find . -depth -print | cpio -pdm /root/ai/zlib
Now the install image files are located at /root/ai/zlib and /root/ai/image directories. Now you can modify or replace any file you want in these directories.
# cd /root/ai/zlib
Recreate Solaris zlib image using the following command (it will get saved as mysolaris.zlib):
# mkisofs -o /root/ai/mysolaris.zlib -quiet -N -l -R -U -allow-multidot -no-iso-translate -cache-inodes -d -D -V "compress" /root/ai/zlib/
# lofiadm -C lzma /root/ai/mysolaris.zlib
Copy back the mysolaris.zlib back to /root/ai/image/solaris.zlib:
# cp /root/ai/mysolaris.zlib /root/ai/image/solaris.zlib
Create the new ISO image using the command:
# mkisofs -o /var/tmp/sol-11_4_24_72_0-text-x86_new.iso -c .catalog -eltorito-boot boot/bios.img -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-# platform efi -eltorito-boot boot/uefi.img -no-emul-boot -eltorito-platform 0xaf -eltorito-boot zvboot -no-emul-boot -U -allow-multidot -no-iso-translate -cache-inodes -N -l -R -D -volset tcu24-02.us.oracle.com-2014-02-01T22:13:56.652251 -V Oracle_Solaris_Text_X86 /root/ai/image
The new ISO file is ready and it is saved as: /var/tmp/sol-11_4_24_72_0-text-x86_new.iso This new ISO image has your changes inside.