Share via


Phone storage service

This section describes the boot preparation executable (BootPrep) and a kernel notification service (KernelNotifyService) that runs after the device boots. The boot preparation executable is a Session Manager Subsystem (SMSS) loaded executable that performs a minimal set of operations to get the rest of the system running. The kernel notification service is a regular Windows service that sends and receives notifications for various events, including storage and power management events.

Both components run in user mode.

Boot preparation executable (BootPrep)

This service is responsible for the following actions:

  1. Extending the data partition. When the image is generated, it contains a Data partition with a formatted NTFS file system. However, to keep the image size small and so that it can be flashed on parts with various storage sizes, the Data partition in the generated image is smaller than the actual size that will be used on the phone when it is fully initialized. The boot service will detect this initial, smaller Data partition, and then extend the Data partition to the end of the disk.

  2. Duplicating the GUID Partition Table (GPT). The GPT standard requires a primary and secondary copy of the GPT. The initial image contains only the primary copy, so the boot service will need to create the secondary copy. This cannot be done when the image is generated because the secondary copy is put the end of disk and the disk size is not known when the image is generated.

  3. Provisioning the Data partition. The folder layout of the Data partition is initialized by copying directory trees from the Main OS partition to the Data partition. Copy only data that needs to be copied early in the initialization sequence here. The Main OS partition will include a mirror directory, which contains the entire directory tree to copy. Some additional directories from CoreSystem are copied, such as the default user account directory.

Kernel notification service (KernelNotifyService)

This service is responsible for the following storage events:

  1. Detecting the arrival and removal of the SD card. The service detects the arrival and removal of the SD card and sends the mount/dismount notification to applications. The Windows Notification Facility (WNF) sends the event.

  2. Detecting unformatted SD cards. If the SD card is unformatted, the service sends a WNF event to trigger the dialog box to ask the user if they want to format the card. The shell application that receives this event is responsible for issuing the format command.

  3. Sending the low–disk space notification. The service monitors the free space on both the internal data partition and the SD card. If the disk space falls below a certain threshold, the WNF sends a low–disk space notification. This notification triggers the automatic deletion of temp files and a low–disk space toast.

  4. Handling read and write failures. The service monitors any read and write failures to both internal and external storage. A series of repeated read or write failures to internal storage triggers a reboot, because it is likely that the block driver is in a bad state. A series of repeated read or write failures to the SD card triggers the SD card to dismount, and sends a message to the user, informing them of the event.

  5. Handling the dirty bit. The file system sets the dirty bit when a file system corruption is detected or suspected. However, the dirty bit often can be a false positive. The exact handling of the dirty bit on either internal volumes or the SD card has not yet been determined.

The following diagram shows the components that the KernelNotifyService interacts with. The numbers in the diagram correspond to the operations listed earlier in this section.

Load order

The following list shows the load order of the Boot Preparation Executable and the Kernel Notification Service relative to other related components that affect initial device provisioning.

  1. Boot Preparation Executable – Runs when boot-execute services run. Only runs on first boot.

  2. Account Provisioning Service – Creates all of the accounts on the device. This includes the default application account, where all of the application containers are stored. This service also creates individual application containers for built-in applications.

  3. Kernel Notification Service – Auto-starts during boot and stays running. It needs to start before any applications that depend on the SD card.

  4. Phone Provisioner – Provisions the device based on ProvXML files.

Storage model

 

 

Send comments about this topic to Microsoft