blob: 1e1e40d942ac9070e72db344ddeb6a72fbc799a4 (
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
|
#!/bin/bash
#makebootdisk required for EFI bootloader dosfs image
makebootdisk() {
EXTRAKERNELPATH=""
INITRDFLAGS=""
MBD_FILENAME=""
INITRDFILE=""
MBD_TMPIMAGE=/tmp/makebootdisk.image.$$
MBD_BOOTTREE=/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"
dd if=/dev/zero bs=1k count=$BOOTDISKSIZE of=$MBD_FILENAME 2>/dev/null
mkdosfs -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() {
if [ "$kerneltag" != "xen" ]; then
# 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
# make a boot iso
mkdir -p $TOPDESTPATH/images/isopath
cp -l $TOPDESTPATH/images/boot.img $TOPDESTPATH/images/isopath
mkisofs -quiet -o $TOPDESTPATH/images/boot.iso -b boot.img -no-emul-boot -R -J -V "$PRODUCT" -T $TOPDESTPATH/images/isopath
rm -rf $TOPDESTPATH/images/isopath
# 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
else # set up the boot stuff for the xen guest kernel
echo "Building $KERNELARCH guest initrd.img"
mkdir -p $TOPDESTPATH/images/xen
makeinitrd --initrdto $TOPDESTPATH/images/xen/initrd.img \
--initrdsize 12288 \
--loaderbin loader \
--modules "$INITRDMODS"
[ $? = 0 ] || exit 1
cp $KERNELROOT/boot/efi/EFI/redhat/vmlinuz-*xen* $TOPDESTPATH/images/xen/vmlinuz
fi
}
|