The basic toolchain can/should be gotten from the running host system if it is for the same build arch and etc. This can be accomplished by using binary caches from /var/cache/sorcery. If the cache file for a given toolchain spell does not exist, it should NOT be taken from a repository somewhere, or from a basesystem tarball. Nor should the ISO builder have to re-cast one of the tool-chain components in order to generate the cache file for use. Rather, it should be taken from the already existing installed files on the system. This will require sorcery to generate binary tarballs of installed spells. If it doesn't do this already, a solution can be had by grabbing files from the installwatch logs (/var/state/sorcery?) and rolling those into a tarball. (I believe devel sorcery handles this situation.)
If the host system is for a different arch than the target for which the ISO is to be generated, then the spell caches will need to be obtained by other means. This could be done by casting those particular spells using the path of the CAULDRON_BUILD directory as INSTALL_ROOT. This would also need a separate instance of sorcery inside CAULDRON_BUILD so that it could safely be set for the target arch without polluting the host sorcery settings. This method can only be employed when the host arch is similar enough to the target arch though (e.g., the host is nocona-32 and the target is i486, or the host is x86_64 and the target is i486, etc.). In the event that the host is not sufficiently similar to the target, then an entire basesystem chroot will be needed, as for below (the host does not have a build toolchain).
In the event that the host system does not have a build toolchain itself (an embedded system, for example, or a system geared for security), then a basesystem tarball will be needed. However, for the intents and purposes of Cauldron, that basesystem will then be considered the host system, so the same discussion as above still applies.
Once the basic tool-chain is generated/found/copied into the build directory, along with a copy of sorcery, everything needed to generate the ISO (aside from the spell packages themselves, which should be gotten over the net or copied in manually from pre-downloaded files; for grabbing over the net, a proper resolv.conf will be needed inside the ISO build chroot) should now be available inside of the build directory (CAULDRON_BUILD).
The settings for sorcery should be set for the target system (target cpu, etc.) if they haven't been already. For optimizations, strip should be used. The question of whether -Os should be used or not depends on how stable the resulting builds will be for the minimal architecture to be supported by the ISO being built (e.g. i486, x86_64). If -Os will cause problems for some machines to boot the ISO for which the ISO was intended to boot on, then it obviously should not be used. If -Os can be used without causing any problems for the booting of the ISO on the target systems, -Os should be used in addition to --strip in order to reduce the size of the ISO.
Afterwards, a basic system can be built inside the build chroot using sorcery and the configured tool-chain. This basic system should be absolutely minimal, as it will be what is installed onto the target system. After the base system is generated/built, the chroot should be exited, and the cache files for all the spells that are to be included in the target install (non-optional spells) should be unpacked into a separate directory. That directory will then be archived and compressed as system.tar.bz2 to be placed on the ISO. Don't forget to clean out unnecessary files from the new separate directory, _not_ the original build directory, before making the bzipped tarball. [system.tar.bz2] (Unnecessary files will include the host (cross-compile) tool-chain used to build the base system (this should not be copied in the first place, but it's a good idea to check), as well as (possibly) sorcery files in /var, anything in /usr/src, etc.)
Chroot back into the main build dir (i.e. not the system install copy). Build the ISO system by casting additional spells on top of the base system generated in the previous step. This includes a kernel (config for the kernel SHOULD be something downloaded from a repository), filesystem tools (reiserfstools, xfstools, e2fstools, etc.), and anything else required not only to boot the target system but manipulate and install onto it. This means that all features desired in the installer must be present or provided for through the spells cast in this step or the previous step (though very little should come from the previous step, as the previous step should really only provide an absolute minimal tool-chain generated for the target system).
Exit the ISO build chroot. Unpack the necessary spell caches to a separate directory for the ISO system. Remove any unnecessary files/packages/etc. from the ISO (i.e., run the cleaners on it). Copy in the bzipped tarball of the system install (system.tar.bz2).
Generate an initrd/initramfs to be used to boot the ISO, and place it boot/ in the ISO system directory just created and populated from the build spell caches. Configure the boot/init process for the ISO. This includes modifying isolinux/isolinux.cfg, as well as various scripts/configs in /etc, as well as generating an initrd/initramfs for the ISO. Pay particular attention to the init system (including what will happen "before init"). (Whether or not other bootloaders, such as grub, can be used as viable alternatives to isolinux will be researched later.)
Generate a bootable ISO using mkisofs. Compress the ISO using bzip2. [e.g. smgl-devel.iso.bz2]
