Added specific code for ppc images

This commit is contained in:
Martin Gracik 2010-01-14 14:26:55 +01:00
parent 7eecf20703
commit 9867c805d0
12 changed files with 342 additions and 1671 deletions

View File

@ -8,4 +8,4 @@ modules: zfcp tape390 dasd_diag_mod dasd_eckd_mod dasd_fba_mod dasd_mod
ctc netiucv smsgiucv lcs qdio qeth ccwgroup crypto_api xfrm_nalgo
initrd_template=templates/initrd/initrd.s390
scrubs_template=templates/scrubs/scrubs.s390
scrubs_template=templates/scrubs/scrubs.i386

View File

@ -1 +0,0 @@
scrubs.i386

File diff suppressed because it is too large Load Diff

View File

@ -1,131 +0,0 @@
#
# mk-images.alpha
#
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
INITRDMODS="tgafb crc32 $INITRDMODS"
###FSMODS="msdos vfat ext3 reiserfs jfs xfs"
###IDEMODS="cdrom ide-cd"
###SCSIMODS="cdrom scsi_mod sd_mod sg sr_mod st"
###USBMODS="ohci-hcd uhci-hcd hid usb-storage sd_mod sr_mod"
###LATEUSBMODS="mousedev usb-storage"
###SECSTAGE="md raid0 raid1 raid5 dm-mod srm_env $FSMODS $IDEMODS $SCSIMODS $LATEUSBMODS"
NETMODULES="e100 tulip 8139too tulip 3c509 3c59x dl2k eepro epic100 ewrk3 hamachi natsemi ne2k-pci ns83820 starfire yellowfin de4x5 depca acenic tg3"
SCSIMODULES="$SCSIMODS qlogicisp DAC960 cpqfc BusLogic 3w-xxxx dmx3191d dpt_i2o megaraid ncr53c8xx sym53c8xx qlogicfc qla2x00 qla1280 cciss cpqarray aic7xxx aha1740 megaraid"
###ISOMODULES="ehci-hcd ieee1394 ohci1394 sbp2"
prepareBootImage() {
echo "ALPHA: prepareBootImage() is called"
dd if=/dev/zero of=$MBD_TMPIMAGE bs=1k count=$BOOTDISKSIZE 2>/dev/null
echo y | /sbin/mke2fs -b 1024 -r 0 -O none $MBD_TMPIMAGE > /dev/null 2>/dev/null
LODEV=`findloopdevice $MBD_TMPIMAGE`
e2writeboot $LODEV $BOOTDISKDIR/bootlx
mount $LODEV -t ext2 $MBD_BOOTTREE
mkdir -p $MBD_BOOTTREE/etc
cat > $MBD_BOOTTREE/etc/aboot.conf <<EOF
#
# Fedora Linux aboot configuration options:
#
# 0 - Boot the Fedora Linux installer using a 2.6 kernel
# 1 - Boot the Fedora Linux installer in non graphical mode
# 2 - Boot the Fedora Linux installer in text only mode on ttyS0
# for installation control via the serial port
# 3 - Boot in rescue mode
#
0:vmlinux.gz load_ramdisk=1 prompt_ramdisk=1 console=tty0 root=/dev/fd0
1:vmlinux.gz load_ramdisk=1 prompt_ramdisk=1 console=tty0 text root=/dev/fd0
2:vmlinux.gz load_ramdisk=1 prompt_ramdisk=1 console=ttyS0 text root=/dev/fd0
3:vmlinux.gz load_ramdisk=1 prompt_ramdisk=1 console=tty0 rescue root=/dev/fd0
EOF
cat > $MBD_BOOTTREE/etc/milo.conf <<EOF
image=/vmlinux.gz
label=linux
root=/dev/fd0
append="load_ramdisk=1 prompt_ramdisk=1"
EOF
zcat $KERNELROOT/boot/vmlinuz-* | gzip -9 > $MBD_BOOTTREE/vmlinux.gz
umount $LODEV
losetup -d $LODEV
mount -o loop -t ext2 $MBD_TMPIMAGE $MBD_BOOTTREE
}
makeBootImages() {
echo "Building boot images for kernel $kernelvers"
mkdir -p $TOPDESTPATH/boot
cp $BOOTDISKDIR/bootlx $TOPDESTPATH/boot
mkdir -p $TOPDESTPATH/etc
cat > $TOPDESTPATH/etc/aboot.conf <<EOF
#
# Fedora Linux aboot configuration options:
#
# 0 - Boot the Fedora Linux installer using a 2.6 kernel
# 1 - Boot the Fedora Linux installer with kernel messages sent to ttyS0
# 2 - Boot the Fedora Linux installer in text only mode
# 3 - Boot the Fedora Linux installer in text only rescue mode
#
0:/kernels/vmlinux.gz initrd=/images/initrd.img
1:/kernels/vmlinux.gz initrd=/images/initrd.img console=ttyS0
2:/kernels/vmlinux.gz initrd=/images/initrd.img text
3:/kernels/vmlinux.gz initrd=/images/initrd.img rescue
EOF
mkdir -p $TOPDESTPATH/kernels
cp $KERNELROOT/boot/vmlinuz-* $TOPDESTPATH/kernels/vmlinux.gz
makeinitrd --initrdto $TOPDESTPATH/images/ramdisk.img \
--initrdsize 8192 \
--loaderbin loader \
--modules "$NETMODULES $SCSIMODULES"
echo "List of init modules: $INITRDMODS"
makeinitrd --initrdto $TOPDESTPATH/images/initrd.img \
--initrdsize 8192 \
--loaderbin loader \
--modules "$INITRDMODS"
# makebootdisk --bootdisksize 4096 --kernelto $TOPDESTPATH/kernels/vmlinux.gz \
# --imagename generic.img
if [ -f $KERNELPATH/kernel-jensen-*.rpm ]; then
KJ_PKG=$KERNELPATH/kernel-jensen-*.rpm
KJ_DIR=/tmp/kernelj.dir.$$
mkdir -p $KJ_DIR
rpm2cpio $KJ_PKG | (cd $KJ_DIR; cpio --quiet -iumd ./boot/vmlinuz-*)
cp $KJ_DIR/boot/vmlinuz-* $TOPDESTPATH/kernels/vmlinuz.j
rm -rf $KJ_DIR
fi
# makedriverdisk --padsize 1440 "Supplemental Block Device Drivers" "drvblock" "$SCSIMODULES $EXTRASCSI +scsi"
# makedriverdisk --padsize 1440 "Supplemental Network Device Drivers" "drvnet" "$NETMODULES $EXTRANET +net"
}
#makeSecondStage() {
# makeinstimage "netstg" "$SECSTAGE $SCSIMODULES $IDEMODS =scsi"
# makeinstimage "hdstg" "$SECSTAGE $NETMODULES $IDEMODS =net"
# makemainmodules "$SECSTAGE $NETMODULES $SCSIMODULES $IDEMODS =scsi =net"
# makemainimage "install" "cramfs"
#}

View File

@ -1,172 +0,0 @@
#
# mk-images.ia64
#
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#makebootdisk required for EFI bootloader dosfs image
makebootdisk() {
EXTRAKERNELPATH=""
INITRDFLAGS=""
MBD_FILENAME=""
INITRDFILE=""
MBD_TMPIMAGE=${TMPDIR:-/tmp}/makebootdisk.image.$$
MBD_BOOTTREE=${TMPDIR:-/tmp}/makebootdisk.tree.$$
MBD_BOOTTREE_TMP=$MBD_BOOTTREE'_tmp'
while [ x$(echo $1 | cut -c1-2) = x"--" ]; do
if [ $1 = "--kernelto" ]; then
EXTRAKERNELPATH=$2
shift; shift
continue
elif [ $1 = "--initrdflags" ]; then
INITRDFLAGS=$2
shift; shift
continue
elif [ $1 = "--initrd" ]; then
INITRDFILE=$2
shift; shift
continue
elif [ $1 = "--imagename" ]; then
MBD_FILENAME=$IMAGEPATH/$2
shift; shift
continue
fi
echo "Unknown option passed to makebootdisk"
exit 1
done
if [ -z "$MBD_FILENAME" ]; then
echo "No imagename passed"
exit 1
fi
if [ -n "$INITRDFILE" ]; then
MBD_FSIMAGE="$INITRDFILE"
elif [ -n "$INITRDFLAGS" ]; then
eval makeinitrd --keep $INITRDFLAGS
fi
mkdir -p $MBD_BOOTTREE
mkdir -p $MBD_BOOTTREE_TMP
rm -rf $MBD_BOOTTREE_TMP
mkdir -p $MBD_TMPIMAGE
# provided by the mk-image.$ARCH file
prepareBootImage
left=$(df $MBD_BOOTTREE | tail -n1)
left=$(echo $left | awk '{print $4'})
umount $MBD_BOOTTREE
if [ -n "$EXTRAKERNELPATH" ]; then
mkdir -p `dirname $EXTRAKERNELPATH`
cp -f $KERNELROOT/$KERNELDIR/${KERNELNAME}-* $EXTRAKERNELPATH
fi
mkdir -p `dirname $MBD_FILENAME`
rm -rf $MBD_TMPIMAGE $MBD_MNTPOINT $MBD_BOOTTREE
if [ -z "$INITRDFILE" ]; then
rm -f $MBD_FSIMAGE
fi
echo "Wrote $MBD_FILENAME (${left}k free)"
}
prepareBootImage() {
prepareBootTree
# dynamically calculate the size of the dosfs
BOOTDISKSIZE=$(du -kcs $MBD_BOOTTREE_TMP | tail -n1 | awk '{print $1}')
BOOTDISKSIZE=$(expr $BOOTDISKSIZE + 100)
echo "The size of the boot.img dosfs is $BOOTDISKSIZE"
mkdosfs -n ANACONDA -C $MBD_FILENAME $BOOTDISKSIZE >/dev/null
mount -o loop -t vfat $MBD_FILENAME $MBD_BOOTTREE
cp -R $MBD_BOOTTREE_TMP/* $MBD_BOOTTREE
}
prepareBootTree() {
mkdir -p $MBD_BOOTTREE_TMP/EFI/boot
cp $MBD_FSIMAGE $MBD_BOOTTREE_TMP/EFI/boot/initrd.img
cp -a $BOOTDISKDIR/* $MBD_BOOTTREE_TMP/EFI/boot/
cp $KERNELROOT/boot/efi/EFI/redhat/vmlinuz-* $MBD_BOOTTREE_TMP/EFI/boot/vmlinuz
cp $MBD_BOOTTREE_TMP/EFI/boot/elilo.efi $MBD_BOOTTREE_TMP/EFI/boot/bootia64.efi
cat > $MBD_BOOTTREE_TMP/EFI/boot/elilo.conf << EOF
prompt
timeout=50
relocatable
image=vmlinuz
label=linux
read-only
initrd=initrd.img
EOF
# make a copy in the root of the image
cp $MBD_BOOTTREE_TMP/EFI/boot/* $MBD_BOOTTREE_TMP
}
makeBootImages() {
# Because ia64 boxes use EFI there needs to be a boot.img dosfs.
echo "making boot.img for EFI bootloader"
makebootdisk --kernelto $TOPDESTPATH/kernels/vmlinuz \
--imagename boot.img \
--initrdflags '--initrdto $TOPDESTPATH/images/ramdisk.img \
--initrdsize 12288 \
--loaderbin loader \
--modules "$INITRDMODS sgiioc4" '
mkdir -p $TOPDESTPATH/images/pxeboot
makeinitrd --initrdto $TOPDESTPATH/images/pxeboot/initrd.img \
--initrdsize 12288 \
--loaderbin loader \
--modules "$INITRDMODS sgiioc4"
[ $? = 0 ] || exit 1
mv $TOPDESTPATH/kernels/vmlinuz $TOPDESTPATH/images/pxeboot/vmlinuz
rmdir $TOPDESTPATH/kernels
# make a pxe dir with kernel + initrd
cat > $TOPDESTPATH/images/pxeboot/README <<EOF
The files in this directory are useful for booting a machine via PXE.
The following files are available:
vmlinuz - the kernel used for the installer
initrd.img - an initrd with support for all install methods and
drivers supported for installation of $PRODUCT
EOF
cat << __EOT__ >> $TOPDESTPATH/.treeinfo
[images-$KERNELARCH]
kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img
boot.img = images/boot.img
[images-xen]
kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img
__EOT__
}
doPostImages() {
if [ -n "$BOOTISO" ]; then
mkisofs -quiet -o $TOPDESTPATH/images/$BOOTISO -b boot.img -no-emul-boot -R -J -V "$PRODUCT" -T -graft-points boot.img=$TOPDESTPATH/images/boot.img images/install.img=$TOPDESTPATH/images/install.img
implantisomd5 $TOPDESTPATH/images/$BOOTISO
fi
}

View File

@ -1,171 +0,0 @@
#
# mk-images.ppc
#
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
makeBootImages() {
echo "Building boot images for kernel $kernelvers"
FAKEARCH=""
if [ "$KERNELARCH" = "ppc64" ]; then
mkdir -p $TOPDESTPATH/ppc/ppc64
echo "Building $KERNELARCH initrd"
makeinitrd --initrdto $TOPDESTPATH/ppc/ppc64/ramdisk.image.gz \
--initrdsize 8192 \
--loaderbin loader \
--modules "$INITRDMODS spufs viocd gpio_mdio"
cp $KERNELROOT/boot/vmlinuz-* $TOPDESTPATH/ppc/ppc64/vmlinuz
sed -e "s/%BITS%/64/" -e "s/%PRODUCT%/$PRODUCT/" -e "s/%VERSION%/$VERSION/" \
$BOOTDISKDIR/yaboot.conf.in > $TOPDESTPATH/ppc/ppc64/yaboot.conf
cat << __EOT__ >> $TOPDESTPATH/.treeinfo
[images-$KERNELARCH]
kernel = ppc/ppc64/vmlinuz
initrd = ppc/ppc64/ramdisk.image.gz
__EOT__
if [ -x $IMGPATH/usr/bin/mkzimage -a -r $IMGPATH/usr/share/ppc64-utils/zImage.stub ]; then
mkdir -p $TOPDESTPATH/images/netboot
pushd $TOPDESTPATH/ppc/ppc64
cp $IMGPATH/usr/share/ppc64-utils/zImage.lds $TOPDESTPATH/ppc/ppc64/zImage.lds
$IMGPATH/usr/bin/mkzimage $TOPDESTPATH/ppc/ppc64/vmlinuz no no $TOPDESTPATH/ppc/ppc64/ramdisk.image.gz $IMGPATH/usr/share/ppc64-utils/zImage.stub $TOPDESTPATH/images/netboot/ppc64.img
rmdir $TOPDESTPATH/images/netboot || :
rm -f $TOPDESTPATH/ppc/ppc64/zImage.lds
popd
echo "zimage = images/netboot/ppc64.img" >> $TOPDESTPATH/.treeinfo
elif [ -x $IMGPATH/usr/sbin/wrapper -a -r $IMGPATH/usr/lib/kernel-wrapper/wrapper.a ]; then
mkdir -p $TOPDESTPATH/images/netboot
$IMGPATH/usr/sbin/wrapper -o $TOPDESTPATH/images/netboot/ppc64.img \
-i $TOPDESTPATH/ppc/ppc64/ramdisk.image.gz \
-D $IMGPATH/usr/lib/kernel-wrapper \
$TOPDESTPATH/ppc/ppc64/vmlinuz
rmdir $TOPDESTPATH/images/netboot || :
echo "zimage = images/netboot/ppc64.img" >> $TOPDESTPATH/.treeinfo
fi
echo >> $TOPDESTPATH/.treeinfo
elif [ "$KERNELARCH" = "ppc" ]; then
FAKEARCH="ppc"
mkdir -p $TOPDESTPATH/ppc/ppc32
mkdir -p $TOPDESTPATH/ppc/mac
echo "Building ppc initrd"
makeinitrd --initrdto $TOPDESTPATH/ppc/ppc32/ramdisk.image.gz \
--initrdsize 8192 \
--loaderbin loader \
--modules "$INITRDMODS"
cp $KERNELROOT/boot/vmlinuz-* $TOPDESTPATH/ppc/ppc32/vmlinuz
sed -e "s/%BITS%/32/" -e "s/%PRODUCT%/$PRODUCT/" -e "s/%VERSION%/$VERSION/" \
$BOOTDISKDIR/yaboot.conf.in > $TOPDESTPATH/ppc/ppc32/yaboot.conf
cat << __EOT__ >> $TOPDESTPATH/.treeinfo
[images-$KERNELARCH]
kernel = ppc/ppc32/vmlinuz
initrd = ppc/ppc32/ramdisk.image.gz
__EOT__
if [ -x $IMGPATH/usr/bin/mkzimage -a -r $IMGPATH/usr/share/ppc64-utils/zImage.stub ]; then
mkdir -p $TOPDESTPATH/images/netboot
pushd $TOPDESTPATH/ppc/ppc32
cp $IMGPATH/usr/share/ppc64-utils/zImage.lds $TOPDESTPATH/ppc/ppc32/zImage.lds
$IMGPATH/usr/bin/mkzimage $TOPDESTPATH/ppc/ppc32/vmlinuz no no $TOPDESTPATH/ppc/ppc32/ramdisk.image.gz $IMGPATH/usr/share/ppc64-utils/zImage.stub $TOPDESTPATH/images/netboot/ppc32.img
rmdir $TOPDESTPATH/images/netboot || :
rm -f $TOPDESTPATH/ppc/ppc32/zImage.lds
popd
echo "zimage = images/netboot/ppc32.img" >> $TOPDESTPATH/.treeinfo
elif [ -x $IMGPATH/usr/sbin/wrapper -a -r $IMGPATH/usr/lib/kernel-wrapper/wrapper.a ]; then
$IMGPATH/usr/sbin/wrapper -o $TOPDESTPATH/images/netboot/ppc32.img \
-i $TOPDESTPATH/ppc/ppc32/ramdisk.image.gz \
-D $IMGPATH/usr/lib/kernel-wrapper \
$TOPDESTPATH/ppc/ppc32/vmlinuz
rmdir $TOPDESTPATH/images/netboot || :
popd
echo "zimage = images/netboot/ppc32.img" >> $TOPDESTPATH/.treeinfo
fi
echo >> $TOPDESTPATH/.treeinfo
else
echo "Unknown kernel arch: $KERNELARCH"
fi
}
doPostImages() {
mkdir -p $TOPDESTPATH/etc
mkdir -p $TOPDESTPATH/ppc/chrp
# Create ofboot.b and bootinfo.txt files, and yaboot binaries for Mac and CHRP
cp $BOOTDISKDIR/bootinfo.txt $TOPDESTPATH/ppc/bootinfo.txt
cp $IMGPATH/usr/lib/anaconda-runtime/boot/efika.forth $TOPDESTPATH/ppc/efika.forth
if [ -d $TOPDESTPATH/ppc/mac ]; then
cp $BOOTDISKDIR/ofboot.b $TOPDESTPATH/ppc/mac/ofboot.b
cp $IMGPATH/usr/lib/yaboot/yaboot $TOPDESTPATH/ppc/mac/yaboot
fi
if [ -d $TOPDESTPATH/ppc/chrp ]; then
cp $IMGPATH/usr/lib/yaboot/yaboot $TOPDESTPATH/ppc/chrp/yaboot
$IMGPATH/usr/lib/yaboot/addnote $TOPDESTPATH/ppc/chrp/yaboot
fi
# IBM firmware can't handle boot scripts properly, so for biarch installs
# we use a yaboot.conf which asks the user to select 32-bit or 64-bit kernel.
if [ -r $TOPDESTPATH/ppc/ppc32/yaboot.conf -a -r $TOPDESTPATH/ppc/ppc64/yaboot.conf ]; then
# Both kernels exist. Copy the biarch yaboot.conf into place.
sed -e "s/%BITS%/32/" -e "s/%PRODUCT%/$PRODUCT/" -e "s/%VERSION%/$VERSION/" \
$BOOTDISKDIR/yaboot.conf.3264 > $TOPDESTPATH/etc/yaboot.conf
else
# Copy the one that exists, assuming one does exist
cp $TOPDESTPATH/ppc/ppc??/yaboot.conf $TOPDESTPATH/etc
fi
if [ -z "$BOOTISO" ]; then
return
fi
# Copy it all into the isopath for the boot CD
mkdir -p $TOPDESTPATH/isopath
cp -r $TOPDESTPATH/{ppc,etc} $TOPDESTPATH/isopath
# We want the ppc32 prep image in the boot.iso too.
if [ -d $TOPDESTPATH/images/netboot ]; then
mkdir -p $TOPDESTPATH/isopath/images
cp -r $TOPDESTPATH/images/netboot $TOPDESTPATH/isopath/images
rm -f $TOPDESTPATH/isopath/images/ppc64.img
fi
if [ -r $TOPDESTPATH/isopath/images/netboot/ppc32.img ]; then
PREPBOOT="-prep-boot images/netboot/ppc32.img"
fi
if [ -d $TOPDESTPATH/isopath/ppc/mac ]; then
MACBOOT="-hfs-volid $VERSION -hfs-bless $TOPDESTPATH/isopath/ppc/mac"
fi
# Create the boot.iso
mkisofs -o $TOPDESTPATH/images/$BOOTISO -chrp-boot -U $PREPBOOT \
-part -hfs -T -r -l -J -A "$PRODUCT $VERSION" -sysid PPC \
-V "PBOOT" -volset "$VERSION" -volset-size 1 -volset-seqno 1 \
$MACBOOT \
-map $BOOTDISKDIR/mapping -magic $BOOTDISKDIR/magic \
-no-desktop -allow-multidot -graft-points $TOPDESTPATH/isopath \
images/install.img=$TOPDESTPATH/images/install.img
implantisomd5 $TOPDESTPATH/images/$BOOTISO
rm -rf $TOPDESTPATH/isopath
}

View File

@ -1,54 +0,0 @@
#
# mk-images.s390
#
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
S390SCSIMODS="zfcp tape390"
S390DASDMODS=" dasd_diag_mod dasd_eckd_mod dasd_fba_mod dasd_mod"
S390NETMODS="ctc netiucv smsgiucv lcs qdio qeth ccwgroup crypto_api xfrm_nalgo"
S390MODS="$S390SCSIMODS $S390DASDMODS $S390NETMODS"
makeBootImages() {
makeinitrd --initrdto $TOPDESTPATH/images/initrd.img \
--initrdsize 20000 \
--loaderbin loader \
--modules "$INITRDMODS $S390MODS"
sz=$(ls -l $TOPDESTPATH/images/initrd.img | awk '{print $5}')
$GENINITRDSZ $sz $TOPDESTPATH/images/initrd.size
cp -vf $KERNELROOT/boot/${KERNELNAME}-${version} $TOPDESTPATH/images/kernel.img
cp -v $BOOTDISKDIR/redhat.exec $TOPDESTPATH/images/redhat.exec
cp -v $BOOTDISKDIR/generic.prm $TOPDESTPATH/images/generic.prm
cp -v $BOOTDISKDIR/generic.ins $TOPDESTPATH/generic.ins
$MKS390CDBOOT \
-i $TOPDESTPATH/images/kernel.img \
-r $TOPDESTPATH/images/initrd.img \
-p $TOPDESTPATH/images/generic.prm \
-o $TOPDESTPATH/images/cdboot.img
cat << __EOT__ >> $TOPDESTPATH/.treeinfo
[images-$KERNELARCH]
kernel = images/kernel.img
initrd = images/initrd.img
initrd.size = images/initrd.size
generic.prm = images/generic.prm
generic.ins = generic.ins
cdboot.img = images/cdboot.img
__EOT__
}

View File

@ -240,8 +240,10 @@ class Lorax(object):
kernel_path, initrd_path = initrd.create()
# copy the kernel and initrd images to the pxeboot directory
shutil.copy2(kernel_path, self.conf.pxebootdir)
shutil.copy2(initrd_path, self.conf.pxebootdir)
if kernel_path is not None:
shutil.copy2(kernel_path, self.conf.pxebootdir)
if kernel_path is not None:
shutil.copy2(initrd_path, self.conf.pxebootdir)
# if this is a PAE kernel, skip the EFI part
if kernel_path.endswith("PAE"):
@ -279,8 +281,12 @@ class Lorax(object):
shutil.copy2(installimg, self.conf.imagesdir)
# create the boot iso
self.output.info(":: creating the boot iso")
bootiso = self.create_boot_iso()
if self.conf.arch in ("i386", "i586", "i686", "x86_64"):
self.output.info(":: creating the boot iso")
bootiso = self.create_boot_iso_x86()
elif self.conf.arch in ("ppc", "ppc64"):
self.output.info(":: creating the boot iso")
bootiso = self.create_boot_iso_ppc()
if bootiso is None:
self.output.critical("unable to create boot iso")
@ -473,9 +479,6 @@ class Lorax(object):
dst = os.path.join(isolinuxdir, "grub.conf")
shutil.copy2(self.paths.GRUBCONF, dst)
utils.replace(dst, "@PRODUCT@", self.conf.product)
utils.replace(dst, "@VERSION@", self.conf.version)
# copy the splash files
if os.path.isfile(self.paths.VESASPLASH):
shutil.copy2(self.paths.VESASPLASH,
@ -522,7 +525,7 @@ class Lorax(object):
return True
def create_boot_iso(self):
def create_boot_iso_x86(self):
bootiso = os.path.join(self.conf.tempdir, "boot.iso")
if os.path.exists(bootiso):
@ -567,6 +570,99 @@ class Lorax(object):
return bootiso
def create_boot_iso_ppc(self):
bootiso = os.path.join(self.conf.tempdir, "boot.iso")
if os.path.exists(bootiso):
os.unlink(bootiso)
etcdir = os.path.join(self.conf.outputdir, "etc")
ppcdir = os.path.join(self.conf.outputdir, "ppc")
macdir = os.path.join(ppcdir, "mac")
chrpdir = os.path.join(ppcdir, "chrp")
utils.makedirs(etcdir)
utils.makedirs(chrpdir)
shutil.copy2(self.paths.BOOTINFO, ppcdir)
shutil.copy2(self.paths.EFIKA_FORTH, ppcdir)
if os.path.isdir(macdir):
shutil.copy2(self.paths.OFBOOT, macdir)
shutil.copy2(self.paths.YABOOT, macdir)
if os.path.isdir(chrpdir):
shutil.copy2(self.paths.YABOOT, chrpdir)
cmd = "%s %s" % (self.paths.ADD_NOTE,
os.path.join(chrpdir, "yaboot"))
# IBM firmware can't handle boot scripts properly,
# so for biarch installs we use a yaboot.conf,
# which asks the user to select 32-bit or 64-bit kernel
yaboot32 = os.path.join(ppcdir, "ppc32", "yaboot.conf")
yaboot64 = os.path.join(ppcdir, "ppc64", "yaboot.conf")
if os.path.isfile(yaboot32) and os.path.isfile(yaboot64):
# both kernels exist, copy the biarch yaboot.conf into place
yaboot = os.path.join(etcdir, "yaboot.conf")
shutil.copy2(self.paths.BIARCH_YABOOT, yaboot)
utils.replace(yaboot, "%BITS%", "32")
utils.replace(yaboot, "%PRODUCT%", self.conf.product)
utils.replace(yaboot, "%VERSION%", self.conf.version)
else:
if os.path.isfile(yaboot32):
shutil.copy2(yaboot32, etcdir)
if os.path.isfile(yaboot64):
shutil.copy2(yaboot64, etcdir)
isopath = os.path.join(self.conf.outputdir, "isopath")
utils.mkdir(isopath)
utils.scopy(ppcdir, isopath)
utils.scopy(etcdir, isopath)
netbootdir = os.path.join(self.conf.outputdir, "images", "netboot")
if os.path.isdir(netbootdir):
imagesdir = os.path.join(isopath, "images")
utils.mkdir(imagesdir)
utils.scopy(netbootdir, imagesdir)
utils.remove(os.path.join(imagesdir, "ppc64.img"))
ppc32img = os.path.join(netbootdir, "ppc32.img")
if os.path.isfile(pcp32img):
prepboot = "-prep-boot images/netboot/ppc32.img"
isomacdir = os.path.join(isopath, "ppc", "mac")
if os.path.isdir(isomacdir):
macboot = "-hfs-volid %s -hfs-bless %s" % (self.conf.version,
isomacdir)
installimg = os.path.join(self.conf.imagesdir, "install.img")
cmd = '%s -o %s -chrp-boot -U %s -part -hfs -T -r -l -J -A "%s %s"' \
' -sysid PPC -V "PBOOT" -volset %s -volset-size 1' \
' -volset-seqno 1 %s -map %s/mapping -magic %s/magic' \
' -no-desktop' \
' -allow-multidot -graft-points %s images/install.img=%s' % \
(self.paths.MKISOFS, bootiso, prepboot, self.conf.product,
self.conf.version, self.conf.version, macboot,
self.paths.ANACONDA_BOOT, self.paths.ANACONDA_BOOT,
isopath, installimg)
err, output = commands.getstatusoutput(cmd)
if err:
self.output.warning(output)
return None
cmd = "%s %s" % (self.paths.IMPLANTISO, bootiso)
err, output = commands.getstatusoutput(cmd)
if err:
self.output.warning(output)
return None
utils.remove(isopath)
return bootiso
def cleanup(self):
if self.conf.cleanup:
shutil.rmtree(self.conf.tempdir)

View File

@ -207,3 +207,57 @@ class LoraxPaths(singleton.Singleton):
def FEDORAKMODCONF(self):
return os.path.join(self.installtree, "etc", "yum", "pluginconf.d",
"fedorakmod.conf")
@property
def MKZIMAGE(self):
return os.path.join(self.installtree, "usr", "bin", "mkzimage")
@property
def ZIMAGE_STUB(self):
return os.path.join(self.installtree, "usr", "share", "ppc64-utils",
"zImage.stub")
@property
def ZIMAGE_LDS(self):
return os.path.join(self.installtree, "usr", "share", "ppc64-utils",
"zImage.lds")
@property
def WRAPPER(self):
return os.path.join(self.installtree, "usr", "sbin", "wrapper")
@property
def WRAPPER_A_DIR(self):
return os.path.join(self.installtree, "usr", "lib", "kernel-wrapper")
@property
def WRAPPER_A(self):
return os.path.join(self.WRAPPER_A_DIR, "wrapper.a")
@property
def BOOTINFO(self):
return os.path.join(self.ANACONDA_BOOT, "bootinfo.txt")
@property
def EFIKA_FORTH(self):
return os.path.join(self.ANACONDA_BOOT, "efika.forth")
@property
def OFBOOT(self):
return os.path.join(self.ANACONDA_BOOT, "ofboot.b")
@property
def YABOOT(self):
return os.path.join(self.installtree, "usr", "lib", "yaboot", "yaboot")
@property
def ADD_NOTE(self):
return os.path.join(self.installtree, "usr", "lib", "yaboot", "addnote")
@property
def BIARCH_YABOOT(self):
return os.path.join(self.ANACONDA_BOOT, "yaboot.conf.3264")
@property
def IMPLANTISO(self):
return "/usr/bin/implantisomd5"

View File

@ -139,10 +139,11 @@ class EFI(object):
self.output.warning(output)
pass
# copy the conf files to the output directory
# copy the conf files and splash.xpm.gz to the output directory
if not kernel and not initrd:
utils.scopy(src_root=efitreedir, src_path="*.conf",
dst_root=self.conf.efibootdir, dst_path="")
shutil.copy2(self.paths.SPLASHXPM, self.conf.efibootdir)
return efiboot

View File

@ -161,109 +161,110 @@ class InstallImage(object):
# XXX this saves 2 MB
def remove_gtk_stuff(self):
# figure out the gtk+ theme to keep
gtkrc = os.path.join(self.conf.installtree, "etc", "gtk-2.0", "gtkrc")
gtk_theme_name = None
gtk_engine = None
gtk_icon_themes = []
if os.path.isfile(gtkrc):
f = open(gtkrc, "r")
lines = f.readlines()
f.close()
for line in lines:
line = line.strip()
if line.startswith("gtk-theme-name"):
gtk_theme_name = line[line.find("=") + 1:]
gtk_theme_name = gtk_theme_name.replace('"', "").strip()
# find the engine for this theme
gtkrc = os.path.join(self.conf.installtree, "usr", "share",
"themes", gtk_theme_name, "gtk-2.0", "gtkrc")
if os.path.isfile(gtkrc):
f = open(gtkrc, "r")
engine_lines = f.readlines()
f.close()
for engine_l in engine_lines:
engine_l = engine_l.strip()
if engine_l.find("engine") != -1:
gtk_engine = engine_l[engine_l.find('"') + 1:]
gtk_engine = gtk_engine.replace('"', "").strip()
break
elif line.startswith("gtk-icon-theme-name"):
icon_theme = line[line.find("=") + 1:]
icon_theme = icon_theme.replace('"', "").strip()
gtk_icon_themes.append(icon_theme)
# bring in all inherited themes
while True:
icon_theme_index = os.path.join(self.conf.installtree,
"usr", "share", "icons", icon_theme,
"index.theme")
if os.path.isfile(icon_theme_index):
inherits = False
f = open(icon_theme_index, "r")
icon_lines = f.readlines()
f.close()
for icon_l in icon_lines:
icon_l = icon_l.strip()
if icon_l.startswith("Inherits="):
inherits = True
icon_theme = icon_l[icon_l.find("=") + 1:]
icon_theme = \
icon_theme.replace('"', "").strip()
gtk_icon_themes.append(icon_theme)
break
if not inherits:
break
else:
break
# remove themes we don't need
theme_path = os.path.join(self.conf.installtree, "usr", "share",
"themes")
if os.path.isdir(theme_path):
for theme in filter(lambda theme: theme != gtk_theme_name,
os.listdir(theme_path)):
theme = os.path.join(theme_path, theme)
shutil.rmtree(theme, ignore_errors=True)
# remove icons we don't need
icon_path = os.path.join(self.conf.installtree, "usr", "share",
"icons")
if os.path.isdir(icon_path):
for icon in filter(lambda icon: icon not in gtk_icon_themes,
os.listdir(icon_path)):
icon = os.path.join(icon_path, icon)
shutil.rmtree(icon, ignore_errors=True)
# remove engines we don't need
tmp_path = os.path.join(self.conf.installtree, "usr",
self.conf.libdir, "gtk-2.0")
if os.path.isdir(tmp_path):
fnames = map(lambda fname: os.path.join(tmp_path, fname,
"engines"), os.listdir(tmp_path))
dnames = filter(lambda fname: os.path.isdir(fname), fnames)
for dir in dnames:
engines = filter(lambda e: e.find(gtk_engine) == -1,
os.listdir(dir))
for engine in engines:
engine = os.path.join(dir, engine)
os.unlink(engine)
pass
# # figure out the gtk+ theme to keep
# gtkrc = os.path.join(self.conf.installtree, "etc", "gtk-2.0", "gtkrc")
#
# gtk_theme_name = None
# gtk_engine = None
# gtk_icon_themes = []
#
# if os.path.isfile(gtkrc):
# f = open(gtkrc, "r")
# lines = f.readlines()
# f.close()
#
# for line in lines:
# line = line.strip()
# if line.startswith("gtk-theme-name"):
# gtk_theme_name = line[line.find("=") + 1:]
# gtk_theme_name = gtk_theme_name.replace('"', "").strip()
#
# # find the engine for this theme
# gtkrc = os.path.join(self.conf.installtree, "usr", "share",
# "themes", gtk_theme_name, "gtk-2.0", "gtkrc")
# if os.path.isfile(gtkrc):
# f = open(gtkrc, "r")
# engine_lines = f.readlines()
# f.close()
#
# for engine_l in engine_lines:
# engine_l = engine_l.strip()
# if engine_l.find("engine") != -1:
# gtk_engine = engine_l[engine_l.find('"') + 1:]
# gtk_engine = gtk_engine.replace('"', "").strip()
# break
#
# elif line.startswith("gtk-icon-theme-name"):
# icon_theme = line[line.find("=") + 1:]
# icon_theme = icon_theme.replace('"', "").strip()
# gtk_icon_themes.append(icon_theme)
#
# # bring in all inherited themes
# while True:
# icon_theme_index = os.path.join(self.conf.installtree,
# "usr", "share", "icons", icon_theme,
# "index.theme")
#
# if os.path.isfile(icon_theme_index):
# inherits = False
# f = open(icon_theme_index, "r")
# icon_lines = f.readlines()
# f.close()
#
# for icon_l in icon_lines:
# icon_l = icon_l.strip()
# if icon_l.startswith("Inherits="):
# inherits = True
# icon_theme = icon_l[icon_l.find("=") + 1:]
# icon_theme = \
# icon_theme.replace('"', "").strip()
#
# gtk_icon_themes.append(icon_theme)
# break
#
# if not inherits:
# break
# else:
# break
#
# # remove themes we don't need
# theme_path = os.path.join(self.conf.installtree, "usr", "share",
# "themes")
#
# if os.path.isdir(theme_path):
# for theme in filter(lambda theme: theme != gtk_theme_name,
# os.listdir(theme_path)):
#
# theme = os.path.join(theme_path, theme)
# shutil.rmtree(theme, ignore_errors=True)
#
# # remove icons we don't need
# icon_path = os.path.join(self.conf.installtree, "usr", "share",
# "icons")
#
# if os.path.isdir(icon_path):
# for icon in filter(lambda icon: icon not in gtk_icon_themes,
# os.listdir(icon_path)):
#
# icon = os.path.join(icon_path, icon)
# shutil.rmtree(icon, ignore_errors=True)
#
# # remove engines we don't need
# tmp_path = os.path.join(self.conf.installtree, "usr",
# self.conf.libdir, "gtk-2.0")
#
# if os.path.isdir(tmp_path):
# fnames = map(lambda fname: os.path.join(tmp_path, fname,
# "engines"), os.listdir(tmp_path))
#
# dnames = filter(lambda fname: os.path.isdir(fname), fnames)
# for dir in dnames:
# engines = filter(lambda e: e.find(gtk_engine) == -1,
# os.listdir(dir))
# for engine in engines:
# engine = os.path.join(dir, engine)
# os.unlink(engine)
# XXX this saves 5 MB
def remove_locales(self):

View File

@ -394,7 +394,7 @@ initrd = images/pxeboot/initrd-PAE.img
def create_x86_64(self):
return self.create_i386()
def run_s390(self):
def create_s390(self):
initrd_filename = os.path.join(self.conf.tempdir, "initrd.img")
self.compress(initrd_filename)
@ -414,7 +414,7 @@ initrd = images/pxeboot/initrd-PAE.img
shutil.copy2(filename, self.conf.outputdir)
cmd = "%s -i %s -r %s -p %s -o %s" % (
MKS390CD, kernel_filename, initrd_filename,
self.paths.MKS390CD, kernel_filename, initrd_filename,
self.paths.GENERIC_PRM,
os.path.join(self.conf.imagesdir, "cdboot.img"))
@ -436,18 +436,85 @@ cdboot.img = images/cdboot.img
return kernel_filename, initrd_filename
def run_s390x(self):
return self.run_s390()
def create_s390x(self):
return self.create_s390()
# XXX this should be removed
def run_alpha(self):
def create_alpha(self):
raise NotImplementedError
def run_ia64(self):
def create_ia64(self):
raise NotImplementedError
def run_ppc(self):
raise NotImplementedError
def create_ppc(self):
if self.conf.arch == "ppc":
bits = "32"
elif self.conf.arch == "ppc64":
bits = "64"
def run_ppc64(self):
raise NotImplementedError
ppc_dir = os.path.join(self.conf.outputdir, "ppc", "ppc%s" % bits)
utils.makedirs(ppc_dir)
if self.conf.arch == "ppc":
mac_dir = os.path.join(self.conf.outputdir, "ppc", "mac")
utils.makedirs(mac_dir)
initrd_filename = os.path.join(ppc_dir, "ramdisk.image.gz")
self.compress(initrd_filename)
kernel_filename = os.path.join(ppc_dir, "vmlinuz")
shutil.copy2(self.conf.kernelfile, kernel_filename)
yaboot_src = os.path.join(self.paths.ANACONDA_BOOT, "yaboot.conf.in")
yaboot_dst = os.path.join(ppc_dir, "yaboot.conf")
shutil.copy2(yaboot_src, yaboot_dst)
utils.replace(yaboot_dst, "%BITS%", bits)
utils.replace(yaboot_dst, "%PRODUCT%", self.conf.product)
utils.replace(yaboot_dst, "%VERSION%", self.conf.version)
text = """[images-%s]
kernel = ppc/ppc%s/vmlinuz
initrd = ppc/ppc%s/ramdisk.image.gz
""" % (self.conf.arch, bits, bits)
utils.edit(self.conf.treeinfo, append=True, text=text)
netboot_dir = os.path.join(self.conf.imagesdir, "netboot")
utils.makedirs(netboot_dir)
ppc_img = os.path.join(netboot_dir, "ppc%s.img" % bits)
if os.path.exists(self.paths.MKZIMAGE) and \
os.path.exists(self.paths.ZIMAGE_STUB):
shutil.copy2(self.paths.ZIMAGE_LDS, ppc_dir)
cmd = "%s %s no no %s %s %s" % \
(self.paths.MKZIMAGE, kernel_filename, initrd_filename,
self.paths.ZIMAGE_STUB, ppc_img)
err, output = commands.getstatusoutput(cmd)
if err:
self.output.warning(output)
utils.remove(os.path.join(ppc_dir, "zImage.lds"))
elif os.path.exists(self.paths.WRAPPER) and \
os.path.exists(self.paths.WRAPPER_A):
cmd = "%s -o %s -i %s -D %s %s" % \
(self.paths.WRAPPER, ppc_img, initrd_filename,
self.paths.WRAPPER_A_DIR, kernel_filename)
err, output = commands.getstatusoutput(cmd)
if err:
self.output.warning(output)
if os.path.exists(ppc_img):
text = "zimage = images/netboot/ppc%s.img" % bits
utils.edit(self.conf.treeinfo, append=True, text=text)
else:
utils.remove(netboot_dir)
return None, None
def create_ppc64(self):
return create_ppc()