File: boot-arm64

package info (click to toggle)
debian-cd 3.2.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,848 kB
  • sloc: sh: 6,129; perl: 4,129; makefile: 413
file content (140 lines) | stat: -rwxr-xr-x 4,217 bytes parent folder | download | duplicates (6)
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
#!/bin/bash

# Based on boot-x86
#
# Do install stuff for arm64, including making bootable CDs
# Works with debian-installer
#
# $1 is the CD number
# $2 is the temporary CD build dir

. $BASEDIR/tools/boot/$DI_CODENAME/common.sh

set -e
#set -x

# Workaround for #823881:
export MTOOLS_SKIP_CHECK=1

N=$1
CDDIR=$2
INSTALLDIR="install.a64"

# Common options for all disks
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-l"

# Exit if this is not CD#1/DVD#1
if [ $N != "1" ]; then
    exit 0
fi

if [ "$DI_WWW_HOME" = "default" ]; then
    DI_WWW_HOME="https://d-i.debian.org/daily-images/arm64/daily"
    try_di_image_cache
else
    DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,")
fi

case "$MKISOFS" in
    *xorriso*)
        XORRISO_VER=$(xorriso_version)
        ;;
    *)
        echo "ERROR: debian-cd depends on xorriso for making $ARCH bootable CDs."
        exit 1;
        ;;
esac

cd $CDDIR/..

BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"

# Download boot images.
for image in $BOOT_IMAGES; do
    if [ ! -e "$image" ]; then
        dir=$(dirname $image)
        mkdir -p $dir
        if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
            cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
        elif [ ! "$DI_WWW_HOME" ];then
            if [ ! "$DI_DIR" ];then
                DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
            fi
            cp "$DI_DIR/$image" "$image"
        else
            $WGET "$DI_WWW_HOME/$image" -O "$image"
        fi
    fi
done

mkdir -p $CDDIR/$INSTALLDIR
cp -lf cdrom/vmlinuz $CDDIR/$INSTALLDIR/
cp -lf cdrom/initrd.gz $CDDIR/$INSTALLDIR/

# Try to add graphical installer build too
extra_image gtk/vmlinuz   "../vmlinuz" || true
extra_image gtk/initrd.gz "../initrd.gz" || true

# Boot setup including config and help files comes from d-i.
mkdir -pv $PWD/boot$N
cat cdrom/debian-cd_info.tar.gz | (cd boot$N/; tar zx)

if [ -d boot$N/grub ] ; then
    echo "  Adding EFI boot code for $ARCH on CD$N"

    # Move GRUB files to the right place.
    mkdir -p $CDDIR/EFI/boot
    mcopy -n -s -i boot$N/grub/efi.img '::efi/*' $CDDIR/EFI
    mkdir -p $CDDIR/boot/grub
    mv boot$N/grub/* $CDDIR/boot/grub/
    rmdir boot$N/grub

    change_grub_cfg_uuid $CDDIR

    # Stuff the EFI boot files into a FAT filesystem, making it as
    # small as possible. We end up re-packing like this in case we're
    # making a multi-arch image

    # First, work out how many blocks we need
    blocks=$(calculate_efi_image_size $CDDIR)

    # Now make a new image to contain the files
    rm -f $CDDIR/boot/grub/efi.img
    mkfs.msdos --invariant -v -i deb00001 -C "$CDDIR/boot/grub/efi.img" $blocks >/dev/null

    # And copy them into place
    mmd -i "$CDDIR/boot/grub/efi.img" ::efi
    mcopy -o -s -i "$CDDIR/boot/grub/efi.img" $CDDIR/EFI/* \
        "::efi"

    # Ugh - different code here depending on the version of xorriso we've got
    if [ $XORRISO_VER -le 10202 ] ; then
        echo "ERROR: debian-cd depends on xorriso > 1.2.2 for making $ARCH bootable CDs."
        exit 1;
    elif [ $XORRISO_VER -gt 10202 ] ; then
        echo "    Using newer EFI support in xorriso $XORRISO_VER"

	# Location of the EFI boot image, and don't emulate a floppy or HD
        add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-e boot/grub/efi.img -no-emul-boot"

	# Add an *extra* partition on the end for the EFI bits
	add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-append_partition 2 0xef $CDDIR/boot/grub/efi.img"

	# And force alignment
	add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-partition_cyl_align all"
    fi

    # Finally, belt and braces - fix up the %install% entries in grub
    # in case they're still there
    sed -i "s|\%install\%|$INSTALLDIR|g" $CDDIR/boot/grub/grub.cfg

    # Substitute custom KERNEL_PARAMS into grub.cfg
    sed -i "s|/vmlinuz |/vmlinuz $KERNEL_PARAMS |g" $CDDIR/boot/grub/grub.cfg

else
    echo "  No EFI boot code for $ARCH on CD$N"
fi

# th,th, thats all