flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > An UEFI chainloader for x86 android devices, possible?[Info]

Author
Thread Post new topic Reply to topic
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 08 Mar 2019, 08:59
I ve got an generic x86 phone and im playing around as a hobby to get it to boot
normal pc operating systems like linux or maybe even windows(driver situation unclear) with a chainloader that executes after aboot(the closed android bootloader) starts to execute the second stage loader for the kernel. Ive compiled some information about x86 devices but i had personally no success to get a chainloader execute without crashing the machine.
All x86 android devices seem to use uefi or bios as loader to load aboot.

"On the few Intel devices I've had the pleasure of working with, BIOS was used. Intel is likely trying to push UEFI for its devices, though I haven't seen any personally. If you have an Intel device and want to send me a dump of it's boot partition, I'd appreciate it. "
http://newandroidbook.com/Articles/aboot.html

My device for example seems to use uefi
Code:
static struct efivar_entry *uefi_get_var_entry(wchar_t *varname)
{
        struct efivar_entry *entry;

        efivar_entry_iter_begin();
        entry = efivar_entry_find(varname, EFI_GLOBAL_VARIABLE_GUID,
                                  &efivar_sysfs_list, false);
        efivar_entry_iter_end();

        return entry;
}
    

Source is the file reboot_target_uefi.c from the ASUS_ZenFone_ZX551ML kernel
https://forum.xda-developers.com/android/software-hacking/kernel-source-asus-devices-sources-t3625466

I couldnt find any datasheets that mention if the gpu(powervr) is vga capable and if the uefi/bios supports it.
The exact cpu used is the intel atom z3580.
So as i understand this is what i need to do/know.
1. Create a boot.img file with an modified secondstage loader.(*Partial success)
2. A way to set up the video memory without the bios or uefi to get information and test if bios/uefi
stuff is awailable(could be done in real mode).
3. If above is working load an uefi/bios bootloader from memory(can be included in the secondstage loader as file or replace the kernel elf) relocate it to the needed position in memory and jump to its entry point.(*8k limit for second.img file so probably needs to be replace by the kernel elf for grub)
4. Drivers for the sdcard slot (clover or grub) so an os can be loaded.(*Connected over pci)

The suspected boot process is
BIOS/UEFI->POST(dnxfwr.bin?)->Aboot->Bootimg->SecondStage->Android.

Parts list used by the phone

    SK Hynix H26M52103FMR 16 GB eMMC 5.0 flash memory

    Intel 8818 XGold 223

    Intel PMB 5747 RF Controller

    SkyWorks 77627-11 Network Power Amplifer Module

    Murata 6PH47

    Qualcomm SMB 1357 Quick Charge 2.0 IC

    Intel PMB 6830 - Power Management IC

    Winbond W978H6KBVX2E - 256Mb Low Power DDR2 SDRAM used for aiding the baseband processor.

    Intel PMB 9933 Baseband processor

    SK Hynix H9CKNNNCPTMR - 4 GB LPDDR3 RAM with the Intel Atom Z3560 processor layered underneath as PoP.

    Realtek ALC 5647 audio chip.

    Broadcom BCM4339XKUBG - Dual band WiFi

    more...

If someone has experience with this type of project i would be great full for any kind of advice and also if this is a possible project if someone tried something similar already.

Thanks in advance.


Last edited by dstyl on 08 Mar 2019, 09:57; edited 1 time in total
Post 08 Mar 2019, 08:59
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12934
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 08 Mar 2019, 09:08
I learn something regarding the uefi,

32bit uefi must use 32bit OS even if the processor is capable to run 64bit,

and 64bit uefi must use 64bit OS even if the memory only have 2GB,

should determine if the device came with 32 / 64 bit efi,

efi boot in windows would be attained through

bcdboot w:\windows /s s:

s is efi boot partition

w is windows directory
Post 08 Mar 2019, 09:08
View user's profile Send private message Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 08 Mar 2019, 10:04
Thanks a lot for the advice, sadly im far away fron getting a windows kernel to boot or to know which uefi type is used.
I just could check if an hlt instruction in the second stage loader freezes the phone which it does instead of directly rebooting but thats it Very Happy .
Im struggling at the moment with setting up the vga stuff and have no clue how to do it without the bios/uefi.
Post 08 Mar 2019, 10:04
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12934
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 08 Mar 2019, 16:08
i am interested with chained boot also, maybe using grub2 or etc that support efi booting, and chained boot,

try check the default os bit that came along with the device, i got a acer tablet that came with windows 8.1, and later 10,

am having a desire to boot that tablet into windows 7, which didn't offer efi booting, i was thinking about using chained boot, maybe we could collaborate and learn something through the process,
Post 08 Mar 2019, 16:08
View user's profile Send private message Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 10 Mar 2019, 06:39
Which acer tablet? shure i can send you what ive got so far via pm. I cant dump the partition that seems to hold the efi/bios stuff (mmcblk0boot0).
If youre device uses blinkboot you could use easybcd to add an entry to the windows bootloader to chainload grub/linux from usb and then install it from there.
Im not shure how similar these device are since my uses aboot after the uefi did its job and yours propably is locked via some sort of secure boot and a closed bios menu.
Post 10 Mar 2019, 06:39
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12934
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 10 Mar 2019, 15:26
acer tablet,
https://www.acer.com/ac/en/GB/content/model/NT.L7GEK.002
iconia 810, the original os is windows 8.1 and up-gradable to windows 10,

1gb memory, efi 32bit, able to turn off secure boot through bios, power + sound during boot, or hold sound during power on,

i try grub2 on it later, not sure if it is possible to efi grub2 and boot mbr windows 7?
Post 10 Mar 2019, 15:26
View user's profile Send private message Reply with quote
dstyl



Joined: 23 Jul 2015
Posts: 67
dstyl 14 Mar 2019, 15:06
Why just not use grub in mbr mode?
Just use clover if you want an easy multiboot from usb it includes an loadeble uefi called duet.
You can easily make an bootable usb using bootdisk utility.
https://sourceforge.net/projects/cloverefiboot/
http://cvad-mac.narod.ru/index/bootdiskutility_exe/0-5
Post 14 Mar 2019, 15:06
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12934
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 15 Mar 2019, 01:56
Most tablet doesn't support mbr boot, they only allow boot through uefi,

I saw clover before (the green leaf) if I am not mistaken, afaik, uefi booting means partition first 100 with fat32, it doesn't needs extra program to do this, I could be wrong,

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions

Or this only works when using Windows 8, 8.1 and 10?
Code:
create partition efi size=100
format quick fs=fat32 label="System"    


Another tool that I use is BootIce that available in Hiren's Boot ISO (not sure if below link is the one)
https://www.majorgeeks.com/files/details/bootice_64_bit.html

Look more like this,
https://www.freewarefiles.com/Bootice_program_95133.html
Post 15 Mar 2019, 01:56
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.