3

I'm switching from busybox to toybox in a customized Yocto. After the switch I no longer have /dev/block/ populated.

I'd like to learn how /dev/block/bootdevice/by-name is populated? Is this done by mdev?

The toybox mdev command is still in pending. However, the /dev/block/bootdevice/by-name seems to be an Android feature which is using toybox irc.

Étienne
  • 4,773
  • 2
  • 33
  • 58

1 Answers1

2

In Android there are a couple of parts to this:

  1. /dev/block/bootdevice is created by an init script, for example init.hardware.rc:

    symlink /dev/block/platform/${ro.boot.boot_devices} /dev/block/bootdevice
    

    In this case the ro.boot.boot_devices property is derived from the kernel command line argument set when the kernel image is built by BoardConfig-common.mk:

    BOARD_KERNEL_CMDLINE += androidboot.boot_devices=soc/1d84000.ufshc
    

    (All androidboot.* command line options are converted into ro.boot.* properties by init, see ProcessKernelCmdline()).

  2. /dev/block/platform/* links are created by ueventd (which is part of the Android version of init). The function responsible for this is DeviceHandler::GetBlockDeviceSymlinks().

    This function is also responsible for creating the /dev/block/platform/*/by-name links based on the partition names supplied by the kernel in the uevent. Not all partition schemes supply a partition name, for example GPT does while a DOS MBR partition table does not.

    More recent versions of this function will also create generic links in /dev/block/by-name for partitions on the boot device. The boot device is again identified using the androidboot.boot_devices kernel command line option.

Stuart Menefy
  • 618
  • 3
  • 6