CN104049970B - The automatic identifying method and system of User space architecture platform - Google Patents
The automatic identifying method and system of User space architecture platform Download PDFInfo
- Publication number
- CN104049970B CN104049970B CN201410236437.5A CN201410236437A CN104049970B CN 104049970 B CN104049970 B CN 104049970B CN 201410236437 A CN201410236437 A CN 201410236437A CN 104049970 B CN104049970 B CN 104049970B
- Authority
- CN
- China
- Prior art keywords
- system information
- user space
- data structure
- variable
- kernel
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Stored Programmes (AREA)
Abstract
The invention discloses a kind of automatic identifying method and system of User space architecture platform, methods described includes:Configure linux kernel;System information is obtained in User space;And identifying system architecture platform.The method according to the invention and system, system architecture or hardware platform can be automatically identified, realize the application module that is generated after a set of code compilation can the more hardware platform functions of adaptive allocation multisystem framework, without compiling the application program of multiple different editions further according to different system framework or hardware platform.
Description
Technical field
The present invention relates to embedded OS field, more particularly to a kind of automatic identifying method of User space architecture platform
And system.
Background technology
Current digital communication era, the system architecture that different vendor uses are different, it is also possible to which same manufacturer props up simultaneously
Several system architecture platforms are held, and a kind of architecture platform may derive different product form, then for a set of code,
How to distinguish different system architectures and different hardware platforms have become all big enterprises all can problems faced, may be different
The differentiating method of manufacturer is different, and kernel is being configured by make menuconfig to specify using preceding generally by kernel state
Framework (MIPS, ARM, X86 etc.);Or User space controls version of the compiling for different frameworks or hardware platform by compiling macro
This executable file.
For different system framework or hardware platform, compiling every time need to specify or change compiling option or compiling macro, need to compile
Translate multiple different editions, very time and effort consuming, trouble.
The content of the invention
It is an object of the invention to provide a kind of automatic identifying method and system of User space architecture platform, this method passes through interior
Core identifies and preserves system related information, is obtained in User space and uses the system related information, to solve different hardware platforms
The identification problem of type.
In order to solve the above-mentioned technical problem, the invention provides a kind of automatic identifying method of User space architecture platform, bag
Include following steps:Step S100, configure linux kernel;Step S200, system information is obtained in User space;And step S300,
Identifying system architecture platform.
Wherein, the step of linux kernel is configured in the step S100 includes:The newly-built kernel for including system information variable
Data structure, increase the kernel interface function of the system information for identifying current device, the system information is stored in described
In kernel data structure.
Wherein, include in the step S200 the step of User space obtains system information:Pass through equipment in User space
Ioctl functions obtain the system information from kernel data structure.
Wherein, include in the step S300 the step of identifying system architecture platform:Believed in User space according to the system
Breath defines corresponding system information variable;By the use of the system information variable as Rule of judgment to judge that different system architectures is put down
Platform;Load the initialization program of different system architecture platforms.
Wherein, the step S100 further comprises:Step S110, newly-built kernel data structure;Step S120, increase newly interior
Kernel interface function;Step S130, assignment is carried out to newly-built kernel data structure.
The step S200 further comprises step:Step S210, newly-built User space data structure;Step S220, is based on
User space data structure obtains the system information of current device.
Optionally, the step S210 also includes:The global variable array of User space data structure is stated, increases User space
Interface function.
The step S300 further comprises:Step S310, assignment is carried out to the relevant variable in User space data structure;
Step S320, identifying system architecture platform type;Step S330, according at the beginning of the type of the system architecture platform of identification performs equipment
Beginningization.
Preferably, in the step S320, the global variable for the different system architecture platform that User space passes through acquisition is used as
The criterion for distinguishing different hardware equipment carries out characteristic encoding, with identifying system architecture platform type.
According to another aspect of the present invention, there is provided a kind of automatic recognition system of User space architecture platform, its feature exist
In, including:Linux kernel dispensing unit, for the kernel data structure of newly-built system information variable, increase current for identifying
The system information of the current device recognized is stored in the kernel by the kernel interface of the system information of equipment, the kernel interface
In data structure;System information acquiring unit, for obtaining institute from kernel data structure by equipment ioctl functions in User space
State system information;System identification unit, corresponding system information variable is defined according to system information using User space, is by this
Information variable unite as Rule of judgment, different system architecture platforms is identified, to load the initial of different system architecture platforms
Change program.
The present invention establishes the kernel interface letter of the system information for identifying current device by configuring linux kernel
Number and the kernel data structure for storing system information, in order to which User space reads system information;By User space according to institute
State system information and define corresponding system information variable, different systems is loaded by the use of the system information variable as Rule of judgment
The initialization program of architecture platform, to realize the automatic identification of architecture platform;Put down according to the system architecture or hardware judged
Platform realizes the more hardware platform functions of application program adaptive allocation multisystem framework of being generated after a set of code compilation, without
Compile multiple different editions application programs further according to different system framework or hardware platform, saved time cost and software into
This.
Brief description of the drawings
Fig. 1 is the flow chart of the automatic identifying method of the present invention;
Fig. 2 is the method flow diagram for configuring linux kernel in the present invention in step S100;
Fig. 3 is the method flow diagram for obtaining system information in the present invention in step S200;
Fig. 4 is the method flow diagram of step S300 in the present invention;
Fig. 5 shows the structural representation of the automatic recognition system of the present invention.
Embodiment
To make the object, technical solutions and advantages of the present invention of greater clarity, with reference to embodiment and join
According to accompanying drawing, the present invention is described in more detail.It should be understood that these descriptions are merely illustrative, and it is not intended to limit this hair
Bright scope.In addition, in the following description, the description to known features and technology is eliminated, to avoid unnecessarily obscuring this
The concept of invention.
Embodiment 1
Fig. 1 shows the flow chart of the automatic identifying method of the present invention.
As shown in figure 1, the automatic identifying method of the present invention comprises the following steps:
Step S100, configure linux kernel.
It is newly-built to include the kernel data structure of system information variable, and increase the system information for identifying current device
Kernel interface function, while the system information is stored in the kernel data structure.
Step S200, system information is obtained in User space.
The system information is obtained from kernel data structure by equipment ioctl functions in User space.
In this step, the ioctl functions are the functions being managed in device driver to the I/O passages of equipment.
Step S300, identifying system architecture platform.
Corresponding system information variable is defined according to the system information in User space.And become using the system information
Amount is used as Rule of judgment, judges different system architecture platforms, real to load the initialization program of different system architecture platforms
The automatic identification of existing architecture platform.
In the present embodiment, the system information is system configuration information and/or hardware platform information;The system information
Variable is system configuration information variable and/or hardware platform variable;Wherein, the hardware platform information is cpu information and/or total
Line information;The hardware platform variable is cpu information variables and/or bus message variable.
Fig. 2 shows the method flow diagram that linux kernel is configured in step S100.
As shown in Fig. 2 the step of linux kernel is configured in above-mentioned steps S100 further comprises following step:
Step S110, newly-built kernel data structure.
In this step, the kernel data structure includes system configuration information variable, cpu information variables, bus variable etc..
Such as following data structures, struct platform_info { intsysterm_type;(type can basis by int cpu_info
Need to may also be structure);Int bus_info (type can may also be structure as needed) }.
Step S120, increase kernel interface function newly.
In this step, kernel interface function is used to identify the system information that current device is used, i.e., system architecture and
The cpu information and bus message of hardware device.
Step S130, assignment is carried out to newly-built kernel data structure.
After kernel interface function identifies said system information, these system informations are stored in newly-built kernel data
In structure.For example, linux kernel can configure kernel before use according to individual demand, then can be according to the CONFIG_ of configuration
MIPS, CONFIG_ARM, CONFIG_X86 judge system architecture and are assigned to systerm_type;Then read by kernel function
The cpu information of hardware device, bus message is taken to be assigned to cpu_info, bus_info.
Fig. 3 shows that the User space in the step S200 is obtained by equipment ioctl functions from kernel data structure
The flow chart of the method for the system information.
As described in Figure 3, User space obtains institute by equipment ioctl functions from kernel data structure in the step S200
The method for stating system information, comprises the following steps:
Step S210, newly-built User space data structure.
In this step, the newly-built User space data structure in User space, while state the global variable number of the data structure
Group, increase User space interface function.The global variable array includes system information variable.
Step S220, the system information of current device is obtained based on User space data structure.
In this step, before system initialization, issued based on User space data structure by equipment ioctl functions described
Kernel interface function, with the system information of the current device in the User space acquisition step S100.The User space data
Structure includes system information variable, and the system information variable is system configuration information variable and/or hardware platform variable, described
System information is system configuration information and/or hardware platform information.
Fig. 4 shows step S300 flow chart.
As shown in figure 4, in the step S300, corresponding system information is defined according to the system information in User space and become
The method of amount, and the initialization program for loading different system architecture platforms by the use of the system information variable as Rule of judgment has
Body comprises the following steps:
Step S310, assignment is carried out to the relevant variable in User space data structure.
In this step, the system information for the current device that the User space in the step S210 obtains, institute is assigned to
The corresponding member variable of the global variable array of User space data structure is stated, for judging different system architecture platforms.Tool
For body, according to the step S200 system architectures obtained and the cpu information of hardware device, bus message etc., corresponding contents are assigned
It is worth and gives the corresponding member variable of the global variable of User space data structure (system configuration information variable and/or hardware platform change
Amount).
Step S320, identifying system architecture platform type.
In this step, by the use of the system information of acquisition as identifying feature, different system architecture platforms is identified, i.e.
The global variable for the different architecture platforms that User space passes through acquisition is used as the criterion progress characteristic for distinguishing different hardware equipment
Coding, to realize the automatic identification of architecture platform.Specifically, it is used as and is distinguished according to the global variable for defining different architecture platforms
The criterion of different hardware equipment carries out characteristic encoding.For example, different hardware equipment number of ports is different, driving type is different,
Feature development is carried out according to the platform of judgement, to load different driving and initialization distinct interface number etc..
Step S330, equipment initialization is performed according to the type of the system architecture platform of identification.
In this step, when hardware device initializes, it can determine that framework is put down according to the system architecture platform information recognized
The type of platform and corresponding software version, that is, determine to perform corresponding architecture platform branch, realize a set of one version of code compilation
This.Finally realize that carrying out different initialization to distinct device on multiple frameworks or multiple hardware platforms loads.
Embodiment 2
The automatic recognition system implemented on the basis of embodiment 1.
Fig. 5 has gone out the structural representation of the automatic recognition system of the present invention.
As shown in figure 5, the automatic recognition system of the identification User space architecture platform of the present invention includes following components.
Linux kernel dispensing unit, for the kernel data structure of newly-built system information variable, and increase and work as identifying
The system information of the current device recognized is stored in described by the kernel interface of the system information of preceding equipment, the kernel interface
Identified in Nuclear Data structure.
System information acquiring unit, for passing through in User space described in equipment ioctl functions from kernel data structure acquisition
System information.
System identification unit, corresponding system information variable is defined according to system information using User space, passes through the system
Information variable identifies different system architecture platforms, to load the initialization of different system architecture platforms as Rule of judgment
Program, so as to realize the automatic identification of architecture platform.
In the present embodiment, the system information is system configuration information and/or hardware platform information;The system information becomes
Measure as system configuration information variable and/or hardware platform variable;Wherein, the hardware platform information is cpu information and/or bus
Information;The hardware platform variable is cpu information variables and/or bus message variable.
In the present embodiment, linux kernel dispensing unit, system information acquiring unit, performed by system automatic identification unit
Operation it is similar with each step in embodiment 1, referring specifically to corresponding steps in step S100, step S200, step S300
Specific implementation method.
According to the automatic identifying method and system of the present invention, it can pass through by obtaining kernel configuration information and read system
To unite information, i.e. system configuration information, the CPU information of hardware device, bus message judges system architecture or hardware platform, so as to
System architecture or hardware platform according to judging realize the application program adaptive allocation polyphyly generated after a set of code compilation
The system more hardware platform functions of framework, without compiling multiple different editions application journeys further according to different system framework or hardware platform
Sequence, that is, realize the different loadings of a mirror image distinct device.Therefore, automatic identifying method of the invention and system, which can save, is
Run time of uniting and construction cost.
It should be appreciated that the above-mentioned embodiment of the present invention is used only for exemplary illustration or explains the present invention's
Principle, without being construed as limiting the invention.Therefore, that is done without departing from the spirit and scope of the present invention is any
Modification, equivalent substitution, improvement etc., should be included in the scope of the protection.In addition, appended claims purport of the present invention
Covering the whole changes fallen into scope and border or this scope and the equivalents on border and repairing
Change example.
Claims (9)
1. a kind of automatic identifying method of User space architecture platform, comprises the following steps:
Step S100, configure linux kernel;
Step S200, system information is obtained in User space;And
Step S300, identifying system architecture platform;
The step of linux kernel is configured in the step S100 includes:The newly-built kernel data structure for including system information variable,
The system information is system configuration information, and the system information is stored in the kernel data structure;The system information
Variable is system configuration information variable;
Include in the step S200 the step of User space obtains system information:Newly-built User space data structure;Based on user
State data structure obtains the system information of current device;
Include in the step S300 the step of identifying system architecture platform:Defined accordingly according to the system information in User space
System information variable;Wherein, according to the system information of the current device, it is assigned to the overall situation of the User space data structure
The corresponding member variable of variable array;By the use of the system information variable as Rule of judgment to judge that different system architectures is put down
Platform.
2. the step of linux kernel is configured automatic identifying method according to claim 1, in the step S100 is also wrapped
Include:Increase the kernel interface function of the system information for identifying current device.
3. automatic identifying method according to claim 1, the step of system information is obtained in the step S200 in User space
Suddenly include:The system information is obtained from kernel data structure by equipment ioctl functions in User space.
4. automatic identifying method according to claim 1, in the step S300 the step of identifying system architecture platform also
Including:Load the initialization program of different system architecture platforms.
5. automatic identifying method according to claim 1 or 2, the step S100 further comprises:
Step S110, newly-built kernel data structure;
Step S120, increase kernel interface function newly;
Step S130, assignment is carried out to newly-built kernel data structure.
6. automatic identifying method according to claim 1, the step S200 also includes:State User space data structure
Global variable array, increase User space interface function.
7. the automatic identifying method according to claim 1 or 4, the step S300 further comprises:
Step S310, assignment is carried out to the relevant variable in User space data structure;
Step S320, identifying system architecture platform type;
Step S330, equipment initialization is performed according to the type of the system architecture platform of identification.
8. automatic identifying method according to claim 7, in the step S320,
The global variable for the different system architecture platform that User space passes through acquisition is used as the criterion for distinguishing different hardware equipment
Characteristic encoding is carried out, with identifying system architecture platform type.
A kind of 9. automatic recognition system of User space architecture platform, it is characterised in that including:
Linux kernel dispensing unit, for the kernel data structure of newly-built system information variable, increase for identifying current device
System information kernel interface, the system information of the current device recognized is stored in the kernel data by the kernel interface
In structure;The system information is system configuration information;The system information variable is system configuration information variable;
System information acquiring unit, for obtaining the system from kernel data structure by equipment ioctl functions in User space
Information;It is additionally operable to newly-built User space data structure;The system information of current device is obtained based on User space data structure;
System identification unit, corresponding system information variable is defined according to system information using User space, passes through the system information
Variable identifies different system architecture platforms, to load the initialization program of different system architecture platforms as Rule of judgment;
Be additionally operable to the system information according to the current device, be assigned to the User space data structure global variable array it is corresponding
Member variable.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410236437.5A CN104049970B (en) | 2014-05-29 | 2014-05-29 | The automatic identifying method and system of User space architecture platform |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410236437.5A CN104049970B (en) | 2014-05-29 | 2014-05-29 | The automatic identifying method and system of User space architecture platform |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104049970A CN104049970A (en) | 2014-09-17 |
CN104049970B true CN104049970B (en) | 2018-01-16 |
Family
ID=51502879
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410236437.5A Active CN104049970B (en) | 2014-05-29 | 2014-05-29 | The automatic identifying method and system of User space architecture platform |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104049970B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104615493A (en) * | 2015-01-14 | 2015-05-13 | 浪潮电子信息产业股份有限公司 | Cross-platform server-side mode recognition tool and method |
CN105491387B (en) * | 2015-12-04 | 2019-06-21 | 武汉斗鱼网络科技有限公司 | A kind of H264 hardware encoding system based on tri- platform of Intel, AMD and Nvidia |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100472440C (en) * | 2005-11-09 | 2009-03-25 | 中兴通讯股份有限公司 | A method for hardware drive program of intelligent loading mobile phone |
-
2014
- 2014-05-29 CN CN201410236437.5A patent/CN104049970B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN104049970A (en) | 2014-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10817279B1 (en) | Providing different upgrade paths for upgrading a server | |
CN104008060B (en) | Method for detecting compatibility of plug-in and host, and detection server | |
US10802815B1 (en) | Managing upgrades of clients having different installed versions of a software product | |
CN104978271A (en) | Automatic upgrade pressure measurement method and system for Android system | |
US20190347190A1 (en) | Code usage map | |
CN106462422B (en) | System upgrading method and device for multi-system terminal and terminal | |
CN104246702A (en) | Workflow compilation | |
CN106648563B (en) | Dependency decoupling processing method and device for shared module in application program | |
CN110389903B (en) | Test environment deployment method and device, electronic equipment and readable storage medium | |
CN106371864A (en) | Method for quickly deploying plugin architecture | |
CN104049970B (en) | The automatic identifying method and system of User space architecture platform | |
US20160328173A1 (en) | Scalable and flexible operating system platform | |
CN106484620A (en) | Method for testing multi-system terminal equipment, control equipment and console | |
CN110209520A (en) | A kind of method, apparatus, computer equipment and storage medium improving SSD testing efficiency | |
CN112732561A (en) | Project deployment method and device, computer equipment and storage medium | |
CN111953503B (en) | NFV resource deployment arrangement method and network function virtualization orchestrator | |
CN109406025B (en) | Pressure testing method and device and electronic equipment | |
CN107341106A (en) | Application compatibility detection method, exploitation terminal and storage medium | |
CN114647519A (en) | Data transmission method and device between native platform and Flutter platform and storage medium | |
US9886374B1 (en) | Virtual device farm for software testing | |
CN107025126B (en) | Resource scheduling method, NFVO and system | |
CN109284137B (en) | Hypervisor-based QNX operating system starting method and device | |
CN110673988A (en) | eMMC debugging method independent of self-contained firmware | |
CN114356346A (en) | Application program deployment method, device, storage medium and electronic equipment | |
Barbier et al. | Software adaptation: classification and a case study with state chart xml |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
PP01 | Preservation of patent right |
Effective date of registration: 20180528 Granted publication date: 20180116 |
|
PP01 | Preservation of patent right |