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
how to enable btrfs for livecd ?
by Valent Turkovic
I have tried editing kickstart file so that instead of ext4 iso image
uses btrfs but this fails everytime I try it.
What am I doing wrong? Has anybody managed to create btrfs livecd
image via livecd-creator?
How? Please show me your example kickstart files.
I see that there was bug opened but now is closed:
https://bugzilla.redhat.com/show_bug.cgi?id=571910
If this is not user (mine) error this bug should be reopened,
Some more info is also on my blog:
http://kernelreloaded.blog385.com/index.php/archives/btrfs-fedora-remix/
--
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, 3 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
Re: [Fedora-livecd-list] Help: livecd-creator details
by Bruno Wolff III
You didn't copy this back to the list. Since the questions appear to be
targeted to the list, I am going to copy this back to the list.
On Sun, May 30, 2010 at 11:08:10 +0800,
Lee Eric <openlinuxsource(a)gmail.com> wrote:
> Thanks for your reply. My goal is simple, I just wanna make a live cd
> not using livecd-creator but take steps what livecd-creator does.
That's a pretty odd request. If you want to learn, a good place to start
would be looking at the installed python code that runs.
You might even be able to plugin the reiserfs stuff into a modifed version.
There will probably be some gotcha's along the way.
> Here's what I saw from livecd-creator README.
>
> o Sets up a file for the ext3 file system that will contain all the
> data comprising the live CD
>
> o Loopback mounts that file into the file system so there is an
> installation root
>
> o Bind mounts certain kernel file systems (/dev, /dev/pts, /proc,
> /sys, /selinux) inside the installation root
>
> o Uses a configuration file to define the requested packages and
> default configuration options. The format of this file is the same
> as is used for installing a system via kickstart.
>
> o Installs, using yum, the requested packages into the installation
> using the given repositories
>
> o Optionally runs scripts as specified by the live CD configuration file.
>
> o Relabels the entire installation root (for SELinux)
>
> o Creates a live CD specific initramfs that matches the installed kernel
>
> o Unmounts the kernel file systems mounted inside the installation root
>
> o Unmounts the installation root
>
> o Runs resize2fs to minimize and unminimize the ext3 file to remove data
> from deleted files
>
> o Runs resize2fs to minimize on a devicemapper snapshot, to generate a
> small minimized delta image file which can be used by anaconda to
> reduce installation time by not copying unused data to disk
>
> o Creates a squashfs file system containing only the ext3 file (compression)
>
> o Configures the boot loader
>
> o Creates an iso9660 bootable CD
>
> I wanna take steps it mentions then I can make a Live CD. I hope
> someone shoe me some tips for every commands.
>
> Thanks.
>
> Eric
>
> On Sun, May 30, 2010 at 12:09 AM, Bruno Wolff III <bruno(a)wolff.to> wrote:
> > On Fri, May 28, 2010 at 23:52:32 +0800,
> > Lee Eric <openlinuxsource(a)gmail.com> wrote:
> >> Hi all,
> >>
> >> I'm a user of Fedora 12. And I wanna make my own Live CD by using some
> >> ways. I noticed livecd-creator works well and I read its read me under
> >> /usr/share/doc, it looks like here's a chapter named "HOW THE LIVE CD
> >> CREATOR WORKS" tell us how to make a Live CD manually. So I'm very
> >> curious how this magic happened then a Live CD created.
> >
> > What is your overall goal. It is unlikely (though it could be) that the
> > way you are trying to do this is the right approach.
> >
> > Normally you want to work with the kickstart files. Those can contain more
> > than a list of packages to install. If you explain what your overall goal is
> > someone might be able to make some suggestions with how to achieve it using
> > a kickstart file.
> >
13 years, 3 months
Re: [Fedora-livecd-list] Non-native architectures
by Jasper Hartline
You don't have to run binaries in the target platform to build a LiveCD.
That is where you are getting confused.
>From any system I can build a LiveCD for any target architecture, as
long as I set the target up correctly
for that platform. For example when I do copy or configuration
changes, I can simply run
mv this or cp this to the target, which is still a same architecture
binary as the host system.
Trust me I have built LiveCDs for x86_64 and i686 on an i686 box.
When for example syslinux is installed, you want to use the
isolinux.bin file FROM THE TARGET
with the host's mkisofs. You don't need to execute command from the
target system to create a LiveCD for another
platform.
On Sun, May 30, 2010 at 4:23 AM, Mads Kiilerich <mads(a)kiilerich.com> wrote:
> As far as I know the only way to run x86_64 binaries (and thus allow such
> rpms to be installed correctly) on i686 is to use full hardware emulation.
> Neither variables nor setarch nor mock is sufficient.
13 years, 3 months
Non-native architectures
by Misha Shnurapet
Hello.
Currently, running an x86_64 system I can also re-spin 32-bit versions
by using "setarch i686" in the command line:
su -c "setarch i686 livecd-creator
--config=/usr/share/spin-kickstarts/fedora-livecd-desktop.ks"
But it does not work other way around. For example,
su -c "setarch x86_64 livecd-creator
--config=/usr/share/spin-kickstarts/fedora-livecd-desktop.ks"
gives an error. Same for another architecture. I think there's something
wrong with this. Is it possible to create spins for other architectures?
Can it be fixed?
Thank you.
--
Best regards,
Misha Shnurapet, Fedora Project Contributor
http://fedoraproject.org/wiki/User:Shnurapet
shnurapet at fedoraproject.org, GPG: 00217306
13 years, 4 months