Boot from sd card which is not available on EFI stage

409 views
Skip to first unread message

Oleg K

unread,
Jun 16, 2019, 10:42:07 AM6/16/19
to Android-x86
I have a device with small onboard disk, Chuwi Hi13 actually with w10 installed

Would like to install Android-x86 on SD card but there is a problem - sd card is not initialized during EFI boot stage, it needs OS drivers to work.
Workaround here is put kernel and initrd image on EFI partition but i didn't find what kernel parameters should i put to use system.img from different partition.

Are there any suggestions?

Sincerely
Oleg

Chih-Wei Huang

unread,
Jun 16, 2019, 10:41:41 PM6/16/19
to Android-x86
Oleg K <glo...@gmail.com> 於 2019年6月16日 週日 下午10:42寫道:
>
> I have a device with small onboard disk, Chuwi Hi13 actually with w10 installed
>
> Would like to install Android-x86 on SD card but there is a problem - sd card is not initialized during EFI boot stage, it needs OS drivers to work.
> Workaround here is put kernel and initrd image on EFI partition but i didn't find what kernel parameters should i put to use system.img from different partition.

Add SRC=<android-x86_path_in_that_partition>, e.g.,

SRC=/android-8.1-r2


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

Oleg K

unread,
Jun 16, 2019, 11:19:28 PM6/16/19
to Android-x86
Hi

Thanks for suggestion but unfortunately it doesn't help

To provide better description more details here:

$ lsblk -f
NAME         FSTYPE LABEL    UUID                                 FSAVAIL FSUSE
% MOUNTPOINT
mmcblk1                                                                          
|-mmcblk1p1  vfat            1D01-6B09                                99M    57% /boot
|-mmcblk1p2  ntfs            AAE0FA9DE0FA6F47                                    
`-mmcblk1p3  ntfs   Recovery 8EB0FB57B0FB446D                                    
mmcblk1boot0                                                                    
mmcblk1boot1                                                                    
mmcblk0                                                                          
|-mmcblk0p1  ext4   andr     8e373983-91b7-4710-afa0-482ec14aeb1d                
|-mmcblk0p2  ext4   arch     61b9d623-1ebc-4325-87fc-0bd1fdb6510e   30.7G     6% /

`-mmcblk0p3  swap   swap     ea1329fc-57dc-4ede-92f6-71513212626c                [SWAP]

mmcblk1 is visible in EFI, mmcblk0 visible after drivers load

mmcblk1p1 - EFI partition with grub/winloader/linux and android kernels

i'm trying to put android on mmcblk0p1 like i made for linux which is on mmcblk0p2

assuming mmcblk1p1 mounted as /boot and mmcblk0p1 as /tmp/andr:

# ls /boot
BOOTNXT  
Boot  EFI  android  bootmgr  grub  initramfs-linux-fallback.img  initramfs-linux.img  intel-ucode.img    shellx64.efi  vmlinuz-linux
# ls /boot/android/
initrd
.img  kernel  ramdisk.img

# ls /tmp/andr/
android
-8.1-r2    lost+found
# ls /tmp/andr/android-8.1-r2/
data  initrd
.img  kernel  ramdisk.img  system.img

grub.cfg menuentry:

menuentry "Android X86" {
    search
--no-floppy --set=root --fs-uuid 1D01-6B09

    linux
/android/kernel root=/dev/ram0 androidboot.selinux=permissive SRC=/android-8.1-r2
    initrd /
android/initrd.img
}

It boots android kernel but that's it, shows only more and more dots

Thanks
Oleg

Chih-Wei Huang

unread,
Jun 16, 2019, 11:25:53 PM6/16/19
to Android-x86
Oleg K <glo...@gmail.com> 於 2019年6月17日 週一 上午11:19寫道:
I thought you have added the driver to kernel
or modify initrd to load it manually.
If not, it won't work, of course.

Oleg K

unread,
Jun 17, 2019, 11:36:12 PM6/17/19
to Android-x86
Strange thing here

the driver used by sd card reader is built into the kernel, sdhci-pci
but the driver doesn't initialize the reader on the early stages of boot

lspci -k on early boot shows that the driver used by onboard flash, but not attached to sd card reader

It seems that the reader initialized after uedev starting

Any thoughts or directions where i can dig?

Thanks
Oleg

Oleg K

unread,
Jun 18, 2019, 5:54:37 AM6/18/19
to Android-x86
Finally found a driver which initializes sd card reader and now android boots as expected

it is pinctrl_broxton

Added to initrd and modprobed in init script

Stavros Christodoulou

unread,
Jun 19, 2019, 11:59:27 AM6/19/19
to Android-x86
Can you show how you did it? Did you mount initrd.img and manually add the module and edit the init script inside?

Oleg K

unread,
Jun 19, 2019, 9:32:32 PM6/19/19
to Android-x86
Yes, right this way

Stavros Christodoulou

unread,
Jun 21, 2019, 8:41:17 AM6/21/19
to Android-x86
I cannot find any module directories in initrd, what did you do exactly to add the module?

Oleg K

unread,
Jun 21, 2019, 9:03:44 AM6/21/19
to Android-x86
In short:

unsquashfs $PATH_TO_ANDR_ROOT/system.sfs
mkdir /tmp/system
mount -O loop ./squashfs-root/system.img /tmp/system
mkdir -p $PATH_TO_EXTRACTED_INITRD/system/lib/
cp -rv /tmp/system/lib/modules $PATH_TO_EXTRACTED_INITRD/system/lib

now one can make initrd with all modules included (i did it for test purposes, after i found the modules i nedded i removed others)
that's it

DDS Central

unread,
Jun 21, 2019, 10:09:01 AM6/21/19
to Android-x86
I do this on my T100TA for a long time. /system is located on a 8GB embedded recovery drive which is unbootable from EFI. /data is located on a microSD card which is also unbootable. To get the system to boot, I just had to copy the kernel and initrd to the EFI partition and add an extra entry to grub.cfg to look for kernel and initrd in EFI partition.
When the kernel takes over, it should be able to find your storage devices and mount them.

--
You received this message because you are subscribed to the Google Groups "Android-x86" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-x86...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-x86.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-x86/00875fd4-bd1e-4983-8c79-bc224de7cce9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oleg K

unread,
Jun 21, 2019, 10:28:17 AM6/21/19
to Android-x86
To get the system to boot, I just had to copy the kernel and initrd to the EFI partition and add an extra entry to grub.cfg to look for kernel and initrd in EFI partition.

On Friday, June 21, 2019 at 2:09:01 PM UTC, DDS Central wrote:
To get the system to boot, I just had to copy the kernel and initrd to the EFI partition and add an extra entry to grub.cfg to look for kernel and initrd in EFI partition.
When the kernel takes over, it should be able to find your storage devices and mount them.

That doesn't work, if required driver is compiled as a module. In this case there are two options - add the module to initrd or recompile the kernel and make the driver static.
 
To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.

DDS Central

unread,
Jun 21, 2019, 11:29:28 AM6/21/19
to Android-x86
True. Storage driver has to be either built into kernel or added to the initrd and loaded manually by a boot script. In my case, the driver was a built-in by default.

To unsubscribe from this group and stop receiving emails from it, send an email to android-x86...@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-x86.

Stavros Christodoulou

unread,
Aug 13, 2019, 4:35:14 PM8/13/19
to Android-x86
Can you share the grub.cfg entry?
To unsubscribe from this group and stop receiving emails from it, send an email to andro...@googlegroups.com.

Oleg K

unread,
Aug 16, 2019, 7:35:59 AM8/16/19
to Android-x86
menuentry "Android X86" {
    search --no-floppy --set=root --fs-uuid 1D01-6B09

    linux /android/kernel root=/dev/ram0 androidboot.selinux=permissive SRC=/android-8.1-r2 video=1500x1000
    initrd /android/initrd.img
}

ouija

unread,
Aug 17, 2019, 1:29:18 AM8/17/19
to Android-x86
This is what I was hoping to achieve regarding my post at: https://groups.google.com/forum/#!topic/android-x86/vMTG5v0QGtU

Using the idea of creating an 'android-8.1.-r2' folder in the efi partition of mmcblk1p1 (which is detected by EFI) and having it contain the kernel, ramdisk.img, and initrd.img files, along with formatting the SD Card to an ext4 partition with the installed /android-8.1-r2 folder (kernel, ramdisk.img, initrd.img, system.img and data folder) made the system finally boot with detecting Android-x86 on mmcblk2p1...

However, it never finishes booting, and is stuck in a boot loop on the android logo forever.

Trying to load in debug mode, but the terminal won't stay open as it looks like its restarting boot over and over or something..

Note that I also have to use the "sdhci_debug_quirks=0x1000" flag or the sdcard is in read-only mode and I get errors related to this when booting.

Any ideas what may cause this?

It would be cool to get Android running off the sdcard on this unit and have it dual-boot alongside Windows, but it's really been a challenge to try and achieve this and I'm about to give up.. :)


ouija

unread,
Aug 17, 2019, 1:31:05 AM8/17/19
to Android-x86
Sorry, typo there; That should say sdhci.debug_quirks=0x10000

Chih-Wei Huang

unread,
Aug 20, 2019, 5:40:54 AM8/20/19
to Android-x86
ouija <djo...@gmail.com> 於 2019年8月17日 週六 下午1:29寫道:
>
> This is what I was hoping to achieve regarding my post at: https://groups.google.com/forum/#!topic/android-x86/vMTG5v0QGtU
>
> Using the idea of creating an 'android-8.1.-r2' folder in the efi partition of mmcblk1p1 (which is detected by EFI) and having it contain the kernel, ramdisk.img, and initrd.img files, along with formatting the SD Card to an ext4 partition with the installed /android-8.1-r2 folder (kernel, ramdisk.img, initrd.img, system.img and data folder) made the system finally boot with detecting Android-x86 on mmcblk2p1...
>
> However, it never finishes booting, and is stuck in a boot loop on the android logo forever.

One possible reason is the kernel modules in your system.img
don't match with the kernel. (so no modules are loaded)

Anyway, try to switch to console (by Alt-F1) and
type 'stop', then you can check logcat, lsmod, etc.
(you may need to try several times since it may
switch back to graphic mode soon)


> Trying to load in debug mode, but the terminal won't stay open as it looks like its restarting boot over and over or something..
>
> Note that I also have to use the "sdhci_debug_quirks=0x1000" flag or the sdcard is in read-only mode and I get errors related to this when booting.
>
> Any ideas what may cause this?
>
> It would be cool to get Android running off the sdcard on this unit and have it dual-boot alongside Windows, but it's really been a challenge to try and achieve this and I'm about to give up.. :)



Reply all
Reply to author
Forward
0 new messages