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, 5 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
Custom initrd
by Mads Kiilerich
I am using livecd-creator from livecd-tools-024-1.fc11.i586 and need to
customize the initrd. But I have problems making it work and figuring
out what is going on.
I have figured out that livecd-creator through imgcreate creates a
/etc/sysconfig/mkinitrd. When rpms runs mkinitrd from their %post script
then it will exec mkliveinitrd and use the configured module list.
AFAICS livecd-creator then picks up the initrd from /boot, and the end
result after having written the iso to usb with livecd-iso-to-disk is
that it ends up in /syslinux/initrd0.img.
But if I overwrite the /boot/initrd* in %post like this:
/sbin/mkinitrd -f /boot/initrd-$(rpm -q kernel --qf
'%{version}-%{release}.%{arch}\n').img $(rpm -q kernel --qf
'%{version}-%{release}.%{arch}\n')
then it won't be used.
What am I doing wrong? When is the initrd picked up? What is the code flow?
If I make %post preserve /etc/sysconfig/mkinitrd and boots from usb and
restores /etc/sysconfig/mkinitrd and runs
/sbin/mkinitrd -f /mnt/live/syslinux/initrd0.img $(rpm -q kernel
--qf "%{version}-%{release}.%{arch}\n")
then it works as expected.
/Mads
13 years, 3 months
livecd-creator crashes
by Valent Turkovic
Hi,
I was able to create LiveCD/DVD images without problem, now I get a
crash everytime I try to create an iso image. Do you also have this
issue?
this is the line I use:
livecd-creator -t /home/temp/ --cache=/home/yum-cache/ -f Fedora-Remix
-c /home/user/fedora-remix-12.ks
and after packages get downloaded and installed then it crashes:
e2fsck 1.41.9 (22-Aug-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Community-Fedora: 178207/384272 files (0.1% non-contiguous),
1231851/1536000 blocks
e2image 1.41.9 (22-Aug-2009)
resize2fs 1.41.9 (22-Aug-2009)
Resizing the filesystem on
/home/temp/imgcreate-j8h7Np/tmp-KY_dxF/ext3fs.img to 1238091 (4k)
blocks.
The filesystem on /home/temp/imgcreate-j8h7Np/tmp-KY_dxF/ext3fs.img is
now 1238091 blocks long.
e2fsck 1.41.9 (22-Aug-2009)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free inodes count wrong for group #16 (8176, counted=0).
Fix? yes
Free inodes count wrong for group #32 (8176, counted=0).
Fix? yes
Free inodes count wrong (148833, counted=132481).
Fix? yes
Community-Fedora: ***** FILE SYSTEM WAS MODIFIED *****
Community-Fedora: 178207/310688 files (0.1% non-contiguous),
1227236/1238091 blocks
/usr/lib/python2.6/site-packages/imgcreate/errors.py:45:
DeprecationWarning: BaseException.message has been deprecated as of
Python 2.6
return unicode(self.message)
Error creating Live CD : fsck after resize returned an error! image
to debug at /tmp/resize-image-Vym83w
--
pratite me na twitteru - www.twitter.com/valentt
http://kernelreloaded.blog385.com/
linux, blog, anime, spirituality, windsurf, wireless
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
Can't boot iso from usb flash device
by Mads Kiilerich
I noticed that "cat live.iso > usbflashdevice" almost works. Lilo and
the kernel starts, but fails to find the root partition.
Could it be because blkid shows that it has a LABEL="live" while the
kernel parameter is "root=CDLABEL=live"?
Changing the kernel parameter to "root=LABEL=live" doesn't work, but
"root=/dev/sdb" works.
How should it work?
livecd-tools-031-1.fc12.1.i686
/Mads
13 years, 3 months
[PATCH] Use Exception.args instead of .message
by Mads Kiilerich
# HG changeset patch
# User Mads Kiilerich <mads(a)kiilerich.com>
# Date 1267025085 -3600
# Node ID f54180cb4db5e6a06e95f2225b6f100aa68f6ee8
# Parent 710e272f26c41db3d3df22295e4b112477bed96d
Use Exception.args instead of .message
Fixes python 2.6 deprecation warning
diff --git a/imgcreate/errors.py b/imgcreate/errors.py
--- a/imgcreate/errors.py
+++ b/imgcreate/errors.py
@@ -23,8 +23,8 @@
# Some error messages may contain unicode strings (especially if your system
# locale is different from 'C', e.g. 'de_DE'). Python's exception class does
- # not handle this appropriately (at least until 2.5) because str(Exception)
- # returns just self.message without ensuring that all characters can be
+ # not handle this appropriately (at least until 2.5) because str(Exception(x))
+ # returns just x without ensuring that all characters can be
# represented using ASCII. So we try to return a str and fall back to repr
# if this does not work.
#
@@ -37,12 +37,12 @@
# first log call print a more readable error message.
def __str__(self):
try:
- return str(self.message)
+ return str(self.args[0])
except UnicodeEncodeError:
- return repr(self.message)
+ return repr(self.args[0])
def __unicode__(self):
- return unicode(self.message)
+ return unicode(self.args[0])
class KickstartError(CreatorError):
pass
13 years, 3 months
Re: [Fedora-livecd-list] edit-livecd tool usage
by David Huff
adding livecd list....
On 02/22/2010 06:53 PM, Kunthar wrote:
> Hi,
>
> I really need to use this tool but it has lack of info in code.
> Could you give me a one liner sample to use with?
"edit-livecd.py --help" gives more info
>
> Usage: livecd-edit.py [-s=<script.sh>]<LIVECD.iso>
>
> 1. what is -s scripth.sh for?
specify a bash script to run chrooted inside the livecd, fs image.
> 2. generic usage sample to change one file from same machine.
most simple usage is "edit-livecd.py image-you-want-to-edit.iso" this
will give you a chrooted shell inside the livecd, fs mage.
> Thank you very much for this tool and please ,mprove and add it to
> livecd tools set.
>
Also note, there are two known issues with the script as is: 1) the FS
label is not correctly copied form the base image, a work around is to
manually edit the grub menu and change the cd label to the correct
label. I am working on fix for this and should have it posted soon! 2)
there is an ~ 10-15M size increase on the edited image. We believe this
is because the hard links form initrd are broken when the image is
copied, so essentially you have two copies of the initrd image on the
new iso. Jboggs has proposed a patch I am working on getting this fix
into the script. I will also soon have a patch for this as well.
-D
13 years, 3 months
Adding packages to an existing iso
by James Heather
Back in the reign of Henry VIII, there was an option to livecd-creator
to add a named package to an existing iso image ('--package'). Is there
just no way of doing this any more?
It is odd, because the '--base' option is still there. But I can't find
a way to use it sensibly. I've tried creating a kickstart file that just
reads
%packages
blither
%end
and then run
livecd-creator --base=existing.iso --config=extra.ks
but I get a moan about not having defined any repositories. Do I really
have to create a complete kickstart file just to add one package?
Intuitively the idea seems sensible: unpack the squashfs image
somewhere, chroot, yum install blither (using whatever repos are defined
inside the image), repack.
Ta.
James
13 years, 3 months
Compression option
by Bruno Wolff III
Hopefully in about a month I'll want to modify the rawhide (f14) version
of livecd-creator to allow use of lzma compression. squashfs-tools should
be ready for rawhide very shortly and once 2.6.34 hits rawhide we should
have the prerequistits for using lzma compression for live images.
I'd like to propose the following change and hear back what people think.
I would like the default compression to be lzma. I would like there to
be an option compression=COMPRESSION where COMPRESSION is passed using
-comp to mksquashfs. By default COMPRESSION would be lzma (since mksquashfs
defaults to zlib).
While there is some argument for making zlib the default for backwards
compatibilty, I don't think that is a big deal and having the better
compression by default seems to make more sense to me. A test with
the games spin showed a 10% reduction in size of the image.
13 years, 3 months
Why copy initramfs prior to running post install scripts?
by Williamson Grant
I am wondering why the initramfs is copied prior to the post install
scripts being run.
In my case I want to customize this.
The following patch allows me to do this, I am curious are there are
issues doing this.
--- creator.py.orig 2010-02-11 20:16:26.067736692 +0100
+++ creator.py 2010-02-11 20:17:26.601615518 +0100
@@ -734,10 +734,10 @@
kickstart.NetworkConfig(self._instroot).apply(ksh.network)
kickstart.RPMMacroConfig(self._instroot).apply(self.ks)
- self._create_bootconfig()
-
self.__run_post_scripts()
+ self._create_bootconfig()
+
def launch_shell(self):
"""Launch a shell in the install root.
13 years, 3 months