summaryrefslogtreecommitdiffstats
path: root/scripts/mk-images.i386
blob: 42dee8cccc12f77705edd70fbb993e825cf41a8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
SYSLINUX=$IMGPATH/usr/bin/syslinux

if [ ! -f $SYSLINUX ]; then
    echo "$SYSLINUX doesn't exist"
    exit 1
fi

prepareBootImage() {
        dd if=/dev/zero bs=1k count=$BOOTDISKSIZE of=/$MBD_TMPIMAGE 2>/dev/null
	mkdosfs -r 16 -C $MBD_TMPIMAGE $BOOTDISKSIZE >/dev/null
	$SYSLINUX $MBD_TMPIMAGE
	mount -o loop -t msdos $MBD_TMPIMAGE $MBD_BOOTTREE

	prepareBootTree
}

# prepare a directory with the kernel, initrd, and various message files
# used to populate a boot image
prepareBootTree() {
	(cd $BOOTDISKDIR; find . ! -name "*.msg" -maxdepth 1 ! -type d | cpio --quiet -p $MBD_BOOTTREE)
	
	cp $MBD_FSIMAGE $MBD_BOOTTREE/initrd.img
	cp $KERNELROOT/boot/vmlinuz-* $MBD_BOOTTREE/vmlinuz
	pngtopnm $BOOTDISKDIR/syslinux-splash.png | ppmtolss16 \#000000=0 \#fefefd=7 \#ce0202=2 > $BOOTDISKDIR/splash.lss
	cp $BOOTDISKDIR/splash.lss $MBD_BOOTTREE/splash.lss
	if [ -d $BOOTDISKDIR/$BOOTLANG ]; then
	    # fb console and kon don't get along...
	    if [ "$BOOTLANG" = "ja_JP" ]; then
		sed -e "s/ vga=[0-9]*//g" < $MBD_BOOTTREE/syslinux.cfg > $MBD_BOOTTREE/syslinux.cf2
		mv -f $MBD_BOOTTREE/syslinux.cf2 $MBD_BOOTTREE/syslinux.cfg
	    fi
	    if [ -n $BOOTDIR ]; then
		sed -e "s/initrd.img/initrd.img lang=$BOOTDIR/g" < $MBD_BOOTTREE/syslinux.cfg > $MBD_BOOTTREE/syslinux.cf2
		mv -f $MBD_BOOTTREE/syslinux.cf2 $MBD_BOOTTREE/syslinux.cfg
	    fi
	    for file in $BOOTDISKDIR/$BOOTLANG/*.msg; do
		filename=`basename $file`
		sed -e "s/@VERSION@/$VERSION/g" $file > $MBD_BOOTTREE/$filename
	    done
	    if [ $? != 0 ]; then
		echo $0: Failed to copy messages from $BOOTDISKDIR/$BOOTLANG to $MBD_BOOTTREE.
		umount $MBD_BOOTTREE
		rm -rf $MBD_BOOTTREE $MBD_TMPIMAGE
		exit 1
	    fi
	else
	    for file in $BOOTDISKDIR/*.msg; do
		filename=`basename $file`
		sed -e "s/@VERSION@/$VERSION/g" $file > $MBD_BOOTTREE/$filename
	    done
	    if [ $? != 0 ]; then
		echo $0: Failed to copy messages from $BOOTDISKDIR to $MBD_BOOTTREE.
		umount $MBD_BOOTTREE
		rm -rf $MBD_BOOTTREE $MBD_TMPIMAGE
		exit 1
	    fi
	fi
}

mkdir -p $TOPDESTPATH/images
cat > $TOPDESTPATH/images/README <<EOF

The files in this directory are raw disk images.  Some are boot disks
for booting the Red Hat Linux installation program.  Others are driver
disks to support loading the installation program from less common
hardware.

Follow the instructions in the Red Hat Linux Installation Guide,
Chapter 2, section "Making Installation Diskettes" to create the
disks.

The drivers.img driver disk image has been split into several disks
because of the increasing size of the supported modules.

The following boot images images available:

boot.img - boot image for CD and hard drive based install
bootnet.img - boot image for network based install
pcmcia.img - boot image for installing on laptops

The following driver disks are available:

EOF

# LATEUSBMODS go in the second stage
USBMODS="usb-ohci usb-uhci hid keybdev usb-storage"
# usb-storage goes on both so we can reload it.  *sigh*
LATEUSBMODS="mousedev usb-storage"
IDEMODS=""
SCSIMODS="sd_mod sr_mod"

FSMODS="msdos vfat ext3 reiserfs jfs"
SECSTAGE="agpgart raid0 raid1 raid5 lvm-mod $FSMODS $IDEMODS $SCSIMODS $LATEUSBMODS st"

COMMONMODULES="vfat $USBMODS"
LOCALMODULES="$COMMONMODULES aic7xxx megaraid ncr53c8xx 
	     sym53c8xx $IDEMODS $SCSIMODS"
NETWORKMODULES="$COMMONMODULES nfs 3c59x 
	       eepro100 tulip pcnet32 8139too"
#	       sis900 e100 hp100 natsemi"

PCMCIAMAINMODULES="$COMMONMODULES nfs $IDEMODS $SCSIMODS"

echo "Building dosutils/autoboot/initrd.img"
makeinitrd --initrdto $TOPDESTPATH/dosutils/autoboot/initrd.img \
	   --initrdsize 2750 \
	   --loaderbin loader-local \
	   --modules "$LOCALMODULES"

echo "Building images/pxeboot/initrd.img"
makeinitrd --initrdto $TOPDESTPATH/images/pxeboot/initrd.img \
	   --initrdsize 2750 \
	   --loaderbin loader-network \
	   --modules "$NETWORKMODULES"

# XXX hack hack
PCMCIAMODULES_EXCLUDED="
	apa1480_cb
	iflash2+_mtd
	iflash2_mtd
	memory_cb
	memory_cs
	parport_cs
	parport_pc
	parport
	serial_cs
	serial_cb
	sram_mtd
"
PCMCIAMODULES_EXCLUDED_SED="sed"
for m in $PCMCIAMODULES_EXCLUDED
do
   PCMCIAMODULES_EXCLUDED_SED="$PCMCIAMODULES_EXCLUDED_SED -e 's/$m//g'"
done
PCMCIAMODULES=`echo $PCMCIAMODULES | eval "$PCMCIAMODULES_EXCLUDED_SED"`

echo "Building images/initrd-pcmcia.img"
makeinitrd --initrdto $TOPDESTPATH/images/initrd-pcmcia.img \
	   --pcmcia \
	   --initrdsize 2750 \
	   --loaderbin loader-pcmcia \
	   --modules "$PCMCIAMAINMODULES"
[ $? = 0 ] || exit 1

#for I in $BOOTDISKDIR; do
TIER1LANGS="de_DE|fr_FR|it_IT|es_ES|ja_JP"
for I in $BOOTDISKDIR `find $BOOTDISKDIR -type d | egrep "($TIER1LANGS)"`; do
    BOOTLANG=`basename $I`
    BOOTDIR=`basename $I | cut -d'_' -f1`

    if [ $BOOTLANG = "boot" ]; then
	BOOTLANG=""
	BOOTDIR=""
    fi

    echo "Building $BOOTDIR/boot.img"
    makebootdisk --kernelto $TOPDESTPATH/dosutils/autoboot/vmlinuz  \
		 --bootdisksize 1440 \
		 --imagename $BOOTDIR/boot.img \
		 --initrd $TOPDESTPATH/dosutils/autoboot/initrd.img
    [ $? = 0 ] || exit 1

    echo "Building $BOOTDIR/bootnet.img"
    makebootdisk --kernelto $TOPDESTPATH/images/pxeboot/vmlinuz  \
		 --bootdisksize 1440 \
		 --imagename $BOOTDIR/bootnet.img \
		 --initrd $TOPDESTPATH/images/pxeboot/initrd.img
    [ $? = 0 ] || exit 1

    echo "Building $BOOTDIR/pcmcia.img"
    makebootdisk --imagename $BOOTDIR/pcmcia.img \
	         --bootdisksize 1440 \
		 --initrd $TOPDESTPATH/images/initrd-pcmcia.img
    [ $? = 0 ] || exit 1
done

rm -f $TOPDESTPATH/images/initrd-pcmcia.img

echo "Building drvblock.img"
makedriverdisk --padsize 1440 "Supplemental Block Device Drivers" "drvblock" "+scsi"
[ $? = 0 ] || exit 1
echo "Building drvnet.img"
makedriverdisk --padsize 1440 "Supplemental Network Drivers" "drvnet" "+net"
[ $? = 0 ] || exit 1

echo "Building pcmciadd.img"
makedriverdisk --padsize 1440 "PCMCIA Driver Diskette" "pcmciadd" "$PCMCIAMODULES"
[ $? = 0 ] || exit 1

unset BOOTLANG
unset BOOTDIR

echo "Building dosutils/autoboot/initrd.img"
makeinitrd --initrdto $TOPDESTPATH/dosutils/autoboot/initrd.img \
	   --initrdsize 4100 \
	   --pcmcia \
	   --loaderbin loader-pcmcia \
	   --modules "$COMMONMODULES $SCSIMODS =scsi $IDEMODS"
[ $? = 0 ] || exit 1

echo "Building cdboot.img"
makebootdisk --kernelto $TOPDESTPATH/dosutils/autoboot/vmlinuz  \
	     --bootdisksize 2880 \
	     --imagename ../dosutils/autoboot/cdboot.img \
	     --initrd $TOPDESTPATH/dosutils/autoboot/initrd.img
[ $? = 0 ] || exit 1

echo "Building initrd-everything.img"
makeinitrd --initrdto $TOPDESTPATH/images/pxeboot/initrd-everything.img \
	   --pcmcia \
	   --initrdsize 4000 \
	   --loaderbin loader-pcmcia \
	   --modules "$LOCALMODULES $NETWORKMODULES $PCMCIAMAINMODULES $PCMCIAMODULES =scsi =net"
[ $? = 0 ] || exit 1

if [ -f $IMGPATH/usr/lib/syslinux/isolinux.bin ]; then
	echo "Building isolinux directory"
	MBD_BOOTTREE=$TOPDESTPATH/isolinux
	MBD_FSIMAGE=$TOPDESTPATH/images/pxeboot/initrd-everything.img
	mkdir $MBD_BOOTTREE
	cp $IMGPATH/usr/lib/syslinux/isolinux.bin $MBD_BOOTTREE/isolinux.bin

	prepareBootTree

	# isolinux needs the config file to be isolinux.cfg
	mv $MBD_BOOTTREE/syslinux.cfg $MBD_BOOTTREE/isolinux.cfg
else
	echo "No isolinux binaries.  Skipping isolinux creation"
fi

echo "Building main moduleball"
makemainmodules "=scsi =net $SECSTAGE"
[ $? = 0 ] || exit 1

echo "Building netstg.img"
makeinstimage "netstg" "=scsi $SECSTAGE"
[ $? = 0 ] || exit 1
echo "Building hdstg.img"
makeinstimage "hdstg" "=net $SECSTAGE"
[ $? = 0 ] || exit 1
echo "Building stage2.img"
makemainimage "stage2" "cramfs"
[ $? = 0 ] || exit 1


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 BOOT kernel used for the installer
initrd.img - the regular network initrd used by the bootnet images
initrd-everything.img - an initrd with support for all install methods and
    drivers supported for installation of Red Hat Linux
EOF