lorax/rewrite/scratch/mk-images.alpha

132 lines
4.8 KiB
Plaintext
Raw Normal View History

#
# 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"
#}