Add initramfs image creator Installed system is packaged as a cpio archive to be used as initramfs.
Based on markmc's patch: http://people.redhat.com/markmc/live/livecd-creator-patches/livecd-initramfs-target.patch Signed-off-by: Alan Pevec <[EMAIL PROTECTED]> Index: livecd/imgcreate/creator.py =================================================================== --- livecd.orig/imgcreate/creator.py +++ livecd/imgcreate/creator.py @@ -832,3 +832,58 @@ class LoopImageCreator(ImageCreator): def _stage_final_image(self): self._resparse() shutil.move(self._image, self._outdir + "/" + self.name + ".img") + + +class InitramfsImageCreator(ImageCreator): + """Installs a system into a cpio archive for initramfs. + + InitramfsImageCreator is a straightforward ImageCreator subclass; + the installed system is packaged as a compressed cpio archive which can be + subsequently used for initramfs. + + """ + + def __init__(self, ks, name): + """Initialize an InitramfsImageCreator instance. + """ + ImageCreator.__init__(self, ks, name) + + def _cdroot(self): + """Change into the install root. + """ + os.chdir(self._instroot) + + # + # Actual implementation + # + def _get_fstab(self): + s = "rootfs / ext3 defaults,noatime 0 0\n" + s += "devpts /dev/pts devpts gid=5,mode=620 0 0\n" + s += "tmpfs /dev/shm tmpfs defaults 0 0\n" + s += "proc /proc proc defaults 0 0\n" + s += "sysfs /sys sysfs defaults 0 0\n" + return s + + def _mount_instroot(self, base_on = None): + if not base_on is None: + try: + subprocess.call(['/usr/bin/pax', '-rzf', base_on], preexec_fn=self._cdroot) + except OSError, e: + raise CreatorError("Failed to extract '%s': %s" % (base_on, e)) + + def __get_image(self): + return self._outdir + "/" + self.name + ".img" + _image = property(__get_image) + """The location of the initramfs archive. + """ + + def _stage_final_image(self): + try: + instroot_init = self._instroot + "/init" + if not os.path.lexists(instroot_init): + os.symlink("sbin/init", instroot_init) + subprocess.call(['/usr/bin/pax', '-w', '-zx', 'sv4cpio', '-s', '/^\.\///', + '-f', self._image, '.'], preexec_fn=self._cdroot) + except OSError, e: + raise CreatorError("Failed to create the initramfs image: %s" % e) + Index: livecd/livecd-tools.spec =================================================================== --- livecd.orig/livecd-tools.spec +++ livecd/livecd-tools.spec @@ -20,6 +20,7 @@ Requires: squashfs-tools Requires: pykickstart >= 0.96 Requires: dosfstools >= 2.11-8 Requires: isomd5sum +Requires: pax %ifarch %{ix86} x86_64 Requires: syslinux %endif -- Fedora-livecd-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/fedora-livecd-list
