CN106155961B - The method and device of parameter is passed to kernel based on BootLoader - Google Patents

The method and device of parameter is passed to kernel based on BootLoader Download PDF

Info

Publication number
CN106155961B
CN106155961B CN201610598689.1A CN201610598689A CN106155961B CN 106155961 B CN106155961 B CN 106155961B CN 201610598689 A CN201610598689 A CN 201610598689A CN 106155961 B CN106155961 B CN 106155961B
Authority
CN
China
Prior art keywords
physical memory
operating system
memory
crc check
hardware parameter
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
Application number
CN201610598689.1A
Other languages
Chinese (zh)
Other versions
CN106155961A (en
Inventor
璧典腹
赵丹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201610598689.1A priority Critical patent/CN106155961B/en
Publication of CN106155961A publication Critical patent/CN106155961A/en
Application granted granted Critical
Publication of CN106155961B publication Critical patent/CN106155961B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The application provides a kind of method and device for passing parameter to kernel based on BootLoader, which comprises BootLoader will need the hardware parameter transmitted to be stored in specified physical memory, and the address information of the physical memory is sent to operating system;Wherein, of length no more than preset length threshold of the physical memory, the maximum value of the hardware parameter quantity of the length threshold characterization single transmitting;Operating system based on the address information received, by the physical memory be limited to it is non-can committed memory;Operating system reads the hardware parameter stored in the physical memory and executes starting, and establishes the physical address of the physical memory and the mapping relations of the logical address in operating system logical address space.Reduce operating system to the access times of hardware chip, to improve the rate that embedded device is started and run due to improving the quantity of BootLoader transmitting hardware parameter using the embodiment of the present invention.

Description

The method and device of parameter is passed to kernel based on BootLoader
Technical field
This application involves computer communication fields, more particularly to pass the method and dress of parameter to kernel based on BootLoader It sets.
Background technique
In embedded systems, BootLoader (start-up loading device) is that one section run during device power starting draws Lead sequence is mainly used for initializing hardware device, transmits hardware parameter to kernel and establishes the space reflection etc. of memory.Especially It is that BootLoader plays a crucial role the starting speed of embedded device to the efficiency of kernel transmitting hardware parameter.
However, it is limited that BootLoader transmits hardware parameter ability, and is in operation in the operating system initialization stage During system operation, when operating system needs to be used for multiple times the same hardware parameter of BootLoader transmitting, then need frequently to visit It asks hardware chip, hardware parameter is read from the chip, thus reduce the rate that embedded device is started and run.
Summary of the invention
In view of this, the application provides a kind of method and device for passing parameter to kernel based on BootLoader, to mention The rate that high embedded device is started and run.
According to a first aspect of the embodiments of the present invention, a kind of method passing parameter to kernel based on BootLoader is provided, The method is applied to embedded device, comprising:
BootLoader will need the hardware parameter that transmits to be stored in specified physical memory, and by the physical memory Address information is sent to operating system;Wherein, of length no more than preset length threshold of the physical memory, the length threshold The maximum value of the hardware parameter quantity of value characterization single transmitting;
Operating system based on the address information received, by the physical memory be limited to it is non-can committed memory;
Operating system reads the hardware parameter stored in the physical memory and executes starting, and establishes in the physics The mapping relations for the logical address in physical address and operating system logical address space deposited.
According to a second aspect of the embodiments of the present invention, a kind of device being passed parameter to kernel based on BootLoader is provided, Described device includes:
Transmission unit will need the hardware parameter transmitted to be stored in specified physical memory for BootLoader, and will The address information of the physical memory is sent to operating system;Wherein, of length no more than preset length of the physical memory Threshold value, the maximum value of the hardware parameter quantity of the length threshold characterization single transmitting;
The physical memory is limited to non-by limiting unit for operating system based on the address information received It can committed memory;
Creating unit reads the hardware parameter stored in the physical memory for operating system and executes starting, and Establish the physical address of the physical memory and the mapping relations of the logical address in operating system logical address space.
The embodiment of the present invention proposes a kind of new method for passing parameter to kernel based on BootLoader.By to being based on BootLoader passes the improvement of parameter mechanism, and BootLoader can will need the hardware parameter transmitted to be stored in specified physics In depositing, and the address information of the physical memory can be sent to operating system, the of length no more than of the physical memory presets Length threshold institute, and the length threshold characterization single transmitting hardware parameter size maximum value.Operating system can be with base In the address information received, by the physical memory be limited to it is non-can committed memory, and the physics can be read The hardware parameter stored in memory executes starting, and the physical address and operating system of establishing the physical memory are logically The mapping relations of logical address in the space of location.
On the one hand, before os starting, since the length of physical memory is by traditional regular length, length is changed into No more than preset length threshold, length threshold characterizes the maximum value of the hardware parameter quantity of single transmitting, therefore can be effective Ground expands the quantity of transmitting hardware parameter, improves the starting rate of operating system.
On the other hand, due to operating system by the physical memory be limited to it is non-can committed memory, after os starting, The physical memory will not be occupied, and the hardware parameter stored in physical memory is safeguarded.When operating system needs are used for multiple times When the hardware parameter, it can be obtained by the physical memory, without continually being read from hardware.This improves embedding Enter the operating rate of formula equipment.
Based on above-mentioned both sides reason, embedded device can be improved using method provided in an embodiment of the present invention and start With the rate of operation.
Detailed description of the invention
Fig. 1 is a kind of related skill for passing parameter to kernel based on BootLoader shown in one exemplary embodiment of the application The flow chart of art scheme;
Fig. 2 is a kind of method for passing parameter to kernel based on BootLoader shown in one exemplary embodiment of the application Flow chart;
Fig. 3 is another method for passing parameter to kernel based on BootLoader shown in one exemplary embodiment of the application Flow chart;
Fig. 4 is a kind of device institute for passing parameter to kernel based on BootLoader shown in one exemplary embodiment of the application In a kind of hardware structure diagram of equipment;
Fig. 5 is a kind of device for passing parameter to kernel based on BootLoader shown in one exemplary embodiment of the application Block diagram.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all embodiments consistent with the application.On the contrary, they be only with it is such as appended The example of the consistent device and method of some aspects be described in detail in claims, the application.
It is only to be not intended to be limiting the application merely for for the purpose of describing particular embodiments in term used in this application. It is also intended in the application and the "an" of singular used in the attached claims, " described " and "the" including majority Form, unless the context clearly indicates other meaning.It is also understood that term "and/or" used herein refers to and wraps It may be combined containing one or more associated any or all of project listed.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the application A little information should not necessarily be limited by these terms.These terms are only used to for same type of information being distinguished from each other out.For example, not departing from In the case where the application range, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as One information.Depending on context, word as used in this " if " can be construed to " ... when " or " when ... When " or " in response to determination ".
It is hard to kernel transmitting to be that one kind shown in one exemplary embodiment of the application is based on BootLoader referring to Fig. 1, Fig. 1 The flow chart of the related art scheme of part parameter.
In embedded device, BootLoader is one section of bootstrap before os starting.Similar to PC machine Bootstrap loader BIOS.
After embedded device starting, in operating system nucleus initial phase, BootLoader can be into operating system Core transmitting hardware parameter initializes hardware device and the space reflection figure for establishing memory etc..Especially, BootLoader is to behaviour The quantity for making system kernel transmitting hardware parameter, determines the starting speed of embedded device.BootLoader is to operating system The quantity that kernel transmits hardware parameter is more, the quantity for the hardware parameter that operating system and other applications can be used directly Also more, the starting speed of embedded device is faster.
In the relevant mechanism for transmitting hardware parameter to kernel based on BootLoader, BootLoader can will need The hardware parameter of transmitting is stored in one section of fixed physical memory, and can by the start physical address of this section of physical memory and Length is sent to operating system.Operating system can search this section of physics based on the start physical address received and length Memory, and using the hardware parameter stored in the physical memory, execute system starting.
When realizing, as shown in Figure 1, BootLoader can apply for one section of regular length physical memory, needed for storing The hardware parameter to be transmitted.BootLoader will need the memory storage transmitted in the physical memory, and it is hard to calculate this The CRC check value of part parameter, and the CRC check value is pre-stored in the physical memory.After the hardware parameter is stored, The start physical address of the physical memory and length can be sent to operating system by BootLoader.Operating system is receiving After the start physical address and length, corresponding physical memory can be searched, and can be based on and be pre-stored in the physics The corresponding algorithm of CRC check value in depositing calculates the crc value of the hardware parameter saved in physical memory.Operating system can compare More calculated CRC check value and the CRC check value prestored, when two crc values are consistent, operating system can determine the hardware Parameter has passed through CRC check.After through CRC check, operating system can read the hardware stored in the physical memory Parameter executes system start-up operation.
However, on the one hand, since BootLoader is the physics that the hardware parameter that will need to transmit is stored in regular length In memory, since the length of the physical memory is fixed, so the hardware parameter that BootLoader is stored in the physical memory Quantity is restricted, and then affects BootLoader to the quantity of operating system nucleus transmitting hardware parameter, is reduced embedding Enter the starting rate of formula equipment.
On the other hand, since after os starting, the hardware parameter of this section of physical memory will be by other content Covering.If when needing that above-mentioned hardware parameter is used for multiple times, operating system can only be by continually in the operating system stage Hardware chip is accessed, the hardware parameter is read.Since operating system needs continually to access the hardware in above-mentioned embedded device Chip, therefore reduce the operating rate of the embedded device.
Therefore, it is based on above-mentioned two aspects reason, uses the related skill based on BootLoader to kernel transmitting hardware parameter Art, can reduce embedded device starts and runs rate.
The embodiment of the present invention proposes a kind of new method for passing parameter to kernel based on BootLoader.By to being based on BootLoader passes the improvement of parameter mechanism, and BootLoader can will need the hardware parameter transmitted to be stored in specified physics In depositing, and the address information of the physical memory can be sent to operating system, the of length no more than of the physical memory presets Length threshold institute, and the length threshold characterization single transmitting hardware parameter size maximum value.Operating system can be with base In the address information received, by the physical memory be limited to it is non-can committed memory, and the physics can be read The hardware parameter stored in memory executes starting, and the physical address and operating system of establishing the physical memory are logically The mapping relations of logical address in the space of location.
On the one hand, before os starting, since the length of physical memory is by traditional regular length, length is changed into No more than preset length threshold, length threshold characterizes the maximum value of the hardware parameter quantity of single transmitting, therefore can be effective Ground expands the quantity of transmitting hardware parameter, improves the starting rate of operating system.
On the other hand, due to operating system by the physical memory be limited to it is non-can committed memory, after os starting, The physical memory will not be occupied, and the hardware parameter stored in physical memory is safeguarded.When operating system needs are used for multiple times When the hardware parameter, it can be obtained by the physical memory, without continually being read from hardware.This improves embedding Enter the operating rate of formula equipment.
Based on above-mentioned both sides reason, embedded device can be improved using method provided in an embodiment of the present invention and start With the rate of operation.
Referring to fig. 2, Fig. 2 is that one kind shown in one exemplary embodiment of the application is based on BootLoader to kernel biography parameter Method flow chart, this method be applied to embedded device, comprising the following steps:
Step 201:BootLoader will need the hardware parameter that transmits to be stored in specified physical memory, and by the object The address information of reason memory is sent to operating system;Wherein, of length no more than preset length threshold of the physical memory, institute State the maximum value of the hardware parameter quantity of length threshold characterization single transmitting.
In embedded device, BootLoader is the one section of bootstrap run before os starting, is mainly used for Hardware parameter is transmitted to operating system nucleus, initialize hardware device and establishes the space reflection etc. of memory.
In the relevant mechanism for passing parameter to kernel based on BootLoader, after embedded device starting, it is in operation System initial phase, BootLoader can transmit hardware parameter to operating system nucleus.When realizing, BootLoader can be with The hardware parameter transmitted will be needed to be stored in the physical memory of one section of regular length, and the address information of the physical memory is passed Pass operating system.Operating system is obtained the hardware parameter stored in the physical memory, is held based on the address information received The starting of row system.
Since the length of the physical memory of above-mentioned storage hardware parameter is fixed, limiting BootLoader to operation is Kernel of uniting transmits the quantity of hardware parameter, reduces the starting rate of embedded device.
In the present embodiment, BootLoader will need the hardware parameter transmitted to be stored in one section of physical memory, the object Of length no more than preset length threshold of memory is managed, which characterizes the maximum of the hardware parameter quantity of single transmitting Value.Since in the present embodiment, preset length threshold is greater than above-mentioned regular length, so BootLoader is in application physics When memory, the length of the physical memory to be applied can be determined according to the number of transmitted hardware parameter quantity.Due to storage The length for depositing the physical memory of hardware parameter is become being no more than preset length threshold from regular length, to a certain extent, is increased The big length of the physical memory, has also been enlarged BootLoader to the quantity of operating system nucleus transmitting hardware parameter, improves The starting rate of embedded device.
When realizing, BootLoader can according to need the hardware parameter quantity of transmitting, apply for one section of physical memory, should Of length no more than preset length threshold of physical memory.BootLoader can calculate the CRC for needing the hardware parameter transmitted Check value, and the calculated CRC check value can be pre-stored in front of the starting of the physical memory in 4 bytes, and this is hard Part parameter is stored in the physical memory.BootLoader will need the CRC check value of the hardware parameter transmitted to be pre-stored in the object The purpose for managing memory, is the CRC check that can carry out hardware parameter for operating system, guarantees the reliable of the hardware parameter of transmitting Property.
Wherein, BootLoader is calculated in the CRC check of computing hardware parameter and operating system and is read from physical memory Hardware parameter CRC check value when, used algorithm is identical.
After the hardware parameter for needing to transmit and CRC check value are pre-stored in above-mentioned physical memory, BootLoader The address information of the physical memory can be sent to operating system.
Wherein, the address information includes the length etc. of the start physical address of physical memory, physical memory, here, not It repeats one by one.
Step 202: operating system is limited to non-occupy based on the address information received, by the physical memory Memory.
Step 203: operating system reads the hardware parameter stored in the physical memory and executes starting, and establishes institute State the physical address of physical memory and the mapping relations of the logical address in operating system logical address space.
In the relevant mechanism for passing parameter to kernel based on BootLoader, operating system is receiving BootLoader After the address information of the above-mentioned physical memory of transmitting, it can be joined by the address information using the hardware in above-mentioned physical memory Number.But after os starting, the hardware parameter in the physical memory will be covered by other content, the hardware parameter It cannot be safeguarded.If operating system needs to be used for multiple times the hardware parameter, operating system can only continually access embedded The hardware chip of equipment reads the hardware parameter.Since operating system access hardware chip is excessively frequent, so it is embedding to reduce this Enter the operating rate of formula equipment.
And in the present embodiment, address information of the operating system in the above-mentioned physical memory for receiving BootLoader transmitting Afterwards, can be based on the address information, by the physical memory be limited to it is non-can committed memory so that the hardware in the physical memory is joined Number will not be covered by other content.Operating system can read the ginseng of the hardware in the physical memory based on the physical address information Number executes system start-up operation.After os starting, if the operating system is needed using the hardware parameter, operation system The hardware parameter can be read from this section of physical memory by uniting, the hardware chip without continually accessing embedded device, Read the hardware parameter.Therefore, the operating rate of embedded device is improved.
When realizing, operating system can receive the address information of the above-mentioned physical memory of BootLoader transmitting, and Can be based on the address information, by this section of physical memory be limited to it is non-can committed memory.
Operating system can be by the address information of the physical memory from can delete in committed memory white list.In operating system It, only can be according to can the white name of committed memory if operating system needs to apply that physical memory carries out other work during operation The physical memory recorded in list is applied, without occupying the above-mentioned physical memory for storing hardware parameter, therefore, above-mentioned object Hardware parameter in reason memory will not be covered by other content, and hardware parameter is safeguarded.
Operating system can read the hardware ginseng stored in the physical memory based on the physical address information of the physical memory Number executes system start-up operation.
After os starting, in order to repeatedly access the hardware parameter in the physical memory, in the physics It deposits into after row limitation, operating system can establish the memory mapping of the physical memory.
Operating system can establish in the physical address and operating system logical address space of the physical memory logically The mapping relations of location.After establishing mapping relations, after os starting, if operating system needs to join using above-mentioned hardware Number, operating system can be based on the logical address and mapping relations, obtain the corresponding physical address of the logical address, and can be with base The physical memory is found in the physical address, obtains the hardware parameter stored in the physical memory.
Whether the hardware parameter in order to determine BootLoader transmitting is correct, and operating system can be to the hardware in the memory Parameter carries out CRC check.When realizing, operating system can calculate the object based on algorithm corresponding with the CRC check value prestored It manages the CRC check value of memory, and more calculated CRC check value and the physical memory can be pre-stored in originate preceding 4 words Whether the CRC check value in section is consistent, and when two CRC check values are consistent, the CRC check of hardware parameter passes through.
After the CRC check by hardware parameter, during operation, the physical memory can be used for multiple times in operating system Hardware parameter improves the speed of service of the embedded device without repeatedly obtaining from hardware.
Wherein, it is above-mentioned can committed memory white list, the address information including physical memory can be occupied.Address above mentioned packet The start physical address of physical memory and the length of physical memory etc. are included, here, not repeating one by one.Aforesaid operations system is established should The memory of physical memory maps and carries out CRC check to hardware parameter, is not limited by timing.
The embodiment of the present invention proposes a kind of new method for passing parameter to kernel based on BootLoader.By to being based on BootLoader passes the improvement of parameter mechanism to kernel, and it is specified that BootLoader can will need the hardware parameter transmitted to be stored in In physical memory, and the CRC check value of the parameter can be prestored in the physical memory.The physical memory it is of length no more than pre- If length threshold, and the length threshold characterization single transmitting hardware parameter size maximum value.BootLoader can be with The start physical address of the physical memory and length are sent to operating system.Operating system can based on receive this Beginning physical address and length, by the physical memory be limited to it is non-can committed memory, and can establish operating system establish described in The physical address of physical memory and the mapping relations of the logical address in operating system logical address space, and can be pre- based on this The CRC check value deposited carries out CRC check to the hardware parameter.After the CRC check by the hardware parameter, it is in operation It unites the operation phase, operating system can be based on the mapping relations and the logical address, repeatedly read in the physical memory The parameter of storage.
On the one hand, before os starting, since the length of physical memory is by traditional regular length, length is changed into No more than preset length threshold, length threshold characterizes the maximum value of the hardware parameter quantity of single transmitting, therefore can be effective Ground expands the quantity of transmitting hardware parameter, improves the starting rate of operating system.
On the other hand, due to operating system by the physical memory be limited to it is non-can committed memory, after os starting, The physical memory will not be occupied, and the hardware parameter stored in physical memory is safeguarded.When operating system needs are used for multiple times When the hardware parameter, it can be obtained by the physical memory, without continually being read from hardware.This improves embedding Enter the operating rate of formula equipment.
In addition, operating system carries out CRC check can determine whether the parameter of transmitting is correct, enhances to parameter BootLoader passes the reliability of parameter to operating system nucleus.
Based on above-mentioned factor, it can be improved what embedded device was started and run using method provided in an embodiment of the present invention Rate.
It is that another kind shown in one exemplary embodiment of the application is based on BootLoader and passes to kernel to join referring to Fig. 3, Fig. 3 The flow chart of several methods, the method are applied to embedded device, comprising the following steps:
Step 301:BootLoader will need the hardware parameter transmitted to be stored in one section of physical memory, the physical memory Of length no more than preset length threshold.
Step 302:BootLoader calculates the crc value of the hardware parameter, and the crc value is pre-stored in the physical memory It originates in preceding 4 bytes.
The start physical address of physical memory and length are sent to operating system by step 303:BootLoader.
In embedded device, BootLoader is the one section of bootstrap run before os starting, is mainly used for Hardware parameter is transmitted to operating system nucleus, initialize hardware device and establishes the space reflection etc. of memory.
In the relevant mechanism for passing parameter to kernel based on BootLoader, after embedded device starting, it is in operation System initial phase, BootLoader can transmit hardware parameter to operating system nucleus.When realizing, BootLoader can be with The hardware parameter transmitted will be needed to be stored in the physical memory of one section of regular length, and physically by the starting of the physical memory Location and length pass to operating system.Operating system is obtained in the physics based on the start physical address received and length The hardware parameter of middle storage is deposited, system starting is executed.
Since the length of the physical memory of above-mentioned storage hardware parameter is fixed, limiting BootLoader to operation is Kernel of uniting transmits the quantity of hardware parameter, reduces the starting rate of embedded device.
In the present embodiment, BootLoader will need the hardware parameter transmitted to be stored in one section of physical memory, the object Of length no more than preset length threshold of memory is managed, which characterizes the maximum of the hardware parameter quantity of single transmitting Value.Since in the present embodiment, preset length threshold is greater than above-mentioned regular length, so BootLoader is in application physics When memory, the length of the physical memory to be applied can be determined according to the number of transmitted hardware parameter quantity.Due to storage The length for depositing the physical memory of hardware parameter is become being no more than preset length threshold from regular length, to a certain extent, is increased The big length of the physical memory, has also been enlarged BootLoader to the quantity of operating system nucleus transmitting hardware parameter, improves The starting rate of embedded device.
When realizing, BootLoader can according to need the hardware parameter quantity of transmitting, apply for one section of physical memory, should Of length no more than preset length threshold of physical memory.BootLoader can calculate the CRC for needing the hardware parameter transmitted Check value, and the calculated CRC check value can be pre-stored in front of the starting of the physical memory in 4 bytes, and this is hard Part parameter is stored in the physical memory.BootLoader will need the CRC check value of the hardware parameter transmitted to be pre-stored in the object The purpose for managing memory, is the CRC check that can carry out hardware parameter for operating system, guarantees the reliable of the hardware parameter of transmitting Property.
Wherein, BootLoader is calculated in the CRC check of computing hardware parameter and operating system and is read from physical memory Hardware parameter CRC check value when, used algorithm is identical.
After the hardware parameter for needing to transmit and CRC check value are pre-stored in above-mentioned physical memory, BootLoader The length of the start physical address of the physical memory He the physical memory can be sent to operating system.
Step 304. operating system based on the start physical address and length received, by the physical memory be limited to it is non-can Committed memory.
In the relevant mechanism for passing parameter to kernel based on BootLoader, operating system is receiving BootLoader It, can be by the start physical address and length, in use after the start physical address and length of the above-mentioned physical memory of transmitting State the hardware parameter in physical memory.But after os starting, the hardware parameter in the physical memory will be by other Content covering, the hardware parameter cannot be safeguarded.If operating system needs to be used for multiple times the hardware parameter, operating system is only The hardware chip that embedded device can continually be accessed, reads the hardware parameter.Excessively due to operating system access hardware chip Frequently, so the operating rate of the embedded device can be reduced.
And in the present embodiment, starting physics of the operating system in the above-mentioned physical memory for receiving BootLoader transmitting Behind address and length, can be based on the start physical address and length, by the physical memory be limited to it is non-can committed memory so that Hardware parameter in the physical memory will not be covered by other content.After os starting, if the operating system needs Using the hardware parameter, operating system can read the hardware parameter from this section of physical memory, without by continually The hardware chip for accessing embedded device, reads the hardware parameter.It is thus possible to improve the operating rate of embedded device.
Realize when, operating system can receive BootLoader transmitting above-mentioned physical memory start physical address and Length, and can be based on the start physical address and length, by this section of physical memory be limited to it is non-can committed memory.
Operating system can be by the start physical address of the physical memory and length from can delete in committed memory white list. It, only can be according to can account for if operating system needs to apply that physical memory carries out other work during operating system Applied with the physical memory recorded in memory white list, without occupying the above-mentioned physical memory for storing hardware parameter, Therefore, the hardware parameter in above-mentioned physical memory will not be covered by other content, and hardware parameter is safeguarded.
Operating system can read the hardware parameter in the physical memory based on the physical address information, execute system starting Operation.
Wherein, it is above-mentioned can committed memory white list, start physical address and length including physical memory can be occupied.
Step 305: operating system establishes the physical address of the physical memory and patrolling in operating system logical address space Collect the mapping relations of address
In the present embodiment, operating system can establish the physical address and operating system logical address sky of the physical memory Between in logical address mapping relations.After establishing mapping relations, after os starting, if operating system need using Above-mentioned hardware parameter, operating system can be based on the logical address and mapping relations, it is corresponding physically to obtain the logical address Location, and the physical memory can be found based on the physical address, obtain the hardware parameter stored in the physical memory.
Whether what step 306. operating system judged hardware parameter passes through CRC check.
Step 307. operating system uses the hardware parameter.
Step 308. operating system terminates the process.
Whether the hardware parameter in order to determine BootLoader transmitting is correct, and operating system can be to the hardware in the memory Parameter carries out CRC check.When realizing, operating system can calculate the object based on algorithm corresponding with the CRC check value prestored It manages the CRC check value of memory, and more calculated CRC check value and the physical memory can be pre-stored in originate preceding 4 words Whether the CRC check value in section is consistent, and when two CRC check values are consistent, the CRC check of hardware parameter passes through.
After the CRC check by hardware parameter, step 307 is executed, operating system during operation, can be used for multiple times The hardware parameter of the physical memory improves the speed of service of the embedded device without repeatedly obtaining from hardware.Such as Fruit executes step 308 not over the CRC check of hardware parameter, and operating system determines that the hardware parameter of the transmitting is incorrect, and Terminate the process.
Aforesaid operations system establishes the memory mapping of the physical memory and carries out CRC check to hardware parameter, not by timing Limitation.
The embodiment of the present invention proposes a kind of new method for passing parameter to kernel based on BootLoader.By to being based on BootLoader passes the improvement of parameter mechanism to kernel, and it is specified that BootLoader can will need the hardware parameter transmitted to be stored in In physical memory, and the CRC check value of the parameter can be prestored in the physical memory.The physical memory it is of length no more than pre- If length threshold, and the length threshold characterization single transmitting hardware parameter size maximum value.BootLoader can be with The start physical address of the physical memory and length are sent to operating system.Operating system can based on receive this Beginning physical address and length, by the physical memory be limited to it is non-can committed memory, and can establish operating system establish described in The physical address of physical memory and the mapping relations of the logical address in operating system logical address space, and can be pre- based on this The CRC check value deposited carries out CRC check to the hardware parameter.After the CRC check by the hardware parameter, it is in operation It unites the operation phase, operating system can be based on the mapping relations and the logical address, repeatedly read in the physical memory The parameter of storage.
On the one hand, before os starting, since the length of physical memory is by traditional regular length, length is changed into No more than preset length threshold, length threshold characterizes the maximum value of the hardware parameter quantity of single transmitting, therefore can be effective Ground expands the quantity of transmitting hardware parameter, improves the starting rate of operating system.
On the other hand, due to operating system by the physical memory be limited to it is non-can committed memory, after os starting, The physical memory will not be occupied, and the hardware parameter stored in physical memory is safeguarded.When operating system needs are used for multiple times When the hardware parameter, it can be obtained by the physical memory, without continually being read from hardware.This improves embedding Enter the operating rate of formula equipment.
In addition, operating system carries out CRC check can determine whether the parameter of transmitting is correct, enhances to parameter BootLoader passes the reliability of parameter to operating system nucleus.
Based on above-mentioned factor, it can be improved what embedded device was started and run using method provided in an embodiment of the present invention Rate.
The application can be applied on embedded device based on the embodiment of the BootLoader device for passing parameter to kernel. Installation practice can also be realized by software realization by way of hardware or software and hardware combining.It is implemented in software For, it is by the processor of embedded device where it by nonvolatile memory as the device on a logical meaning In corresponding computer program instructions be read into memory operation formed.For hardware view, as shown in figure 4, being this Shen A kind of hardware structure diagram of embedded device where please passing the device of parameter to kernel based on BootLoader, in addition to shown in Fig. 4 Processor, memory, except network interface and nonvolatile memory, the embedded device in embodiment where device is logical It can also include other hardware, not to this often according to the actual functional capability for the device that should pass parameter to kernel based on BootLoader It repeats again.
It is that one kind shown in one exemplary embodiment of the application is based on BootLoader and passes parameter to kernel referring to Fig. 5, Fig. 5 Device block diagram, described device be applied to embedded device, described device includes: transmission unit 510,520 and of limiting unit Creating unit 530.
Wherein, transmission unit 510 will need the hardware parameter transmitted to be stored in specified physical memory for BootLoader In, and the address information of the physical memory is sent to operating system;Wherein, the physical memory is of length no more than default Length threshold, the maximum value of the hardware parameter quantity of length threshold characterization single transmitting;
The physical memory is limited to by limiting unit 520 for operating system based on the address information received It is non-can committed memory;
Creating unit 530 reads the hardware parameter stored in the physical memory for operating system and executes starting, And establish the physical address of the physical memory and the mapping relations of the logical address in operating system logical address space.
In an optional implementation:
Described device further includes (being not shown in Fig. 5): determination unit, for searching institute after the os starting Mapping relations are stated, determine the physical address corresponding with the logical address;Reading unit is based on described for operating system Physical address reads the hardware parameter from the corresponding physical memory.
In another optional implementation:
The limiting unit 520 further include: delete subelement, be based on the address information for operating system, can account for With the address information for deleting the physical memory in memory white list, wherein it is described can committed memory white list include can occupy The address information of physical memory.
In another optional implementation:
Described device further includes (being not shown in Fig. 5): storage element, for BootLoader by the ground of the physical memory Location information is sent to before operating system, the CRC check value for the hardware parameter precomputed is pre-stored in described Specified bytes in physical memory;Verification unit is based on the physical address for operating system, reads in the physical memory The CRC check value of storage, and it is based on the CRC check value, for the hardware parameter read from the physical memory Carry out CRC check.
In another optional implementation:
The verification unit includes: computation subunit, and the CRC check value of the hardware parameter is calculated for operating system; Comparing subunit, CRC check value for being stored in the calculated CRC check value and the physical memory whether one It causes;When the CRC check value stored in the calculated CRC check value and the physical memory is consistent, the school CRC is determined It tests and passes through.
The function of each unit and the realization process of effect are specifically detailed in the above method and correspond to step in above-mentioned apparatus Realization process, details are not described herein.
For device embodiment, since it corresponds essentially to embodiment of the method, so related place is referring to method reality Apply the part explanation of example.The apparatus embodiments described above are merely exemplary, wherein described be used as separation unit The unit of explanation may or may not be physically separated, and component shown as a unit can be or can also be with It is not physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to actual The purpose for needing to select some or all of the modules therein to realize application scheme.Those of ordinary skill in the art are not paying Out in the case where creative work, it can understand and implement.
The foregoing is merely the preferred embodiments of the application, not to limit the application, all essences in the application Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the application protection.

Claims (8)

1. a kind of method for passing parameter to kernel based on BootLoader, which is characterized in that the method is applied to embedded set It is standby, comprising:
BootLoader will need the hardware parameter that transmits to be stored in specified physical memory, and by the address of the physical memory Information is sent to operating system;Wherein, of length no more than preset length threshold of the physical memory, the length threshold table Levy the maximum value of the hardware parameter quantity of single transmitting;
Operating system based on the address information received, by the physical memory be limited to it is non-can committed memory;
Operating system reads the hardware parameter stored in the physical memory and executes starting, and establishes the physical memory The mapping relations of logical address in physical address and operating system logical address space;
After the os starting, search the mapping relations, determine it is corresponding with the logical address described in physically Location;
Operating system is based on the physical address, reads the hardware parameter from the corresponding physical memory.
2. the method according to claim 1, wherein the operating system is based on the address letter received Breath, by the physical memory be limited to it is non-can committed memory, comprising:
Operating system is based on the address information, in the address information that can delete the physical memory in committed memory white list, Wherein, it is described can committed memory white list include the address information that can occupy physical memory.
3. the method according to claim 1, wherein BootLoader sends out the address information of the physical memory Before giving operating system, further includes:
The CRC check value for the hardware parameter precomputed is stored in the physical memory by BootLoader Specified bytes;
The method also includes:
Operating system is based on the physical address, reads the CRC check value stored in the physical memory, and based on described CRC check value carries out CRC check for the hardware parameter read from the physical memory.
4. according to the method described in claim 3, it is characterized in that, described for the hardware read from the physical memory Parameter carries out CRC check, comprising:
Operating system calculates the CRC check value of the hardware parameter;
Whether consistent compare the CRC check value stored in the calculated CRC check value and the physical memory;When the meter When the CRC check value stored in the CRC check value of calculating and the physical memory is consistent, determine that the CRC check passes through.
5. a kind of device for passing parameter to kernel based on BootLoader, which is characterized in that described device includes:
Transmission unit will need the hardware parameter transmitted to be stored in specified physical memory for BootLoader, and will be described The address information of physical memory is sent to operating system;Wherein, of length no more than preset length threshold of the physical memory, The maximum value of the hardware parameter quantity of the length threshold characterization single transmitting;
The physical memory is limited to non-account for for operating system based on the address information received by limiting unit Use memory;
Creating unit reads the hardware parameter stored in the physical memory for operating system and executes starting, and establishes The physical address of the physical memory and the mapping relations of the logical address in operating system logical address space;
Determination unit, for after the os starting, searching the mapping relations, determination is corresponding with the logical address The physical address;
Reading unit is based on the physical address for operating system, reads the hardware from the corresponding physical memory Parameter.
6. device according to claim 5, which is characterized in that the limiting unit, comprising:
Subelement is deleted, the address information is based on for operating system, the physics can deleted in committed memory white list The address information of memory, wherein it is described can committed memory white list include the address information that can occupy physical memory.
7. device according to claim 5, which is characterized in that described device further include:
Storage element will be preparatory before the address information of the physical memory is sent to operating system for BootLoader The calculated CRC check value for the hardware parameter is stored in the specified bytes in the physical memory;
Verification unit is based on the physical address for operating system, reads the CRC check stored in the physical memory Value, and it is based on the CRC check value, CRC check is carried out for the hardware parameter read from the physical memory.
8. device according to claim 7, which is characterized in that the verification unit, further includes:
Computation subunit calculates the CRC check value of the hardware parameter for operating system;
Comparing subunit, the CRC check value for storing in the calculated CRC check value and the physical memory are It is no consistent;When the CRC check value stored in the calculated CRC check value and the physical memory is consistent, described in determination CRC check passes through.
CN201610598689.1A 2016-07-25 2016-07-25 The method and device of parameter is passed to kernel based on BootLoader Active CN106155961B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610598689.1A CN106155961B (en) 2016-07-25 2016-07-25 The method and device of parameter is passed to kernel based on BootLoader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610598689.1A CN106155961B (en) 2016-07-25 2016-07-25 The method and device of parameter is passed to kernel based on BootLoader

Publications (2)

Publication Number Publication Date
CN106155961A CN106155961A (en) 2016-11-23
CN106155961B true CN106155961B (en) 2019-08-06

Family

ID=58060236

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610598689.1A Active CN106155961B (en) 2016-07-25 2016-07-25 The method and device of parameter is passed to kernel based on BootLoader

Country Status (1)

Country Link
CN (1) CN106155961B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334413A (en) * 2017-12-22 2018-07-27 天津麒麟信息技术有限公司 Information transmitting methods between a kind of firmware and operating system based on platform of soaring

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104809013A (en) * 2015-04-21 2015-07-29 北京创毅视讯科技有限公司 Embedded system starting method and device
CN104915302A (en) * 2014-03-10 2015-09-16 华为技术有限公司 Data transmission processing method and data transmission unit

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110145807A1 (en) * 2008-06-02 2011-06-16 Awox Method and device for updating a computer application
CN101763279B (en) * 2010-01-15 2012-12-12 上海维宏电子科技股份有限公司 BootLoader architectural design method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104915302A (en) * 2014-03-10 2015-09-16 华为技术有限公司 Data transmission processing method and data transmission unit
CN104809013A (en) * 2015-04-21 2015-07-29 北京创毅视讯科技有限公司 Embedded system starting method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Linux操作系统在ARM硬件平台上的移植;周超;《中国优秀硕士学位论文全文数据库》;20130715(第7期);第19-24页

Also Published As

Publication number Publication date
CN106155961A (en) 2016-11-23

Similar Documents

Publication Publication Date Title
CN109428943B (en) Request processing method, system on chip and public cloud management component
US6513114B1 (en) System and methods for providing selectable initialization sequences
CN109067877B (en) Control method for cloud computing platform deployment, server and storage medium
US20070245134A1 (en) Testing device and testing method for computer
CN109145051A (en) The data summarization method and device and electronic equipment of distributed data base
CN108632107A (en) MAC Address of Network Card detection method and device
CN112988281B (en) Application starting method and device
CN109814980A (en) Image file acquisition methods and device
US7293168B2 (en) System and method for initially configuring and booting a device using a device identifier
CN106873970A (en) The installation method and device of a kind of operating system
CN106470253A (en) IP address recovery method and device
CN110135163B (en) Security detection method, device and system based on target application
CN106155961B (en) The method and device of parameter is passed to kernel based on BootLoader
CN111552517B (en) Application program starting method and device, electronic equipment and computer storage medium
CN103455750B (en) The high peace verification method of a kind of embedded device and device
CN110399168A (en) Majority according to disk storage server system start method, device and equipment
CN109150969A (en) Data transmission method, sorter, terminating machine and data transmission system
WO2024011860A1 (en) Cloud operating system deployment method and device
CN106033398A (en) Data processing system, external device starting method, and data processing method
CN110427250A (en) Create cloud host instances, the method, apparatus of elastic telescopic group, equipment and medium
CN109491951A (en) A kind of method and calculating equipment of configuration data
CN104375871A (en) Method and device for accelerating system startup on basis of eMMC
CN109189705A (en) A kind of usb expansion method, apparatus, equipment, storage medium and system
CN108847975B (en) Communication method, device, computer equipment and medium based on NFV (network function virtualization) architecture
CN111063387B (en) Method, device and equipment for testing performance of solid state disk and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Binjiang District and Hangzhou city in Zhejiang Province Road 310051 No. 68 in the 6 storey building

Applicant after: Hangzhou Dipu Polytron Technologies Inc

Address before: Binjiang District and Hangzhou city in Zhejiang Province Road 310051 No. 68 in the 6 storey building

Applicant before: Hangzhou Dipu Technology Co., Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant