Debian Codegraph @

tools/boot/kali-dev/boot-ia64

raw
1 #!/bin/bash
2
3 # Based on boot-arm64
4 #
5 # Do install stuff for ia64, including making bootable CDs
6 # Works with debian-installer
7 #
8 # $1 is the CD number
9 # $2 is the temporary CD build dir
10
11 . $BASEDIR/tools/boot/$DI_CODENAME/common.sh
12
13 set -e
14 #set -x
15
16 # Workaround for #823881:
17 export MTOOLS_SKIP_CHECK=1
18
19 N=$1
20 CDDIR=$2
21 INSTALLDIR="install"
22
23 # Common options for all disks
24 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long"
25 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes"
26 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-l"
27
28 # Exit if this is not CD#1/DVD#1
29 if [ $N != "1" ]; then
30 exit 0
31 fi
32
33 if [ "$DI_WWW_HOME" = "default" ]; then
34 DI_WWW_HOME="https://d-i.debian.org/daily-images/ia64/daily"
35 try_di_image_cache
36 else
37 DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,")
38 fi
39
40 case "$MKISOFS" in
41 *xorriso*)
42 XORRISO_VER=$(xorriso_version)
43 ;;
44 *)
45 echo "ERROR: debian-cd depends on xorriso for making $ARCH bootable CDs."
46 exit 1;
47 ;;
48 esac
49
50 cd $CDDIR/..
51
52 BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
53
54 # Download boot images.
55 for image in $BOOT_IMAGES; do
56 if [ ! -e "$image" ]; then
57 dir=$(dirname $image)
58 mkdir -p $dir
59 if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
60 cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
61 elif [ ! "$DI_WWW_HOME" ];then
62 if [ ! "$DI_DIR" ];then
63 DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
64 fi
65 cp "$DI_DIR/$image" "$image"
66 else
67 $WGET "$DI_WWW_HOME/$image" -O "$image"
68 fi
69 fi
70 done
71
72 mkdir -p $CDDIR/$INSTALLDIR
73 cp -lf cdrom/vmlinuz $CDDIR/$INSTALLDIR/
74 cp -lf cdrom/initrd.gz $CDDIR/$INSTALLDIR/
75
76 # Boot setup including config and help files comes from d-i.
77 mkdir -pv $PWD/boot$N
78 cat cdrom/debian-cd_info.tar.gz | (cd boot$N/; tar zx)
79
80 if [ -d boot$N/grub ] ; then
81 echo " Adding EFI boot code for $ARCH on CD$N"
82
83 # Move GRUB files to the right place.
84 mkdir -p $CDDIR/EFI/boot
85 mcopy -n -s -i boot$N/grub/efi.img '::efi/*' $CDDIR/EFI
86 mkdir -p $CDDIR/boot/grub
87 mv boot$N/grub/* $CDDIR/boot/grub/
88 rmdir boot$N/grub
89
90 change_grub_cfg_uuid $CDDIR
91
92 # Stuff the EFI boot files into a FAT filesystem, making it as
93 # small as possible. We end up re-packing like this in case we're
94 # making a multi-arch image
95
96 # First, work out how many blocks we need
97 blocks=$(calculate_efi_image_size $CDDIR)
98
99 # Now make a new image to contain the files
100 rm -f $CDDIR/boot/grub/efi.img
101 mkfs.msdos --invariant -v -i deb00001 -C "$CDDIR/boot/grub/efi.img" $blocks >/dev/null
102
103 # And copy them into place
104 mmd -i "$CDDIR/boot/grub/efi.img" ::efi
105 mcopy -o -s -i "$CDDIR/boot/grub/efi.img" $CDDIR/EFI/* \
106 "::efi"
107
108 # Ugh - different code here depending on the version of xorriso we've got
109 if [ $XORRISO_VER -le 10202 ] ; then
110 echo "ERROR: debian-cd depends on xorriso > 1.2.2 for making $ARCH bootable CDs."
111 exit 1;
112 elif [ $XORRISO_VER -gt 10202 ] ; then
113 echo " Using newer EFI support in xorriso $XORRISO_VER"
114
115 # Location of the EFI boot image, and don't emulate a floppy or HD
116 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-e boot/grub/efi.img -no-emul-boot"
117
118 # Add an *extra* partition on the end for the EFI bits
119 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-append_partition 2 0xef $CDDIR/boot/grub/efi.img"
120
121 # And force alignment
122 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-partition_cyl_align all"
123 fi
124
125 # Finally, belt and braces - fix up the %install% entries in grub
126 # in case they're still there
127 sed -i "s|\%install\%|$INSTALLDIR|g" $CDDIR/boot/grub/grub.cfg
128
129 # Substitute custom KERNEL_PARAMS into grub.cfg
130 sed -i "s|/vmlinuz |/vmlinuz $KERNEL_PARAMS |g" $CDDIR/boot/grub/grub.cfg
131
132 else
133 echo " No EFI boot code for $ARCH on CD$N"
134 fi
135
136 # th,th, thats all