]> git.pld-linux.org Git - packages/anaconda.git/blob - anaconda-mk-images.i386
- live with old llh
[packages/anaconda.git] / anaconda-mk-images.i386
1 SYSLINUX=$IMGPATH/usr/bin/syslinux-nomtools
2
3 if [ ! -f $SYSLINUX ]; then
4   echo "Warning: nomtools syslinux doesn't exist"
5   SYSLINUX=$IMGPATH/usr/bin/syslinux
6   if [ ! -f $SYSLINUX ]; then
7     echo "$SYSLINUX doesn't exist"
8     exit 1
9   fi
10 fi
11
12 prepareBootImage() {
13         dd if=/dev/zero bs=1k count=$BOOTDISKSIZE of=/$MBD_TMPIMAGE 2>/dev/null
14         mkdosfs -r 32 -C $MBD_TMPIMAGE $BOOTDISKSIZE >/dev/null
15         $SYSLINUX $MBD_TMPIMAGE
16         mount -o loop -t msdos $MBD_TMPIMAGE $MBD_BOOTTREE
17
18         prepareBootTree
19 }
20
21 # prepare a directory with the kernel, initrd, and various message files
22 # used to populate a boot image
23 prepareBootTree() {
24         (cd $BOOTDISKDIR; find . ! -name "*.msg" -maxdepth 1 ! -type d | cpio --quiet -p $MBD_BOOTTREE)
25         
26         cp $MBD_FSIMAGE $MBD_BOOTTREE/initrd.img
27         cp $KERNELROOT/boot/vmlinuz-* $MBD_BOOTTREE/vmlinuz
28
29         pngtopnm $BOOTDISKDIR/syslinux-splash.png | ppmtolss16 \#000000=0 \#cdcfd5=7 \#c90000=2 \#ffffff=15 \#5b6c93=9 > $BOOTDISKDIR/splash.lss
30         if [ $? != 0 ]; then
31            echo $0: Failed to create splash.lss
32            exit 1
33         fi      
34         cp $BOOTDISKDIR/splash.lss $MBD_BOOTTREE/splash.lss
35         rm -f $MBD_BOOTTREE/syslinux-splash.png
36         rm -f $MBD_BOOTTREE/memtest*
37         for file in $BOOTDISKDIR/*.msg; do
38             filename=`basename $file`
39             sed -e "s/@VERSION@/$VERSION/g" $file > $MBD_BOOTTREE/$filename
40         done
41         if [ $? != 0 ]; then
42            echo $0: Failed to copy messages from $BOOTDISKDIR to $MBD_BOOTTREE.
43            umount $MBD_BOOTTREE
44            rm -rf $MBD_BOOTTREE $MBD_TMPIMAGE
45            exit 1
46         fi
47 }
48
49 mkdir -p $TOPDESTPATH/images
50 cat > $TOPDESTPATH/images/README <<EOF
51 This directory contains image files that can be used to create media
52 capable of starting the $PRODUCT installation process.
53
54 The boot.iso file is an ISO 9660 image of a bootable CD-ROM.  It is useful
55 in cases where the CD-ROM installation method is not desired, but the
56 CD-ROM's boot speed would be an advantage.
57
58 To use this image file, burn the file onto CD-R (or CD-RW) media as you
59 normally would.
60
61 The diskboot.img file is a VFAT filesystem image that can be written to a
62 USB pendrive or other bootable media larger than a floppy.  Note that
63 booting via USB is dependent on your BIOS supporting this.  It should
64 be written to the device using dd.
65 EOF
66
67 # LATEUSBMODS go in the second stage.  
68 # FIXME: bleah, have to include sd_mod, sr_mod for usb-storage
69 USBMODS="usbcore ohci-hcd uhci-hcd hid usb-storage sd_mod sr_mod"
70 # usb-storage goes on both so we can reload it.  *sigh*
71 LATEUSBMODS="usb-storage"
72 IDEMODS="cdrom ide-cd"
73 SCSIMODS="cdrom scsi_mod sd_mod sg sr_mod st"
74
75 FSMODS="fat msdos vfat ext3 reiserfs jfs xfs"
76 LVMMODS="dm-mod dm-zero dm-snapshot dm-mirror"
77 RAIDMODS="md raid0 raid1 raid5 raid6"
78 SECSTAGE="agpgart $RAIDMODS $LVMMODS $FSMODS $IDEMODS $SCSIMODS $LATEUSBMODS st parport_pc parport"
79
80 BTERMMODULES="vga16fb vgastate"
81 COMMONMODULES="fat vfat nfs sunrpc lockd floppy cramfs loop edd $USBMODS $BTERMMODULES"
82 LOCALMODULES="$COMMONMODULES aic7xxx megaraid_mbox sym53c8xx $IDEMODS $SCSIMODS"
83 NETWORKMODULES="$COMMONMODULES 3c59x 
84                e100 tulip 8139too"
85 #              sis900 e100 hp100 natsemi pcnet32"
86
87 PCMCIAMAINMODULES="$COMMONMODULES nfs $IDEMODS $SCSIMODS"
88
89 # images we only want on the CD (usually for space reasons)
90 ISOLINUXMODULES="usbcore ehci-hcd ieee1394 ohci1394 sbp2"
91
92 # XXX hack hack
93 PCMCIAMODULES_EXCLUDED="
94         apa1480_cb
95         iflash2+_mtd
96         iflash2_mtd
97         memory_cb
98         memory_cs
99         parport_cs
100         parport_pc
101         parport
102         serial_cs
103         serial_cb
104         sram_mtd
105 "
106 PCMCIAMODULES_EXCLUDED_SED="sed"
107 for m in $PCMCIAMODULES_EXCLUDED
108 do
109    PCMCIAMODULES_EXCLUDED_SED="$PCMCIAMODULES_EXCLUDED_SED -e 's/$m//g'"
110 done
111 BOOTPCMCIAMODULES=`echo $PCMCIAMODULES | eval "$PCMCIAMODULES_EXCLUDED_SED"`
112
113 # need to make sure the base modules are included
114 BOOTPCMCIAMODULES="$BOOTPCMCIAMODULES yenta_socket i82365 tcic pcmcia_core pcmcia"
115
116 makeBootImages() {
117  if [ "$KERNELARCH" = "i386" ]; then
118     echo "Building $KERNELARCH $TOPDESTPATH/images/pxeboot/initrd.img"
119     makeinitrd --initrdto $TOPDESTPATH/images/pxeboot/initrd.img \
120         --pcmcia --nobogl \
121         --initrdsize 4750 \
122         --loaderbin loader \
123         --modules "$COMMONMODULES"
124
125     echo "Building $KERNELARCH bootdisk.img"
126     makebootdisk --kernelto $TOPDESTPATH/images/pxeboot/vmlinuz  \
127         --bootdisksize 1440 \
128         --imagename $BOOTDIR/bootdisk.img \
129         --initrd $TOPDESTPATH/images/pxeboot/initrd.img
130     [ $? = 0 ] || exit 1
131
132     rm -f $TOPDESTPATH/images/pxeboot/initrd.img
133
134   fi
135
136   # FIXME: this is so that we can switch back and forth.  if we want both
137   # on the CD, then more needs to be done, esp for things like isolinux.cfg
138   # Right now, last one wins
139   if [ "$KERNELARCH" = "i686" -o "$KERNELARCH" = "i586" -o "$KERNELARCH" = "athlon" ]; then
140     echo "Building $KERNELARCH initrd-everything.img"
141     makeinitrd --initrdto $TOPDESTPATH/images/pxeboot/initrd-everything.img \
142         --pcmcia \
143         --initrdsize 10000 \
144         --loaderbin loader \
145         --modules "$LOCALMODULES $NETWORKMODULES $PCMCIAMAINMODULES $BOOTPCMCIAMODULES $PCMCIAMODULES $ISOLINUXMODULES =scsi =net"
146     [ $? = 0 ] || exit 1
147
148     if [ -f $IMGPATH/usr/lib/syslinux/isolinux.bin ]; then
149         echo "Building isolinux directory"
150         MBD_BOOTTREE=$TOPDESTPATH/isolinux
151         MBD_FSIMAGE=$TOPDESTPATH/images/pxeboot/initrd-everything.img
152         mkdir $MBD_BOOTTREE 2>/dev/null
153         cp $IMGPATH/usr/lib/syslinux/isolinux.bin $MBD_BOOTTREE/isolinux.bin
154
155         prepareBootTree
156
157         # isolinux needs the config file to be isolinux.cfg
158         mv $MBD_BOOTTREE/syslinux.cfg $MBD_BOOTTREE/isolinux.cfg
159
160         # copy in memtest if present
161         if [ -f $IMGPATH/usr/lib/anaconda-runtime/boot/memtest* ]; then
162            cp $IMGPATH/usr/lib/anaconda-runtime/boot/memtest* $MBD_BOOTTREE/memtest
163            echo -e "label memtest86\n  kernel memtest\n  append -\n" >> $MBD_BOOTTREE/isolinux.cfg
164         fi
165
166     else
167         echo "No isolinux binaries.  Skipping isolinux creation"
168     fi
169
170     # clean up time -- being very explicit about what's linked
171     if [ -f $TOPDESTPATH/isolinux/vmlinuz -a -f $TOPDESTPATH/isolinux/initrd.img ] ;then
172         echo "Cleaning up images"
173         # links for the pxeboot bits
174         rm -f $TOPDESTPATH/images/pxeboot/*
175         ln $TOPDESTPATH/isolinux/vmlinuz $TOPDESTPATH/images/pxeboot/vmlinuz
176         ln $TOPDESTPATH/isolinux/initrd.img $TOPDESTPATH/images/pxeboot/initrd.img
177
178         # links for the autoboot bits
179         if [ -f $TOPDESTPATH/dosutils/loadlin.exe ]; then
180                 rm -f $TOPDESTPATH/dosutils/autoboot/*
181                 mkdir -p $TOPDESTPATH/dosutils/autoboot/
182                 ln $TOPDESTPATH/isolinux/vmlinuz $TOPDESTPATH/dosutils/autoboot/vmlinuz
183                 ln $TOPDESTPATH/isolinux/initrd.img $TOPDESTPATH/dosutils/autoboot/initrd.img
184         fi
185     fi
186
187     # now make a boot iso
188     mkdir -p $TOPDESTPATH/images/isopath
189     cp -rl $TOPDESTPATH/isolinux $TOPDESTPATH/images/isopath
190     mkisofs -quiet -o $TOPDESTPATH/images/boot.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -V "$PRODUCT" -T $TOPDESTPATH/images/isopath
191     rm -rf $TOPDESTPATH/images/isopath
192     
193     # now make a boot pendrive image
194     mkdir -p $TOPDESTPATH/images/fobpath
195     dd if=/dev/zero of=$TOPDESTPATH/images/diskboot.img bs=1M count=8 2>/dev/null
196     mkdosfs $TOPDESTPATH/images/diskboot.img
197     $SYSLINUX $TOPDESTPATH/images/diskboot.img
198     mount -o loop $TOPDESTPATH/images/diskboot.img $TOPDESTPATH/images/fobpath
199     cp -r $TOPDESTPATH/isolinux/* $TOPDESTPATH/images/fobpath/
200     grep -v local $TOPDESTPATH/images/fobpath/isolinux.cfg > $TOPDESTPATH/images/fobpath/syslinux.cfg
201     rm -f $TOPDESTPATH/images/fobpath/isolinux.cfg
202     umount -f $TOPDESTPATH/images/fobpath
203     rmdir $TOPDESTPATH/images/fobpath
204     
205     cat > $TOPDESTPATH/images/pxeboot/README <<EOF
206 The files in this directory are useful for booting a machine via PXE.  
207
208 The following files are available:
209 vmlinuz - the BOOT kernel used for the installer
210 initrd.img - an initrd with support for all install methods and
211     drivers supported for installation of $PRODUCT
212 EOF
213   fi
214 }
215
216 makeSecondStage() {
217     echo "Building main moduleball"
218     makemainmodules "=scsi =net $SECSTAGE"
219     [ $? = 0 ] || exit 1
220
221     echo "Building netstg.img"
222     makeinstimage "netstg" "=scsi $SECSTAGE"
223     [ $? = 0 ] || exit 1
224     echo "Building hdstg.img"
225     makeinstimage "hdstg" "=net $SECSTAGE"
226     [ $? = 0 ] || exit 1
227     echo "Building stage2.img"
228     makemainimage "stage2" "cramfs"
229     [ $? = 0 ] || exit 1
230 }
This page took 0.064441 seconds and 3 git commands to generate.