-
Notifications
You must be signed in to change notification settings - Fork 2
Android boot device and usb gadget
Android reference to kernel cmdline and(or) bootconfig to gather boot info. Here are examples:
- Android 9 and older
- androidboot.bootdevice=8804000.mmc
- androidboot.bootdevice=1d84000.ufshc
- androidboot.usbcontroller=a600000.dwc3
- Android 10 and newer
- androidboot.boot_device=soc/1d84000.ufshc
- androidboot.boot_device=soc/8804000.mmc
- androidboot.usbcontroller=a600000.dwc3
- Mainline device tree arrangement had changed a bit for soc node or change device tree to revert old behavior:
- androidboot.boot_device=soc@0/1d84000.ufshc
- androidboot.boot_device=soc@0/8804000.mmc
- androidboot.usbcontroller=a600000.usb
For example, if situration like, there are cmdline option from androidboot img and append some more by bootloader, generally bootloader will post-pending to the tail end of cmdline.
This behavior can let developer to override bootloader postpended option by prepending them at first of cmdline of the androidboot img. subsequently android boot init will get those androidboot.* as property and hence setup ro.boot.*; since this is ro property, only set once and no change afterward, so bootloader postpending value can result overridden by those cmdline prepending value.
This is a mechanism to set androidboot.boot_device to mmc/sdcard instead of default ufs boot by bootloader. Thus archive Android sdcard boot on phone device.
One puzzle is bootconfig vs boot cmdline priority. This is greatly depending init to grab from bootconfig or cmdline with priority and is not documented elsewhere. android (LOS) source code might change this behavior so not very conclusive. If there are important value to override, put in head of cmdline is a better choice.
Generally android boot init will create /dev/block/ and then loop through udev and making all block dev node. then /dev/block/bootdevice is created. Also /dev/block/by-name is also created.
In this situation, /dev/block/platform/ will have all available block device within. the symlink of /dev/block/bootdevice is depending of androidboot.bootdevice/androidboot.boot_device like below:
Android 9 | newer
/dev/block/platform/$(androidboot.boot_device)
Older Android treat it as
/dev/block/platform/soc/$(androidboot.bootdevice)
And the devicetree influrence is "soc" node and newer "soc@0" node.