Changes to 'refs/tags/livecd-tools-16.16'
by Brian C. Lane
Tag 'livecd-tools-16.16' created by Brian C. Lane <bcl(a)redhat.com> at 2012-09-07 00:27 +0000
Tag as livecd-tools-16.16
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQEVAwUAUEk/VhF+jBaO/jp/AQI+WQgAo8KRWOidWN/bGA9Vnt6Va/rCplUHsUCy
nu1fUXKMRKqnOsr3l2OKWisA465VFJSZnbe7tKjZJJmh5u1zrreSF2RWAcjyfL3U
CS6q8O2t8GvH8AUBjfYoOXmHWcDGguFSePidX7ywMUDf7G5yPHWddM2ZTDmuQWM4
7VmnsQIdGJLX8cysPGfi5mCH1AvphoiA9lb9pYbkCfJZdbxH6fbqAB5RQaks1FBx
a30jgREQzb0+6+h1HNuEiBui5jZKHLrKVukHAQ9ak+UvMMFi37bdm2KYQlEXQSk1
dulHYCaiFY+dIxlkGzi6klHPE72Cx0bEtI4WZULIMQE/xFfJRu9/gA==
=Z8lD
-----END PGP SIGNATURE-----
Changes since livecd-tools-16.15:
Brian C. Lane (3):
New location for GRUB2 config on UEFI (#851220)
use cp -r instead of -a
Version 16.16
---
Makefile | 2 +-
tools/livecd-iso-to-disk.sh | 22 ++++++++++++++--------
2 files changed, 15 insertions(+), 9 deletions(-)
---
11 years, 7 months
Branch 'f16-branch' - 3 commits - Makefile tools/livecd-iso-to-disk.sh
by Brian C. Lane
Makefile | 2 +-
tools/livecd-iso-to-disk.sh | 22 ++++++++++++++--------
2 files changed, 15 insertions(+), 9 deletions(-)
New commits:
commit 34b70606f2da10d073b1a25595e0f29318b04340
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Sep 6 17:26:43 2012 -0700
Version 16.16
diff --git a/Makefile b/Makefile
index b5c389d..38c6076 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 16.15
+VERSION = 16.16
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
commit c6649bd82eca65f7d6ab9a206c626dbb289e8d9a
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Sep 6 15:27:31 2012 -0700
use cp -r instead of -a
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 479fe85..4807b1f 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1089,7 +1089,7 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
echo "Setting up $EFI_BOOT"
- cp -a $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
+ cp -r $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
# The GRUB EFI config file can be one of:
# boot?*.conf
commit f6e117f22df127757db0bd1a5ca73195b9ff85c7
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Sep 5 14:58:59 2012 -0700
New location for GRUB2 config on UEFI (#851220)
With Secure Boot and shim the GRUB2 config is no grub.cfg
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 15de42d..479fe85 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1089,14 +1089,20 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
echo "Setting up $EFI_BOOT"
- cp $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
-
- # FIXME
- # There is a problem here. On older LiveCD's the files are boot?*.conf
- # They really should be renamed to BOOT?*.conf
-
- # this is a little ugly, but it gets the "interesting" named config file
- BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ cp -a $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
+
+ # The GRUB EFI config file can be one of:
+ # boot?*.conf
+ # BOOT?*.conf
+ # grub.cfg
+ if [ -e $TGTMNT$EFI_BOOT/grub.cfg ]; then
+ BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/grub.cfg
+ elif [ -e $TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf ]; then
+ BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ else
+ echo "Unable to find EFI config file."
+ exitclean
+ fi
rm -f $TGTMNT$EFI_BOOT/grub.conf
# On some images (RHEL) the BOOT*.efi file isn't in $EFI_BOOT, but is in
11 years, 7 months
tools/livecd-iso-to-disk.sh
by Brian C. Lane
tools/livecd-iso-to-disk.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 0d5df206890b5872054397a0fda533e35cd1fa0a
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Sep 6 15:27:31 2012 -0700
use cp -r instead of -a
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index c681e37..1a87869 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1089,7 +1089,7 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
echo "Setting up $EFI_BOOT"
- cp -a $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
+ cp -r $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
# The GRUB EFI config file can be one of:
# boot?*.conf
11 years, 7 months
Branch 'f18-branch' - 2 commits - Makefile tools/livecd-iso-to-disk.sh
by Brian C. Lane
Makefile | 2 +-
tools/livecd-iso-to-disk.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit e5635e13282d3a930df158869cfbdd3e2095c098
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Sep 6 16:38:20 2012 -0700
Version 18.10
diff --git a/Makefile b/Makefile
index c319f77..c3f33a3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 18.9
+VERSION = 18.10
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
commit acd44429ed4911721e6029e6fd646c1ef395fb91
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Sep 6 15:27:31 2012 -0700
use cp -r instead of -a
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index c681e37..1a87869 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1089,7 +1089,7 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
echo "Setting up $EFI_BOOT"
- cp -a $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
+ cp -r $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
# The GRUB EFI config file can be one of:
# boot?*.conf
11 years, 7 months
Branch 'f18-branch' - 5 commits - imgcreate/creator.py imgcreate/live.py Makefile tools/livecd-creator tools/livecd-iso-to-disk.sh
by Brian C. Lane
Makefile | 2
imgcreate/creator.py | 14 +++-
imgcreate/live.py | 131 ++++++++++++++++++++++++++++----------------
tools/livecd-creator | 9 ++-
tools/livecd-iso-to-disk.sh | 26 +++++---
5 files changed, 121 insertions(+), 61 deletions(-)
New commits:
commit bfaa85aa63e580540ac1bc84b25ea3e826f9776c
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Sep 6 12:24:57 2012 -0700
Version 18.9
diff --git a/Makefile b/Makefile
index 16b370b..c319f77 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 18.8
+VERSION = 18.9
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
commit 7b2cb0aa6233b881d3d97f78f48d4ff3cba66d3c
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Sep 5 15:47:49 2012 -0700
fix extra-kernel-args (#853570)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index cd9a89c..c681e37 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1192,9 +1192,9 @@ echo "Updating boot config file"
# adjust label and fstype
sed -i -e "s/CDLABEL=[^ ]*/$TGTLABEL/" -e "s/rootfstype=[^ ]*/rootfstype=$TGTFS/" -e "s/LABEL=[^ ]*/$TGTLABEL/" $BOOTCONFIG $BOOTCONFIG_EFI
if [ -n "$kernelargs" ]; then
- sed -i -e "s;initrd.img;initrd.img ${kernelargs};" $BOOTCONFIG
+ sed -i -e "s;initrd.\?\.img;& ${kernelargs};" $BOOTCONFIG
if [ -n "$efi" ]; then
- sed -i -e "s;vmlinuz;vmlinuz ${kernelargs};" $BOOTCONFIG_EFI
+ sed -i -e "s;vmlinuz.\?;& ${kernelargs} ;" $BOOTCONFIG_EFI
fi
fi
if [ "$LIVEOS" != "LiveOS" ]; then
commit 0e88402b4418e1edb4a4a7622e0dbac335ae1be0
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Sep 5 14:58:59 2012 -0700
New location for GRUB2 config on UEFI (#851220)
With Secure Boot and shim the GRUB2 config is no grub.cfg
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 71fb288..cd9a89c 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1089,14 +1089,20 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
echo "Setting up $EFI_BOOT"
- cp $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
-
- # FIXME
- # There is a problem here. On older LiveCD's the files are boot?*.conf
- # They really should be renamed to BOOT?*.conf
-
- # this is a little ugly, but it gets the "interesting" named config file
- BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ cp -a $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
+
+ # The GRUB EFI config file can be one of:
+ # boot?*.conf
+ # BOOT?*.conf
+ # grub.cfg
+ if [ -e $TGTMNT$EFI_BOOT/grub.cfg ]; then
+ BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/grub.cfg
+ elif [ -e $TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf ]; then
+ BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ else
+ echo "Unable to find EFI config file."
+ exitclean
+ fi
rm -f $TGTMNT$EFI_BOOT/grub.conf
# On some images (RHEL) the BOOT*.efi file isn't in $EFI_BOOT, but is in
commit c7743ab6ed95b743bbeba2738e197726dfc9c043
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Aug 29 10:04:02 2012 -0700
Add nocleanup option to retain temp files
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 77b6e56..891d6ef 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -51,7 +51,8 @@ class ImageCreator(object):
"""
- def __init__(self, ks, name, releasever=None, tmpdir="/tmp", useplugins=False, cacheonly=False):
+ def __init__(self, ks, name, releasever=None, tmpdir="/tmp", useplugins=False,
+ cacheonly=False, docleanup=True):
"""Initialize an ImageCreator instance.
ks -- a pykickstart.KickstartParser instance; this instance will be
@@ -82,6 +83,7 @@ class ImageCreator(object):
makedirs(self.tmpdir)
self.cacheonly = cacheonly
+ self.docleanup = docleanup
self.__builddir = None
self.__bindmounts = []
@@ -557,6 +559,10 @@ class ImageCreator(object):
creator.cleanup()
"""
+ if not self.docleanup:
+ logging.warn("Skipping cleanup of temporary files")
+ return
+
if not self.__builddir:
return
@@ -784,7 +790,8 @@ class LoopImageCreator(ImageCreator):
"""
- def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp", useplugins=False, cacheonly=False):
+ def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp",
+ useplugins=False, cacheonly=False, docleanup=True):
"""Initialize a LoopImageCreator instance.
This method takes the same arguments as ImageCreator.__init__() with
@@ -793,7 +800,8 @@ class LoopImageCreator(ImageCreator):
fslabel -- A string used as a label for any filesystems created.
"""
- ImageCreator.__init__(self, ks, name, releasever=releasever, tmpdir=tmpdir, useplugins=useplugins, cacheonly=cacheonly)
+ ImageCreator.__init__(self, ks, name, releasever=releasever, tmpdir=tmpdir,
+ useplugins=useplugins, cacheonly=cacheonly, docleanup=docleanup)
self.__fslabel = None
self.fslabel = fslabel
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 67f53af..73e3466 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -16,6 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+import sys
import os
import os.path
import glob
@@ -40,7 +41,8 @@ class LiveImageCreatorBase(LoopImageCreator):
"""
def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp",
- title="Linux", product="Linux", useplugins=False, cacheonly=False):
+ title="Linux", product="Linux", useplugins=False, cacheonly=False,
+ docleanup=True):
"""Initialise a LiveImageCreator instance.
This method takes the same arguments as LoopImageCreator.__init__().
@@ -50,7 +52,9 @@ class LiveImageCreatorBase(LoopImageCreator):
fslabel=fslabel,
releasever=releasever,
tmpdir=tmpdir,
- useplugins=useplugins, cacheonly=cacheonly)
+ useplugins=useplugins,
+ cacheonly=cacheonly,
+ docleanup=docleanup)
self.compress_type = "xz"
"""mksquashfs compressor to use."""
diff --git a/tools/livecd-creator b/tools/livecd-creator
index e9be1e5..44d07a1 100755
--- a/tools/livecd-creator
+++ b/tools/livecd-creator
@@ -78,6 +78,9 @@ def parse_options(args):
sysopt.add_option("", "--cacheonly", action="store_true",
dest="cacheonly", default=False,
help="Work offline from cache, use together with --cache (default: False)")
+ sysopt.add_option("", "--nocleanup", action="store_true",
+ dest="nocleanup", default=False,
+ help="Skip cleanup of temporary files")
parser.add_option_group(sysopt)
@@ -180,14 +183,16 @@ def main():
tmpdir=os.path.abspath(options.tmpdir),
useplugins=options.plugins,
title=title, product=product,
- cacheonly=options.cacheonly)
+ cacheonly=options.cacheonly,
+ docleanup=not options.nocleanup)
elif options.image_type == 'image':
creator = imgcreate.LoopImageCreator(ks, name,
fslabel=fslabel,
releasever=options.releasever,
useplugins=options.plugins,
tmpdir=os.path.abspath(options.tmpdir),
- cacheonly=options.cacheonly)
+ cacheonly=options.cacheonly,
+ docleanup=not options.nocleanup)
else:
# Cannot happen, we validate this when parsing options.
logging.error(u"'%s' is not a valid image type" % options.image_type)
commit bc47ee3f54445acce090554b9ea2aaa80631d2e0
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Aug 28 15:19:46 2012 -0700
Update imgcreate for UEFI Secure Boot
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 4aa220e..67f53af 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -1,7 +1,7 @@
#
# live.py : LiveImageCreator class for creating Live CD images
#
-# Copyright 2007, Red Hat Inc.
+# Copyright 2007-2012, Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -117,7 +117,7 @@ class LiveImageCreatorBase(LoopImageCreator):
if os.path.exists(self._instroot + "/usr/bin/plymouth"):
r += " rhgb"
return r
-
+
def _get_mkisofs_options(self, isodir):
"""Return the architecture specific mkisosfs options.
@@ -230,8 +230,11 @@ class LiveImageCreatorBase(LoopImageCreator):
def _generate_efiboot(self, isodir):
"""Generate EFI boot images."""
- if not os.path.exists(self._instroot + "/boot/efi/EFI/redhat/grub.efi"):
- return False
+ if not glob.glob(self._instroot+"/boot/efi/EFI/*/shim.efi"):
+ logging.error("Missing shim.efi, skipping efiboot.img creation.")
+ return
+
+ # XXX-BCL: does this need --label?
subprocess.call(["mkefiboot", isodir + "/EFI/BOOT",
isodir + "/isolinux/efiboot.img"])
subprocess.call(["mkefiboot", "-a", isodir + "/EFI/BOOT",
@@ -297,7 +300,7 @@ class LiveImageCreatorBase(LoopImageCreator):
f = open(path, "a")
f.write('filesystems+="' + self.__extra_filesystems() + ' "\n')
f.write('drivers+="' + self.__extra_drivers() + ' "\n')
- f.write('add_dracutmodules+=" dmsquash-live "')
+ f.write('add_dracutmodules+=" dmsquash-live pollcdrom "')
f.close()
def __create_iso(self, isodir):
@@ -335,7 +338,7 @@ class LiveImageCreatorBase(LoopImageCreator):
else:
logging.warn("isomd5sum not installed; not setting up mediacheck")
return
-
+
subprocess.call([implantisomd5, iso])
def _stage_final_image(self):
@@ -374,6 +377,10 @@ class LiveImageCreatorBase(LoopImageCreator):
class x86LiveImageCreator(LiveImageCreatorBase):
"""ImageCreator for x86 machines"""
+ def __init__(self, *args, **kwargs):
+ LiveImageCreatorBase.__init__(self, *args, **kwargs)
+ self._efiarch = None
+
def _get_mkisofs_options(self, isodir):
options = [ "-b", "isolinux/isolinux.bin",
"-c", "isolinux/boot.cat",
@@ -389,7 +396,8 @@ class x86LiveImageCreator(LiveImageCreatorBase):
return options
def _get_required_packages(self):
- return ["syslinux"] + LiveImageCreatorBase._get_required_packages(self)
+ return ["syslinux", "grub2-efi", "shim"] \
+ + LiveImageCreatorBase._get_required_packages(self)
def _get_isolinux_stanzas(self, isodir):
return ""
@@ -690,26 +698,65 @@ menu end
cfgf.write(cfg)
cfgf.close()
- def __copy_efi_files(self, isodir):
- if not os.path.exists(self._instroot + "/boot/efi/EFI/redhat/grub.efi"):
- return False
- shutil.copy(self._instroot + "/boot/efi/EFI/redhat/grub.efi",
- isodir + "/EFI/BOOT/grub.efi")
+ @property
+ def efiarch(self):
+ if not self._efiarch:
+ # for most things, we want them named boot$efiarch
+ efiarch = {"i386": "IA32", "x86_64": "X64"}
+ self._efiarch = efiarch[rpmUtils.arch.getBaseArch()]
+ return self._efiarch
- # Should exist, but if it doesn't we should fail
- if os.path.exists(self._instroot + "/boot/grub/splash.xpm.gz"):
- shutil.copy(self._instroot + "/boot/grub/splash.xpm.gz",
- isodir + "/EFI/BOOT/splash.xpm.gz")
-
- return True
+ def __copy_efi_files(self, isodir):
+ """ Copy the efi files into /EFI/BOOT/
+ If any of them are missing, return False.
+ requires:
+ shim.efi
+ gcdx64.efi
+ fonts/unicode.pf2
+ grub/splash.xpm.gz
+ """
+ fail = False
+ missing = []
+ files = [("/boot/efi/EFI/*/shim.efi", "/EFI/BOOT/BOOT%s.efi" % (self.efiarch,)),
+ ("/boot/efi/EFI/*/gcdx64.efi", "/EFI/BOOT/grubx64.efi"),
+ ("/boot/efi/EFI/*/fonts/unicode.pf2", "/EFI/BOOT/fonts/"),
+ ("/boot/grub/splash.xpm.gz", "/EFI/BOOT"),
+ ]
+ makedirs(isodir+"/EFI/BOOT/fonts/")
+ for src, dest in files:
+ src_glob = glob.glob(self._instroot+src)
+ if not src_glob:
+ missing.append("Missing EFI file (%s)" % (src,))
+ fail = True
+ else:
+ shutil.copy(src_glob[0], isodir+dest)
+ map(logging.error, missing)
+ return fail
def __get_basic_efi_config(self, **args):
return """
-default=0
-splashimage=/EFI/BOOT/splash.xpm.gz
-timeout %(timeout)d
-hiddenmenu
+set default="0"
+
+function load_video {
+ insmod efi_gop
+ insmod efi_uga
+ insmod video_bochs
+ insmod video_cirrus
+ insmod all_video
+}
+
+load_video
+set gfxpayload=keep
+insmod gzio
+insmod part_gpt
+insmod ext2
+
+set timeout=%(timeout)d
+### END /etc/grub.d/00_header ###
+
+search --no-floppy --set=root -l '%(isolabel)s'
+### BEGIN /etc/grub.d/10_linux ###
""" %args
def __get_efi_image_stanza(self, **args):
@@ -717,10 +764,10 @@ hiddenmenu
args["rootlabel"] = "live:LABEL=%(fslabel)s" % args
else:
args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
- return """title %(long)s
- findiso
- kernel /isolinux/vmlinuz%(index)s root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s
- initrd /isolinux/initrd%(index)s.img
+ return """menuentry '%(long)s' --class fedora --class gnu-linux --class gnu --class os {
+ linuxefi /isolinux/vmlinuz%(index)s root=%(rootlabel)s %(liveargs)s %(extra)s
+ initrdefi /isolinux/initrd%(index)s.img
+}
""" %args
def __get_efi_image_stanzas(self, isodir, name):
@@ -736,13 +783,11 @@ hiddenmenu
if os.path.exists("%s/EFI/BOOT/xen%d.gz" %(isodir, index)):
continue
cfg += self.__get_efi_image_stanza(fslabel = self.fslabel,
- isofstype = "auto",
liveargs = kernel_options,
long = name,
extra = "", index = index)
if checkisomd5:
cfg += self.__get_efi_image_stanza(fslabel = self.fslabel,
- isofstype = "auto",
liveargs = kernel_options,
long = "Verify and Boot " + name,
extra = "rd.live.check",
@@ -753,30 +798,22 @@ hiddenmenu
def _configure_efi_bootloader(self, isodir):
"""Set up the configuration for an EFI bootloader"""
- makedirs(isodir + "/EFI/BOOT")
-
- if not self.__copy_efi_files(isodir):
+ if self.__copy_efi_files(isodir):
shutil.rmtree(isodir + "/EFI")
- return
+ raise CreatorError("Failed to copy EFI files")
- cfg = self.__get_basic_efi_config(name = self.name,
+ cfg = self.__get_basic_efi_config(isolabel = self.fslabel,
timeout = self._timeout)
cfg += self.__get_efi_image_stanzas(isodir, self.name)
- cfgf = open(isodir + "/EFI/BOOT/grub.conf", "w")
+ cfgf = open(isodir + "/EFI/BOOT/grub.cfg", "w")
cfgf.write(cfg)
cfgf.close()
# first gen mactel machines get the bootloader name wrong apparently
if rpmUtils.arch.getBaseArch() == "i386":
- os.link(isodir + "/EFI/BOOT/grub.efi", isodir + "/EFI/BOOT/BOOT.efi")
- os.link(isodir + "/EFI/BOOT/grub.conf", isodir + "/EFI/BOOT/BOOT.conf")
-
- # for most things, we want them named boot$efiarch
- efiarch = {"i386": "IA32", "x86_64": "X64"}
- efiname = efiarch[rpmUtils.arch.getBaseArch()]
- os.rename(isodir + "/EFI/BOOT/grub.efi", isodir + "/EFI/BOOT/BOOT%s.efi" %(efiname,))
- os.link(isodir + "/EFI/BOOT/grub.conf", isodir + "/EFI/BOOT/BOOT%s.conf" %(efiname,))
+ os.link(isodir + "/EFI/BOOT/BOOT%s.efi" % (self.efiarch),
+ isodir + "/EFI/BOOT/BOOT.efi")
def _configure_bootloader(self, isodir):
@@ -805,7 +842,7 @@ class ppcLiveImageCreator(LiveImageCreatorBase):
path = self._instroot + dir + "/" + file
if not os.path.exists(path):
continue
-
+
makedirs(destdir)
shutil.copy(path, destdir)
return
11 years, 7 months
Run livecd-iso-to-disk in the source environment with chroot
by Frederick Grose
This version of livecd-iso-to-disk is reworked to use the source root
filesystem in a chroot by default, along with the livecd-iso-to-disk script
embedded in the source. A --nochroot as well as a --avoidsourcescript
option are available for cases where the launching filesystem and/or
installation script is called for.
One can load a Live USB by these steps:
1. mounting the source.iso
2. determine its loop device, /dev/loopN
3. call /mountpoint/LiveOS/livecd-iso-to-disk /dev/loopN /dev/target
All 3 steps could be avoided by providing some appropriate autorun scripts
for the iso, or including some standard install scripts that could be
invoked by clicking on them in Nautilus.
By mounting the source.iso LiveOS filesystem in a chroot enviroment, the
current version of software components, including the installation script,
on the source can be used for installation. (If syslinux-extlinux is not
in the source, ext234,btrfs target devices will have to use the --nochroot
option and a system with the proper bootloader.) An --avoidsourcescript
option is also added to allow installation with alternative scripts.
This new version of livecd-iso-to-disk prefers builtin functions, finds and
offers to unmount mounted targets, and reorders some compatibility checks
in order to bailout early, if needed.
If this passes further testing (the DVD and netinst installer paths are
untested), I can submit incremental patches for these changes.
Link to the reworked livecd-iso-to-disk script,
https://bugzilla.redhat.com/attachment.cgi?id=610112
Filed on this ticket,
https://bugzilla.redhat.com/show_bug.cgi?id=663986
Testing and comments would be appreciated.
--Fred
11 years, 7 months
4 commits - imgcreate/creator.py imgcreate/live.py tools/livecd-creator tools/livecd-iso-to-disk.sh
by Brian C. Lane
imgcreate/creator.py | 14 +++-
imgcreate/live.py | 131 ++++++++++++++++++++++++++++----------------
tools/livecd-creator | 9 ++-
tools/livecd-iso-to-disk.sh | 26 +++++---
4 files changed, 120 insertions(+), 60 deletions(-)
New commits:
commit 7b2cb0aa6233b881d3d97f78f48d4ff3cba66d3c
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Sep 5 15:47:49 2012 -0700
fix extra-kernel-args (#853570)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index cd9a89c..c681e37 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1192,9 +1192,9 @@ echo "Updating boot config file"
# adjust label and fstype
sed -i -e "s/CDLABEL=[^ ]*/$TGTLABEL/" -e "s/rootfstype=[^ ]*/rootfstype=$TGTFS/" -e "s/LABEL=[^ ]*/$TGTLABEL/" $BOOTCONFIG $BOOTCONFIG_EFI
if [ -n "$kernelargs" ]; then
- sed -i -e "s;initrd.img;initrd.img ${kernelargs};" $BOOTCONFIG
+ sed -i -e "s;initrd.\?\.img;& ${kernelargs};" $BOOTCONFIG
if [ -n "$efi" ]; then
- sed -i -e "s;vmlinuz;vmlinuz ${kernelargs};" $BOOTCONFIG_EFI
+ sed -i -e "s;vmlinuz.\?;& ${kernelargs} ;" $BOOTCONFIG_EFI
fi
fi
if [ "$LIVEOS" != "LiveOS" ]; then
commit 0e88402b4418e1edb4a4a7622e0dbac335ae1be0
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Sep 5 14:58:59 2012 -0700
New location for GRUB2 config on UEFI (#851220)
With Secure Boot and shim the GRUB2 config is no grub.cfg
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 71fb288..cd9a89c 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1089,14 +1089,20 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
echo "Setting up $EFI_BOOT"
- cp $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
-
- # FIXME
- # There is a problem here. On older LiveCD's the files are boot?*.conf
- # They really should be renamed to BOOT?*.conf
-
- # this is a little ugly, but it gets the "interesting" named config file
- BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ cp -a $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
+
+ # The GRUB EFI config file can be one of:
+ # boot?*.conf
+ # BOOT?*.conf
+ # grub.cfg
+ if [ -e $TGTMNT$EFI_BOOT/grub.cfg ]; then
+ BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/grub.cfg
+ elif [ -e $TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf ]; then
+ BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ else
+ echo "Unable to find EFI config file."
+ exitclean
+ fi
rm -f $TGTMNT$EFI_BOOT/grub.conf
# On some images (RHEL) the BOOT*.efi file isn't in $EFI_BOOT, but is in
commit c7743ab6ed95b743bbeba2738e197726dfc9c043
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Aug 29 10:04:02 2012 -0700
Add nocleanup option to retain temp files
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 77b6e56..891d6ef 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -51,7 +51,8 @@ class ImageCreator(object):
"""
- def __init__(self, ks, name, releasever=None, tmpdir="/tmp", useplugins=False, cacheonly=False):
+ def __init__(self, ks, name, releasever=None, tmpdir="/tmp", useplugins=False,
+ cacheonly=False, docleanup=True):
"""Initialize an ImageCreator instance.
ks -- a pykickstart.KickstartParser instance; this instance will be
@@ -82,6 +83,7 @@ class ImageCreator(object):
makedirs(self.tmpdir)
self.cacheonly = cacheonly
+ self.docleanup = docleanup
self.__builddir = None
self.__bindmounts = []
@@ -557,6 +559,10 @@ class ImageCreator(object):
creator.cleanup()
"""
+ if not self.docleanup:
+ logging.warn("Skipping cleanup of temporary files")
+ return
+
if not self.__builddir:
return
@@ -784,7 +790,8 @@ class LoopImageCreator(ImageCreator):
"""
- def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp", useplugins=False, cacheonly=False):
+ def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp",
+ useplugins=False, cacheonly=False, docleanup=True):
"""Initialize a LoopImageCreator instance.
This method takes the same arguments as ImageCreator.__init__() with
@@ -793,7 +800,8 @@ class LoopImageCreator(ImageCreator):
fslabel -- A string used as a label for any filesystems created.
"""
- ImageCreator.__init__(self, ks, name, releasever=releasever, tmpdir=tmpdir, useplugins=useplugins, cacheonly=cacheonly)
+ ImageCreator.__init__(self, ks, name, releasever=releasever, tmpdir=tmpdir,
+ useplugins=useplugins, cacheonly=cacheonly, docleanup=docleanup)
self.__fslabel = None
self.fslabel = fslabel
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 67f53af..73e3466 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -16,6 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+import sys
import os
import os.path
import glob
@@ -40,7 +41,8 @@ class LiveImageCreatorBase(LoopImageCreator):
"""
def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp",
- title="Linux", product="Linux", useplugins=False, cacheonly=False):
+ title="Linux", product="Linux", useplugins=False, cacheonly=False,
+ docleanup=True):
"""Initialise a LiveImageCreator instance.
This method takes the same arguments as LoopImageCreator.__init__().
@@ -50,7 +52,9 @@ class LiveImageCreatorBase(LoopImageCreator):
fslabel=fslabel,
releasever=releasever,
tmpdir=tmpdir,
- useplugins=useplugins, cacheonly=cacheonly)
+ useplugins=useplugins,
+ cacheonly=cacheonly,
+ docleanup=docleanup)
self.compress_type = "xz"
"""mksquashfs compressor to use."""
diff --git a/tools/livecd-creator b/tools/livecd-creator
index e9be1e5..44d07a1 100755
--- a/tools/livecd-creator
+++ b/tools/livecd-creator
@@ -78,6 +78,9 @@ def parse_options(args):
sysopt.add_option("", "--cacheonly", action="store_true",
dest="cacheonly", default=False,
help="Work offline from cache, use together with --cache (default: False)")
+ sysopt.add_option("", "--nocleanup", action="store_true",
+ dest="nocleanup", default=False,
+ help="Skip cleanup of temporary files")
parser.add_option_group(sysopt)
@@ -180,14 +183,16 @@ def main():
tmpdir=os.path.abspath(options.tmpdir),
useplugins=options.plugins,
title=title, product=product,
- cacheonly=options.cacheonly)
+ cacheonly=options.cacheonly,
+ docleanup=not options.nocleanup)
elif options.image_type == 'image':
creator = imgcreate.LoopImageCreator(ks, name,
fslabel=fslabel,
releasever=options.releasever,
useplugins=options.plugins,
tmpdir=os.path.abspath(options.tmpdir),
- cacheonly=options.cacheonly)
+ cacheonly=options.cacheonly,
+ docleanup=not options.nocleanup)
else:
# Cannot happen, we validate this when parsing options.
logging.error(u"'%s' is not a valid image type" % options.image_type)
commit bc47ee3f54445acce090554b9ea2aaa80631d2e0
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Aug 28 15:19:46 2012 -0700
Update imgcreate for UEFI Secure Boot
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 4aa220e..67f53af 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -1,7 +1,7 @@
#
# live.py : LiveImageCreator class for creating Live CD images
#
-# Copyright 2007, Red Hat Inc.
+# Copyright 2007-2012, Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -117,7 +117,7 @@ class LiveImageCreatorBase(LoopImageCreator):
if os.path.exists(self._instroot + "/usr/bin/plymouth"):
r += " rhgb"
return r
-
+
def _get_mkisofs_options(self, isodir):
"""Return the architecture specific mkisosfs options.
@@ -230,8 +230,11 @@ class LiveImageCreatorBase(LoopImageCreator):
def _generate_efiboot(self, isodir):
"""Generate EFI boot images."""
- if not os.path.exists(self._instroot + "/boot/efi/EFI/redhat/grub.efi"):
- return False
+ if not glob.glob(self._instroot+"/boot/efi/EFI/*/shim.efi"):
+ logging.error("Missing shim.efi, skipping efiboot.img creation.")
+ return
+
+ # XXX-BCL: does this need --label?
subprocess.call(["mkefiboot", isodir + "/EFI/BOOT",
isodir + "/isolinux/efiboot.img"])
subprocess.call(["mkefiboot", "-a", isodir + "/EFI/BOOT",
@@ -297,7 +300,7 @@ class LiveImageCreatorBase(LoopImageCreator):
f = open(path, "a")
f.write('filesystems+="' + self.__extra_filesystems() + ' "\n')
f.write('drivers+="' + self.__extra_drivers() + ' "\n')
- f.write('add_dracutmodules+=" dmsquash-live "')
+ f.write('add_dracutmodules+=" dmsquash-live pollcdrom "')
f.close()
def __create_iso(self, isodir):
@@ -335,7 +338,7 @@ class LiveImageCreatorBase(LoopImageCreator):
else:
logging.warn("isomd5sum not installed; not setting up mediacheck")
return
-
+
subprocess.call([implantisomd5, iso])
def _stage_final_image(self):
@@ -374,6 +377,10 @@ class LiveImageCreatorBase(LoopImageCreator):
class x86LiveImageCreator(LiveImageCreatorBase):
"""ImageCreator for x86 machines"""
+ def __init__(self, *args, **kwargs):
+ LiveImageCreatorBase.__init__(self, *args, **kwargs)
+ self._efiarch = None
+
def _get_mkisofs_options(self, isodir):
options = [ "-b", "isolinux/isolinux.bin",
"-c", "isolinux/boot.cat",
@@ -389,7 +396,8 @@ class x86LiveImageCreator(LiveImageCreatorBase):
return options
def _get_required_packages(self):
- return ["syslinux"] + LiveImageCreatorBase._get_required_packages(self)
+ return ["syslinux", "grub2-efi", "shim"] \
+ + LiveImageCreatorBase._get_required_packages(self)
def _get_isolinux_stanzas(self, isodir):
return ""
@@ -690,26 +698,65 @@ menu end
cfgf.write(cfg)
cfgf.close()
- def __copy_efi_files(self, isodir):
- if not os.path.exists(self._instroot + "/boot/efi/EFI/redhat/grub.efi"):
- return False
- shutil.copy(self._instroot + "/boot/efi/EFI/redhat/grub.efi",
- isodir + "/EFI/BOOT/grub.efi")
+ @property
+ def efiarch(self):
+ if not self._efiarch:
+ # for most things, we want them named boot$efiarch
+ efiarch = {"i386": "IA32", "x86_64": "X64"}
+ self._efiarch = efiarch[rpmUtils.arch.getBaseArch()]
+ return self._efiarch
- # Should exist, but if it doesn't we should fail
- if os.path.exists(self._instroot + "/boot/grub/splash.xpm.gz"):
- shutil.copy(self._instroot + "/boot/grub/splash.xpm.gz",
- isodir + "/EFI/BOOT/splash.xpm.gz")
-
- return True
+ def __copy_efi_files(self, isodir):
+ """ Copy the efi files into /EFI/BOOT/
+ If any of them are missing, return False.
+ requires:
+ shim.efi
+ gcdx64.efi
+ fonts/unicode.pf2
+ grub/splash.xpm.gz
+ """
+ fail = False
+ missing = []
+ files = [("/boot/efi/EFI/*/shim.efi", "/EFI/BOOT/BOOT%s.efi" % (self.efiarch,)),
+ ("/boot/efi/EFI/*/gcdx64.efi", "/EFI/BOOT/grubx64.efi"),
+ ("/boot/efi/EFI/*/fonts/unicode.pf2", "/EFI/BOOT/fonts/"),
+ ("/boot/grub/splash.xpm.gz", "/EFI/BOOT"),
+ ]
+ makedirs(isodir+"/EFI/BOOT/fonts/")
+ for src, dest in files:
+ src_glob = glob.glob(self._instroot+src)
+ if not src_glob:
+ missing.append("Missing EFI file (%s)" % (src,))
+ fail = True
+ else:
+ shutil.copy(src_glob[0], isodir+dest)
+ map(logging.error, missing)
+ return fail
def __get_basic_efi_config(self, **args):
return """
-default=0
-splashimage=/EFI/BOOT/splash.xpm.gz
-timeout %(timeout)d
-hiddenmenu
+set default="0"
+
+function load_video {
+ insmod efi_gop
+ insmod efi_uga
+ insmod video_bochs
+ insmod video_cirrus
+ insmod all_video
+}
+
+load_video
+set gfxpayload=keep
+insmod gzio
+insmod part_gpt
+insmod ext2
+
+set timeout=%(timeout)d
+### END /etc/grub.d/00_header ###
+
+search --no-floppy --set=root -l '%(isolabel)s'
+### BEGIN /etc/grub.d/10_linux ###
""" %args
def __get_efi_image_stanza(self, **args):
@@ -717,10 +764,10 @@ hiddenmenu
args["rootlabel"] = "live:LABEL=%(fslabel)s" % args
else:
args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
- return """title %(long)s
- findiso
- kernel /isolinux/vmlinuz%(index)s root=%(rootlabel)s rootfstype=%(isofstype)s %(liveargs)s %(extra)s
- initrd /isolinux/initrd%(index)s.img
+ return """menuentry '%(long)s' --class fedora --class gnu-linux --class gnu --class os {
+ linuxefi /isolinux/vmlinuz%(index)s root=%(rootlabel)s %(liveargs)s %(extra)s
+ initrdefi /isolinux/initrd%(index)s.img
+}
""" %args
def __get_efi_image_stanzas(self, isodir, name):
@@ -736,13 +783,11 @@ hiddenmenu
if os.path.exists("%s/EFI/BOOT/xen%d.gz" %(isodir, index)):
continue
cfg += self.__get_efi_image_stanza(fslabel = self.fslabel,
- isofstype = "auto",
liveargs = kernel_options,
long = name,
extra = "", index = index)
if checkisomd5:
cfg += self.__get_efi_image_stanza(fslabel = self.fslabel,
- isofstype = "auto",
liveargs = kernel_options,
long = "Verify and Boot " + name,
extra = "rd.live.check",
@@ -753,30 +798,22 @@ hiddenmenu
def _configure_efi_bootloader(self, isodir):
"""Set up the configuration for an EFI bootloader"""
- makedirs(isodir + "/EFI/BOOT")
-
- if not self.__copy_efi_files(isodir):
+ if self.__copy_efi_files(isodir):
shutil.rmtree(isodir + "/EFI")
- return
+ raise CreatorError("Failed to copy EFI files")
- cfg = self.__get_basic_efi_config(name = self.name,
+ cfg = self.__get_basic_efi_config(isolabel = self.fslabel,
timeout = self._timeout)
cfg += self.__get_efi_image_stanzas(isodir, self.name)
- cfgf = open(isodir + "/EFI/BOOT/grub.conf", "w")
+ cfgf = open(isodir + "/EFI/BOOT/grub.cfg", "w")
cfgf.write(cfg)
cfgf.close()
# first gen mactel machines get the bootloader name wrong apparently
if rpmUtils.arch.getBaseArch() == "i386":
- os.link(isodir + "/EFI/BOOT/grub.efi", isodir + "/EFI/BOOT/BOOT.efi")
- os.link(isodir + "/EFI/BOOT/grub.conf", isodir + "/EFI/BOOT/BOOT.conf")
-
- # for most things, we want them named boot$efiarch
- efiarch = {"i386": "IA32", "x86_64": "X64"}
- efiname = efiarch[rpmUtils.arch.getBaseArch()]
- os.rename(isodir + "/EFI/BOOT/grub.efi", isodir + "/EFI/BOOT/BOOT%s.efi" %(efiname,))
- os.link(isodir + "/EFI/BOOT/grub.conf", isodir + "/EFI/BOOT/BOOT%s.conf" %(efiname,))
+ os.link(isodir + "/EFI/BOOT/BOOT%s.efi" % (self.efiarch),
+ isodir + "/EFI/BOOT/BOOT.efi")
def _configure_bootloader(self, isodir):
@@ -805,7 +842,7 @@ class ppcLiveImageCreator(LiveImageCreatorBase):
path = self._instroot + dir + "/" + file
if not os.path.exists(path):
continue
-
+
makedirs(destdir)
shutil.copy(path, destdir)
return
11 years, 7 months
Change squashfs in cdrom
by Marcelo Guazzardo
Hi all.
I'm developing a fedora livecd, and would like to have my own squashfs, from a
facility that I saved.
I found the squashfs and ext3fs.img , and then, I could remaster that
files, (I added a few programs), and then, I ran mksquashfs, and replace in
the ISO, and all worked well.
But now, I have a fresh install of my Fedora Core 17, with any programs
added. then, I created an .tgz of my install, generate a new image dd for
ext3fs.img, and then, a new squashfs . I change it in the ISO.
When the iso boot, an error appears. DM_SNAPSHOT_COW appears a lot of
times, and , then, kernel panic. I add in the syslinux the rdshell, and I
entered in and emergency shell. But, I guess that the problem, is the
osmin.img wasn't generate again (and I don't know what is the way for
generate it). But, I debian flavours, that way works well, but, I have
read, in FC, is more complex.
My doubt is any could generate an fresh ext3fs.img, without use tools like
"livecd-creator", and then pack a new squashfs.img in the iso, and all
works fine?
thanks in advance.
PS: Sorry for my english
--
Marcelo Guazzardo
mguazzardo76(a)gmail.com
Linkedin: http://www.linkedin.com/pub/marcelo-guazzardo/a/541/842
http://mguazzardo.wordpress.com <http://mguazzardo.blogspot.com>
11 years, 7 months