intel / kernelflinger

BSD 2-Clause "Simplified" License
65 stars 67 forks source link

Using self-built kernelflinger for booting Android on Cherrytrail tablet? #4

Closed floe closed 3 years ago

floe commented 6 years ago

I apologize in advance for the relatively noob-ish question, but it's surprisingly hard to find information about the combination of x86 arch, EFI boot process, and Android.

I have a Cherrytrail-based dual-boot tablet (Chuwi Hi10 Pro) and have replaced the Windows installation with Linux (Ubuntu 18.04). The Ubuntu install works mostly fine, however, there is also an Android installation which I'd like to continue using.

The original bootloader which allowed selecting between Windows and Android is broken now after Linux installation and causes a bootloop. I've installed GRUB and can use that to boot Linux, but not Android (no surprise, slightly different boot protocol AFAICT).

Even though the original bootloader is an atrocity, it's nevertheless apparently based on kernelflinger:

$ strings loader.efi | grep -i fling
### KERNELFLINGER ###

Moreover, the partition layout matches exactly what's described in https://github.com/intel/kernelflinger/blob/master/doc/fastboot.md

So my main question now is: is it worth spending the effort to build kernelflinger myself? If I understand correctly, I will get an EFI binary that I can just drop onto my EFI partition and chainload from GRUB, correct?

poz1 commented 6 years ago

Hello floe, I am in a similar situation (my device is a Lenovo YogaBook). From my understandings KernelFlinger is composed of 2 EFI executables: 1) An installer, that simply partitions your drive and copies the various images (system, boot, etc) and sets KernelFlinger as default boot option in your EUFI 2) KernelFlinger that is the actual bootloader that boots android.

So yes, you can chainload it from GRUB but i don't believe it's necessary to rebuild it, you should be able to extract it from a ROM of a similar device (it should inject devices from the ACPI tables so it should work)

jeremy-compostella commented 6 years ago

Hello @floe ,

As poz1 said chainloading should work for you and you don't necessarily need to do rebuild it. Let us know if it works for you or if it fails with an error message.

@poz1, your point 2 is a bit incomplete. the installer.efi binary that you can build out of the Kernelflinger repository is basically the libkernelflinger and the libfastboot combined into a EFI shell like program which allow to provision a device from usb stick using fastboot like commands like "installer.efi flash system system.img". The Kernelflinger bootloader is capable of booting the Android image but also has a fastboot support baked into it (over USB or ethernet depending on what the UEFI BIOS exposes).

floe commented 6 years ago

@jeremy-compostella thanks for the clarification! Any suggestions where I could find a suitable kernelflinger EFI binary? As mentioned, the original bootloader on my device is some pseudo-GUI on top of what I presume to be kernelflinger, so I can't use that standalone...

jeremy-compostella commented 6 years ago

@floe

I also have a lenovo cherrytrail tablet. You can give a try to the old Kernelflinger 02.19 I have attached.

loader.efi.gz