blob: b8912766e31f7e28985b225f05f1a7ca75e5a3f6 (
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
|
#! /bin/bash
# support for GRUB version 2
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
set -a
# do not set up grub during dirinstall
if [ "$FAI_ACTION" = "dirinstall" ] ; then
exit 0
fi
# during softupdate use this file
[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh
if [ -z "$BOOT_DEVICE" ]; then
exit 189
fi
# disable os-prober because of #788062
ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true'
# skip the rest, if not an initial installation
if [ $FAI_ACTION != "install" ]; then
$ROOTCMD update-grub
exit $error
fi
$ROOTCMD grub-mkdevicemap --no-floppy
GROOT=$($ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE)
if [[ $GROOT =~ 'hostdisk' ]]; then
cat > $target/boot/grub/device.map <<EOF
(hd0) $BOOT_DEVICE
EOF
if ifclass HIKEY; then
# Standard grub-install for SD card
$ROOTCMD grub-install --removable --no-nvram $BOOT_DEVICE
if [ $? -eq 0 ]; then
echo "Hikey grub for SD card installed"
fi
# Custom grub for emmc and lava
cat << EOF > $target/boot/grub/emmc.config
set root=(hd0,gpt9)
set prefix=(\$root)'/boot/grub'
configfile \$prefix/grub.cfg
EOF
GRUB_MODULES="boot chain configfile echo efinet eval ext2 fat font gettext gfxterm gzio help linux loadenv lsefi normal part_gpt part_msdos read regexp search search_fs_file search_fs_uuid search_label terminal terminfo test tftp time"
$ROOTCMD grub-mkimage --prefix='(hd0,gpt9)/boot/grub' \
--config=/boot/grub/emmc.config --output=/boot/efi/EFI/BOOT/GRUBAA64.EFI \
--format=arm64-efi --compression=auto $GRUB_MODULES
echo "Standalone Hikey grub for eMMC and LAVA installed"
fi
rm $target/boot/grub/device.map
else
$ROOTCMD grub-install --no-floppy "$GROOT"
if [ $? -eq 0 ]; then
echo "Grub installed on $BOOT_DEVICE = $GROOT"
fi
fi
$ROOTCMD update-grub
exit $error
|