Dependence information mounting method and device, electronic equipment and storage medium
By creating a target mount space and mounting a virtual machine assembly running dependency library in the Linux distribution, the problem that the Linux distribution cannot run the Chrome OS virtual machine module is solved, and the Android application is implemented in the same device, improving the improvement of running Android applications. Application compatibility and software ecosystem richness.
Patent Information
- Application Number
- CN202310803173.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2025-01-07
AI Technical Summary
The Linux distribution has shortcomings in application support and software ecosystem, and it is unable to directly run the virtual machine module of Chrome OS, resulting in low application compatibility.
By creating a target mount space and mounting the running dependency library of the virtual machine assembly within it, the virtual machine module is implemented in the second operating system and supports the operation of Android applications.
Isolate the resources of two operating systems in the same computing device, and successfully transplant the virtualization module of the first operating system, enriching the software ecosystem of the second operating system and improving application compatibility.
Smart Images

Figure CN119271278A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for mounting dependency information. Background Art
[0002] Linux distribution refers to an operating system designed by different development teams based on the Linux kernel and integrating different software packages and tools according to design requirements. It usually only supports running Linux applications, so various Linux distributions often have the problem of supporting fewer applications and poor application software ecosystem. Google's operating system (Chrome OS), as an operating system designed based on the Linux kernel and compatible with Android applications and Linux applications, can support running a variety of applications and has a good software ecosystem.
[0003] Therefore, if the virtual machine module used to create the Android ecosystem in Chrome OS can be ported to the Linux distribution, it will greatly enrich the software ecosystem of the Linux distribution and improve the application compatibility of the Linux distribution. However, how to achieve the porting of the virtual machine module has become a technical difficulty. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a method, device, electronic device and storage medium for mounting dependency information.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for mounting dependency information, including:
[0006] Obtaining a runtime dependency library that a virtual machine assembly of a first operating system depends on; the runtime dependency library is used to load and run a first executable program in the virtual machine assembly, the first executable program is used to create a virtualized target ecological environment; the target ecological environment is an ecological environment of an application developed based on a target operating system, and the target operating system is different from the first operating system;
[0007] Selecting a target path from the program loading directory path included in the system mount space of the second operating system, and creating a target mount space in the second operating system;
[0008] The target path of the running dependency library is mounted and stored in the target mount space; wherein the target path in the target mount space is used to provide dependency information of the virtual machine assembly in the second operating system.
[0009] In a possible implementation, the program loading directory path includes a storage path of a first loading library for loading a first loader; the first loader is used to load a second executable program compiled by the second operating system; the target root directory of the target mount space includes a path root directory corresponding to the storage path; the target root directory is a default search directory for the first loading library;
[0010] Mounting the target path storing the running dependent library in the target mount space includes:
[0011] The target path storing the running dependent library is mounted under the path root directory of the target mounting space.
[0012] In a possible implementation manner, after mounting the target path storing the operation-dependent library, the method further includes:
[0013] Get the program to be run;
[0014] Determine whether the program to be run belongs to the virtual machine program set;
[0015] If yes, obtaining the stored runtime dependency library from the target path of the target mount space;
[0016] The program to be run is loaded and run by utilizing the run-dependency library to obtain the virtualized target ecological environment.
[0017] In a possible implementation, the running dependency library includes at least a second loading library and a system base library on which the second loader used to compile the first executable program depends; the system base library is used to run the first executable program, and the second loading library is used to load the first executable program.
[0018] In a possible implementation manner, before determining whether the program to be run belongs to the virtual machine program set, the method further includes:
[0019] Enter the system mount space;
[0020] Acquiring the stored runtime dependency library from the target path of the target mount space includes:
[0021] Invoking a space conversion program, and using the invoked space conversion program to switch from the system mount space to the target mount space;
[0022] The stored runtime dependency library is obtained from the target path of the target mount space.
[0023] In a possible implementation, acquiring the stored runtime dependency library from the target path of the target mount space includes:
[0024] According to the loader field corresponding to the program to be run, obtaining the path root directory in the target mount space;
[0025] The operation dependency library is obtained in the target path mounted under the path root directory.
[0026] In a possible implementation manner, before mounting the target path storing the operation-dependent library, the method further includes:
[0027] The mount propagation attribute of the target root directory of the target mount space is modified so that operations performed in the target mount space cannot be mapped to the system mount space.
[0028] In a second aspect, the embodiment of the present disclosure further provides a dependency information mounting device, including:
[0029] an acquisition module, configured to acquire a runtime dependency library on which a virtual machine assembly of a first operating system depends; the runtime dependency library is used to load and run a first executable program in the virtual machine assembly, the first executable program is used to create a virtualized target ecological environment; the target ecological environment is an ecological environment of an application developed based on a target operating system, and the target operating system is different from the first operating system;
[0030] A selection module, used to select a target path from the program loading directory path included in the system mount space of the second operating system, and create a target mount space in the second operating system;
[0031] A mounting module is used to mount the target path storing the running dependency library in the target mounting space; wherein the target path in the target mounting space is used to provide dependency information of the virtual machine assembly in the second operating system.
[0032] In a third aspect, an optional implementation of the present disclosure further provides an electronic device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.
[0033] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.
[0034] For a description of the effects of the above-mentioned dependency information mounting device, electronic device, and computer-readable storage medium, please refer to the description of the above-mentioned dependency information mounting method, which will not be repeated here.
[0035] The dependency information mounting method, device, electronic device and storage medium provided by the embodiment of the present disclosure, because the target ecological environment is the Android ecological environment, and the first executable program in the virtual machine program set can be used to create a virtualized target ecological environment, the target ecological environment is the Android ecological environment, so the operation dependency library that the virtual machine program set depends on can support the operation of the virtual machine module corresponding to the first operating system. By creating a target mount space and mounting the operation dependency library to the target path in the target mount space, it can be achieved that the use of various original resources related to the second operating system stored in the system mount space of the second operating system is not affected, and the dependency information required for the operation of the virtual machine module can be obtained in the target mount space, thereby supporting the operation of the virtual machine module in the second operating system to create a target ecological environment that supports the operation of various Android applications. In this way, using the created target mount space, it is possible to isolate the resources required by the two operating systems in the same computing device, and then successfully transplant the virtualization module of the first operating system in a computing device where the second operating system is deployed, ensuring that the second operating system and the virtualization module can run normally and independently, enriching the software ecology of the second operating system, increasing the types and number of applications that the second operating system can support to run, and improving the application compatibility of the second operating system.
[0036] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0038] Figure 1A flow chart of a method for mounting dependency information provided by an embodiment of the present disclosure is shown;
[0039] Figure 2 A schematic diagram showing the interaction between a virtual machine assembly and a running dependent library in a first operating system provided by an embodiment of the present disclosure is shown;
[0040] Figure 3 A schematic diagram of directly porting VMTools to a Linux distribution provided by an embodiment of the present disclosure is shown;
[0041] Figure 4 A schematic diagram of using a namespace to transplant a virtual machine module in a first operating system to a second operating system provided by an embodiment of the present disclosure is shown;
[0042] Figure 5 A schematic diagram of a dependency information mounting device provided by an embodiment of the present disclosure is shown;
[0043] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0045] In addition, the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.
[0046] The "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0047] According to research, there are many types of Linux distributions, such as Ubuntu, general operating system Debian, Fedora, Red Hat, community enterprise operating system CentOS, openSUSE, Arch Linux, etc. Each distribution has its own characteristics and uses, which can meet different design requirements. Users can choose different Linux distributions according to their needs and preferences, and customize and configure them as needed. However, no matter which Linux distribution, there are often problems with fewer supported applications and poor application software ecosystem. In order to enrich the application ecosystem of Linux distributions, it is usually possible to consider porting the virtual machine module used to create the Android ecosystem in Chrome OS to the Linux distribution.
[0048] However, the dependency information that the virtual machine module of Chrome OS relies on during operation is incompatible with the resources of the Linux distribution, which makes the virtual machine module unable to run directly in the Linux distribution. If the dependency information of the virtual machine module is used directly in the Linux distribution, the programs that come with the Linux distribution will not be able to run. Therefore, how to achieve compatibility of the virtual machine module in the Linux distribution has become a technical issue worthy of attention.
[0049] Based on the above research, the present disclosure provides a method, device, electronic device and storage medium for mounting dependency information. Since the target ecological environment is the Android ecological environment, and the first executable program in the virtual machine program set can be used to create a virtualized target ecological environment, the target ecological environment is the Android ecological environment, so the running dependency library that the virtual machine program set depends on can support the operation of the virtual machine module corresponding to the first operating system. By creating a target mount space and mounting the running dependency library to the target path in the target mount space, it can be achieved that the use of various original resources related to the second operating system stored in the system mount space of the second operating system is not affected, and the dependency information required for the operation of the virtual machine module can be obtained in the target mount space, thereby supporting the operation of the virtual machine module in the second operating system to create a target ecological environment that supports the operation of various Android applications. In this way, using the created target mount space, it is possible to isolate the resources required for the two operating systems in the same computing device, and then successfully transplant the virtualization module of the first operating system in a computing device where the second operating system is deployed, ensuring that the second operating system and the virtualization module can run normally and independently, enriching the software ecology of the second operating system, increasing the types and number of applications that the second operating system can support to run, and improving the application compatibility of the second operating system.
[0050] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0051] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0052] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0053] It should be noted that the specific terms mentioned in the embodiments of the present disclosure include:
[0054] Nsenter: is a command that can run a specified program in the namespace of a specified process. Its most typical use is to enter the network namespace of a container.
[0055] To facilitate understanding of this embodiment, a dependency information mounting method disclosed in an embodiment of the present disclosure is first introduced in detail. The execution subject of the dependency information mounting method provided in the embodiment of the present disclosure is generally a terminal device or other processing device with a certain computing capability, wherein the terminal device may be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a personal digital assistant device (Personal Digital Assistant, PDA), a handheld device, a computer device, etc.; in some possible implementation methods, the dependency information mounting method may be implemented by a processor calling a computer-readable instruction stored in a memory.
[0056] The following describes the dependency information mounting method provided by the embodiment of the present disclosure by taking a computer device as an example of an execution subject.
[0057] like Figure 1 As shown, it is a flowchart of a method for mounting dependency information provided by an embodiment of the present disclosure, which may include the following steps:
[0058] S101: Obtain a runtime dependency library that a virtual machine assembly of a first operating system depends on; the runtime dependency library is used to load and run a first executable program in the virtual machine assembly, and the first executable program is used to create a virtualized target ecological environment; the target ecological environment is an ecological environment of an application developed based on a target operating system, and the target operating system is different from the first operating system.
[0059] Here, the first operating system, the target operating system, and the second operating information in the following text are all different operating systems. The dependency information mounting method provided in the embodiment of the present disclosure can be implemented in the same computer device, and the first operating system and the second operating system running in the computer device can be used to deploy applications based on the target ecological environment.
[0060] The virtual machine assembly can be represented by VMTools, which includes various first executable programs compiled from the Chrome OS source code. The first executable program can be used to create a virtualized target ecological environment, in which various applications developed based on the target operating system can be run.
[0061] The running dependency library may include various resource libraries required to be relied upon when loading and running the first executable program, and different resource libraries are used to provide different dependency information.
[0062] In a specific implementation, the first operating system may be Chrome OS, and the first executable program included in the virtual machine program set may be various executable programs compiled from the Chrome OS source code. The target operating system may be an Android operating system, and the target ecological environment may be an Android ecological environment. The first executable program in the virtual machine program set may be used to create a virtualized Android ecological environment, and various types of Android applications may be run in the Android ecological environment.
[0063] The operation-dependent library may include at least a second loading library and a system base library on which the second loader used to compile the first executable program depends; the system base library is used to run the first executable program, and the second loading library is used to load the first executable program.
[0064] Here, the second loading library is the resource library that the second loader depends on, the system basic library is the resource library that the first executable program depends on when running, the second loader is used to compile the first executable program, and use the resource information in the second loading library to parse and load the first executable program.
[0065] like Figure 2As shown, it is a schematic diagram of the interaction between a virtual machine assembly and a runtime dependency library in a first operating system provided by an embodiment of the present disclosure, wherein the first operating system is Chrome OS, the second loading library that the second loader in Chrome OS depends on may be the ld-linux-x86-64.so.2 resource library, and the system base library may be the libc.so.6 resource library, where .2 represents the version of the second loading library and .6 represents the version of the system base library. In specific implementation, the virtual machine assembly corresponding to Chrome OS (i.e. VMTools) also depends on other resource libraries. Figure 2 The second loader can load the first executable program in VMTools based on the ld-linux-x86-64.so.2 resource library, and based on the libc.so.6 resource library and other dependent resource libraries, it can communicate with the linux kernel and provide resource information required to run the first executable program.
[0066] like Figure 3 As shown in FIG. 1 , a schematic diagram of directly porting VMTools to a Linux distribution is provided in an embodiment of the present disclosure. Figure 3 In the example, the second operating system is Ubuntu OS. The first loading library that the first loader in Ubuntu OS depends on is the ld-linux-x86-64.so.2 resource library. The path of this resource library is / lib64 / ld-linux-x86-64.so.2 (that is, the resource library is located in the / lib64 directory), and this resource library is different from the second loading library that Chrome OS depends on. It is used to parse and load the executable program compiled by Ubuntu OS (that is, the second executable program in the following text). The system base library in Ubuntu OS is the libc.so.6 resource library, and this resource library is also different from the libc.so.6 resource library that Chrome OS depends on. This resource library is used to run the second executable program compiled by Ubuntu OS. The libc.so.6 resource library is the most basic resource library of Linux and can be used to communicate with the Linux kernel to implement some basic operations, such as file opening operations, thread creation operations, etc. Ubuntu OS also depends on other resource libraries. Figure 3 If the virtual machine module in Chrome OS is directly transplanted to Ubuntu OS, that is, Figure 3If the VMTools of Chrome OS is directly ported to Ubuntu OS, the first executable program in VMTools cannot run because the ld-linux-x86-64.so.2 resource library, libc.so.6 resource library and other resource libraries of Ubuntu OS are incompatible with VMTools. This will cause the virtual machine module of Chrome OS to be unable to run in Ubuntu OS. Figure 3 It can be seen that directly transplanting VMTools in the first operating system to the second operating system is not feasible. Therefore, in order to enable the virtual machine module to run normally in the second operating system without affecting the normal operation of the second executable program in the second operating system, a dependency information mounting method of an embodiment of the present disclosure is proposed.
[0067] During specific implementation, the runtime dependency library that the virtual machine assembly of the Chrome OS depends on may be obtained first.
[0068] S102: Select a target path from the program loading directory path included in the system mount space of the second operating system, and create a target mount space in the second operating system.
[0069] Here, the system mount space of the second operating system is a mount namespace created using the space naming technology, which may include the program loading directory path that the second operating system relies on. The program loading directory path is the directory and path corresponding to various resource information that the second operating system relies on, which may include the directory and path for program loading and running, for example, various resource libraries that the second operating system relies on may be stored.
[0070] After obtaining the second executable program compiled by the second operating system, the system mount space may be entered, and various resource libraries on which the second executable program depends may be obtained from the system mount space to load and run the second executable program.
[0071] The target path may be any path in the program loading directory path, or may be any path under the directory (such as the / usr / lib64 directory) that the second executable program depends on.
[0072] For example, the system mount space may be shown in the following MNT0:
[0073]
[0074] Thus, based on the system mount space MNT0, it can be known that the system mount space MNT0 may include multiple program loading directory paths, and different program loading directory paths may be used to store different resource libraries.
[0075] The target mount space may be a newly created namespace in the second operating system, which is used to mount the runtime dependency library that the virtual machine assembly depends on. In this way, the various resource information that the second operating system itself depends on and the runtime dependency library that the virtual machine assembly depends on can be isolated and stored.
[0076] In specific implementation, a path may be randomly selected in the system mount space as the target path, for example, the path / opt / cros / usr / lib64 in the above MNT0 may be selected as the target path.
[0077] At the same time, the space naming technology can be used to create a target mount space in the second operating system. For example, the target mount space MNT1 can be created in the system mount space MNT0.
[0078] S103: Mounting a target path storing the running dependency library in the target mount space; wherein the target path in the target mount space is used to provide dependency information of the virtual machine assembly in the second operating system.
[0079] In specific implementation, after the target mount space is created, a target path can be created in the target mount space, and the runtime dependency library can be mounted in the target path. In this way, the virtual machine module of the first operating system can be ported to the second operating system. If the first executable program is subsequently compiled in the second operating system, the runtime dependency library mounted in the target path in the target mount space can be used to provide dependency information for the first executable program of the virtual machine assembly. The dependency information can specifically be resource information stored in the runtime dependency library used to load and run the first executable program.
[0080] For example, when the target path is the / opt / cros / usr / lib64 path in MNT0, you can create the / opt / cros / usr / lib64 path in the target mount space, and mount the ld-linux-x86-64.so.2 resource library, libc.so.6 resource library and other resource libraries that the virtual machine assembly (ie VMTools) corresponding to Chrome OS depends on in the path.
[0081] In one embodiment, the program loading directory path may include a storage path of a first loading library used to load a first loader; the first loader is used to load a second executable program compiled by a second operating system; and the target root directory of the target mount space includes a path root directory corresponding to the storage path.
[0082] Here, the first loader can be a loader in the second operating system, for loading the executable program compiled by the second operation (i.e., the second executable program), and the first load library is the resource library that the first loader depends on. The storage path is the first load library, the storage path in the system mount space. Exemplarily, the first load library can be ld-linux-x86-64.so.2, and the storage path can be the / usr / lib64 / ld-linux-x86-64.so.2 path in MNT0.
[0083] The target root directory in the target mount space may be a default search directory corresponding to the first loader. For example, when the first loading library corresponding to the first loader is ld-linux-x86-64.so.2, the target root directory may be the / lib64 directory.
[0084] The path root directory may be a directory in the storage path that has a soft link with the target root directory, and the path root directory may be a directory that the second executable program actually depends on. Exemplarily, in MNT0, when the storage path is the / usr / lib64 / ld-linux-x86-64.so.2 path in MNT0, the target root directory may be the / lib64 directory, and the path root directory may be the / usr directory that has a soft link with the / lib64 directory.
[0085] With respect to S103, a target path storing the running dependent library may be mounted in the path root directory of the target mount space.
[0086] Exemplarily, the target mount space may be as shown in the following MNT1:
[0087]
[0088]
[0089] Based on the above target mount space MNT1, it can be known that the target path (i.e., / opt / cros / usr / lib64 path) storing the runtime dependency library can be mounted to the path root directory / usr by means of soft connection, so as to obtain the target mount space MNT1 with the target path mounted. In this way, the runtime dependency library that the first operating system depends on is stored under / usr / lib64 in MNT1, and the runtime dependency library that the second operating system depends on is stored under / usr / lib64 in MNT0.
[0090] In one embodiment, before mounting the target path storing the running dependency library, the following steps may be performed:
[0091] Modify the mount propagation attribute of the target root directory of the target mount space so that operations performed in the target mount space cannot be mapped to the system mount space.
[0092] Here, the mount propagation attribute is used to control whether the modification operation in the target mount space can affect the information of other mount spaces. It can be understood that the mount propagation attribute can determine whether the modification in the target mount space will cause associated modifications to other mount spaces.
[0093] For example, after the target mount space MNT1 is created by using the space naming technology, the mount propagation attribute of the target root directory of MNT1 (ie, the / lib64 directory) may be modified to a private state (ie, a private state).
[0094] In this way, it can be ensured that operations (such as modification operations, mount operations, etc.) performed in MNT1 cannot be mapped to MNT0 and other mount namespaces created in the second operating system, thereby avoiding the impact of operations performed in MNT1 on MNT0.
[0095] like Figure 4 FIG. 1 is a schematic diagram of a method of using a namespace to transplant a virtual machine module in a first operating system to a second operating system according to an embodiment of the present disclosure. Figure 4 In the example, the first operating system is Chrome OS, the second operating system is Ubuntu OS, MNT0 is the system mount space corresponding to Ubuntu OS, and MNT1 is the target mount space on which the virtual machine assembly of Chrome OS depends. MNT0 stores the ld-linux-x86-64.so.2 resource library, libc.so.6 resource library, and other resource libraries on which Ubuntu OS depends, and linux kernel is the linux kernel. MNT1 is located in MNT0, and MNT1 stores the ld-linux-x86-64.so.2 resource library, libc.so.6 resource library, and other resource libraries on which Chrome OS depends.
[0096] In one embodiment, to facilitate understanding of the dependency information mounting method provided in the embodiment of the present disclosure, the first operating system is Chrome OS and the second operating system is Ubuntu OS as an example for description:
[0097] Specifically, the system basic library on which VMTools in Chrome OS depends and the second loading library on which the second loader depends may be obtained first.
[0098] Then, you can select the target path / opt / cros / usr / lib64 from the program loading directory path included in the system mount space MNT0 of the Ubuntu OS.
[0099] Then, create the target mount space MNT1 in MNT0, and change the mountpropagation property of the target root directory of MNT1 to private.
[0100] Finally, you can mount the / opt / cros / usr path to the / usr path in MNT1. In this way, the loader and system base library of the distribution can be seen under / usr / lib64 in MNT0, while the loader and system base library on Chrome OS can be seen under / usr / lib64 in MNT1. In this way, VMTools can be run on Ubuntu OS while ensuring that the second executable program corresponding to Ubuntu OS can run normally.
[0101] In this way, since the target ecological environment is the Android ecological environment, and the first executable program in the virtual machine program set can be used to create a virtualized target ecological environment, the target ecological environment is the Android ecological environment, so the operation dependency library that the virtual machine program set depends on can support the operation of the virtual machine module corresponding to the first operating system. By creating a target mount space and mounting the operation dependency library to the target path in the target mount space, it can be achieved that the use of various original resources related to the second operating system stored in the system mount space of the second operating system is not affected, and the dependency information required for the operation of the virtual machine module can be obtained in the target mount space, thereby supporting the operation of the virtual machine module in the second operating system to create a target ecological environment that supports the operation of various Android applications. In this way, using the created target mount space, it is possible to isolate the resources required by the two operating systems in the same computing device, and then successfully transplant the virtualization module of the first operating system in a computing device where the second operating system is deployed, ensuring that the second operating system and the virtualization module can run normally and independently, enriching the software ecology of the second operating system, increasing the types and number of applications that the second operating system can support to run, and improving the application compatibility of the second operating system.
[0102] In one embodiment, after mounting the target path storing the running dependency library, the executable program may be run in the second operating system. Specifically, the executable program may be run according to the following steps:
[0103] Step 1: Get the program to be run.
[0104] Here, the program to be run is an executable program compiled in the second operating system transplanted with the virtualization module, and may be the first executable program or the second executable program.
[0105] Step 2: Determine whether the program to be run belongs to the virtual machine program set.
[0106] In specific implementation, after obtaining the program to be run, it can be determined whether the program to be run belongs to the virtual machine program set VMTools, that is, whether the program to be run belongs to the first executable program. If so, the following step three is executed; if not, the first loader corresponding to the second operating system can be used to parse and load the program to be run using the first loading library stored in MNT0, and the system basic library and other resource libraries that the second operating system depends on stored in MNT0 can be used to run the program to be run.
[0107] Step 3: If yes, obtain the stored runtime dependency library from the target path of the target mount space.
[0108] Step 4: Use the runtime dependency library to load and run the program to be run to obtain a virtualized target ecological environment.
[0109] Exemplarily, when the program to be run belongs to the first executable program, the second loading library and the system base library on which the first operating system depends can be obtained in the target path in MNT1. Then, the second loader corresponding to the first operating system is used to parse and load the program to be run based on the second loading library. At the same time, the system base library and other resource libraries stored in MNT1 on which the first operating system depends can be used to run the program to be run. When the program to be run runs successfully, a virtualized Android ecological environment can be obtained. Various types of Android applications can then be deployed and run in the Android ecological environment to enrich the software ecology of the Linux distribution and improve the application compatibility of the Linux distribution.
[0110] In one embodiment, before determining whether the program to be run belongs to the virtual machine program set, the system mount space may be entered first. Specifically, after obtaining the program to be run, whether the program to be run belongs to the first executable program or the second executable program, the system mount space corresponding to the second operating system may be entered first.
[0111] Then, when it is determined that the program to be run belongs to the virtual machine program set, the above step three can be implemented as follows:
[0112] Calling a space conversion program, and using the called space conversion program to switch from the system mount space to the target mount space;
[0113] Get the stored runtime dependency library from the target path of the target mount space.
[0114] Here, the space conversion program is a program for switching the mount space, which can realize entering the target mount space from the system mount space. In specific implementation, the space conversion program can be a pre-set nsenter program.
[0115] In specific implementation, when the program to be run belongs to a virtual machine program set, it means that the program to be run needs to rely on the running dependency library that the first operating system depends on in order to run successfully. At this time, since the system mount space has been entered, in order to accurately obtain the running dependency library that the first operating system depends on, it is necessary to switch from the system mount space to the target mount space.
[0116] For example, when the program to be run belongs to a virtual machine program set, the nsenter program can be called to enter the MNT1 space from the MNT0 space. Then, the ld-linux-x86-64.so.2 resource library, libc.so.6 resource library and other resource libraries stored in the target path mounted by MNT1 can be obtained from the first operating system.
[0117] In one embodiment, the step of “obtaining the stored runtime dependency library from the target path of the target mount space” can be implemented according to the following steps:
[0118] According to the loader field corresponding to the program to be run, obtain the path root directory in the target mount space;
[0119] Get the runtime dependency library from the target path mounted in the path root directory.
[0120] Here, the loader field can be the interpreter field carried by the program to be run, which points to the load library, system base library and other dependent libraries that the loader depends on by default. Exemplarily, the interpreter field can point to ld-linux-x86-64.so.2 in the / lib64 directory by default. Since the target mount space has been entered, the interpreter field can point to the target root directory / lib64 in the target mount space by default.
[0121] Exemplarily, after entering the MNT1 space, the target root directory / lib64 in the MNT1 space can be obtained according to the interpreter field. Then, based on the above introduction to the MNT1 space, it can be known that there is a soft link pointing to the / usr directory between the target root directory / lib64 and the path root directory / usr (i.e., / lib64->usr / lib64), so the path root directory / usr can be obtained by using the soft link. At the same time, based on the above introduction to the MNT1 space, it can also be known that there is a soft link pointing to the target path / opt / cros / usr between the / usr directory in / usr / lib64 and the target path / opt / cros / usr (i.e., usr-> / opt / cros / usr), so the soft link can be continued to be used to locate the target path under the path root directory of the MNT1 space under the / usr directory, and then, the ld-linux-x86-64.so.2 resource library, libc.so.6 resource library and other resource libraries that the first operating system depends on can be obtained from the target path.
[0122] Then, after obtaining each resource library from the MNT1 space, the second loader corresponding to the first operating system can be used to parse and load the program to be run based on the ld-linux-x86-64.so.2 resource library. At the same time, the libc.so.6 resource library and other resource libraries obtained in MNT1 can be used to run the program to be run. In this way, if the program to be run runs successfully, a virtualized Android ecological environment can be obtained, and then the deployment and operation of Android applications can be realized in the Android ecological environment.
[0123] In this way, using the space naming technology, it is possible to isolate the loaders and system base libraries corresponding to the two operating systems in the same computer device. Using the isolated loaders and system base libraries, the executable programs corresponding to the two operating systems (i.e., the first executable program and the second executable program) can be run, and at the same time, the resources under other paths in the system mount space of the second operating system can be shared, completing the fusion of the two operating systems and ensuring that the two fused operating systems are compatible.
[0124] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0125] Based on the same inventive concept, a dependency information mounting device corresponding to the dependency information mounting method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned dependency information mounting method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0126] like Figure 5 FIG. 1 is a schematic diagram of a dependency information mounting device provided by an embodiment of the present disclosure, including:
[0127] The acquisition module 501 is used to acquire a runtime dependency library that a virtual machine assembly of a first operating system depends on; the runtime dependency library is used to load and run a first executable program in the virtual machine assembly, and the first executable program is used to create a virtualized target ecological environment; the target ecological environment is an ecological environment of an application developed based on a target operating system, and the target operating system is different from the first operating system;
[0128] A selection module 502 is used to select a target path from the program loading directory path included in the system mount space of the second operating system, and create a target mount space in the second operating system;
[0129] The mounting module 503 is used to mount the target path storing the running dependency library in the target mounting space; wherein the target path in the target mounting space is used to provide dependency information of the virtual machine assembly in the second operating system.
[0130] In a possible implementation, the program loading directory path includes a storage path of a first loading library for loading a first loader; the first loader is used to load a second executable program compiled by the second operating system; the target root directory of the target mount space includes a path root directory corresponding to the storage path; the target root directory is a default search directory for the first loading library;
[0131] The mounting module 503, when mounting the target path storing the operation-dependent library in the target mounting space, is used to:
[0132] The target path storing the running dependent library is mounted under the path root directory of the target mounting space.
[0133] In a possible implementation, the device further includes an operation module 504, which is used to: after mounting the target path storing the operation dependency library,
[0134] Get the program to be run;
[0135] Determine whether the program to be run belongs to the virtual machine program set;
[0136] If yes, obtaining the stored runtime dependency library from the target path of the target mount space;
[0137] The program to be run is loaded and run by utilizing the run-dependency library to obtain the virtualized target ecological environment.
[0138] In a possible implementation, the running dependency library includes at least a second loading library and a system base library on which the second loader used to compile the first executable program depends; the system base library is used to run the first executable program, and the second loading library is used to load the first executable program.
[0139] In a possible implementation manner, the running module 504, before determining whether the program to be run belongs to the virtual machine program set, is further configured to:
[0140] Enter the system mount space;
[0141] And when obtaining the stored operation dependency library from the target path of the target mount space, it is used to:
[0142] Invoking a space conversion program, and using the invoked space conversion program to switch from the system mount space to the target mount space;
[0143] The stored runtime dependency library is obtained from the target path of the target mount space.
[0144] In a possible implementation, the running module 504, when acquiring the stored running dependency library from the target path of the target mount space, is configured to:
[0145] According to the loader field corresponding to the program to be run, obtaining the path root directory in the target mount space;
[0146] The operation dependency library is obtained in the target path mounted under the path root directory.
[0147] In a possible implementation manner, the operation module 504, before mounting the target path storing the operation dependency library, is further configured to:
[0148] The mount propagation attribute of the target root directory of the target mount space is modified so that operations performed in the target mount space cannot be mapped to the system mount space.
[0149] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0150] Based on the same technical concept, the embodiment of the present application also provides an electronic device. Figure 6 FIG. 1 is a schematic diagram of a structure of an electronic device provided in an embodiment of the present application, including:
[0151] Processor 601, memory 602 and bus 603. The memory 602 stores machine-readable instructions executable by the processor 601, and the processor 601 is used to execute the machine-readable instructions stored in the memory 602. When the machine-readable instructions are executed by the processor 601, the processor 601 performs the following steps: S101: obtaining a runtime dependency library that the virtual machine assembly of the first operating system depends on; the runtime dependency library is used to load and run the first executable program in the virtual machine assembly, and the first executable program is used to create a virtualized target ecological environment; the target ecological environment is the ecological environment of an application developed based on the target operating system, and the target operating system is different from the first operating system; S102: selecting a target path from the program loading directory path included in the system mount space of the second operating system, and creating a target mount space in the second operating system; S103: mounting the target path storing the runtime dependency library in the target mount space; wherein the target path in the target mount space is used to provide dependency information of the virtual machine assembly in the second operating system.
[0152] The above-mentioned memory 602 includes a memory 6021 and an external memory 6022; the memory 6021 here is also called an internal memory, which is used to temporarily store the calculation data in the processor 601, as well as the data exchanged with the external memory 6022 such as a hard disk. The processor 601 exchanges data with the external memory 6022 through the memory 6021. When the electronic device is running, the processor 601 communicates with the memory 602 through the bus 603, so that the processor 601 executes the execution instructions mentioned in the above method embodiment.
[0153] The embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the dependency information mounting method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0154] The computer program product of the dependency information mounting method provided in the embodiment of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the steps of the dependency information mounting method described in the above method embodiment. Please refer to the above method embodiment for details, which will not be repeated here.
[0155] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0156] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0157] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0158] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0159] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0160] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0161] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for mounting dependency information, characterized in that: include: Obtaining a runtime dependency library that a virtual machine assembly of the first operating system depends on; The operation dependency library is used to load and run the first executable program in the virtual machine program set, and the first executable program is used to create a virtualized target ecological environment; The target ecological environment is an ecological environment of applications developed based on a target operating system, and the target operating system is different from the first operating system; Selecting a target path from the program loading directory path included in the system mount space of the second operating system, and creating a target mount space in the second operating system; The target path of the running dependency library is mounted and stored in the target mount space; wherein the target path in the target mount space is used to provide dependency information of the virtual machine assembly in the second operating system.
2. The method according to claim 1, characterized in that The program loading directory path includes a storage path of a first loading library for loading a first loader; the first loader is used to load a second executable program compiled by the second operating system; the target root directory of the target mount space includes a path root directory corresponding to the storage path; the target root directory is a default search directory for the first loading library; Mounting the target path storing the running dependent library in the target mount space includes: The target path storing the running dependent library is mounted under the path root directory of the target mounting space.
3. The method according to claim 1, characterized in that After mounting the target path storing the operation dependency library, the method further includes: Get the program to be run; Determine whether the program to be run belongs to the virtual machine program set; If yes, obtaining the stored runtime dependency library from the target path of the target mount space; The program to be run is loaded and run by utilizing the run-dependency library to obtain the virtualized target ecological environment.
4. The method according to claim 3, characterized in that The operation dependency library includes at least a second loading library and a system base library on which the second loader for compiling the first executable program depends; the system base library is used to run the first executable program, and the second loading library is used to load the first executable program.
5. The method according to claim 3, characterized in that: Before determining whether the program to be run belongs to the virtual machine program set, the method further includes: Enter the system mount space; Acquiring the stored runtime dependency library from the target path of the target mount space includes: Invoking a space conversion program, and using the invoked space conversion program to switch from the system mount space to the target mount space; The stored runtime dependency library is obtained from the target path of the target mount space.
6. The method according to claim 5, characterized in that The step of acquiring the stored runtime dependency library from the target path of the target mount space includes: According to the loader field corresponding to the program to be run, obtaining the path root directory in the target mount space; The operation dependency library is obtained in the target path mounted under the path root directory.
7. The method according to claim 2, characterized in that Before mounting the target path storing the running dependency library, the method further includes: The mount propagation attribute of the target root directory of the target mount space is modified so that operations performed in the target mount space cannot be mapped to the system mount space.
8. A dependency information mounting device, characterized in that: include: An acquisition module, used for acquiring a runtime dependency library that a virtual machine assembly of a first operating system depends on; The operation dependency library is used to load and run the first executable program in the virtual machine program set, and the first executable program is used to create a virtualized target ecological environment; The target ecological environment is an ecological environment of applications developed based on a target operating system, and the target operating system is different from the first operating system; A selection module, used to select a target path from the program loading directory path included in the system mount space of the second operating system, and create a target mount space in the second operating system; A mounting module is used to mount the target path storing the running dependency library in the target mounting space; wherein the target path in the target mounting space is used to provide dependency information of the virtual machine assembly in the second operating system.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the dependency information mounting method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed by an electronic device, the electronic device executes the steps of the dependency information mounting method according to any one of claims 1 to 7.