[Fedora-ia64-list] Fedora livecd for ia64
Zhan, Yi
yi.zhan at intel.com
Wed May 7 16:11:28 UTC 2008
> -----Original Message-----
> From: Prarit Bhargava [mailto:prarit at redhat.com]
> Sent: Wednesday, May 07, 2008 11:04 PM
> To: Zhan, Yi; ia64 Fedora Core Development
> Cc: Doug Chapman
> Subject: Re: [Fedora-ia64-list] Fedora livecd for ia64
>
> Yi -- I did some patching in this area a while ago -- did it work "out
> of the box" or was additional patching/bugfixing required?
>
Besides modifying the scripts in livecd-tools, I also need to delete
memtest86+ from the ks file which used to compose the livecd. Putting
the package in _get_excluded_packages() didn't work.
For the livecd-tools, what I did is creating a whole
"ia64LiveImageCreator" class in imgcreate/live.py. The main work is to
create a boot.img and put things in. The code is working but not all
finished yet.
For an instance, currently I just put things into the image as the same
locations as in install media (images/boot.img). So we have:
/elilo.efi
/bootia64.efi
/elilo.conf
/initrd.img
/vmlinuz
/efi/boot/elilo.efi
/efi/boot/bootia64.efi
/efi/boot/elilo.conf
/efi/boot/initrd.img
/efi/boot/vmlinuz
Things are duplicate. I'm not sure if we can delete some of them. The
code (unfinished and haven't cleaned up) lists below. Any comment is
appreciated.
I will see if I can get the ia64 specified codes merged into the
livecd-tools later.
Yi
========================================================================
==
class ia64LiveImageCreator(LiveImageCreatorBase):
"""ImageCreator for ia64 machines"""
def _get_mkisofs_options(self, isodir):
return [ "-b", "boot.img",
"-no-emul-boot" ]
def _get_required_packages(self):
return ["elilo"] +
LiveImageCreatorBase._get_required_packages(self)
def _get_excluded_packages(self):
# kind of hacky, but exclude memtest86+ on ia64 so it can stay
in cfg
# FIXME: we still have issue to let memtest86+ stay in cfg,
# since the package is totally unvailable on ia64
return ["memtest86+"] +
LiveImageCreatorBase._get_excluded_packages(self)
def _get_kernel_versions(self):
def get_version(header):
version = None
for f in header['filenames']:
if f.startswith('/boot/efi/EFI/redhat/vmlinuz-'):
version = f[29:]
return version
ts = rpm.TransactionSet(self._instroot)
ret = {}
for header in ts.dbMatch('provides', 'kernel'):
version = get_version(header)
if version is None:
continue
name = header['name']
if not name in ret:
ret[name] = [version]
elif not version in ret[name]:
ret[name].append(version)
return ret
def __copy_kernel_and_initramfs(self, isodir, version):
bootdir = self._instroot + "/boot/efi/EFI/redhat"
makedirs(isodir + "/efi/boot")
shutil.copyfile(bootdir + "/vmlinuz-" + version,
isodir + "/vmlinuz")
shutil.copyfile(bootdir + "/vmlinuz-" + version,
isodir + "/efi/boot/vmlinuz")
shutil.copyfile(bootdir + "/initrd-" + version + ".img",
isodir + "/initrd.img")
shutil.copyfile(bootdir + "/initrd-" + version + ".img",
isodir + "/efi/boot/initrd.img")
return True
def __copy_background(self, isodest):
background_path = self._instroot + \
"/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg"
if not os.path.exists(background_path):
return False
shutil.copyfile(background_path, isodest)
return True
def __get_elilo_config (self, **args):
return """
prompt
timeout=50
relocatable
image=vmlinuz
label=linux
read-only
initrd=initrd.img
append="root=CDLABEL=%(fslabel)s rootfstype=iso9660 quiet
liveimg rhgb %(extra)s"
""" % args
def __write_elilo_config (self, isodir, **args):
cfg = self.__get_elilo_config(**args)
cfgf = open(isodir + "/elilo.conf", "w")
cfgf.write(cfg)
cfgf.close()
shutil.copyfile(isodir + "/elilo.conf",
isodir + "/efi/boot/elilo.conf")
def __copy_elilo (self, isodir):
bootdir = self._instroot + "/boot/efi/EFI/redhat"
makedirs(isodir + "/efi/boot")
shutil.copyfile(bootdir + "/elilo.efi",
isodir + "/elilo.efi")
shutil.copyfile(bootdir + "/elilo.efi",
isodir + "/bootia64.efi")
shutil.copyfile(bootdir + "/elilo.efi",
isodir + "/efi/boot/elilo.efi")
shutil.copyfile(bootdir + "/elilo.efi",
isodir + "/efi/boot/bootia64.efi")
def __generate_bootimg (self, isodir):
"""generate the boot.img"""
bootimg = isodir + "/boot.img"
bootimg_size = "40000" # give an arbitrary but large enough
size for now
args = [ "/sbin/mkdosfs",
"-n", "LIVECD",
"-C", bootimg,
bootimg_size ]
ret = subprocess.call(args)
if ret != 0:
raise CreatorError("'%s' exited with error (%d)" %
(string.join(args, " "), ret))
return bootimg
def _configure_bootloader(self, isodir):
"""configure the boot loader"""
bootimg = self.__generate_bootimg(isodir)
bootimgloop = LoopbackMount(bootimg, self._mkdtemp())
try:
bootimgloop.mount()
except MountError, e:
raise CreatorError("Failed to loopback mount '%s' : %s" %
(bootimg, e))
kernel = self._get_kernel_versions().values()[0][0]
self.__copy_kernel_and_initramfs(bootimgloop.mountdir, kernel)
self.__copy_background(bootimgloop.mountdir + "splash.jpg")
self.__copy_elilo(bootimgloop.mountdir)
kernel_options = self._get_kernel_options()
self.__write_elilo_config(bootimgloop.mountdir,
fslabel = self.fslabel,
liveargs = kernel_options,
extra = "")
bootimgloop.cleanup()
More information about the Fedora-ia64-list
mailing list