| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# Do install stuff for sparc, including making bootable CDs |
| 4 |
# Works with debian-installer |
| 5 |
# |
| 6 |
# $1 is the CD number |
| 7 |
# $2 is the temporary CD build dir |
| 8 |
|
| 9 |
. $BASEDIR/tools/boot/$DI_CODENAME/common.sh |
| 10 |
|
| 11 |
set -e |
| 12 |
#set -x |
| 13 |
|
| 14 |
N=$1 |
| 15 |
CDDIR=$2 |
| 16 |
INSTALLDIR=$CDDIR/install |
| 17 |
|
| 18 |
# Common mkisofs options when creating CDs |
| 19 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long" |
| 20 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes" |
| 21 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-l" |
| 22 |
|
| 23 |
# mkisofs options specific to sparc |
| 24 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-G $CDDIR/../CD1/cdboot.img" |
| 25 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-B '...'" |
| 26 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "--grub2-sparc-core /boot/grub/core.img" |
| 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/sparc/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 now depends on xorriso for making sparc bootable CDs." |
| 46 |
exit 1; |
| 47 |
;; |
| 48 |
esac |
| 49 |
|
| 50 |
cd $CDDIR/.. |
| 51 |
|
| 52 |
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinux 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 |
# Boot setup including config and help files comes from d-i. |
| 73 |
mkdir -pv $PWD/CD$N |
| 74 |
cat cdrom/debian-cd_info.tar.gz | (cd CD$N/; tar zx) |
| 75 |
|
| 76 |
# Prepend cdboot.img with 512 zero bytes as block 0 contains |
| 77 |
# the SUN disk label and would get overwritten by xorriso |
| 78 |
dd if=/dev/zero of=$CDDIR/../CD1/cdboot.img bs=512 count=1 |
| 79 |
dd if=$CDDIR/../CD1/boot/grub/sparc64-ieee1275/cdboot.img of=$CDDIR/../CD1/cdboot.img bs=512 count=1 oflag=append conv=notrunc |
| 80 |
|
| 81 |
# Copy kernel and initrd |
| 82 |
mkdir -p $INSTALLDIR |
| 83 |
cp -lf cdrom/vmlinux $INSTALLDIR/ |
| 84 |
cp -lf cdrom/initrd.gz $INSTALLDIR/ |
| 85 |
|
| 86 |
exit 0 |