Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 1, an eMMC verification method includes the steps of:
s1, establishing communication with the eMMC during power-on initialization;
s2, acquiring a register value of the eMMC, and analyzing according to the register value to obtain the service life state of the eMMC;
s3, acquiring the key state of the RPMB Partition in the eMMC;
and S4, judging whether the eMMC is used or not according to the life state and the key state, and if so, not using the eMMC.
From the above description, the beneficial effects of the present invention are: the life state of the eMMC is obtained through obtaining register value analysis of the eMMC, the key state in the RPMB Partition is obtained through the characteristic that the key in the RPMB Partition in the eMMC can only be written once, the service condition of the eMMC is finally obtained through the life state and the key state, if the eMMC is used according to the judgment result, the eMMC is discarded, discrimination of the second-hand eMMC in the production process is achieved, and the method is simple and high in efficiency.
Further, the S2 specifically includes:
obtaining a 269-bit register value in the eMMC by sending a first instruction;
if the register value of 269 bits is greater than a first preset value, the life state of the eMMC is used;
the step S4 includes:
if the life state of the eMMC is used, the eMMC is not used.
As can be seen from the above description, the life state of the eMMC is indirectly obtained by obtaining the 269-bit register value and performing corresponding analysis according to the register value, and the 269-bit register value is easy to obtain and the determination result is accurate.
Further, the S3 specifically includes:
s31, entering the RPMB Partition of the eMMC by sending a second instruction;
s32, initiating a write action to the eMMC by sending a third instruction, wherein the write parameter of the write action is a second preset value;
s33, initiating a read action to the eMMC by sending a fourth instruction, and reading a return value corresponding to the write action;
s34, judging whether the return value is 0x0007, if not, the state of the secret key is that the secret key exists;
the step S4 includes:
if the key status is that a key already exists, the eMMC is not used.
As can be seen from the above description, by using the feature that the RPMB Partition key is written once intelligently, a read-write operation is performed by sending an instruction to obtain a return value of the RPMB Partition, and key padding is determined according to the return value.
Further, the S1 specifically includes:
and when power-on initialization is carried out, entering U-Boot to establish communication with the non-programmed eMMC.
As can be seen from the above description, communication is established with the eMMC that is not programmed in the U-Boot stage, normal initialization of the smart POS and the eMMC is ensured through the basic software code of the pre-factory threshold of the corresponding module in the smart POS, communication with the eMMC is established, and the data communication requirement of software programming is ensured.
Further, the S4 further includes:
and judging whether the eMMC is used or not according to the service life state and the secret key state, and if not, performing software programming.
As can be seen from the above description, if the eMMC is not used, normal software programming is performed, that is, the eMMC is verified before the programming process, and if the eMMC is not used, the programming is not performed, which saves the programming process and improves the verification efficiency.
Referring to fig. 2, an intelligent POS includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the following steps:
s1, establishing communication with the eMMC during power-on initialization;
s2, acquiring a register value of the eMMC, and analyzing according to the register value to obtain the service life state of the eMMC;
s3, acquiring the key state of the RPMB Partition in the eMMC;
and S4, judging whether the eMMC is used or not according to the life state and the key state, and if so, not using the eMMC.
From the above description, the beneficial effects of the present invention are: the life state of the eMMC is obtained through obtaining register value analysis of the eMMC, the key state in the RPMB Partition is obtained through the characteristic that the key in the RPMB Partition in the eMMC can only be written once, the service condition of the eMMC is finally obtained through the life state and the key state, if the eMMC is used according to the judgment result, the eMMC is discarded, discrimination of the second-hand eMMC in the production process is achieved, and the method is simple and high in efficiency.
Further, the S2 specifically includes:
obtaining a 269-bit register value in the eMMC by sending a first instruction;
if the register value of 269 bits is greater than a first preset value, the life state of the eMMC is used;
the step S4 includes:
if the life state of the eMMC is used, the eMMC is not used.
As can be seen from the above description, the life state of the eMMC is indirectly obtained by obtaining the 269-bit register value and performing corresponding analysis according to the register value, and the 269-bit register value is easy to obtain and the determination result is accurate.
Further, the S3 specifically includes:
s31, entering the RPMB Partition of the eMMC by sending a second instruction;
s32, initiating a write action to the eMMC by sending a third instruction, wherein the write parameter of the write action is a second preset value;
s33, initiating a read action to the eMMC by sending a fourth instruction, and reading a return value corresponding to the write action;
s34, judging whether the return value is 0x0007, if not, the state of the secret key is that the secret key exists;
the step S4 includes:
if the key status is that a key already exists, the eMMC is not used.
As can be seen from the above description, by using the feature that the RPMB Partition key is written once intelligently, a read-write operation is performed by sending an instruction to obtain a return value of the RPMB Partition, and key padding is determined according to the return value.
Further, the S1 specifically includes:
and when power-on initialization is carried out, entering U-Boot to establish communication with the non-programmed eMMC.
As can be seen from the above description, communication is established with the eMMC that is not programmed in the U-Boot stage, normal initialization of the smart POS and the eMMC is ensured through the basic software code of the pre-factory threshold of the corresponding module in the smart POS, communication with the eMMC is established, and the data communication requirement of software programming is ensured.
Further, the S4 further includes:
and judging whether the eMMC is used or not according to the service life state and the secret key state, and if not, performing software programming.
As can be seen from the above description, if the eMMC is not used, normal software programming is performed, that is, the eMMC is verified before the programming process, and if the eMMC is not used, the programming is not performed, which saves the programming process and improves the verification efficiency.
Referring to fig. 1, a first embodiment of the present invention is:
an eMMC authentication method, comprising the steps of:
s1, when power-on initialization is carried out, entering U-Boot to establish communication with the eMMC which is not programmed;
specifically, when the intelligent POS completes the first power-on initialization after the hardware patch process, a bootstrap program U-Boot automatically judges that the intelligent POS enters a download mode and establishes communication with the eMMC which is not programmed;
s2, acquiring a register value of the eMMC, and analyzing according to the register value to obtain the service life state of the eMMC;
specifically, a register value of 269 bits of an Extended CSD partition in the eMMC is obtained by sending a first instruction;
if the register value of 269 bits is greater than a first preset value, the life state of the eMMC is used;
s3, acquiring the key state of the RPMB Partition in the eMMC;
the method specifically comprises the following steps:
s31, entering the RPMB Partition of the eMMC by sending a second instruction;
s32, initiating a write action to the eMMC by sending a third instruction, wherein the write parameter of the write action is a second preset value;
s33, initiating a read action to the eMMC by sending a fourth instruction, and reading a return value corresponding to the write action;
s34, judging whether the return value is 0x0007, if not, the state of the secret key is that the secret key exists;
s4, judging whether the eMMC is used or not according to the service life state and the key state, and if yes, not using the eMMC;
specifically, whether the life state of the eMMC is used or not and whether the key state is that the key exists or not are judged, if yes, the eMMC is used and the eMMC is not used;
otherwise, the software programming is carried out.
Referring to fig. 3 and 4, a second embodiment of the present invention is:
an eMMC authentication method, which is different from the first embodiment:
the S2 specifically includes: sending a CMD8 instruction to obtain a register value of Extended CSD (Extended CSD register is one of eMMC controller registers and is mainly used for defining the attribute and the working mode of equipment), obtaining a 269-bit register for representing the life condition of MLC (Multi-Level Cell, Multi-layer Cell flash) type flash by referring to an eMMC standard protocol, referring to the content in the protocol, if the value of the 269-bit register is equal to 0x01 (namely hexadecimal data 01, which represents that the used equipment life accounts for 0% -10% of the total life of the equipment), indicating that the wear condition of the eMMC storage particles is 0% -10%, and if the value exceeds the range, indicating that the life condition of the eMMC is used;
specifically, the step S3 is;
s31, entering an RPMB (Replay Protected Memory Block) Partition of the eMMC by sending a CMD6 command;
storing some special data which need to be accessed and authorized in the RPMB Partition, so that an authorization key needs to be written in before starting, namely a preparation (provisioning) process, wherein the process needs to be completed in the process of combining the eMMC and equipment, namely equipment manufacturing, each piece of eMMC is intelligently written in the authorization key once, and then the written secret key is stored by the equipment and is used as a certificate for accessing the RPMB Partition every time;
s32, setting a block size parameter and a block number parameter of a subsequent eMMC write action by sending a CMD23 command; initiating a write action to the eMMC by sending a CMD25 command, wherein the write parameter of the write action is a second preset value;
specifically, referring to the emmc5.1 protocol (Embedded Multi-Media Card (e.mmc) Electrical Standard (5.1)), the data frames Byte0 and Byte1 of the write parameters are respectively set to 0x00 and 0x02 function codes, and the function codes can obtain the write count values of the RPMB partition;
s33, setting a block size parameter and a block number parameter of a subsequent eMMC read action by sending a CMD23 command, initiating a read action on the eMMC by sending a CMD18 command, and reading a return value corresponding to the write action; after receiving the function code, if the preparation process is completed, the eMMC returns the register information in its Write Counter (Write Counter), and if the eMMC has not written the authorization key, returns the status value 0x0007 (i.e. the hexadecimal data 0007);
s34, analyzing the Byte2 and the Byte3 in the return value data frame, wherein the two bytes represent the execution result of the request, if the Byte2 and the Byte3 have the value of 0x0007(0x0007 represents that the authorization key in the eMMC is not coded), the eMMC does not write the authorization key, otherwise, the key state is that the key exists;
the software programming in S4 specifically includes:
the software program is programmed by sending a CMD6 command to switch to the Normal partition.
Referring to fig. 2, a third embodiment of the present invention is:
an intelligent POS1 comprising a processor 2, a memory 3, and a computer program stored on the memory 3 and executable on the processor 2, the processor 2 implementing the steps of the first or second embodiment when executing the computer program.
To sum up, the present invention provides an eMMC verification method and a smart POS, wherein a communication with an unwritten eMMC is established when the smart POS is powered on and initialized, whether the eMMC has been used is determined by obtaining a register value of the eMMC and a key state in an RPMB partition, that is, whether key authorization has been performed, specifically, a wear condition of the eMMC is obtained according to the register value, thereby inferring a lifetime condition of the eMMC, using a characteristic that the RPMB partition authorization key is only allowed to be written once, if the key is written, it indicates that the eMMC has been used, discarding the eMMC whose register value is not a threshold value or the RPMB partition has the authorization key, without using, verifying whether the eMMC is a second-hand material before executing a software burning step, comparing with the conventional method for verifying a complete machine that has been produced, if a request requires a reinstallation, the eMMC verification is realized before burning the eMMC, the cost of verification is saved.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.