Halium / projectmanagement

141 stars 32 forks source link

[Review] Deployment, startup sequence, and OTA updates related notes #7

Open bhush9 opened 7 years ago

bhush9 commented 7 years ago

Last week @shadeslayer and I were at sprint and talked about random points/questions around halium and how to deploy it to device..


Stuff to deploy

Questions

OTA spec

Typical boot sequence

  1. Fastboot starts kernel with cmdline
  2. It loads the initrd
  3. Mounts the userdata partition
  4. Mounts rootfs image
  5. Starts init (systemd) -- weeeeeeeeeeeeeeeee!
  6. Mounts the /system, /vendor and other android mount points with sytemd mount units
  7. lxc pre-start hook mounts the android ramdisk
  8. Starts the lxc container
  9. Start the udev
  10. Scope of halium is now over, login manager or userspace services now can start

Based on the boot sequence provided above, I've initial prototype locally which is able to start android container.. but still needs some more polish during this week.

Kernel patch policy

mickybart commented 7 years ago

About Questions

1/ Kernels per distribution

We should prefer an approach like mer_verify_kernelconfig reworked for Halium needs. defconfig of every devices are too much different and so it is necessary to know which CONFIG* should be added. It will not be necessary easy to do a diff of a specific defconfig kernel with halium_defconfig to add missing options.

2/ rootfs.img

config file can be set for now somewhere on /data where multiple rootfs.img will be available. The initrd of halium will be able to read the config file and mount the good rootfs.img. In the future we can work to embedded a GUI (based on TWRP ?) that will permit to select images, provide password for dm-crypt etc in the initrd.

3/system.img

I vote for a separation.

5/ udev.rules

ueventd.rc and ueventd.$HARDWARE.rc need to be take into account. But some custom rules needs to be done per device :

eg for touchscreen: ACTION=="add|change", KERNEL=="event3", SUBSYSTEM=="input", ENV{ID_INPUT_KEY}="", ENV{ID_INPUT_TOUCHSCREEN}="1"

So final rules should be set by device maintainers (with the help of a script to extract rules) as there is no way to automatically do the one on the example.

6/ vendor.img

for device without vendor.img or vendor partition, a symlink /vendor to /system/vendor should be used (this is done by init.rc for example)

7/ android-ramdisk.img

Alternative: That can be a simple tgz of the out/target/product/"device"/root folder packaged/deployed by the distribution for the device. So we don't need to mount it at all and it can be simply extracted in /opt/android/rootfs for example.

Typical boot sequence

8 Starts the lxc container 9 Start the udev

Should not be 9 before 8 ? The start of lxc container means to start Android init but the init of Android should not populate /dev (so coldboot and /dev content should be done by systemd first). But maybe you are doing it in another way with a separate /dev ?

And I think that the start of lxc/android init should be done by a unit with constraints : After=sysinit.target Before=basic.target