efi-grub

1,068 views
Skip to first unread message

Frank W.

unread,
Jul 22, 2015, 3:44:08 AM7/22/15
to andro...@googlegroups.com
Hi,
i've tried to install android x86 on a laptop with uefi and gpt. on install i set "install grub" to skip and install uefi-grub to yes.
but i have now uefi-entry and currenty can't boot android.

now i have installed ubuntu 14.4, maybe i can create the menu-entry from that. how?

i have no separate grub-partition....

regards Frank

Frank W.

unread,
Jul 23, 2015, 8:54:55 AM7/23/15
to Android-x86
i've tried to register the bootx64 with modified grub.cfg from install-media
efibootmgr --create --disk /dev/sda --part 1 --label "Android x86" -loader \\EFI\\grub_android\\bootx64.efi

menuentry "Run Android x86" {
set root=(hd0,gpt6)
linux /android-4.4-r3/kernel root=/dev/sda6 androidboot.hardware$ initrd /android-4.4-r3/initrd.img }

menuentry 'Windows 8' {
search --file --no-floppy --set=root /EFI/Microsoft/Boot/bootmgfw.efi chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi}

i can select it, but it does not boot.

after that i tried to use ubuntu's grubx64.efi with changed grub.cfg, but also no luck. that seems to be only a redirekt to grub on system-partition

any hints? how can i install efi-grub for android without depency of ubuntus grub.

regards Frank

Chih-Wei Huang

unread,
Jul 23, 2015, 9:23:44 AM7/23/15
to Android-x86
2015-07-23 18:50 GMT+08:00 Frank W. <frank.wu...@gmail.com>:
> i've tried to register the bootx64 with modified grub.cfg from install-media
> efibootmgr --create --disk /dev/sda --part 1 --label "Android x86" -loader \\EFI\\grub_android\\bootx64.efi
>
> menuentry "Run Android x86" {
> set root=(hd0,gpt6)
> linux /android-4.4-r3/kernel root=/dev/sda6 androidboot.hardware$ initrd /android-4.4-r3/initrd.img }

Did you have some typo? Should be androidboot.hardware=android_x86

Remove root=/dev/sda6

> menuentry 'Windows 8' {
> search --file --no-floppy --set=root /EFI/Microsoft/Boot/bootmgfw.efi chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi}
>
> i can select it, but it does not boot.
>
> after that i tried to use ubuntu's grubx64.efi with changed grub.cfg, but also no luck. that seems to be only a redirekt to grub on system-partition
>
> any hints? how can i install efi-grub for android without depency of ubuntus grub.
>


--
Chih-Wei
Android-x86 project
http://www.android-x86.org

Frank W.

unread,
Jul 23, 2015, 11:00:42 PM7/23/15
to Android-x86
It was an error on copy,sorry.

menuentry "Run Android x86" {
set root=(hd0,gpt6)
linux /android-4.4-r3/kernel root=/dev/sda6 androidboot.hardware=android_x86 SRC=/android-4.4-r3
initrd /android-4.4-r3/initrd.img

Removed "root=/dev/sda6",but it still does not work. grub.cfg is in same dir as bootx64.efi.

Chih-Wei Huang

unread,
Jul 23, 2015, 11:04:59 PM7/23/15
to Android-x86
What didn't work?
Is the kernel loaded?
Any error message?

Are you sure root=(hd0,gpt6) is the correct partition
containing the android-x86 installation?

Liao Ssin

unread,
Jul 23, 2015, 11:16:10 PM7/23/15
to Android-x86, frank.wu...@gmail.com
Sometimes if you have a flash drive pluged in
Your main drive may becomes hd1

Also I guess you are using uefi system?
Replace linux and initrd with linuxefiand initrdefi

So your script should be like
menuentry "Run Android x86" {
               set root=(hdX,gpt6)
               linuxefi /android-4.4-r3/kernel androidboot.hardware=android_x86 SRC=/android-4.4-r3
               initrdefi /android-4.4-r3/initrd.img

If you can post what shows after you press enter,that would be much easier to solve


Frank W.於 2015年7月24日星期五 UTC+8上午11時00分42秒寫道:

Liao Ssin

unread,
Jul 23, 2015, 11:24:44 PM7/23/15
to Android-x86, cwh...@android-x86.org
By the way,there's one question I really want to ask

Where can I find grub2 with on screen keyboard?

I know there are some modified grub2 has it

And it is a life saver for Windows tablet like Surface Pro 3

Chih-Wei Huang

unread,
Jul 23, 2015, 11:40:11 PM7/23/15
to Android-x86
If you're not sure what the correct partition it is,
you can let grub2 search it automatically.
Replace

set root=(hd0,gpt6)

to

search --set=root --file /android-4.4-r3/kernel

Frank W.

unread,
Jul 24, 2015, 7:45:09 AM7/24/15
to Android-x86
No error,no text at all. Short black screen and back again in uefi-boot-selection-screen.

I currently can boot android using the ubuntu grub...with root='(hd0,6)'
No flashdrive

As i said,the installer does not created a grub in efi+partition...i copied it from the install-media. Maybe thats wrong..

How can i install it right? What exactly shoild the installer do (which files are copied from to)

Chih-Wei Huang

unread,
Jul 24, 2015, 8:09:39 AM7/24/15
to Android-x86
2015-07-24 19:45 GMT+08:00 Frank W. <frank.wu...@gmail.com>:
> No error,no text at all. Short black screen and back again in uefi-boot-selection-screen.

Have you tried to replace linux with linuxefi in grub.cfg
as said by Liao?

> I currently can boot android using the ubuntu grub...with root='(hd0,6)'
> No flashdrive

You can boot android-x86 using ubuntu grub?
Then that's great! What else do you expect?

> As i said,the installer does not created a grub in efi+partition...i copied it from the install-media. Maybe thats wrong..

When you are prompted
"Do you want to install EFI GRUB2?",
you should say yes.

> How can i install it right? What exactly shoild the installer do (which files are copied from to)

The installer just copy grub2 efi to the boot partition
and create grub.cfg.
It's very preliminary and probably goes wrong
on your system.
Since you know how to install grub and create
the config manually, no need to use the installer.

As we have suggested, the config should just work

menuentry "Run Android x86" {
search --set=root --file /android-4.4-r3/kernel
linuxefi /android-4.4-r3/kernel
androidboot.hardware=android_x86 SRC=/android-4.4-r3
initrdefi /android-4.4-r3/initrd.img
}

If not, I have no idea what wrong it is.

Frank W.

unread,
Jul 24, 2015, 8:35:17 AM7/24/15
to Android-x86
Hi,
I want a separate efi-entry to use bootmanagers like refind or boot android from win8.
Where comes the grub2.efi? On install-media i only found bootx64.efi

Tried linuxefi without luck...seems grub itself is not found/loaded...so theres no error.

Frank

Chih-Wei Huang

unread,
Jul 24, 2015, 9:09:13 AM7/24/15
to Android-x86
Can you see the grub menu or not on earth??

Isn't your ubuntu grub an efi-entry?
Why don't you just use it?

Note android-x86 installer doesn't create efi-entry either.
It just copy grub-efi to /EFI/BOOT/bootx64.efi
or /EFI/BOOT/bootia32.efi
(depends on your EFI is 64-bit or 32-bit)
to be the default efi boot entry.

I suspect you didn't run efibootmgr successfully.
If your EFI BIOS can create efi-entry directly
(like ASUS BIOS), you should just add an entry via it.

Frank W.

unread,
Jul 24, 2015, 9:14:27 AM7/24/15
to Android-x86, frank.wu...@gmail.com
i searched through the disk finding out install.img is a gzipped cpio-archive...extracted and found this:
grub
grub/android-x86.xpm.gz
grub/e2fs_stage1_5
grub/fat_stage1_5
grub/iso9660_stage1_5
grub/ntfs_stage1_5
grub/stage1
grub/stage2
grub/stage2_eltorito
grub2
grub2/efi
grub2/efi/boot
grub2/efi/boot/bootia32.efi
grub2/efi/boot/bootx64.efi


i assume the grub2/efi-folder is the right, but also named bootx64.efi like the efi-folder in root on install-media...next i try that with yout config (auto-detect partition). does bootx64.efi look in same directory for grub.cfg or in parent/subdirectory?

Liao Ssin

unread,
Jul 24, 2015, 9:18:53 AM7/24/15
to Android-x86, frank.wu...@gmail.com
You probably want to try program called easyefi to make your system boot from grub2

With easyefi,you can set default boot to grub/clover/windows or whatever you want

Keep in mind to prepare a bootable flash drive first just in case

And if you you want to access to your efi partition,you can use following commands in CMD
diskpart
list disk (see which disk is your efi located,say it is 0)
select disk 0
list part (again see which partition is your efi located,like 1)
select part 1
assign

Now you should have your efi partition mounted on and you can simply access it with explorer

You can replace the grub files with your working ubuntu grub and set with easyefi then see if your problem solved

Once again,this procedure may risk to damage your system if you do it wrong

Please do it carefully if you wish to try

Frank W.於 2015年7月24日星期五 UTC+8下午8時35分17秒寫道:

Frank W.

unread,
Jul 24, 2015, 9:27:06 AM7/24/15
to Android-x86, frank.wu...@gmail.com
it seems your install-script only copies the grub2/efi-content to /hd (install-partition or ESP? i do not completely understand for-loop and mountpoint-command) and generate grub.cfg...no register via efibootmgr-command.

    dialog --title " Confirm " --no-label Skip --defaultno --yesno \
       
"\n Do you want to install EFI GRUB2?" 7 39
   
if [ $? -eq 0 ]; then
        get_part_info $1
       
for i in /sys/block/$disk/$disk*; do
           
[ 0`cat $i/partition` -eq 1 ] && break
       
done
        boot
=`basename $i`
        mountpoint
-q /hd && umount /hd
        dialog
--title " Confirm " --defaultno --yesno \
           
"\n Do you want to format the boot partition\n /dev/$boot?" 8 45
       
[ $? -eq 0 ] && mkdosfs -n EFI /dev/$boot
        try_mount rw
/dev/$boot /hd
        cp
-af /grub2/efi /hd
        grubcfg
=/hd/efi/boot/grub.cfg
        echo
-e "set timeout=6" > $grubcfg
        echo
-e "menuentry \"Android-x86 $VER\" {\n\tsearch --set=root --file /$asrc/kernel\n\tlinuxefi /$asrc/kernel quiet $cmdline \n\tinitrdefi /$asrc/initrd.img\n}" >> $grubcfg
        echo
-e "menuentry \"Android-x86 $VER (DEBUG mode)\" {\n\tsearch --set=root --file /$asrc/kernel\n\tlinuxefi /$asrc/kernel $cmdline DEBUG=2\n\tinitrdefi /$asrc/initrd.img\n}" >> $grubcfg
       
if [ -e /hd/EFI/Microsoft/Boot/bootmgfw.efi ]; then
            echo
-e "menuentry \"Windows (UEFI)\" {\n\tsearch --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi\n\tchainloader /EFI/Microsoft/Boot/bootmgfw.efi\n}" >> $grubcfg
       
fi
        mountpoint
-q /hd && umount /hd
        try_mount rw
/dev/$1 /hd
   
fi


Frank W.

unread,
Jul 24, 2015, 9:35:58 AM7/24/15
to Android-x86, cwh...@android-x86.org


Chih-Wei Huang:
Can you see the grub menu or not on earth??
no...no grub...i select my created efi-entry and got only a short black-screen, and then back to the efi-selection
Isn't your ubuntu grub an efi-entry?
Why don't you just use it?
yes it is.
FW> I want a separate efi-entry to use bootmanagers like refind or boot android from win8.
FW> Where comes the grub2.efi? On install-media i only found bootx64.efi
 
Note android-x86 installer doesn't create efi-entry either.
It just copy grub-efi to /EFI/BOOT/bootx64.efi
or /EFI/BOOT/bootia32.efi
(depends on your EFI is 64-bit or 32-bit)
to be the default efi boot entry.

I suspect you didn't run efibootmgr successfully.
If your EFI BIOS can create efi-entry directly
(like ASUS BIOS), you should just add an entry via it.
maybe its the first time i did that :) followed by instruction from german https://wiki.ubuntuusers.de/efibootmgr

Frank W.

unread,
Jul 24, 2015, 11:55:58 AM7/24/15
to Android-x86, cwh...@android-x86.org


As we have suggested, the config should just work

menuentry "Run Android x86" {
               search --set=root --file /android-4.4-r3/kernel
               linuxefi /android-4.4-r3/kernel
androidboot.hardware=android_x86 SRC=/android-4.4-r3
               initrdefi /android-4.4-r3/initrd.img
}

tried with config, but still no luck...seems grub is not loaded

 as attachement output from "efibootmgr --verbose" and dir-listing of /boot/efi (/dev/sda)
efi.txt
efibootmgr.txt

Frank W.

unread,
Jul 24, 2015, 3:42:16 PM7/24/15
to Android-x86
Added 2nd dash in efibootmgr-command at loader-option. Now output seems correct:

FILE(\EFI\...)

but still no grub :(

Frank W.

unread,
Jul 25, 2015, 7:46:02 AM7/25/15
to Android-x86, frank.wu...@gmail.com
problem solved...i have to use "--part 2" in my efibootmgr-command:
efibootmgr --create --disk /dev/sda --part 2 --label "Android x86" --loader \\EFI\\grub_android\\bootx64.efi
because of my following gpt:
$ sudo parted -l
Modell: ATA SAMSUNG MZMTE256 (scsi)
Festplatte  /dev/sda:  256GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: gpt

Nummer  Anfang  Ende    Größe   Dateisystem  Name                          Flags
 
1      1049kB  1050MB  1049MB  ntfs                                       versteckt, diag
 
2      1050MB  1322MB  273MB   fat32        EFI system partition          boot

any idea how to get ubuntu (14.04) into the grub? tried with the following (copied block from win8 and used efi-file listed by efibootmgr -v) without luck:
menuentry 'Ubuntu' {
        search
--file --no-floppy --set=root /EFI/ubuntu/shimx64.efi
        chainloader
(${root})/EFI/ubuntu/shimx64.efi
}


Nick Cowan

unread,
Aug 19, 2015, 3:25:02 AM8/19/15
to Android-x86, frank.wu...@gmail.com
Hi Frank,

I think I have the same problem as you. I have Ubuntu and Windows 10 installed, but Android just won't load. If you've managed to get the below working, can you tell me what you did next, so that I can give it a try? Is it a case of installing Android in this new part?

Thanks,

Nick
Reply all
Reply to author
Forward
0 new messages