OSDN Git Service

20f2ca2fd7fd7a0c143d0c755daf728447ed60f9
[android-x86/bootable-newinstaller.git] / install / grub2 / efi / boot / android.cfg
1 # $1 Title
2 # $2... Kernel cmdline
3 function add_entry {
4         menuentry "OS_TITLE VER $1" "$@" --class android-x86 {
5                 shift 2
6                 savedefault
7                 set root=$android
8                 linux $kdir/kernel CMDLINE $src $@
9                 initrd $kdir/initrd.img
10         }
11 }
12
13 # $1 EFI to chainload
14 # $2 OS name
15 # $3 Class
16 function add_os_if_exists {
17         # Is there a better way to find ESP?
18         for d in hd0,gpt1 hd0,gpt2 hd1,gpt1 hd1,gpt2 hd0,msdos1 hd0,msdos2 hd1,msdos1 hd1,msdos2; do
19                 if [ "($d)$1" != "$cmdpath/$bootefi" -a -e ($d)$1 ]; then
20                         menuentry "$2 at $d ->" "$d" "$1" --class "$3" {
21                                 savedefault
22                                 set root=$2
23                                 chainloader ($root)$3
24                         }
25                         break
26                 fi
27         done
28 }
29
30 function savedefault {
31         if [ -s $prefix/grubenv -a "$chosen" != "$default" ]; then
32                 set default="$chosen"
33                 save_env default
34         fi
35 }
36
37 function load_theme {
38         loadfont DejaVuSansMono-18
39         set gfxmode=1024x768
40         terminal_output gfxterm
41         set theme=$prefix/theme/theme.txt
42         export theme
43 }
44
45 if [ -s $prefix/theme/theme.txt ]; then
46         load_theme
47 fi
48
49 if [ -s $prefix/grubenv ]; then
50         load_env
51 fi
52
53 if [ "$grub_cpu" = "i386" ]; then
54         set bootefi=bootia32.efi
55         set grub=grubia32
56 else
57         set bootefi=BOOTx64.EFI
58         set grub=grubx64
59 fi
60
61 if [ -z "$src" -a -n "$isofile" ]; then
62         set src=iso-scan/filename=$isofile
63 fi
64
65 search --no-floppy --set android -f $kdir/kernel
66 export android bootefi grub kdir live src
67
68 # Create main menu
69 add_entry "$live" quiet
70 add_entry "$debug_mode" DEBUG=2
71 if [ -s ($android)$kdir/install.img ]; then
72         add_entry "Installation" INSTALL=1
73 fi
74
75 submenu "Advanced options -> " --class forward {
76         add_entry "$live - No Hardware Acceleration" quiet nomodeset HWACCEL=0
77         if [ -s ($android)$kdir/install.img ]; then
78                 add_entry "Auto Install to specified harddisk" AUTO_INSTALL=0
79                 add_entry "Auto Update" AUTO_INSTALL=update
80         fi
81         add_os_if_exists /EFI/BOOT/$bootefi "UEFI OS" os
82         add_os_if_exists /EFI/BOOT/fallback.efi "UEFI Fallback" os
83         add_os_if_exists /EFI/BOOT/fallback_x64.efi "UEFI Fallback" os
84         menuentry "Reboot" --class reboot { reboot }
85         menuentry "Poweroff" --class shutdown { halt }
86         menuentry "UEFI firmware settings" --class setup { fwsetup }
87 }
88
89 # Add other OSes boot loaders if exist
90 add_os_if_exists /EFI/fedora/${grub}.efi Fedora fedora
91 add_os_if_exists /EFI/centos/${grub}.efi CentOS centos
92 add_os_if_exists /EFI/ubuntu/${grub}.efi Ubuntu ubuntu
93 add_os_if_exists /EFI/debian/${grub}.efi Debian debian
94 add_os_if_exists /EFI/linuxmint/${grub}.efi "Linux Mint" linuxmint
95 add_os_if_exists /EFI/Microsoft/Boot/bootmgfw.efi Windows windows
96
97 for d in $config_directory $cmdpath $prefix; do
98         if [ -f $d/custom.cfg ]; then
99                 source $d/custom.cfg
100         fi
101 done