GloDroid / glodroid_manifest

Android port that aims to bring both user- and developer-friendly experience in using AOSP with a set of single-board computers (SBC), phones and other devices.
472 stars 66 forks source link

Support p-boot bootloader and megi's kernel on PinePhone #108

Closed darkdragon-001 closed 3 years ago

darkdragon-001 commented 3 years ago

It would be awesome, if this could be integrated with p-boot multi-boot image.

I checked the structure:

I was wondering, how GloDroid/Android is structured. Is it possible to just flash an img file to sd-card without fastboot etc.? Which image contains the rootfs? Are any special kernel parameters needed for boot?

It would be really awesome if one could multi-boot GloDroid alongside Linux distros :blush:

rsglobal commented 3 years ago

It is possible, but not as easy as on linux distros. The easiest way is to put glodroid partitions alongside other, and then make p-boot to start u-boot and let it do remaining work.

rsglobal commented 3 years ago

Here is a partition list which is used by Android: https://github.com/GloDroid/glodroid_device/blob/1fe99ca9dd51119b07ce1e162b040b673f7c22fe/platform/uboot/bootscript.cpp#L29

darkdragon-001 commented 3 years ago

Thanks for your information!

Is there a way to merge all partitions into one or is it required to have them separately? Where are mount points configured (is there /etc/fstab as well)?

rsglobal commented 3 years ago

fstab is here: https://github.com/GloDroid/glodroid_device/blob/1fe99ca9dd51119b07ce1e162b040b673f7c22fe/common/fstab#L6

I can't tell anything regarding merging partitions into one. Linux can allow to use device mapper to create another block device using single partition as storage, but I've never done this before.

darkdragon-001 commented 3 years ago

Perfect, thanks!

For the underlying file systems: are there any limitations from the android side or can anything supported by the Linux kernel be used (e.g. btrfs)?

Does the kernel need any specific features or could megi's kernel be used for the PinePhone?

rsglobal commented 3 years ago

You can change filesystem type. Not sure about btrfs, but likely yes. We are using megi's kernel with little modifications which is required to run Android.

darkdragon-001 commented 3 years ago

Awesome!

Are your changes to the kernel documented somewhere? Can regular Linux be used with these changes as well? Would be awesome to use exactly the same kernel (only on filesystem once) for both 😊

rsglobal commented 3 years ago

Here is kernel sources: https://github.com/GloDroid/glodroid_forks/tree/kernel-sunxi-next The situation with defconfig is more complex. GloDroid composes it at build time using a lot of fragments. I still think the best way to include GloDroid into multiimage is to append all partitions AS IS and jump to u-boot to do remaining work. Also this would consume 6 or more GB of extra space on the final image.

darkdragon-001 commented 3 years ago

Hmmm 🤔

Including as is doesn't make sense. The cool thing of the multi-boot image is the small size (one kernel, btrfs with zfs compression). 17 distributions are all together about 8GB...

rsglobal commented 3 years ago

Kernel+BL part is pretty small. Not more than 64MB. framework+hal part takes about 1.5GB. I believe it may be compressed to 700 or so. But Android needs some space for usredata partition to store any external information (apks, downloads, etc.).

rsglobal commented 3 years ago

Android partition layout is too different from linux distros. Looks like nobody wants to start doing this. Closing for now.