OSDN Git Service

android.cfg: support custom boot entry
authorChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 1 Jan 2019 15:31:16 +0000 (23:31 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 11 Jan 2019 17:00:19 +0000 (01:00 +0800)
New entries could also be appended by the new add_boot_entry function
in custom.cfg like

add_boot_entry /android-7.1-r2 "Android-x86 7.1-r2" quiet

install/grub2/efi/boot/android.cfg

index 192d410..c2d09a4 100644 (file)
@@ -1,15 +1,30 @@
-# $1 Title
-# $2... Kernel cmdline
-function add_entry {
-       menuentry "OS_TITLE VER $1" "$@" --class android-x86 {
-               shift 2
+# $1 Kernel dir
+# $2 Title
+# $3... Kernel cmdline
+function add_boot_entry {
+       menuentry "$2" "$@" --class android-x86 {
                savedefault
                set root=$android
-               linux $kdir/kernel CMDLINE $src $@
-               initrd $kdir/initrd.img
+               if [ -e $2/kernel ]; then
+                       true
+               else
+                       search --no-floppy --set root -f $2/kernel
+               fi
+               set kd=$2
+               shift 3
+               linux $kd/kernel CMDLINE $src $@
+               initrd $kd/initrd.img
        }
 }
 
+# $1 Title
+# $2... Kernel cmdline
+function add_entry {
+       set title="OS_TITLE VER $1"
+       shift 1
+       add_boot_entry "$kdir" "$title" "$@"
+}
+
 # $1 EFI to chainload
 # $2 OS name
 # $3 Class