System startup method, readable storage medium and electronic device
By using N-K mounting parameters to remount the data partition during the system startup process of the electronic device, the startup problem caused by the storage media failure is solved and the normal startup and data backup of the device are ensured.
Patent Information
- Application Number
- CN202311000387.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-09
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-08-09
AI Technical Summary
When the storage medium fails, the electronic device cannot start normally, causing the operating system to be unable to load the data partition, affecting the system startup process.
Provide a system startup method. After the data partition fails to be mounted based on N mount parameters, N-K mount parameters are used to remount the data partition, and after success, the desktop launcher, process incubator and system service process are run. If If the startup fails, continue to reduce the mount parameters to remount until it starts successfully.
Even if the storage partition media is damaged or faulty, and is only related to some mounting parameters, the electronic device can still start normally, and after successful startup, the user will be prompted that the storage medium may be damaged to ensure data backup and avoid data loss.
Smart Images

Figure CN117707629B
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a system startup method, a readable storage medium and an electronic device. Background Art
[0002] The boot process of the operating system of an electronic device usually includes the bootloader stage, the kernel stage, the initialization stage, the zygote stage, the system server stage and the launcher stage. In the init stage, the electronic device will mount different partitions, such as the system partition and the data partition, so as to load the data of the subsequent stages.
[0003] In some scenarios, if the memory of the electronic device fails, for example, the storage medium for storing the data partition is damaged or abnormal, the electronic device will fail to load the data partition. In this way, the electronic device will not be able to enter the subsequent stage, resulting in the electronic device's operating system failing to start normally. Summary of the invention
[0004] In view of this, the present application provides a system startup method, a readable storage medium and an electronic device.
[0005] In a first aspect, the present application provides a system startup method, wherein the electronic device includes a data partition; and the method includes: mounting the data partition based on N mount parameters during the startup of the operating system of the electronic device, wherein the mount parameter is the mount parameter corresponding to the file system of the data partition, and N is an integer greater than 1; if mounting the data partition based on N mount parameters fails, mounting the data partition based on NK mount parameters, wherein K is a natural number, and K is less than N; after successfully mounting the data partition based on NK mount parameters, running the desktop launcher.
[0006] By using this method, during the boot process of the operating system of the electronic device, after the data partition fails to be mounted based on N mount parameters, the data partition can be remounted based on NK mount parameters. After the data partition is successfully mounted based on NK mount parameters, the desktop launcher is run. In this way, if the medium of the storage partition in the electronic device is damaged or the faulty part is only related to some mount parameters, the electronic device can still be started normally.
[0007] Optionally, if the electronic device successfully mounts the data partition based on N mounting parameters, a process incubator, a system service process, and a desktop launcher may be run.
[0008] In a possible implementation of the first aspect, the step of mounting the data partition based on NK mount parameters includes: selecting NK mount parameters from N mount parameters, and mounting the data partition based on the NK mount parameters.
[0009] In a possible implementation of the first aspect, the method further includes: if mounting the data partition based on NK mounting parameters fails, mounting the data partition based on NK-1 mounting parameters.
[0010] That is, if the electronic device fails to mount the data partition based on NK mount parameters, the mount parameters can be further reduced to mount the data partition. If the data partition is successfully mounted, the operating system of the electronic device can continue to be started. If the data partition cannot be successfully mounted without mounting any mount parameters, the operating system of the electronic device fails to start.
[0011] In a possible implementation of the first aspect, after the data partition is successfully mounted based on NK mount parameters, the desktop launcher is run, including: after the data partition is successfully mounted based on NK mount parameters, the process incubator, the system service process and the desktop launcher are run.
[0012] That is to say, the startup process of the operating system of the electronic device may include mounting the data partition, running the process incubator, the system service process and the desktop launcher. After the electronic device successfully mounts the data partition, it may run the process incubator, the system service process and the desktop launcher.
[0013] In a possible implementation of the first aspect above, the method also includes: during the running of the process incubator, the system service process and the desktop launcher, the operating system startup is not completed; based on the incomplete operating system startup, the data partition is mounted based on NP mount parameters, wherein P is greater than or equal to K, and at least one mount parameter among the NK mount parameters is different from the mount parameters among the NP mount parameters; after the data partition is successfully mounted based on the NP mount parameters, the process incubator, the system service process and the desktop launcher are run.
[0014] That is to say, if the data partition is mounted successfully based on NK mount parameters, but the operating system of the electronic device fails to start during the process of running the process incubator, the system service process and the desktop launcher, the electronic device can also remount the data partition using NP mount parameters different from the NK mount parameters. And after the data partition is mounted successfully based on the NP mount parameters, the process incubator, the system service process and the desktop launcher are rerun. In this way, the possibility of the operating system startup function of the electronic device can be further improved.
[0015] In a possible implementation of the first aspect, the method further includes: starting a virtual machine of an operating system during the running of the process incubator.
[0016] In a possible implementation of the first aspect, the method further includes: starting a service of the operating system during the running of the system service process.
[0017] In a possible implementation of the first aspect, the method further includes: during the running of the desktop launcher, based on the completion of the operating system startup, calling the finishBooting function to set the flag bit sys.boot_completed to valid.
[0018] In some implementations, when the flag bit sys.boot_completed is valid, it is used to indicate that the operating system boot is complete.
[0019] In a possible implementation of the first aspect, the method further includes: after the data partition is successfully mounted based on NK mount parameters, setting an exception flag to valid, where the exception flag is valid when the data partition is not mounted using the N mount parameters.
[0020] In a possible implementation of the first aspect, the method further includes: after the operating system is started, based on the validity of the abnormal flag, displaying a first interface, wherein the first interface includes information indicating that the memory of the electronic device is damaged.
[0021] That is to say, when the electronic device is starting the operating system, if the data partition is mounted using mount parameters other than the above N mount parameters, the electronic device can prompt the user that the memory may be lost after the operating system is started, so that the user can back up the data in time.
[0022] In a possible implementation of the first aspect, the method further includes: in response to a user's operation of backing up data on the first interface, backing up at least part of the data in the data partition.
[0023] In a possible implementation of the first aspect above, the above-mentioned N mount parameters include at least one of the following mount parameters: rw, seclabel, nosuid, nodev, noatime, background_gc=on, discard, no_heap, user_xattr, inline_xattr, acl, inline_data, inline_dentry, extent_cache, mode=adaptive, active_logs=6, inlinecrypt, alloc_mode=default, fsync_mode=nobarrier.
[0024] In a possible implementation of the first aspect, the step of mounting the data partition based on NK mounting parameters includes:
[0025] Use the mount command to mount the data partition, where the mount command includes NK mount parameters.
[0026] In a second aspect, the present application provides a readable storage medium, which includes instructions. When the instructions are executed by an electronic device, the electronic device implements the above-mentioned first aspect and any possible implementation method provided by the above-mentioned first aspect.
[0027] In a third aspect, the present application provides an electronic device, comprising: a memory for storing instructions; and at least one processor for executing instructions so that the electronic device implements the system startup method provided by the first aspect and any possible implementation of the first aspect.
[0028] In a fourth aspect, the present application provides a program product, which, when running on an electronic device, enables the electronic device to implement the system startup method provided in the first aspect and any possible implementation of the first aspect.
[0029] The beneficial effects of the second to fourth aspects mentioned above can be referred to the description of the first aspect mentioned above, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 According to some embodiments of the present application, a schematic diagram of a software architecture of an electronic device is shown;
[0031] Figure 2 According to some embodiments of the present application, a schematic diagram of a startup process of an electronic device is shown;
[0032] Figure 3 According to some embodiments of the present application, a schematic diagram of displaying prompt information after the operating system of an electronic device is started is shown;
[0033] Figure 4 According to some embodiments of the present application, a flow chart of a system startup method is shown;
[0034] Figure 5 According to some embodiments of the present application, a schematic structural diagram of an electronic device 10 is shown. DETAILED DESCRIPTION
[0035] Illustrative embodiments of the present application include, but are not limited to, a system startup method, a readable storage medium, and an electronic device.
[0036] The technical solution of the present application is described below in conjunction with the accompanying drawings.
[0037] The system startup method provided in the embodiment of the present application can be applied to any electronic device, including but not limited to mobile phones, tablet computers, wearable devices, head-mounted displays, mobile email devices, portable game consoles, portable music players, reader devices, laptops, smart home devices, etc., and the embodiment of the present application is not limited.
[0038] First, take the operating system of the electronic device as Taking the operating system as an example, the process of starting the operating system of an electronic device is introduced.
[0039] Figure 1 According to some embodiments of the present application, a schematic diagram of a software architecture of an electronic device is shown.
[0040] like Figure 1 As shown, the software architecture of the electronic device includes an application layer, an application framework layer, a local layer and a kernel layer.
[0041] The application layer includes applications in the electronic device, such as a desktop launcher (also called a desktop, desktop application, etc.). In some embodiments, the launcher process can call the finishBooting() function to set a flag indicating that the operating system is completed (such as the flag sys.boot_completed) to be valid when running.
[0042] The application framework layer is used to provide an application programming interface (API) and a programming framework for applications in the application layer.
[0043] In some embodiments, the application framework layer may include a system service (system server). The system server process corresponding to the system service can be used to start various services in the Java framework at runtime, such as: Device Identifiers Policy Service (DIPS), Power Manager (PM), System Recovery Service (RSS), Backlight Service (Lights Service, LS), System Service Manager (SSM), Input Management Service (IMS), Window Management Service (WMS), etc.
[0044] The native layer may include a C language base library, a C language tool library, an init process, a service manager, etc. When the init process is running, it may mount the file system in the electronic device, load Selinux (security-enhanced linux, a security policy) rules, initialize the operating system, and start the service manager process and the zygote process.
[0045] In other embodiments, the local layer may further include more modules, such as a hardware abstraction layer, etc., which is not limited here.
[0046] The application framework layer and the local layer communicate through Java native interface (JIN). The zygote process is between the application framework layer and the local layer. The zygote process can start the virtual machine (Dalvik virtual machine or ART virtual machine) and the system server process at runtime. The zygote process can also define a port (socket) to receive requests from the Activity Manager Service (AMS) to start the application.
[0047] The kernel layer may include kthreadd processes, swapper processes, drivers, and the like.
[0048] When the swapper process is running, it can be used to initialize process management, memory management, load drivers, and start the init process and threadd process. The kthreadd process is the first process of the operating system kernel, which is used to create kernel daemons such as kernel worker threads kworkder, soft interrupt threads ksoftirqd, and thermal.
[0049] Optionally, in other embodiments, the software architecture of the electronic device may further include more layers, and each layer may further include more modules, which is not limited here.
[0050] Combine the following Figure 1 The software architecture shown is the process of starting up the operating system of an electronic device.
[0051] Figure 2 According to some embodiments of the present application, a schematic diagram of a startup process of an operating system of an electronic device is shown.
[0052] like Figure 2 As shown, the process of starting the operating system of the electronic device includes the following stages:
[0053] S01, BootRom stage.
[0054] After the electronic device is started, for example, after the user presses the power button of the electronic device, the electronic device is powered on and enters the BootRom stage. In the BootRom stage, the electronic device boot chip code starts to execute from a predefined storage location (such as a read-only memory (ROM) solidified in the electronic device), loads the boot program (such as Bootloader) into the random access memory (random access memory, RAM, such as the memory of the electronic device or the cache of the electronic device processor) of the electronic device, and then starts to execute.
[0055] S02, Bootloader stage.
[0056] After loading the Bootloader into RAM, the electronic device enters the Bootloader stage. Bootloader, also known as a boot program, is a program that runs before the operating system of the electronic device runs. It is used to copy the operating system image file to RAM and then jump to the entry of the image file to execute the file. It can also be called entering the startup loading mode.
[0057] Optionally, in some embodiments, in the Bootloader stage, the electronic device can start the application primary boot loader (APPS PBL), the extensible boot loader (XBL), the application boot loader (ABL), etc. Among them, APPS PBL can be used to initialize the operating system security environment, determine the boot device of the operating system (such as a memory), etc.; XBL is used to initialize the hardware environment of the electronic device, and the code security environment, etc.; ABL can be used to initialize the display driver, provide a fast boot (fastboot) function, and guide the electronic device into the kernel stage (for example, start the swapper process in the kernel), etc.
[0058] Optionally, in some embodiments, in the Bootloader stage, the electronic device may also start a little kernel (LK). The LK may be used to initialize the hardware of the electronic device, guide the electronic device into the kernel stage (eg, start a swapper process in the kernel), and the like.
[0059] S03, kernel stage.
[0060] In the kernel stage, the electronic device runs processes in the kernel layer. For example, the swapper process can be run to start the kthreadd process and initialize the operating system kernel of the electronic device (for example, setting cache, protected memory, schedule list, loading drivers, etc.). At the end of the kernel startup stage, the electronic device can start the init process.
[0061] S04, init phase.
[0062] In the init phase, the electronic device runs the init process. The electronic device can mount the file system in the electronic device, load Selinux (security-enhanced linux, a security policy) rules, initialize the operating system, start the service manager process in the local layer, and start the zygote process by running the init process.
[0063] Exemplarily, in the process of mounting a file system in an electronic device, partitions related to the electronic device can be mounted, such as a boot partition, an initial boot (init_boot) partition, a system partition, a recovery partition, a data partition, etc.
[0064] In some embodiments, the data partition is also referred to as a user data partition, which is used to store data of the user of the electronic device, such as user-installed applications, user images / videos / audios or other forms of files.
[0065] In some embodiments, different partitions may correspond to different file systems, and different file systems may be mounted using mount parameters supported by the file system. For example, for a data partition, it may usually be mounted as F2FS (flash friendly file system, a file system for NAND storage devices). F2FS supports multiple mount parameters. When mounting a partition whose file system is F2FS (e.g., a data partition), one or more mount parameters may be selected from the multiple mount parameters to mount the data partition. In the init stage, electronic devices usually mount data partitions using preset mount parameters (e.g., using all mount parameters supported by F2FS). The mount parameters supported by F2FS will be described in detail below and will not be elaborated on here.
[0066] Optionally, in some embodiments, for a partition whose file system is F2FS, it may be mounted without adding any mount parameters, which is not limited here.
[0067] S05, zygote stage.
[0068] In the zygote stage, the electronic device runs the zygote process, which is the parent process of all Java processes. For example, zygote can start a virtual machine (Dalvik virtual machine or ART virtual machine) and a system server process. The zygote process can also define a port (socket) to receive requests from the Activity Manager Service (AMS) to start an application.
[0069] S06, system server stage.
[0070] In the system server stage, the electronic device can start the services in the electronic device operating system by running the system server process of the application framework layer.
[0071] Exemplarily, the electronic device can run AMS, load the service library of the operating system, call createSystemContext(), create ActivityThread, and load various services, such as loading DIPS, PM, RSS, LS, SSM, IMS, WMS and other services.
[0072] S07, launcher stage.
[0073] In the launcher stage, the electronic device runs the launcher process. During the running of the Launcher process, the finishBooting() function can be called to set the flag indicating the completion of the operating system (such as the flag sys.boot_completed) to be valid (such as set to 1), and the operating system startup is completed.
[0074] The above-mentioned stage division in the process of starting the operating system of the electronic device is only an example. In other embodiments, the process of starting the operating system of the electronic device may include more or fewer stages, and some stages may be merged or split, which is not limited here.
[0075] In the init stage of the startup process of the operating system of the above-mentioned electronic device, the electronic device will mount the data partition through the preset mount parameters. In the case that the storage medium used by the electronic device to store the data partition is damaged or faulty, if the damaged or faulty part is related to the preset mount parameters, it will cause the data partition to fail to mount. After the data partition fails to mount, the startup of the electronic device's operating system will terminate in the init stage, and will not continue to enter the subsequent zygote stage, system server stage and launcher stage, resulting in the electronic device's operating system unable to start normally and the electronic device unable to boot normally.
[0076] If the damaged or faulty storage medium of the electronic device storing the data partition is only related to part of the mounting parameters, the electronic device can mount the data partition without using the part of the mounting parameters.
[0077] Based on this, an embodiment of the present application provides a system startup method, in the process of starting the operating system, after the electronic device fails to mount the data partition by using the preset mount parameters, the electronic device can remount the data partition by using other mount parameters supported by the file system corresponding to the data partition, which are different from the preset mount parameters. After the electronic device successfully mounts the data partition using a certain set of mount parameters, it continues other stages of the electronic device operating system startup process. In this way, in the case where the storage medium storing the data partition of the electronic device is damaged or the faulty part is only related to some of the mount parameters, the electronic device can still mount the data partition, so that the operating system of the electronic device can be started normally and the electronic device can be turned on normally.
[0078] In some embodiments, the mount parameters are defined parameters of the file system corresponding to the data partition, and each mount parameter may correspond to a function of the file system, or a property of the file system, etc. When mounting a data partition, the electronic device may mount the data partition using one or more (or none) mount parameters, and each mount parameter may correspond to turning on / off a function of the file system, configuring a property of the file system, etc.
[0079] In some embodiments, the preset mount parameters include a plurality of mount parameters used to mount the data partition during the startup process of the operating system of the electronic device, which are set by the operating system of the electronic device or a developer.
[0080] In some embodiments, if the electronic device mounts the data partition using mounting parameters other than preset mounting parameters, the electronic device may also prompt the user "the storage medium may be damaged, please back up data in time or go to the after-sales service center" after the operating system is successfully started. In this way, the user can deal with the failure of the storage medium in time to avoid data loss.
[0081] For example, when the electronic device mounts the data partition using mount parameters different from the preset mount parameters, the exception flag can be set to be valid. After the electronic device completes the booting of the operating system, for example, after the sys.boot_completed flag is set to be valid through the aforementioned finishBooting() function, if the exception flag is valid, the display Figure 3 The prompt message 21 shown reminds the user that "the storage medium may be damaged, please back up the data in time or go to the after-sales service center."
[0082] In some embodiments, when the electronic device mounts the data partition using a mount parameter different from the preset mount parameter, the user or maintenance personnel can connect the electronic device to another device (hereinafter referred to as the debugging device) after the operating system of the electronic device is successfully started, and use the debugging device to send an Android debug bridge (ADB) instruction to the electronic device to back up the data in the electronic device to the debugging device. In this way, user data loss can be avoided.
[0083] In some embodiments, during the process of backing up data in an electronic device to a debugging device through an ADB instruction, if an input / output (IO) error occurs when backing up a certain file, the file can be deleted or moved to another directory before backing up other files in the directory where the file is located, or all files of the target where the file is located can be packaged (for example, packaged into tar format or other formats) and then the packaged files can be backed up. In this way, even if there are inaccessible files (that is, the storage area corresponding to the file may be damaged or faulty), other files of the electronic device can be backed up.
[0084] In some embodiments, when the electronic device mounts the data partition using a mount parameter different from the preset mount parameter, after the operating system of the electronic device is started, a jump entry of the application or service for backing up data can also be displayed so that the user can directly back up the data through the entry. Figure 3 , the electronic device can display a “backup” control 211, so that the electronic device can respond to the user's operation of the “backup” control 211 and run an application or service that can perform data backup on the electronic device to back up the data in the electronic device.
[0085] In some embodiments, the file system corresponding to the data partition may be F2FS.
[0086] In some embodiments, the mount parameters supported by a partition whose file system is F2FS (such as the aforementioned data partition) may be empty or include at least one of the following mount parameters:
[0087] rw, mount the partition in read-write mode.
[0088] nosuid, turns off the setting bit for setting the user identification (UID) or group identification (GID).
[0089] nodev, configured to not be able to read character or block devices on the file system.
[0090] dev, configured to read character or block devices on the file system.
[0091] atime is configured to update the access time of the inode (a data structure) every time data is accessed.
[0092] noatime: Configure the inode access time not to be updated each time data is accessed.
[0093] background_gc=%s, configures the F2FS space recycling (garbage collection) method. When %s is on (i.e. the mount parameter is background_gc=on), it indicates that the electronic device will recycle space when the storage medium is idle; when %s is off (i.e. the mount parameter is background_gc=off), it indicates that the electronic device will not recycle space; when %s is sync (i.e. the mount parameter is background_gc=sync), it indicates that the electronic device will synchronously recycle space in the background while the storage medium is working.
[0094] disable_roll_forward, disable the roll-forward recovery routine. Roll-forward recovery is a method of recovering data or instances after a crash. After disabling the roll-forward recovery routine, F2FS will not recover data or instances in this way after a data or instance crashes.
[0095] norecovery, disables the roll-forward recovery procedure when the partition is mounted read-only.
[0096] discard or nodiscard, enable or disable the real-time discard function of F2FS. When the real-time discard function is enabled, if a segment in F2FS is cleaned up, F2FS will send a discard (discard / TRIM) command.
[0097] no_heap, disable heap-style segment allocation. Heap-style segment allocation is a memory allocation method. After heap-style segment allocation is disabled, F2FS will not use this method to allocate storage space.
[0098] nouser_xattr, disable user extended attributes. When user extended attributes are disabled, the electronic device cannot customize the file attributes of the files in F2FS, that is, it cannot add user-defined attributes in the field that records file or directory attributes.
[0099] acl, enable the portable operating system interface access control list (POSIX ACL).
[0100] noacl, disables the Portable Operating System Interface access control list.
[0101] seclabel, configure F2FS to support Selinux (security-enhanced linux, a security policy). When the loading parameters include the seclabel parameter, F2FS can support Selinux after loading.
[0102] active_logs=%u, configure the number of active logs (%u). Exemplarily, %u can be 2, 4, 6, that is, the mount parameter can be active_logs=2, active_logs=4 or active_logs=6. Optionally, in other embodiments, %u can also be other values, which are not limited here.
[0103] disable_ext_identify, disable the extension list configured by mkfs (make file system, a file system). When the extension list configured by mkfs is disabled, F2FS cannot identify cold files (i.e. files with low frequency of use) such as multimedia files.
[0104] inline_xattr, enables the inline xattrs feature. After the inline xattrs feature is enabled, users can write user-defined attributes (i.e. extended attributes) into the inode block.
[0105] noinline_xattr disables the embedded extended attributes feature.
[0106] inline_xattr_size=%u, configures the size of embedded extended attributes to %u, that is, allows the user to write extended attributes of size %u into the inode block.
[0107] inline_data, enables the data embedding function. After the data embedding function is enabled, the electronic device can write the data of the newly created file into the inode block.
[0108] noinline_data, disables the data embedding feature.
[0109] inline_dentry, use the directory embedding function. After the directory embedding function is enabled, the electronic device can write the newly created directory entries into the inode block.
[0110] noinline_dentry, disables the directory embedding feature.
[0111] inlinecrypt is configured to use the blk-crypto (an encryption framework) framework for encryption first.
[0112] flush_merge, enable the flush merge function. When the flush merge function is enabled, the electronic device will merge and execute concurrent cache flush commands as much as possible.
[0113] nobarrier, disable the cache flush function. After the cache flush function is disabled, F2FS will no longer issue cache flush commands (cache_flush commands).
[0114] fastboot, enable fast mount.
[0115] extent_cache, enable rb-tree based extended data block cache. The rb-tree based extended data block cache can cache multiple extended data blocks mapped between consecutive logical addresses and physical addresses for each inode, thereby improving the cache hit rate.
[0116] noextent_cache, disables the rb-tree based extent cache.
[0117] data_flush, enable data flushing. After data flushing is enabled, F2FS will enable data flushing before checkpoint.
[0118] reserve_root=%d, reserves %d storage space (hereinafter referred to as reserved blocks) for the privileged user of the specified UID or GID, and the unit of the reserved space is 4KB. For example, when %d=10, the reserved space is 40KB.
[0119] resuid=%d specifies the UID (%d) of the privileged user who can use the reserved space. For example, if the mount parameter is "resuid=1001", the privileged user with UID 1001 can use the reserved space.
[0120] resgid=%d specifies the GID (%d) of the group to which the privileged user who can use the reserved space belongs. For example, if the mount parameter is "resgid=1002", all users in the group with GID 1002 can use the reserved space.
[0121] fault_injection=%d, enable the fault injection function. After the fault injection function is enabled, the electronic device can inject faults at a frequency of %d.
[0122] fault_type=%d, configures the fault type to be injected by the above fault injection function, wherein %d represents the identifier of the fault type to be injected. The identifiers of different fault types are defined by the operating system or file system of the electronic device, which will not be described in detail here.
[0123] mode=%s, configures the block allocation mode (%s) of the file system. In some embodiments, the block allocation mode may include "adaptive" and "lfs", that is, the value of %s may be "adaptive" or "lfs".
[0124] io_bits=%u, when the configuration block allocation mode is lfs, the number of bits (%u) of the input output (IO) request.
[0125] usrquota, enables disk quota accounting for plain users.
[0126] grpquota enables disk quota accounting for plain users.
[0127] prjquota, enable disk quota accounting for plain projects.
[0128] usrjquota= <file>, specify files and types for ordinary users during mount.
[0129] grpjquota= <file>, specify files and types for common groups during mount.
[0130] prjjquota= <file>, specify the files and types of common items during mount.
[0131] jqfmt=<quota type> , specify the type of disk quota, which can include vfsold, vfsv0, vfsv1, that is,<quota type> Can be vfsold, vfsv0, or vfsv1.
[0132] offusrjquota, turns off the quota that the user has used.
[0133] offgrpjquota, turns off the quota that the group has used.
[0134] offprjjquota, turn off the quota that has been used by the project.
[0135] quota, enable disk quota accounting for plain users.
[0136] noquota disables all normal disk quota accounting features.
[0137] whint_mode=%s, configure the write hints delivery mode (%s). Exemplarily, the write hints modes may include "off", "user-based" and "fs-based". Among them, the "off" mode (that is, %s is off) instructs F2FS not to deliver write hints to the block layer of the operating system; the "user-based" mode (that is, %s is user-based) instructs F2FS to deliver write hints sent by users to the block layer; the "fs-based" mode (that is, %s is fs-based) instructs F2FS to deliver write hints to the block layer according to the rules defined by F2FS.
[0138] alloc_mode=%s, configures the block allocation strategy. Exemplarily, the block allocation strategy may include "resuse" and "default", that is, the value of %s may be "resuse" or "default".
[0139] fsync_mode=%s, configure file synchronization mode. Exemplarily, the file synchronization mode may include "posix", "strict" and "nobarrier", that is, the value of %s may be "posix", "strict" or "nobarrier". "posix" indicates that F2FS performs file synchronization according to the POSIX language; "strict" indicates that F2FS performs file synchronization strictly according to the log file system (XFS for short), the fourth extended file system (ext4), and BTRFS (butter file system, a file system); the difference between the "nobarrier" mode and the "posix" mode is that this mode does not support non-atomic files. .
[0140] test_dummy_encryption, enables dummy encryption. Dummy encryption is used to provide a fake context for fscrypt (an encryption management tool).
[0141] checkpoint=%s, configure the checkpoint function. When the value of %s is disable, the checkpoint function of F2FS is turned off; when the value of %s is enable, the checkpoint function of F2FS is turned on.
[0142] compress_algorithm=%s, configures the compression algorithm used by F2FS to compress data. Exemplarily, the compression algorithm may include "lzo" and "lz4". That is, when the value of %s is "lzo", F2FS compresses data using the lzo algorithm; when the value of %s is "lz4", F2FS compresses data using the lz4 algorithm.
[0143] compress_log_size=%u, configures the cluster size when compressing data. For example, the cluster size when F2FS compresses data is 4KB×(1<<%u), where "<<" indicates a binary number left shift. For example, when %u=0010, 1<<%u=00100, which indicates a decimal number of 4, corresponds to a cluster size of 16KB.
[0144] compress_extension = %s, configure the extension of the file to be compressed by F2FS, %s can be the extension of any file type. For example, corresponding to %s = .ext, that is, the mount parameter is compress_extension = .ext, F2FS can compress files with the extension ".ext".
[0145] Optionally, in some other embodiments, F2FS may also include more mounting parameters, which are not described in detail here.
[0146] Optionally, other file systems, such as ext4, BTRFS, etc., may also include corresponding mounting parameters that are the same as or different from those of F2FS, which will not be described in detail here.
[0147] Below, the technical solution of the present application is introduced by taking the file system of the data partition as F2FS as an example.
[0148] Figure 4 According to some embodiments of the present application, a flow chart of a system startup method is shown. Figure 4 As shown, the process includes the following steps:
[0149] S401: The electronic device copies the image file of the operating system to the RAM and executes the boot program.
[0150] The electronic device copies the image file of the operating system to the RAM and executes the boot program.
[0151] In some embodiments, when the electronic device is executing the boot program, the electronic device may start APPS PBL, XBL, ABL and guide the electronic device into the kernel stage (eg, start the swapper process in the kernel), etc. For details, please refer to the aforementioned step S02, which will not be described in detail here.
[0152] In some embodiments, when the electronic device is executing the boot program, the electronic device may also start the LK and guide the electronic device into the kernel stage (eg, start the swapper process in the kernel), etc. For details, please refer to the aforementioned step S02, which will not be described in detail here.
[0153] In some embodiments, after the electronic device is started, for example, after the user presses the power button of the electronic device, the electronic device is powered on and enters the BootRom stage. The electronic device loads a boot program (such as Bootloader) into the electronic device RAM and then starts to execute the boot program.
[0154] S402: The electronic device initializes the kernel of the operating system.
[0155] After executing the boot program, the electronic device can run the kernel to initialize the kernel of the operating system. That is, the startup process of the operating system of the electronic device enters the kernel stage.
[0156] During the process of initializing the operating system kernel, the electronic device may set a cache, a protected memory, a schedule list, load a driver, etc. After initializing the operating system kernel, the electronic device may also start an init process.
[0157] S403: The electronic device mounts the file system.
[0158] After the init process is started, the operating system of the electronic device boots into the init stage, and the electronic device can mount the file system, for example, mount the partitions in the electronic device, such as the boot partition, the initial boot (init_boot) partition, the system partition, the recovery partition, the data partition, etc.
[0159] In some embodiments, the electronic device may mount each partition based on a mount instruction defined by an operating system of the electronic device, such as a mount instruction.
[0160] S404: The electronic device fails to mount the data partition.
[0161] When the electronic device fails to mount the data partition, the system startup method provided in this application is triggered.
[0162] Optionally, in some embodiments, after the electronic device fails to mount the data partition, the flag bit corresponding to the mount instruction may be valid, and the electronic device determines that the mounting of the data partition has failed in response to the flag bit corresponding to the mount instruction being valid.
[0163] Exemplarily, assume that the instruction corresponding to mounting the data partition is mount( / data, fs_options, mountflags), where / data indicates the data partition, and fs_options and mountflags are mounting parameters. The electronic device can generate the flag bit ret corresponding to the mount instruction through ret=mount( / data, fs_options, mountflags). When ret=0, that is, ret is invalid, it indicates that the data partition is mounted successfully based on the above mount instruction; when ret≠0, that is, ret is valid, it indicates that the data partition is mounted failed based on the above mount instruction.
[0164] Optionally, in some embodiments, when the electronic device fails to mount the data partition, it can also record a log of the failure to mount the data partition. For example, the electronic device can record the mount parameters used during mounting, the reason for the mount failure or the error code, etc. in the log of the failure to mount the data partition.
[0165] Optionally, assuming that the number of partitions to be mounted by the electronic device is P, the electronic device will mount the P partitions one by one. In some embodiments, P can be obtained based on a function fstab.size() defined by an operating system of the electronic device.
[0166] S405: The electronic device decrypts the header of the metadata and generates a DM device.
[0167] When the electronic device fails to mount the data partition, it can decrypt the header of the metadata of the data partition to obtain a mapping device (device mapper, DM) device.
[0168] In some embodiments, the header of the metadata is encrypted data corresponding to the access path of the data in the data partition, information about the storage medium corresponding to the data partition, etc. The DM device is the plaintext data corresponding to the encrypted data, and the plaintext data can be used for mounting the data partition by the electronic device.
[0169] Optionally, in some embodiments, if the header of the data partition metadata is not encrypted, step S405 may not be performed, which is not limited here.
[0170] S406: The electronic device uses fs_check to check metadata of the data partition or all data of the data partition.
[0171] When the electronic device obtains the DM device corresponding to the data partition, the electronic device uses fs_check to check the metadata of the data partition or the entire data partition so as to correct the error of the data partition.
[0172] In some embodiments, fs_check is a tool or function defined by an operating system or developer of an electronic device for modifying a file system or partition. The electronic device can repair some errors of a data partition by calling fs_check to check metadata of the data partition or all data of the data partition.
[0173] S407: The electronic device mounts the data partition based on the N mounting parameters and the DM device.
[0174] After the electronic device repairs the data partition using fs_check, it mounts the data partition based on N mount parameters and the DM device. Specifically, the electronic device executes a mount instruction carrying N mount parameters, and in the process of executing the mount instruction, the electronic device can mount the data partition based on the DM device (i.e., the plaintext data corresponding to the access path of the data in the data partition, the information of the storage medium corresponding to the data partition, etc.).
[0175] In some embodiments, if the electronic device successfully mounts the data partition based on N mount parameters, other instructions of the operating system in the init phase (such as instructions for loading Selinux rules, initializing the operating system, starting the service management process and the zygote process, etc.) are executed, and after the execution is completed, the process goes to step S409. If the electronic device fails to mount the data partition based on N mount parameters, the process goes to step S408.
[0176] In some embodiments, N is an integer greater than 1. The N mount parameters are defined by a developer of the electronic device or an operating system. In some embodiments, the N mount parameters may include all mount parameters that can be used simultaneously among the mount parameters supported by the data partition.
[0177] When mounting a data partition, the electronic device can generate a flag bit corresponding to the mount instruction. For example, the flag bit ret corresponding to the mount instruction can be generated by ret=mount( / data, fs_options, mountflags). Among them, / data represents the data partition, fs_options, and mountflags represent the mount parameters used to mount the data partition. Furthermore, when ret=0, that is, when ret is invalid, it indicates that the data partition is mounted successfully; when ret≠0, that is, when ret is valid, it indicates that the data partition fails to mount.
[0178] In some embodiments, the electronic device can mount the data partition of the DM device with preset mount parameters through the following instruction: "mount -t f2fs / dev / block / dm-20 / data preset mount parameters". Among them, f2fs indicates that the file system of the mounted data partition is F2FS, " / dev / block / dm-20" indicates the identifier of the DM device, and " / data" indicates the data partition.
[0179] The above instruction "mount -t f2fs / dev / block / dm-20 / data preset mount parameters" is only an example. In some embodiments, " / dev / block / dm-20" in the instruction can also be replaced by other DM device identifiers, such as " / dev / block / dm-xx", where xx is an arbitrary value. In other embodiments, " / data" in the instruction can also be replaced by other identifiers representing data partitions, which are not limited here.
[0180] S408: When the electronic device fails to mount the data partition based on N mounting parameters, it mounts the data partition based on NK mounting parameters, increases K by 1, and sets the abnormal flag to be valid, wherein the initial value of K is 1.
[0181] When the electronic device fails to mount a data partition based on N mount parameters (for example, when ret≠0 as mentioned above), it can select NK mount parameters from the N mount parameters (for example, remove K mount parameters from the N mount parameters) to mount the data partition, increase K by 1, and set the exception flag to valid.
[0182] In some embodiments, the electronic device may have N! / (NK)! / K selection methods when selecting NK mount parameters from N mount parameters. The electronic device may traverse the N! / (NK)! / K groups of NK mount parameter groups selected by the N! / (NK)! / K selection methods each time step S408 is executed, and attempt to mount the data partition. If the data partition is successfully mounted, other instructions of the operating system in the init phase (such as instructions for loading Selinux rules, initializing the operating system, starting the service management process and the zygote process, etc.) are executed, and after the execution is completed, the process goes to step S409; if the mount parameters selected by the N! / (NK)! / K selection methods cannot successfully mount the data partition, K is increased by 1, and step S408 is repeated.
[0183] For example:
[0184] When step S408 is executed for the first time, K=1, and the electronic device can mount the data partition using the N-1 parameters after removing the first mount parameter from the N mount parameters; if mounting the data using the N-1 mount parameters fails, the electronic device can mount the data partition using the N-1 parameters after removing the second mount parameter from the N mount parameters. And so on, until the electronic device fails to mount the data partition using the N-1 parameters after removing the Nth mount parameter from the N mount parameters, the electronic device increases K by 1.
[0185] When step S408 is executed for the second time, K=2, and the electronic device can mount the data partition using N-2 parameters after removing the first and second mounting parameters from the N mounting parameters; if mounting the data using the N-2 mounting parameters fails, the electronic device can mount the data partition using N-2 parameters after removing the first and third mounting parameters from the N mounting parameters. And so on, until the electronic device fails to mount the data partition using the N-2 mounting parameters determined from N×(N-1) / 2 ways, the electronic device increases K by 1.
[0186] By analogy, if when K = A (A < N), the electronic device successfully mounts the data partition through N - A mounting parameters, the electronic device executes other instructions in the init stage of the operating system (such as instructions for loading Selinux rules, initializing the operating system, starting the service management process, and starting the zygote process, etc.), and after the execution is completed, proceeds to step S409; if the data partition still cannot be successfully mounted when K = N, the electronic device can stop starting the operating system.
[0187] In some embodiments, when K = A (A < N), if the electronic device successfully mounts the data partition through N - A mounting parameters, the electronic device can record K = A. When step S408 is executed next time, if A + 1 is used as the initial value of K, the data partition is mounted.
[0188] Optionally, in some embodiments, when K = A (A < N), if the electronic device successfully mounts the data partition through N - A mounting parameters (the mounting parameters used when the mounting is successful are called NA parameters), the electronic device can record K = A. When step S408 is executed next time, if A is used as the initial value of K, N - A mounting parameters different from the NA parameters are selected from the N mounting parameters to mount the data partition.
[0189] Optionally, in some other embodiments, the process of mounting the data partition based on N - K mounting parameters can also be to first determine N! / (N - K)! / K types of mounting parameter groups corresponding to selecting N - K mounting parameters from the N mounting parameters, and then traverse these N! / (N - K)! / K types of mounting parameter groups to mount the data partition.
[0190] In some embodiments, when the electronic device selects N - K mounting parameters from the N mounting parameters, there are N! / (N - K)! / K selection methods. In some embodiments, when the exception flag is valid, for example, when the exception flag flag = 1, it indicates that the electronic device mounts the data partition through mounting parameters different from the preset mounting parameters.
[0191] Optionally, in some embodiments, when the electronic device fails to mount the data partition, it can also record the log of mounting the data partition, such as the log of failed mounting of the data partition or the log of successful mounting of the data partition. In some other embodiments, each log of mounting the data partition can also include the mounting parameters used by the electronic device when mounting the data partition, and the log of failed mounting of the data partition can also include the reason or error code that causes the failure of mounting the data partition.
[0192] Based on the above method to remount the data partition, as many mounting parameters in the preset mounting parameters as possible can be used to mount the data partition, so that the mounted data partition can support more functions or features.
[0193] S409: The electronic device runs the zygote process, the system server process and the launcher process.
[0194] After the data partition is successfully mounted and all instructions in the init phase are executed, the electronic device runs the zygote process, the system server process and the launcher process in sequence to execute the relevant instructions of the operating system in the zygote phase, the system server phase and the launcher phase respectively. Figure 2 The illustrated embodiments are not described in detail here.
[0195] In some embodiments, if the operating system has not been started up while the electronic device runs the zygote process, the system server process, and the launcher process in sequence, the process may proceed to step S408; if the operating system has been started up after the electronic device runs the zygote process, the system server process, and the launcher process in sequence, the process may proceed to step S410.
[0196] S410: When the operating system of the electronic device is started and the abnormal flag is valid, the electronic device prompts the user "the storage medium may be damaged, please back up the data in time or go to the after-sales service center."
[0197] The electronic device responds to the completion of the startup of the electronic device's operating system (for example, when the aforementioned flag sys.boot_completed is valid) and the exception flag is valid (indicating that the electronic device mounts the data partition using mount parameters different from the preset mount parameters), prompting the user "The storage medium may be damaged, please back up data in time or go to the after-sales service center."
[0198] In some embodiments, the electronic device may prompt the user by displaying a prompt window, playing a prompt audio, or other means that "the storage medium may be damaged, please back up the data in time or go to the after-sales service center."
[0199] Optionally, in some embodiments, if there is an application or service for backing up data in the electronic device, the electronic device may also display a jump control for the application or service for backing up data, or directly go to the application or service for backing up data, so that the user can back up data to a server or other device connected to the electronic device in a timely manner. Figure 3 In response to the user's operation on the "backup" control 211, the electronic device can run an application or service for backing up data to back up the data in the electronic device to a server or other electronic devices connected to the electronic device.
[0200] Optionally, in some embodiments, during the process of backing up data by the application or service that backs up data, if an input / output (IO) error occurs when backing up a certain file, the file can be deleted or moved to another directory before backing up other files in the directory where the file is located, or all files of the target where the file is located can be packaged (for example, packaged into tar format or other formats) and then the packaged files can be backed up. In this way, even if there are inaccessible files (that is, the storage area corresponding to the file may be damaged or faulty), other files of the electronic device can be backed up.
[0201] Optionally, in some embodiments, after the operating system of the electronic device is successfully started, the user or maintenance personnel can use the aforementioned ADB command to back up the data in the electronic device to the debugging device.
[0202] Through the method provided by the embodiment of the present application, if the electronic device fails to mount the data partition using the preset mount parameters during the startup process, the data partition can be mounted using mount parameters different from the preset mount parameter group. If the electronic device successfully mounts the data partition using mount parameters different from the preset mount parameters, the startup process of the electronic device can continue. In this way, even if the data partition fails to be mounted using the preset mount parameters, the electronic device can be started normally, and the user of the electronic device can back up data in time to avoid data loss.
[0203] In addition, after the electronic device mounts the data partition using NA mount parameters different from the preset mount parameters, if the electronic device still fails to start successfully, the electronic device can remount the data partition using NB mount parameters (B≤A, and the NB mount parameters are different from at least one of the NA mount parameters), which can further increase the possibility of successful startup of the operating system of the electronic device.
[0204] further, Figure 5 According to some embodiments of the present application, a schematic structural diagram of an electronic device 10 is shown.
[0205] Figure 5 As shown, the electronic device 10 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
[0206] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0207] In some embodiments, the processor 110 may call and execute the corresponding instructions of the system startup method provided by each embodiment of the present application stored in the memory to implement the system startup method provided by the embodiment of the present application. For example, the processor 110 may be used to execute an instruction to mount a data partition using a mount parameter different from a preset mount parameter, an instruction to set an exception flag to be valid, an instruction to prompt a user in response to an exception flag being valid, etc.
[0208] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 10, and can also be used to transfer data between the electronic device 10 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices.
[0209] The charging management module 140 is used to receive charging input from a charger. While the charging management module 140 is charging the battery 142 , it can also power the electronic device through the power management module 141 .
[0210] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.
[0211] The wireless communication function of the electronic device 10 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0212] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
[0213] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 10. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0214] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 10. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0215] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini-LED, a micro-LED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 10 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0216] The electronic device 10 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0217] For example, in some embodiments, display screen 194 may be used to display an interface of an application and a first animation.
[0218] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 10 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0219] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 10. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are saved in the external memory card. In some embodiments, the electronic device can back up the data in the aforementioned data partition to the external memory card, so that the user can store the backed-up data in other devices or storage media through the external memory card.
[0220] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function, etc. The data storage area may store data created during the use of the electronic device 10, etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications of the electronic device 10 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor 110. In some embodiments, the data partition of the electronic device 10 may be stored in the internal memory 121.
[0221] The electronic device 10 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0222] The audio module 170 is used to convert digital audio information into analog audio signal output, and also used to convert analog audio input into digital audio signal. The audio module 170 can also be used to encode and decode audio signals.
[0223] Speaker 170A, also called a "horn", is used to convert audio electrical signals into sound signals.
[0224] Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals.
[0225] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.
[0226] The earphone jack 170D is used to connect a wired earphone.
[0227] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
[0228] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 10 in various directions (generally three axes). When the electronic device 10 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device, to determine whether the electronic device 10 is in a horizontal screen state, and for applications such as pedometers.
[0229] The ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 10 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 10 is in a pocket to prevent accidental touch.
[0230] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 10 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0231] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 10, which is different from the position of the display screen 194.
[0232] The bone conduction sensor 180M can obtain vibration signals. In some embodiments, the bone conduction sensor 180M can obtain vibration signals of vibrating bones of the human body. The bone conduction sensor 180M can also contact the human body's pulse to receive blood pressure beating signals.
[0233] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key. It may also be a touch key. The electronic device 10 may receive key input and generate key signal input related to user settings and function control of the electronic device 10. In some embodiments, the electronic device 10 may start the electronic device 10 in response to the user's operation on the power key, such as long pressing the power key, and enter the BootRom stage of the startup process of the electronic device 10.
[0234] Motor 191 can generate vibration prompts.
[0235] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0236] The SIM card interface 195 is used to connect a SIM card.
[0237] It is understood that the structure of the electronic device 10 shown in the embodiment of the present application does not constitute a specific limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0238] Figure 5 The structure of the electronic device 10 shown is only an example. In other embodiments, the electronic device 10 may include more or fewer modules, or some modules may be combined or split, which is not limited here.
[0239] The various embodiments of the mechanism disclosed in the present application can be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code or program product executed on a programmable system, and the programmable system includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device and at least one output device.
[0240] Program code can be applied to input instructions to perform the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor, a microcontroller, an application specific integrated circuit, or a microprocessor.
[0241] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.
[0242] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable storage media. Therefore, a machine-readable storage medium may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including, but not limited to, a floppy disk, an optical disk, an optical disk, a magneto-optical disk, a random access memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, a magnetic card or an optical card, a flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signal digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, a machine-readable storage medium includes any type of machine-readable storage medium suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.
[0243] In the accompanying drawings, some structural, module or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0244] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising" means that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0245] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.< / file> < / file> < / file>
Claims
1. A system startup method, characterized in that: The electronic device includes a data partition; and The method comprises: During the startup of the operating system of the electronic device, the data partition is mounted based on N mount parameters, wherein the mount parameters are mount parameters corresponding to the file system of the data partition, and N is an integer greater than 1; If mounting the data partition based on the N mounting parameters fails, mounting the data partition based on NK mounting parameters, where K is a natural number and K is less than N; After the data partition is successfully mounted based on the NK mounting parameters, the desktop launcher is run.
2. The method according to claim 1, characterized in that The step of mounting the data partition based on NK mounting parameters includes: The NK mount parameters are selected from the N mount parameters, and the data partition is mounted based on the NK mount parameters.
3. The method according to claim 1, characterized in that The method further comprises: Mounting the data partition based on the NK mount parameters fails, and the data partition is mounted based on NK-1 mount parameters.
4. The method according to any one of claims 1 to 3, characterized in that After the data partition is mounted successfully based on the NK mounting parameters, a desktop launcher is run, including: After the data partition is mounted successfully using the NK mount parameters, the process incubator, the system service process and the desktop launcher are run.
5. The method according to claim 4, characterized in that The method further comprises: During the running of the process incubator, the system service process and the desktop launcher, the startup of the operating system is not completed; Based on the incomplete startup of the operating system, the data partition is mounted based on NP mount parameters, wherein P is greater than or equal to K, and at least one mount parameter among the NK mount parameters is different from a mount parameter among the NP mount parameters; After the data partition is mounted successfully based on the NP mounting parameters, the process incubator, the system service process and the desktop launcher are run.
6. The method according to claim 4, characterized in that The method further comprises: During the running of the process incubator, the virtual machine of the operating system is started.
7. The method according to claim 4, characterized in that The method further comprises: In the process of running the system service process, the service of the operating system is started.
8. The method according to claim 4, characterized in that The method further comprises: During the running of the desktop launcher, based on the completion of the booting of the operating system, the finishBooting function is called to set the flag bit sys.boot_completed to be valid.
9. The method according to any one of claims 1 to 3, characterized in that The method further comprises: After the data partition is mounted successfully based on the NK mount parameters, the exception flag is set to be valid, and when the exception flag is valid, it means that the data partition is not mounted through the N mount parameters.
10. The method according to claim 9, characterized in that The method further comprises: After the operating system is started, based on the validity of the abnormal flag, a first interface is displayed, wherein the first interface includes information indicating that the memory of the electronic device is damaged.
11. The method according to claim 10, characterized in that The method further comprises: In response to a user's operation of backing up data in the first interface, at least a portion of the data in the data partition is backed up.
12. The method according to claim 1, characterized in that The N mount parameters include at least one of the following mount parameters: rw, seclabel, nosuid, nodev, noatime, background_gc=on, discard, no_heap, user_xattr, inline_xattr, acl, inline_data, inline_dentry, extent_cache, mode=adaptive, active_logs=6, inlinecrypt, alloc_mode=default, fsync_mode=nobarrier.
13. The method according to claim 1, characterized in that The step of mounting the data partition based on NK mounting parameters includes: The data partition is mounted using a mount instruction, wherein the mount instruction includes the NK mount parameters.
14. A readable storage medium, characterized in that: The readable storage medium includes instructions, and when the instructions are executed by an electronic device, the electronic device implements the method according to any one of claims 1 to 13.
15. An electronic device, characterized in that: include: A memory for storing instructions; At least one processor is used to execute the instructions so that the electronic device implements the method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Method and device for forbidding permission extraction of system, storage medium and terminal equipment
CN107742076A
Method, device and equipment for quickly starting embedded system
CN111880846A
Power failure protection method, computing equipment and storage medium
CN113568787A
Method for protecting ubi file system under Linux
CN116361817A
Dual use master boot record
US20020026571A1
