auto-biarch (x86_64 + i686) LiveDVD patch + ISO
by Jan Kratochvil
Hi,
finally created a LiveDVD ISO automatically booting x86_64 OS on x86_64
(and i686 otherwise). Regular users will not notice there exists any new arch
while they will benefit from the full performance of their PC:
http://people.redhat.com/jkratoch/x86bilive-2009062000.tar.gz (71KB)
It uses live_dir=LiveOS-x86_64 vs. live_dir=LiveOS-i686 to boot the image.
The syslinux patch provides "default-{x86_64,i386}" keywords in isolinux.cfg.
livecd-iso-to-disk is not patched/compatible with such image.
livecd-creator should create such ISO on a single run, not by merging the
output of two livecd-creator runs by a 3rd party app.
Regards,
Jan
Reasons:
* I still did not understand why I have to carry with me two media - both
x86_64 and i386 - when all the data perfectly fit on a single media.
* Why I have to try to boot x86_64 first to find out if the specific machine
is x86_64? Even common programmers do not know it, "Windows XP works here".
* The OS must "just work", it must be fun and easy. Requiring a special
technical decision before even starting the OS download is a showstopper.
* Checked that a regular user will on http://fedoraproject.org/get-fedora
still download terrible performance degradation of 32-bit OS although her
hadware is in 70%-95%(?) of cases x86_64. x86_64 is here for 6 years now.
* Arguing x86 may be faster than x86_64... I did not find any such case,
x86_64 is a more modern arch (more registers, PIC for free, better ABI).
We already hit the 2GB address space limitations. x86_64 is the future.
* All the friends of mine have 8Mbit+ ADSL and TB disks downloading many DVD
disks so some several more hundreds of MB are not something to notice.
mkisofs -f -J -r -hide-rr-moved -hide-joliet-trans-tbl -V Fedora-11-x86bi-Live -o ../x86bilive.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-info-table -boot-load-size 4 .
mount -r -o loop Fedora-11-x86_64-Live.iso x86_64/
mount -r -o loop Fedora-11-i686-Live.iso i686/
x86bilive:
total 4
lrwxrwxrwx 1 root root 13 2009-06-18 21:10 GPL -> ../x86_64/GPL
lrwxrwxrwx 1 root root 14 2009-06-18 21:11 LiveOS-i686 -> ../i686/LiveOS/
lrwxrwxrwx 1 root root 16 2009-06-18 21:10 LiveOS-x86_64 -> ../x86_64/LiveOS/
lrwxrwxrwx 1 root root 16 2009-06-18 21:10 README -> ../x86_64/README
drwxr-xr-x 2 root root 4096 2009-06-20 21:44 isolinux/
x86bilive/isolinux:
total 184
lrwxrwxrwx 1 root root 30 2009-06-18 21:13 boot.cat -> ../../x86_64/isolinux/boot.cat
lrwxrwxrwx 1 root root 31 2009-06-18 21:17 ii686 -> ../../i686/isolinux/initrd0.img
-rw-r--r-- 1 root root 14336 2009-06-20 21:45 isolinux.bin
-r--r--r-- 1 root root 1411 2009-06-20 21:44 isolinux.cfg
lrwxrwxrwx 1 root root 33 2009-06-18 21:13 ix8664 -> ../../x86_64/isolinux/initrd0.img
lrwxrwxrwx 1 root root 28 2009-06-18 21:17 ki686 -> ../../i686/isolinux/vmlinuz0
lrwxrwxrwx 1 root root 30 2009-06-18 21:13 kx8664 -> ../../x86_64/isolinux/vmlinuz0
lrwxrwxrwx 1 root root 29 2009-06-18 21:13 memtest -> ../../x86_64/isolinux/memtest
lrwxrwxrwx 1 root root 32 2009-06-18 21:13 splash.jpg -> ../../x86_64/isolinux/splash.jpg
-r--r--r-- 1 root root 159888 2009-06-20 20:48 vesamenu.c32
isolinux.cfg:
default vesamenu.c32
timeout 100
menu background splash.jpg
menu title Welcome to Fedora-11-x86bi-Live!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color timeout_msg 0 #ffffffff #00000000
menu color timeout 0 #ffffffff #00000000
menu color cmdline 0 #ffffffff #00000000
menu hidden
menu hiddenrow 5
label linux0
menu label x86_64 Boot
kernel kx8664
append initrd=ix8664 root=CDLABEL=Fedora-11-x86bi-Live rootfstype=auto live_dir=LiveOS-x86_64 ro liveimg quiet rhgb
menu default-x86_64
label check0
menu label x86_64 Verify and Boot
kernel kx8664
append initrd=ix8664 root=CDLABEL=Fedora-11-x86bi-Live rootfstype=auto live_dir=LiveOS-x86_64 ro liveimg quiet rhgb check
label linux1
menu label i686 Boot
kernel ki686
append initrd=ii686 root=CDLABEL=Fedora-11-x86bi-Live rootfstype=auto live_dir=LiveOS-i686 ro liveimg quiet rhgb
menu default-i386
label check1
menu label i686 Verify and Boot
kernel ki686
append initrd=ii686 root=CDLABEL=Fedora-11-x86bi-Live rootfstype=auto live_dir=LiveOS-i686 ro liveimg quiet rhgb check
label memtest
menu label Memory Test
kernel memtest
label local
menu label Boot from local drive
localboot 0xffff
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ defaults.patch 20 Jun 2009 20:10:46 -0000
@@ -0,0 +1,175 @@
+--- syslinux-3.75-orig/com32/menu/Makefile 2009-04-16 06:42:14.000000000 +0200
++++ syslinux-3.75-defaults/com32/menu/Makefile 2009-06-20 19:21:32.000000000 +0200
+@@ -24,7 +24,7 @@ MODULES = menu.c32 vesamenu.c32
+ TESTFILES =
+
+ COMMONOBJS = menumain.o readconfig.o passwd.o drain.o printmsg.o colors.o \
+- background.o refstr.o execute.o
++ background.o refstr.o execute.o verify_cpu.o
+
+ all: $(MODULES) $(TESTFILES)
+
+--- syslinux-3.75-orig/com32/menu/menu.h 2009-04-16 06:42:14.000000000 +0200
++++ syslinux-3.75-defaults/com32/menu/menu.h 2009-06-20 19:21:32.000000000 +0200
+@@ -224,4 +224,9 @@ void execute(const char *cmdline, enum k
+ /* drain.c */
+ void drain_keyboard(void);
+
++/* verify_cpu.S */
++#if defined(__i386__) || defined(__x86_64__)
++int verify_cpu(void);
++#endif
++
+ #endif /* MENU_H */
+--- syslinux-3.75-orig/com32/menu/readconfig.c 2009-04-16 06:42:14.000000000 +0200
++++ syslinux-3.75-defaults/com32/menu/readconfig.c 2009-06-20 20:23:24.000000000 +0200
+@@ -656,11 +656,22 @@ static void parse_config_file(FILE *f)
+ m->parent_entry->displayname = refstr_get(m->title);
+ }
+ }
+- } else if ( looking_at(p, "default") ) {
+- if (ld.label) {
+- ld.menudefault = 1;
+- } else if (m->parent_entry) {
+- m->parent->defentry = m->parent_entry->entry;
++ } else if ( looking_at(p, "default")
++#if defined(__i386__) || defined(__x86_64__)
++ || looking_at(p, "default-i386")
++ || looking_at(p, "default-x86_64")
++#endif
++ ) {
++#if defined(__i386__) || defined(__x86_64__)
++ if (! ( ( looking_at(p, "default-i386") && verify_cpu () == 0 ) ||
++ ( looking_at(p, "default-x86_64") && verify_cpu () != 0 ) ) )
++#endif
++ {
++ if (ld.label) {
++ ld.menudefault = 1;
++ } else if (m->parent_entry) {
++ m->parent->defentry = m->parent_entry->entry;
++ }
+ }
+ } else if ( looking_at(p, "hide") ) {
+ ld.menuhide = 1;
+--- syslinux-3.75-orig/com32/menu/verify_cpu.S 1970-01-01 01:00:00.000000000 +0100
++++ syslinux-3.75-defaults/com32/menu/verify_cpu.S 2009-06-20 20:30:27.000000000 +0200
+@@ -0,0 +1,119 @@
++/* https://lists.linux-foundation.org/pipermail/fastboot/2006-November/01188... */
++#if defined(__i386__) || defined(__x86_64__)
++ .globl verify_cpu
++verify_cpu:
++ push %ebx
++ push %esi
++ push %edi
++ push %ebp
++ call Xverify_cpu
++ pop %ebp
++ pop %edi
++ pop %esi
++ pop %ebx
++ ret
++
++/*
++ *
++ * verify_cpu.S
++ *
++ * 14 Nov 2006 Vivek Goyal: Created the file
++ *
++ * This is a common code for verification whether CPU supports
++ * long mode and SSE or not. It is not called directly instead this
++ * file is included at various places and compiled in that context.
++ * Following are the current usage.
++ *
++ * This file is included by both 16bit and 32bit code.
++ *
++ * arch/x86_64/boot/setup.S : Boot cpu verification (16bit)
++ * arch/x86_64/boot/compressed/head.S: Boot cpu verification (32bit)
++ * arch/x86_64/kernel/trampoline.S: secondary processor verfication (16bit)
++ * arch/x86_64/kernel/acpi/wakeup.S:Verfication at resume (16bit)
++ *
++ * verify_cpu, returns the status of cpu check in register %eax.
++ * 0: Success 1: Failure
++ *
++ * The caller needs to check for the error code and take the action
++ * appropriately. Either display a message or halt.
++ */
++
++Xverify_cpu:
++
++ pushfl # Save caller passed flags
++ pushl $0 # Kill any dangerous flags
++ popfl
++
++ /* minimum CPUID flags for x86-64 */
++ /* see http://www.x86-64.org/lists/discuss/msg02971.html */
++#define SSE_MASK ((1<<25)|(1<<26))
++#define REQUIRED_MASK1 ((1<<0)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<8)|\
++ (1<<13)|(1<<15)|(1<<24))
++#define REQUIRED_MASK2 (1<<29)
++ pushfl # standard way to check for cpuid
++ popl %eax
++ movl %eax,%ebx
++ xorl $0x200000,%eax
++ pushl %eax
++ popfl
++ pushfl
++ popl %eax
++ cmpl %eax,%ebx
++ jz verify_cpu_no_longmode # cpu has no cpuid
++
++ movl $0x0,%eax # See if cpuid 1 is implemented
++ cpuid
++ cmpl $0x1,%eax
++ jb verify_cpu_no_longmode # no cpuid 1
++
++ xor %di,%di
++ cmpl $0x68747541,%ebx # AuthenticAMD
++ jnz verify_cpu_noamd
++ cmpl $0x69746e65,%edx
++ jnz verify_cpu_noamd
++ cmpl $0x444d4163,%ecx
++ jnz verify_cpu_noamd
++ mov $1,%di # cpu is from AMD
++
++verify_cpu_noamd:
++ movl $0x1,%eax # Does the cpu have what it takes
++ cpuid
++ andl $REQUIRED_MASK1,%edx
++ xorl $REQUIRED_MASK1,%edx
++ jnz verify_cpu_no_longmode
++
++ movl $0x80000000,%eax # See if extended cpuid is implemented
++ cpuid
++ cmpl $0x80000001,%eax
++ jb verify_cpu_no_longmode # no extended cpuid
++
++ movl $0x80000001,%eax # Does the cpu have what it takes
++ cpuid
++ andl $REQUIRED_MASK2,%edx
++ xorl $REQUIRED_MASK2,%edx
++ jnz verify_cpu_no_longmode
++
++verify_cpu_sse_test:
++ movl $1,%eax
++ cpuid
++ andl $SSE_MASK,%edx
++ cmpl $SSE_MASK,%edx
++ je verify_cpu_sse_ok
++ test %di,%di
++ jz verify_cpu_no_longmode # only try to force SSE on AMD
++ movl $0xc0010015,%ecx # HWCR
++ rdmsr
++ btr $15,%eax # enable SSE
++ wrmsr
++ xor %di,%di # don't loop
++ jmp verify_cpu_sse_test # try again
++
++verify_cpu_no_longmode:
++ popfl # Restore caller passed flags
++ movl $1,%eax
++ ret
++verify_cpu_sse_ok:
++ popfl # Restore caller passed flags
++ xorl %eax, %eax
++ ret
++#endif
--- syslinux.spec 16 Apr 2009 18:11:30 -0000 1.59
+++ syslinux.spec 20 Jun 2009 20:10:46 -0000
@@ -7,6 +7,7 @@ License: GPLv2+
Group: Applications/System
URL: http://syslinux.zytor.com/
Source0: ftp://ftp.kernel.org/pub/linux/utils/boot/syslinux/%{name}-%{tarball_vers...
+Patch9: defaults.patch
ExclusiveArch: %{ix86} x86_64
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: nasm >= 0.98.38-1, perl, netpbm-progs
@@ -33,12 +34,18 @@ MEMDISK, which loads legacy operating sy
%prep
%setup -q -n syslinux-%{tarball_version}
+%patch9 -p1
%build
CFLAGS="-Werror -Wno-unused -finline-limit=2000"
export CFLAGS
# If you make clean here, we lose the provided syslinux.exe
#make clean
+rm -f com32/menu/vesamenu.c32
+make -C com32/lib libcom32.a
+make -C com32/gpllib libcom32gpl.a
+make -C com32/menu vesamenu.c32
+test -f com32/menu/vesamenu.c32
make installer
make -C sample tidy
12 years, 8 months
btrfs for Fedora 12 and 13 LiveCD/DVD ?
by Valent Turkovic
Hi,
how to make Fedora 12 and Fedora 13 LiveCD/DVD that is btrfs formated
and not ext4?
What options need to be enables in kicstart file so that
livecd-creator makes btrfs iso images?
I would like to also have compression enabled after btrfs image in
transfered to hard drive or SSD.
Has anybody tried this?
Thank you in advanced,
Valent.
--
pratite me na twitteru - www.twitter.com/valentt
blog: http://kernelreloaded.blog385.com
linux, anime, spirituality, windsurf, wireless, ronjenje, pametne kuće, zwave
registered as user #367004 with the Linux Counter, http://counter.li.org.
ICQ: 2125241, Skype: valent.turkovic, MSN: valent.turkovic(a)hotmail.com
12 years, 12 months
[PATCH] add edit-livecd script for editing livecd based images
by Joey Boggs
Resubmitting the edit-livecd script with the latest updates.
edit-livecd is used for opening up livecd images to add and/or edit files with out having to rebuild the iso image.
This script is useful for people who don't have the development and yum infrastructure/repos set up to build livecd's from scratch. This is especially useful for custom livecd images, like the ovirt-node project[1].
We agree that changes to packaging and binaries should always be done by modifying kickstart and rebuilding the image via livecd-creator. But if all you want to do is add/edit a config file, public key for SSH, or change the root password this can be done with the edit-livecd script.
This is the second generation of the edit-livecd tool that replaces our original bash script with a python version and aims to reuse as much as the livecd-creator libraries as possible. The main reason for the new creator class is to avoid the need for a kisckstart file in order to edit an existing livecd image.
[1] http://ovirt.org
---
Makefile | 2 +
tools/edit-livecd | 350 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 352 insertions(+), 0 deletions(-)
create mode 100755 tools/edit-livecd
diff --git a/Makefile b/Makefile
index 991b27b..62e7fd8 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ install: man
$(INSTALL_PROGRAM) -D tools/image-creator $(DESTDIR)/usr/bin/image-creator
$(INSTALL_PROGRAM) -D tools/livecd-iso-to-disk.sh $(DESTDIR)/usr/bin/livecd-iso-to-disk
$(INSTALL_PROGRAM) -D tools/livecd-iso-to-pxeboot.sh $(DESTDIR)/usr/bin/livecd-iso-to-pxeboot
+ $(INSTALL_PROGRAM) -D tools/edit-livecd $(DESTDIR)/usr/bin/edit-livecd
$(INSTALL_DATA) -D AUTHORS $(DESTDIR)/usr/share/doc/livecd-tools-$(VERSION)/AUTHORS
$(INSTALL_DATA) -D COPYING $(DESTDIR)/usr/share/doc/livecd-tools-$(VERSION)/COPYING
$(INSTALL_DATA) -D README $(DESTDIR)/usr/share/doc/livecd-tools-$(VERSION)/README
@@ -40,6 +41,7 @@ uninstall:
rm -f $(DESTDIR)/usr/bin/livecd-creator
rm -rf $(DESTDIR)/usr/lib/livecd-creator
rm -rf $(DESTDIR)/usr/share/doc/livecd-tools-$(VERSION)
+ rm -f $(DESTDIR)/usr/bin/edit-livecd
dist : all
git archive --format=tar --prefix=livecd-tools-$(VERSION)/ HEAD | bzip2 -9v > livecd-tools-$(VERSION).tar.bz2
diff --git a/tools/edit-livecd b/tools/edit-livecd
new file mode 100755
index 0000000..920522c
--- /dev/null
+++ b/tools/edit-livecd
@@ -0,0 +1,350 @@
+#!/usr/bin/python -tt
+#
+# edit livecd: Edit a livecd to insert files
+#
+# Copyright 2009, Red Hat Inc.
+# Written by Perry Myers <pmyers(a)redhat.com> & David Huff <dhuff(a)redhat.com>
+#
+#
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import os
+import sys
+import tempfile
+import shutil
+import subprocess
+import optparse
+import logging
+
+from imgcreate.debug import *
+from imgcreate.fs import *
+from imgcreate.live import *
+
+class ExistingSparseLoopbackDisk(SparseLoopbackDisk):
+ """don't want to expand the disk"""
+ def __init__(self, lofile, size):
+ SparseLoopbackDisk.__init__(self, lofile, size)
+
+ def create(self):
+ #self.expand(create = True)
+ LoopbackDisk.create(self)
+
+class LiveImageEditor(LiveImageCreator):
+ """class for editing LiveCD images.
+
+ We need an instance of LiveImageCreator however we do not have a kickstart
+ file nor do we need to create a new image. We just want to reuse some of
+ LiveImageCreators methods on an existing livecd image.
+
+ """
+
+ def __init__(self, name):
+ """Initialize a LiveImageEditor instance.
+
+ creates a dummy instance of LiveImageCreator
+ We do not initialize any sub classes b/c we have no ks file.
+
+ """
+ self.name = name
+
+ self.tmpdir = "/var/tmp"
+ """The directory in which all temporary files will be created."""
+
+ self.skip_compression = False
+ """Controls whether to use squashfs to compress the image."""
+
+ self.skip_minimize = False
+ """Controls whether an image minimizing snapshot should be created."""
+
+ self._isofstype = "iso9660"
+ self.__isodir = None
+
+ self._ImageCreator__builddir = None
+ """working directory"""
+
+ self._ImageCreator_instroot = None
+ """where the extfs.img is mounted for modification"""
+
+ self._ImageCreator_outdir = None
+ """where final iso gets written"""
+
+ self._ImageCreator__bindmounts = []
+
+ self._LoopImageCreator__imagedir = None
+ """dir for the extfs.img"""
+
+ self._LoopImageCreator__blocksize = 4096
+ self._LoopImageCreator__fslabel = None
+ self._LoopImageCreator__instloop = None
+ self._LoopImageCreator__fstype = None
+ self._LoopImageCreator__image_size = None
+
+ self._LiveImageCreatorBase__isodir = None
+ """directory where the iso is staged"""
+
+ # properties
+ def __get_image(self):
+ if self._LoopImageCreator__imagedir is None:
+ self.__ensure_builddir()
+ self._LoopImageCreator__imagedir = tempfile.mkdtemp(dir = os.path.abspath(self.tmpdir), prefix = self.name + "-")
+ return self._LoopImageCreator__imagedir + "/ext3fs.img"
+ _image = property(__get_image)
+ """The location of the image file"""
+
+
+ def _get_fstype(self):
+ dev_null = os.open("/dev/null", os.O_WRONLY)
+ try:
+ out = subprocess.Popen(["/sbin/blkid", self._image],
+ stdout = subprocess.PIPE,
+ stderr = dev_null).communicate()[0]
+ for word in out.split():
+ if word.startswith("TYPE"):
+ self._LoopImageCreator__fstype = word.split("=")[1].strip("\"")
+
+ except IOError, e:
+ raise CreatorError("Failed to determine fsimage TYPE: %s" % e )
+
+
+ def _get_fslable(self):
+ dev_null = os.open("/dev/null", os.O_WRONLY)
+ try:
+ out = subprocess.Popen(["/sbin/e2label", self._image],
+ stdout = subprocess.PIPE,
+ stderr = dev_null).communicate()[0]
+
+ self._LoopImageCreator__fslable = out.strip()
+
+ except IOError, e:
+ raise CreatorError("Failed to determine fsimage TYPE: %s" % e )
+
+
+ def __ensure_builddir(self):
+ if not self._ImageCreator__builddir is None:
+ return
+
+ try:
+ self._ImageCreator__builddir = tempfile.mkdtemp(dir = os.path.abspath(self.tmpdir),
+ prefix = "edit-livecd-")
+ except OSError, (err, msg):
+ raise CreatorError("Failed create build directory in %s: %s" %
+ (self.tmpdir, msg))
+
+
+ def _run_script(self, script):
+
+ (fd, path) = tempfile.mkstemp(prefix = "script-",
+ dir = self._instroot + "/tmp")
+
+ logging.debug("copying script to install root: %s" % path)
+ shutil.copy(os.path.abspath(script), path)
+ os.close(fd)
+ os.chmod(path, 0700)
+
+ script = "/tmp/" + os.path.basename(path)
+
+
+ try:
+ subprocess.call([script], preexec_fn = self._chroot)
+ except OSError, e:
+ raise CreatorError("Failed to execute script %s, %s " % (script, e))
+ finally:
+ os.unlink(path)
+
+
+ def mount(self, base_on, cachedir = None):
+ """mount existing file system.
+
+ we have to override mount b/c we are not creating an new install root
+ nor do we need to setup the file system, ie makedirs(/etc/, /boot, ...),
+ nor do we want to overwrite fstab, or create selinuxfs
+
+ We also need to get some info about the image before we
+ can mount it.
+
+ """
+
+ if not base_on:
+ raise CreatorError("No base livecd image specified")
+
+ self.__ensure_builddir()
+
+ self._ImageCreator_instroot = self._ImageCreator__builddir + "/install_root"
+ self._LoopImageCreator__imagedir = self._ImageCreator__builddir + "/ex"
+ self._ImageCreator_outdir = self._ImageCreator__builddir + "/out"
+
+ makedirs(self._ImageCreator_instroot)
+ makedirs(self._LoopImageCreator__imagedir)
+ makedirs(self._ImageCreator_outdir)
+
+ LiveImageCreator._base_on(self, base_on)
+
+ self._LoopImageCreator__image_size = os.stat(self._image)[stat.ST_SIZE]
+ self._get_fstype()
+ self._get_fslable()
+ self.fslabel = self._LoopImageCreator__fslable
+
+ self._LoopImageCreator__instloop = ExtDiskMount(ExistingSparseLoopbackDisk(self._image,
+ self._LoopImageCreator__image_size),
+ self._ImageCreator_instroot,
+ self._fstype,
+ self._LoopImageCreator__blocksize,
+ self.fslabel)
+ try:
+ self._LoopImageCreator__instloop.mount()
+ except MountError, e:
+ raise CreatorError("Failed to loopback mount '%s' : %s" %
+ (self._image, e))
+
+ cachesrc = cachedir or (self._ImageCreator__builddir + "/yum-cache")
+ makedirs(cachesrc)
+
+ for (f, dest) in [("/sys", None), ("/proc", None),
+ ("/dev/pts", None), ("/dev/shm", None),
+ (cachesrc, "/var/cache/yum")]:
+ self._ImageCreator__bindmounts.append(BindChrootMount(f, self._instroot, dest))
+
+ self._do_bindmounts()
+
+ os.symlink("../proc/mounts", self._instroot + "/etc/mtab")
+
+ self.__copy_cd_root(base_on)
+
+
+ def __copy_cd_root(self, base_on):
+ """helper function to root content of the base liveCD to ISOdir"""
+
+ isoloop = DiskMount(LoopbackDisk(base_on, 0), self._mkdtemp())
+ self._LiveImageCreatorBase__isodir = self._ImageCreator__builddir + "/iso"
+
+ try:
+ isoloop.mount()
+ # legacy LiveOS filesystem layout support, remove for F9 or F10
+ if os.path.exists(isoloop.mountdir + "/squashfs.img"):
+ squashimg = isoloop.mountdir + "/squashfs.img"
+ else:
+ squashimg = isoloop.mountdir + "/LiveOS/squashfs.img"
+
+ #copy over everything but squashimg
+ shutil.copytree(isoloop.mountdir,
+ self._LiveImageCreatorBase__isodir,
+ ignore=shutil.ignore_patterns("squashfs.img", "osmin.img"))
+ except MountError, e:
+ raise CreatorError("Failed to loopback mount '%s' : %s" %
+ (base_on, e))
+
+ finally:
+ isoloop.cleanup()
+
+
+def parse_options(args):
+ parser = optparse.OptionParser(usage = "%prog [-s=<script.sh>] <LIVECD.iso>")
+
+ parser.add_option("-n", "--name", type="string", dest="name",
+ help="name of new livecd (don't include .iso will be added)")
+
+ parser.add_option("-o", "--output", type="string", dest="output",
+ help="specify the output dir")
+
+ parser.add_option("-s", "--script", type="string", dest="script",
+ help="specify script to run chrooted in the livecd fsimage")
+
+ parser.add_option("-t", "--tmpdir", type="string",
+ dest="tmpdir", default="/var/tmp",
+ help="Temporary directory to use (default: /var/tmp)")
+
+ parser.add_option("", "--skip-compression", action="store_true", dest="skip_compression")
+
+ parser.add_option("", "--skip-minimize", action="store_true", dest="skip_minimize")
+
+ setup_logging(parser)
+
+ (options, args) = parser.parse_args()
+
+ if len(args) != 1:
+ parser.print_usage()
+ sys.exit(1)
+
+ return (args[0], options)
+
+def rebuild_iso_symlinks(isodir):
+ # remove duplicate files and rebuild symlinks to reduce iso size
+ efi_vmlinuz = "%s/EFI/boot/vmlinuz0" % isodir
+ isolinux_vmlinuz = "%s/isolinux/vmlinuz0" % isodir
+ efi_initrd = "%s/EFI/boot/initrd0.img" % isodir
+ isolinux_initrd = "%s/isolinux/initrd0.img" % isodir
+
+ os.remove(efi_vmlinuz)
+ os.remove(efi_initrd)
+ os.symlink(isolinux_vmlinuz,efi_vmlinuz)
+ os.symlink(isolinux_initrd,efi_initrd)
+
+
+def main():
+ (livecd, options) = parse_options(sys.argv[1:])
+
+ if os.geteuid () != 0:
+ print >> sys.stderr, "You must run edit-livecd as root"
+ return 1
+
+ if options.name:
+ name = options.name
+ else:
+ name = os.path.basename(livecd) + ".edited"
+
+ if options.output:
+ output = options.output
+ else:
+ output = os.path.dirname(livecd)
+
+
+ editor = LiveImageEditor(name)
+ editor.tmpdir = os.path.abspath(options.tmpdir)
+ editor.skip_compression = options.skip_compression
+ editor.skip_minimize = options.skip_minimize
+
+ try:
+ editor.mount(livecd, cachedir = None)
+ if options.script:
+ print "Running edit script '%s'" % options.script
+ editor._run_script(options.script)
+ else:
+ print "Launching shell. Exit to continue."
+ print "----------------------------------"
+ editor.launch_shell()
+ rebuild_iso_symlinks(editor._LiveImageCreatorBase__isodir)
+ editor.unmount()
+ editor.package(output)
+ except CreatorError, e:
+ logging.error(u"Error editing Live CD : %s" % e)
+ return 1
+ finally:
+ editor.cleanup()
+
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+
+arch = rpmUtils.arch.getBaseArch()
+if arch in ("i386", "x86_64"):
+ LiveImageCreator = x86LiveImageCreator
+elif arch in ("ppc",):
+ LiveImageCreator = ppcLiveImageCreator
+elif arch in ("ppc64",):
+ LiveImageCreator = ppc64LiveImageCreator
+else:
+ raise CreatorError("Architecture not supported!")
--
1.6.6.1
13 years, 3 months
[PATCH v2] Implement %post --erroronfail
by Daniel Drake
This flag is documented and parsed, but not acted upon.
---
imgcreate/creator.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 909f616..4deb49e 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -23,6 +23,7 @@ import sys
import tempfile
import shutil
import logging
+import subprocess
import selinux
import yum
@@ -702,11 +703,17 @@ class ImageCreator(object):
script = "/tmp/" + os.path.basename(path)
try:
- subprocess.call([s.interp, script],
- preexec_fn = preexec, env = env)
+ subprocess.check_call([s.interp, script],
+ preexec_fn = preexec, env = env)
except OSError, (err, msg):
raise CreatorError("Failed to execute %%post script "
"with '%s' : %s" % (s.interp, msg))
+ except subprocess.CalledProcessError, err:
+ if s.errorOnFail:
+ raise CreatorError("%%post script failed with code %d "
+ % err.returncode)
+ logging.warning("ignoring %%post failure (code %d)"
+ % err.returncode)
finally:
os.unlink(path)
--
1.6.2.5
13 years, 4 months
[PATCH livecd-tools] livecd-creator ignores device directive
by Alan Pevec
From: Alan Pevec <apevec(a)redhat.com>
create dracut.conf not /etc/sysconfig/mkinitrd
Resolves: rhbz#585170
Signed-off-by: Alan Pevec <apevec(a)redhat.com>
---
imgcreate/live.py | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 78cbff7..0d044ee 100644
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -181,11 +181,11 @@ class LiveImageCreatorBase(LoopImageCreator):
def _mount_instroot(self, base_on = None):
LoopImageCreator._mount_instroot(self, base_on)
- self.__write_initrd_conf(self._instroot + "/etc/sysconfig/mkinitrd")
+ self.__write_initrd_conf(self._instroot + "/etc/dracut.conf")
def _unmount_instroot(self):
try:
- os.unlink(self._instroot + "/etc/sysconfig/mkinitrd")
+ os.unlink(self._instroot + "/etc/dracut.conf")
except:
pass
LoopImageCreator._unmount_instroot(self)
@@ -212,24 +212,23 @@ class LiveImageCreatorBase(LoopImageCreator):
makedirs(os.path.dirname(path))
f = open(path, "a")
- f.write('LIVEOS="yes"\n')
f.write('PROBE="no"\n')
- f.write('MODULES+="squashfs ext4 ext3 ext2 vfat msdos "\n')
- f.write('MODULES+="sr_mod sd_mod ide-cd cdrom "\n')
+ f.write('add_drivers+="squashfs ext4 ext3 ext2 vfat msdos "\n')
+ f.write('add_drivers+="sr_mod sd_mod ide-cd cdrom "\n')
for module in self.__modules:
if module == "=usb":
- f.write('MODULES+="ehci_hcd uhci_hcd ohci_hcd "\n')
- f.write('MODULES+="usb_storage usbhid "\n')
+ f.write('add_drivers+="ehci_hcd uhci_hcd ohci_hcd "\n')
+ f.write('add_drivers+="usb_storage usbhid "\n')
elif module == "=firewire":
- f.write('MODULES+="firewire-sbp2 firewire-ohci "\n')
- f.write('MODULES+="sbp2 ohci1394 ieee1394 "\n')
+ f.write('add_drivers+="firewire-sbp2 firewire-ohci "\n')
+ f.write('add_drivers+="sbp2 ohci1394 ieee1394 "\n')
elif module == "=mmc":
- f.write('MODULES+="mmc_block sdhci sdhci-pci "\n')
+ f.write('add_drivers+="mmc_block sdhci sdhci-pci "\n')
elif module == "=pcmcia":
- f.write('MODULES+="pata_pcmcia "\n')
+ f.write('add_drivers+="pata_pcmcia "\n')
else:
- f.write('MODULES+="' + module + ' "\n')
+ f.write('add_drivers+="' + module + ' "\n')
f.close()
--
1.6.0.6
13 years, 4 months
[PATCH] livecd-iso-to-disk --format fails with existing LV on USB
by David Huff
Resolves rhbz#583658
---
tools/livecd-iso-to-disk.sh | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 3a4726d..0cfcfb8 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -138,6 +138,21 @@ checkPartActive() {
fi
}
+checkLVMActive() {
+ dev=$1
+
+ # check for an active lv which will cause format to fail
+ for vg in $(pvs -o vg_name --noheadings $dev $dev${dev_delim}[0-9]* 2>/dev/null|sort -u); do
+ if [ $(lvs -o lv_attr --noheadings $vg |awk {'print $1;'} |cut -c 5) = "a" ]; then
+ echo "Device, $dev, contains a volume group with an active volume and cannot be formated!"
+ echo "You can remove the volume group with "
+ echo " # /sbin/vgremove -f $vg"
+ exitclean
+ fi
+ done
+ return 0
+}
+
createGPTLayout() {
dev=$1
getdisk $dev
@@ -407,6 +422,7 @@ fi
# do some basic sanity checks.
checkMounted $USBDEV
if [ -n "$format" ];then
+ checkLVMActive $USBDEV
# checks for a valid filesystem
if [ -n "$efi" ];then
createGPTLayout $USBDEV
--
1.6.6.1
13 years, 4 months
Getting a graphical Plymouth screen for a Spin
by Sebastian Dziallas
Hi all,
I'm scratching my head about this and have thrown already a good chunk
of time into working on this, so I figured it might be reasonable to
ask here, in case somebody had any ideas. We're working on getting a
modified splash screen as before for Sugar on a Stick in time for the
release (which is coming close, so I'm trying to get the done as soon
as possible).
The required package with the images and the plymouth file has been
packaged long ago [1] and we're replacing the original theme in the
kickstart file by now [2]. However, on a machine that boots both on
F13 Beta and RHEL 6 Beta using the graphical boot screen, SoaS comes
only up with the blue bar at the bottom - the %post part of the RPM
file fails according to the logs, though [3].
Ray Strode suggested that this might be caused by the fact that the
plymouth theme gets installed past the kernel in the build process,
and that if this was the case, it'd be required to rebuild the initrd
in %post. Turns out that sugar-logos actually gets installed past the
kernel. But even after calling dracut in the kickstart's %post part,
nothing changes.
So. Does anybody have an idea how we can get the sugar-logos package
installed *before* the kernel one? Or how we can get a working rebuild
of the initrd into the spin? Any help to get this done in time would
be really appreciated!
--Sebastian
[1] http://cvs.fedoraproject.org/viewvc/devel/sugar-logos/sugar-logos.spec?vi...
[2] http://git.fedorahosted.org/git/?p=spin-kickstarts.git;a=blob;f=fedora-li...
[3] http://alt.fedoraproject.org/pub/alt/nightly-composes/soas/logs/
13 years, 5 months
EL6 Beta livedvd - no root device found
by Williamson Grant
Not sure if this is the correct list to post the following to. However Has anyone tried to create a livedvd/cd on EL6 already.
I seem to be hitting the "no root device found, boot has failed, sleeping forever" problem.
13 years, 5 months
Re: [Fedora-livecd-list] btrfs for Fedora 12 and 13 LiveCD/DVD ?
by Valent Turkovic
>
> https://fedoraproject.org/wiki/Features/SystemRollbackWithBtrfs
>
I don't see any new info on that wiki page that would help with
liveCD/DVD, please explain.
Thanks!
--
pratite me na twitteru - www.twitter.com/valentt
blog: http://kernelreloaded.blog385.com
linux, anime, spirituality, windsurf, wireless, ronjenje, pametne kuće, zwave
registered as user #367004 with the Linux Counter, http://counter.li.org.
ICQ: 2125241, Skype: valent.turkovic, MSN: valent.turkovic(a)hotmail.com
13 years, 5 months