CN114924774A - Upgrading switching method and system for multiple operating systems of smart card - Google Patents

Upgrading switching method and system for multiple operating systems of smart card Download PDF

Info

Publication number
CN114924774A
CN114924774A CN202210534319.7A CN202210534319A CN114924774A CN 114924774 A CN114924774 A CN 114924774A CN 202210534319 A CN202210534319 A CN 202210534319A CN 114924774 A CN114924774 A CN 114924774A
Authority
CN
China
Prior art keywords
operating system
chip
starting
program data
switching
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.)
Pending
Application number
CN202210534319.7A
Other languages
Chinese (zh)
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.)
Hengbao Co Ltd
Original Assignee
Hengbao 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 Hengbao Co Ltd filed Critical Hengbao Co Ltd
Priority to CN202210534319.7A priority Critical patent/CN114924774A/en
Publication of CN114924774A publication Critical patent/CN114924774A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/18Processing of user or subscriber data, e.g. subscribed services, user preferences or user profiles; Transfer of user or subscriber data
    • H04W8/183Processing at user equipment or user record carrier

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to an upgrade switching method and system for a multi-operating system of a smart card, and belongs to the technical field of mobile communication. The method comprises the following steps: after the chip is started according to the chip starting program data, traversing each operating system starting program data, and determining a target operating system to be started through an automatic identification algorithm; the chip relocates the chip interrupt vector table and the interrupt service program interface address through the code, so that the chip runs the code starting program data of the started target operating system, and then the entry function of the target operating system code is called, and the multi-operating system upgrading switching of the intelligent card is realized. The invention can realize that all codes in each operating system can be upgraded and updated, ensures that the data of the default starting program data area of the chip is not erased, avoids the problem that the chip cannot be started due to power failure, has fast switching performance, does not need a power failure backup protection mechanism, and avoids communication protocol overtime caused by slow chip starting.

Description

Method and system for upgrading and switching multiple operating systems of smart card
Technical Field
The invention belongs to the technical field of communication, and particularly relates to a method and a system for upgrading and switching a multi-operation system of an intelligent card.
Background
With the complex and various functions of an operating system of a smart card (communication smart card), and the smart card (communication smart card) is used to provide services for customers, particularly, an eSIM product is adopted to encapsulate the smart card into a patch card shape and is welded on a mainboard, the area of the mainboard and various electronic devices are saved at a certain level, and even a smart card slot is not needed, however, with the evolution of the functions of the smart card product, in order to meet the requirements of new services, under the condition that a smart card chip cannot be replaced, only the operating system of the smart card chip which is issued and welded on equipment is upgraded, which is the only feasible scheme, therefore, when the operating system of the smart card is designed, the following upgrading methods are recommended to be used:
1. a small amount of code space and a module entrance which is supposed to be upgraded are reserved for downloading an upgrading program patch to complete the upgrading of the functional module. (Only the preset module can be upgraded)
2. Designing two or more smart card operating system code storage areas, downloading new operating system codes by operating the operating system of the currently used operating system code area and storing the new operating system codes into another idle operating system code area, and finishing the upgrading of the operating system codes by switching the operating system code areas after the downloading is successful. (Can upgrade the entire operating System code)
Although the two schemes have advantages and disadvantages, the existing upgrading requirements can be basically met, the key point is that operating system codes of different versions are operated by switching different operating system code areas, the switching of the code areas is realized by calling entry functions of different code areas in the prior art, and the method has the premise that program codes used for identifying and calling the entry functions of the enabled operating system are independently stored in a fixed area, and the part of codes and the operating system cannot be updated and upgraded.
The prior art realizes code area switching by calling entry functions of different code areas, and has certain defects, and when a chip is powered on and started, key data of a program needing to be run and having good compiling and compiling links need to be loaded from a fixed starting address, such as: the interrupt vector table, stack size and address, interrupt service program interface address, entry function code interface address, etc., are collectively referred to hereinafter as initiator data. For the scheme of implementing upgrading by switching a plurality of operating system code areas, the interrupt vector table and the interrupt service program address of the code of each operating system code storage area are different, so in order to implement the power-on loading of different startup program data on a chip after switching, the startup program data of the used operating system code needs to be used for replacing the startup program data of the original operating system code area as chip startup initialization data, and the implementation method comprises the following steps:
1. and covering the original starting program data through data erasing.
The method can realize the upgrading and switching of all codes, but when erasing and writing cover the original starting program data, if power is lost during erasing and writing, the chip can never be started.
2. The code related to the boot program data (i.e. the boot program) is independently compiled, so that the code is independently stored outside a plurality of operating system code areas, and the boot code cannot be upgraded by switching different operating systems. Although the method can avoid the problem that the chip cannot be started permanently due to power failure, part of codes cannot be upgraded, and the program code programs comprise an interrupt service program, a reset program, a data receiving and sending program, a power failure protection program, a chip storage area erasing program and the like besides the operating system identification code.
3. In order to avoid the defects in the scheme 2, only an operating system identification program is reserved for a starting program part, after a chip is powered on and is started through the data of the current default starting program of the chip, the operating system to be operated is identified, a starting program data area is switched, and then the soft starting operation of the chip is realized under the condition of not powering off through a soft reset function module provided by hardware.
Disclosure of Invention
The invention mainly aims to overcome the defects of the prior art and provide a method and a system for upgrading and switching a plurality of operating systems of an intelligent card, which can realize that all codes in each operating system can be upgraded and updated, ensure that data in a default starting program data area of a chip is not erased, avoid the problem that the chip cannot be started due to power failure, have fast switching performance, do not need a power failure backup protection mechanism and avoid communication protocol overtime caused by too slow starting of the chip.
According to one aspect of the invention, the invention provides a method for upgrading and switching a multi-operating system of a smart card, which comprises the following steps:
each smart card operating system is designed to generate own starting program data of the operating system and independently store the starting program data in a specific code storage position, after a chip is powered on and is started according to default starting program data of the chip, the starting program data of each operating system are traversed, and a target operating system needing to be started is determined through an automatic identification algorithm; the code area of each operating system stores starting program data required by the chip to start the operating system when the chip is powered on, and the target operating system is identified by the automatic identification algorithm through unique identification data;
the chip relocates the chip interrupt vector table and the interrupt service program interface address through the code, so that the chip runs the code starting program data of the target operating system to be started, and then calls the entry function of the target operating system code to realize the upgrading switching of the intelligent card multi-operating system.
Preferably, the method includes a chip starting module starting process, an operating system switching process and an abnormal operation rollback process.
Preferably, the starting process of the chip starting module includes:
s1, after the chip is powered on, operating a default starting module of the chip;
s2, searching the existing operating systems, reading the starting program data of each operating system, checking the checksum in each starting program data, and recording the value Nn of the counter if the check is successful, wherein n is a natural number;
s3, if the verification fails, verifying the starting program data checksum of the next operating system until the starting program data of all the operating systems are verified;
s4, if the checksums of all the operating systems fail to be checked, starting the starting program data by using the default of the chip;
s5, taking the operating system with the largest counter as the target operating system to be started, initializing the interrupt vector and the interrupt service program in the starting program data of the target operating system, and the entry program, relocating the interrupt vector table and the interface address of the interrupt service program, and then calling the entry program to run the target operating system.
Preferably, the operating system switching process includes:
c1, the old operating system is started;
c2, receiving an operating system switching instruction, and entering an operating system switching module;
c3, reading the starting program data of the new operating system to be switched, using MAX (N1, N2, … Nn) +1 as a new counter, and calculating the checksum by using all the starting program data and the new counter;
c4, writing all the boot program data, the new counter and the checksum into the boot program data storage area of the new operating system;
c5, restarting;
and C6, entering the starting process of the chip starting module after power-on, and completing the switching of the operating system.
Preferably, the rollback procedure of the abnormal operation includes:
the rollback flow is divided into two types of active rollback of a user and abnormal automatic rollback of an operating system:
actively backing up by a user: when the operating system normally runs, a user executes rollback operation through an instruction, namely, switches to the previous operating system, and essentially completes the rollback operation according to the switching flow of the operating system;
and (3) automatic rollback of system exception: when the hardware exception occurs in the operation process of the new operating system, the operating system calls a switching flow in an exception interrupt service program and enters the switching flow of the operating system; or, the data in the data storage area of the operating system startup program is directly erased, and after the chip is restarted, the operating system startup process is entered, so that the effective operating system is automatically identified and the startup is completed.
According to another aspect of the present invention, there is also provided a smart card multi-operating system upgrade switching system, which includes a chip and a plurality of smart card operating systems,
after the chip is started according to the default starting program data of the chip, traversing each operating system starting program data, and determining a target operating system to be started through an automatic identification algorithm; the code area of each operating system stores starting program data required by the chip to start the operating system when the chip is powered on, and the target operating system is identified by the automatic identification algorithm through unique identification data;
the chip relocates the chip interrupt vector table and the interrupt service program interface address through the code, so that the chip runs the code starting program data of the enabled target operating system, and then calls the entry function of the target operating system code to realize the upgrading switching of the intelligent card multi-operating system.
Preferably, the upgrade switching system executes a start-up flow of the chip start-up module, an operating system switching flow and a rollback flow of the abnormal operation when running.
Preferably, the starting process of the chip starting module includes:
s1, after the chip is powered on, operating a default starting module of the chip;
s2, searching the existing operating systems, reading the starting program data of each operating system, checking the checksum in each starting program data, and recording the value Nn of the counter if the check is successful, wherein n is a natural number;
s3, if the verification fails, verifying the starting program data checksum of the next operating system until the starting program data of all the operating systems are verified;
s4, if the checksums of all the operating systems fail to be checked, starting the starting program data by using the default of the chip;
s5, taking the operating system with the largest counter as the target operating system to be started, initializing the interrupt vector and the interrupt service program in the starting program data of the target operating system, and the entry program, relocating the interrupt vector table and the interface address of the interrupt service program, and then calling the entry program to run the target operating system.
Preferably, the operating system switching process includes:
c1, the old operating system is started;
c2, receiving an operating system switching instruction, and entering an operating system switching module;
c3, reading the starting program data of the new operating system to be switched, using MAX (N1, N2, … Nn) +1 as a new counter, and calculating the checksum by using all the starting program data and the new counter;
c4, writing all the boot program data, the new counter and the checksum into the boot program data storage area of the new operating system;
c5, restarting;
and C6, entering the starting process of the chip starting module after power-on, and completing the switching of the operating system.
Preferably, the rollback procedure of the operation exception comprises:
the rollback flow is divided into two types of active rollback of a user and abnormal automatic rollback of an operating system:
actively backing up by a user: when the operating system normally runs, a user executes rollback operation through an instruction, namely, the previous operating system is switched to, and essentially the rollback operation is completed according to the switching flow of the operating system;
automatically backing off the system exception: when a hardware exception occurs in the running process of the new operating system, the operating system calls a switching flow in an exception interrupt service program and enters an operating system switching flow; or directly erasing the data in the data storage area of the operating system startup program, entering an operating system startup process after the chip is restarted, automatically identifying the effective operating system, and completing the startup.
Has the beneficial effects that:
1. the data of the default starting program data area of the chip is guaranteed not to be erased and written, and the problem that the chip cannot be started due to power failure is avoided.
2. By the operating system switching method, all codes in each operating system can be upgraded and updated.
3. The switching performance is fast, a power failure backup protection mechanism is not needed, only one FLASH page (the page where the counter and the checksum are located) is erased, and the overtime of a communication protocol caused by the slow starting of a chip is avoided.
The features and advantages of the present invention will become apparent by reference to the following drawings and detailed description of specific embodiments of the invention.
Drawings
FIG. 1 is a flow chart of a method for upgrading and switching a smart card multi-operating system;
FIG. 2 is a schematic illustration of the storage of each operating system code and boot program data;
FIG. 3 is a schematic diagram illustrating the interaction flow between a chip and an operating system;
FIG. 4 is a diagram of multi-operating system switching.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
FIG. 1 is a flowchart of a method for upgrading and switching a smart card multi-operating system. As shown in fig. 1, the present invention provides a method for upgrading and switching a smart card multi-os, where the method includes:
after the chip is started according to the chip starting program data, traversing each operating system starting program data, and determining a target operating system to be started through an automatic identification algorithm; the code area of each operating system stores starting program data required by the chip to start the operating system when the chip is powered on, and the target operating system is identified by the automatic identification algorithm through unique identification data;
the chip relocates the chip interrupt vector table and the interrupt service program interface address through the code, so that the chip runs the code starting program data of the enabled target operating system, and then calls the entry function of the target operating system code to realize the upgrading switching of the intelligent card multi-operating system.
Specifically, the code area of each operating system has code data for chip startup, and the startup program data includes stack configuration data required by chip operation, chip hardware or software interrupt vector table, and interface implementation data for resetting interrupt when chip is started,
the stack configuration data is as follows:
Figure BDA0003647063950000091
the interrupt vector is as follows:
Figure BDA0003647063950000092
the chip reset interrupt is implemented as follows:
Figure BDA0003647063950000101
the data for matching the chip start of each operating system is different, and the operating systems in different storage areas need to use corresponding start program data to enable the chip to normally operate during operation. A schematic diagram of the storage of each operating system code and boot program data is shown in fig. 2.
After the chip is started from the default startup program data of the chip, the startup program data of each operating system is searched, the operating system needing to be started is determined through an automatic identification algorithm, the interrupt vector table of the chip and the interface address of the interrupt service program are relocated through codes, namely, the initialized interrupt vector is configured into the interrupt vector in the startup program data of the operating system to be started through changing the address of a hardware vector register of the chip, so that the chip runs the code startup program data of the started operating system, and then an entry function of the codes of the started operating system is called, and the upgrade switching of the multi-operating system of the intelligent card is realized.
The automatic identification algorithm uniquely identifies the operating system through automatically generated specific identification data, and the specific identification data preferably adopts a counter, so that the specific identification data uniquely corresponds to the operating system on one hand, and the number of the operating systems and the number of use times are counted on the other hand. Considering that the starting program data of each operating system different from the default starting program data of the chip needs to be written into the operating system storage area by downloading, and simultaneously, the counter data also needs to be stored.
The method of the embodiment can realize that all codes in each operating system can be upgraded and updated, ensures that data in a default starting program data area of the chip is not erased, avoids the problem that the chip cannot be started due to power failure, has fast switching performance, does not need a power failure backup protection mechanism, and avoids communication protocol overtime caused by slow chip starting.
Preferably, the method includes a startup process of the chip startup module, an operating system switching process, and a rollback process of the abnormal operation.
Preferably, the starting process of the chip starting module includes:
s1, running a default starting module of the chip after the chip is powered on;
s2, searching the existing operating systems, reading the starting program data of each operating system, checking the checksum in each starting program data, and if the checking is successful, recording the numerical value Nn of the counter, wherein n is a natural number;
s3, if the verification fails, verifying the starting program data checksum of the next operating system until the starting program data of all operating systems are verified;
s4, if the checksums of all the operating systems fail to be checked, starting the starting program data by using the default of the chip;
s5, taking the operating system with the largest counter as the target operating system to be started, initializing the interrupt vector and the interrupt service program in the starting program data of the target operating system, and the entry program, relocating the interrupt vector table and the interface address of the interrupt service program, and then calling the entry program to run the target operating system.
Preferably, the operating system switching process includes:
c1, the old operating system is started;
c2, receiving an operating system switching instruction, and entering an operating system switching module;
c3, reading the starting program data of the new operating system to be switched, using MAX (N1, N2, … Nn) +1 as a new counter, and using all the starting program data and the new counter to calculate the checksum;
c4, writing all the boot program data, the new counter and the checksum into the boot program data storage area of the new operating system;
c5, restarting;
and C6, entering the starting process of the chip starting module after power-on, and completing the switching of the operating system.
Preferably, the rollback procedure of the operation exception comprises:
the rollback flow is divided into two types, namely user active rollback and operating system abnormal automatic rollback:
actively backing up by a user: when the operating system normally runs, a user executes rollback operation through an instruction, namely, the previous operating system is switched to, and essentially the rollback operation is completed according to the switching flow of the operating system;
automatically backing off the system exception: when a hardware exception occurs in the running process of the new operating system, the operating system calls a switching flow in an exception interrupt service program and enters an operating system switching flow; or, directly erasing the data in the data storage area of the operating system startup program, entering an operating system startup flow after the chip is restarted, automatically identifying a valid operating system, and completing the startup of the operating system.
According to another aspect of the present invention, there is also provided a smart card multi-operating system upgrade switching system, which includes a chip and a plurality of smart card operating systems,
after the chip is started according to the chip starting program data, traversing each operating system starting program data, and determining a target operating system to be started through an automatic identification algorithm; the code area of each operating system stores starting program data required by the chip to start the operating system when the chip is powered on, and the target operating system is identified by the automatic identification algorithm through unique identification data;
the chip relocates the chip interrupt vector table and the interrupt service program interface address through the code, so that the chip runs the code starting program data of the started target operating system, and then the entry function of the target operating system code is called, and the multi-operating system upgrading switching of the intelligent card is realized.
Preferably, the upgrade switching system executes a start-up flow of the chip start-up module, an operating system switching flow and a rollback flow of the abnormal operation when running.
Specifically, referring to fig. 3, the starting process of the chip starting module includes:
s1, after the chip is powered on, operating a default starting module of the chip;
s2, searching the existing operating systems, reading the starting program data of each operating system, checking the checksum in each starting program data, and if the checking is successful, recording the numerical value Nn of the counter, wherein n is a natural number;
the checksum is unique data calculated by all operating system boot program data through a universal algorithm, and the universal algorithm preferably selects an algorithm with a quick profile such as exclusive OR (XOR), HASH (HASH) and the like.
The counter is in the chip memory area where the operating system boot program data is located. The counter is only used for uniquely marking the data identifier of the operating system boot program, and can also be a character table with a certain rule, and the counter is used for facilitating understanding, on one hand, the counter is used for identifying a plurality of operating systems, and on the other hand, the latest character or the maximum count is used for representing that the operating system boot program data stored in the area is the operating system boot program data to be booted.
S3, if the verification fails, verifying the starting program data checksum of the next operating system until the starting program data of all the operating systems are verified;
s4, if the checksums of all the operating systems fail to be checked, starting the starting program data by using the default of the chip;
s5, taking the operating system with the largest counter as the target operating system to be started, initializing the interrupt vector and the interrupt service program in the starting program data of the target operating system, and the entry program, relocating the interrupt vector table and the interface address of the interrupt service program, and then calling the entry program to run the target operating system.
Preferably, the operating system switching process includes:
c1, the old operating system is started;
c2, receiving an operating system switching instruction, and entering an operating system switching module;
c3, reading the starting program data of the new operating system to be switched, using MAX (N1, N2, … Nn) +1 as a new counter, and calculating the checksum by using all the starting program data and the new counter;
taking the description of the preferred counter as an example, MAX represents the algorithm for maximum counting in order to find out the maximum count and the os boot program data in the memory area where the maximum count is located.
C4, writing all the boot program data, the new counter and the checksum into the boot program data storage area of the new operating system;
the erasing FLASH does not need backup protection, and even if power is lost in the erasing process and the erasing FLASH is electrified and started again, a new operating system cannot be started. When a chip programs data in a data storage area of an erasing and writing starting program, if the chip loses power, all data in the storage area are lost for a FLASH storage area, and the general method is that the data in the storage area becomes an irregular random number, or the data in the storage area cannot be read, or the read data is an irregular random number. After the chip is powered on again, all the operating system startup program data can be read in the operating system switching process, the checksum in each startup program data is checked, and the startup program data of the new operating system cannot be subsequently used for running the operating system because the correct checksum cannot be calculated by the random number.
C5, restarting;
and C6, entering the starting process of the chip starting module after power-on, and completing the switching of the operating system.
Preferably, the rollback procedure of the abnormal operation includes:
the rollback flow is divided into two types, namely user active rollback and operating system abnormal automatic rollback:
the user actively backs: when the operating system normally runs, a user executes rollback operation through an instruction, namely, switches to the previous operating system, and essentially completes the rollback operation according to the switching flow of the operating system;
and (3) automatic rollback of system exception: when the hardware exception occurs in the operation process of the new operating system, the operating system calls a switching flow in an exception interrupt service program and enters the switching flow of the operating system; or directly erasing the data in the data storage area of the operating system startup program, entering an operating system startup process after the chip is restarted, automatically identifying an effective operating system, and completing the startup of the operating system.
Through this embodiment, guarantee that the data in chip start-up program data area is not erased and written, avoid leading to the unable problem that starts of chip because of the power failure. By the operating system switching method, all codes in each operating system can be upgraded and updated. The switching performance is fast, a power failure backup protection mechanism is not needed, only one FLASH page (the page where the counter and the checksum are located) is erased, and the overtime of a communication protocol caused by the slow starting of a chip is avoided.
Example 2
FIG. 4 is a diagram of multi-operating system switching. As shown in fig. 4, the present invention also provides an upgrade switching system for a smart card multi-operating system, the upgrade switching system comprising a chip and a plurality of smart card operating systems,
after the chip is started according to the chip starting program data, traversing each operating system starting program data, and determining a target operating system to be started through an automatic identification algorithm; the code area of each operating system stores starting program data required by starting the operating system when the chip is powered on, and the target operating system is identified by the automatic identification algorithm through unique identification data;
the chip relocates the chip interrupt vector table and the interrupt service program interface address through the code, so that the chip runs the starting program data of the enabled target operating system, and then calls the entry function of the target operating system code to realize the upgrading switching of the multiple operating systems of the intelligent card.
Preferably, the upgrade switching system executes a start process of the chip start module, an operating system switching process and a rollback process of the abnormal operation when running.
Preferably, the starting process of the chip starting module includes:
s1, after the chip is powered on, operating a default starting module of the chip;
s2, searching the existing operating systems, reading the starting program data of each operating system, checking the checksum in each starting program data, and recording the value Nn of the counter if the check is successful, wherein n is a natural number;
s3, if the verification fails, verifying the starting program data checksum of the next operating system until the starting program data of all operating systems are verified;
s4, if the checksums of all the operating systems fail to be checked, starting the starting program data by using the default of the chip;
s5, taking the operating system with the largest counter as the target operating system to be started, initializing the interrupt vector and the interrupt service program in the starting program data of the target operating system, and the entry program, relocating the interrupt vector table and the interface address of the interrupt service program, and then calling the entry program to run the target operating system.
Preferably, the operating system switching process includes:
c1, the old operating system is started;
c2, receiving an operating system switching instruction, and entering an operating system switching module;
c3, reading the starting program data of the new operating system to be switched, using MAX (N1, N2, … Nn) +1 as a new counter, and using all the starting program data and the new counter to calculate the checksum;
c4, writing all the boot program data, the new counter and the checksum into the boot program data storage area of the new operating system;
c5, restarting;
and C6, entering the starting process of the chip starting module after power-on, and completing the switching of the operating system.
Preferably, the rollback procedure of the abnormal operation includes:
the rollback flow is divided into two types, namely user active rollback and operating system abnormal automatic rollback:
actively backing up by a user: when the operating system normally runs, a user executes rollback operation through an instruction, namely, the previous operating system is switched to, and essentially the rollback operation is completed according to the switching flow of the operating system;
and (3) automatic rollback of system exception: when a hardware exception occurs in the running process of the new operating system, the operating system calls a switching flow in an exception interrupt service program and enters an operating system switching flow; or directly erasing the data in the data storage area of the operating system startup program, entering an operating system startup process after the chip is restarted, automatically identifying the effective operating system, and completing the startup.
The specific implementation process of this embodiment 2 is the same as the implementation process of each step in embodiment 1, and is not described herein again.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for upgrading and switching a smart card multi-operating system is characterized by comprising the following steps:
after the chip is started according to the chip starting program data, traversing each operating system starting program data, and determining a target operating system to be started through an automatic identification algorithm; the code area of each operating system stores starting program data required by starting the operating system when the chip is powered on, and the target operating system is identified by the automatic identification algorithm through unique identification data;
the chip relocates the chip interrupt vector table and the interrupt service program interface address through the code, so that the chip runs the code starting program data of the enabled target operating system, and then calls the entry function of the target operating system code to realize the upgrading switching of the intelligent card multi-operating system.
2. The method of claim 1, wherein the method comprises a boot process of a chip boot module, an operating system switching process, and a rollback process of an abnormal operation.
3. The method of claim 2, wherein the starting procedure of the chip starting module comprises:
s1, after the chip is powered on, operating a default starting module of the chip;
s2, searching the existing operating systems, reading the starting program data of each operating system, checking the checksum in each starting program data, and recording the value Nn of the counter if the check is successful, wherein n is a natural number;
s3, if the verification fails, verifying the starting program data checksum of the next operating system until the starting program data of all operating systems are verified;
s4, if the checksums of all the operating systems fail to be checked, starting the starting program data by using the default of the chip;
s5, taking the operating system with the largest counter as the target operating system to be started, initializing the interrupt vector and the interrupt service program in the starting program data of the target operating system, and the entry program, relocating the interrupt vector table and the interface address of the interrupt service program, and then calling the entry program to run the target operating system.
4. The method of claim 2, wherein the operating system switching process comprises:
c1, the old operating system is started;
c2, receiving an operating system switching instruction, and entering an operating system switching module;
c3, reading the starting program data of the new operating system to be switched, using MAX (N1, N2, … Nn) +1 as a new counter, and calculating the checksum by using all the starting program data and the new counter;
c4, writing all the boot program data, the new counter and the checksum into the boot program data storage area of the new operating system;
c5, restarting;
and C6, entering the starting process of the chip starting module after power-on, and completing the switching of the operating system.
5. The method of claim 2, wherein the rollback flow for the operational exception comprises:
the rollback flow is divided into two types of active rollback of a user and abnormal automatic rollback of an operating system:
actively backing up by a user: when the operating system normally runs, a user executes rollback operation through an instruction;
and (3) automatic rollback of system exception: when a hardware exception occurs in the running process of the new operating system, the operating system calls a switching flow in an exception interrupt service program and enters an operating system switching flow; or, the data in the data storage area of the operating system startup program is directly erased, and after the chip is restarted, the operating system startup process is entered, so that the effective operating system is automatically identified.
6. A multi-operating system upgrade switching system of a smart card, the upgrade switching system comprises a chip and a plurality of smart card operating systems,
after the chip is started according to the chip starting program data, traversing each operating system starting program data, and determining a target operating system to be started through an automatic identification algorithm; the code area of each operating system stores starting program data required by the chip to start the operating system when the chip is powered on, and the target operating system is identified by the automatic identification algorithm through unique identification data;
the chip relocates the chip interrupt vector table and the interrupt service program interface address through the code, so that the chip runs the code starting program data of the enabled target operating system, and then calls the entry function of the target operating system code to realize the upgrading switching of the intelligent card multi-operating system.
7. The system of claim 6, wherein the upgrade switching system runtime executes a startup procedure of a chip startup module, an operating system switching procedure, and a rollback procedure of an abnormal operation.
8. The system of claim 7, wherein the startup procedure of the chip startup module comprises:
s1, after the chip is powered on, operating a default starting module of the chip;
s2, searching the existing operating systems, reading the starting program data of each operating system, checking the checksum in each starting program data, and if the checking is successful, recording the numerical value Nn of the counter, wherein n is a natural number;
s3, if the verification fails, verifying the starting program data checksum of the next operating system until the starting program data of all the operating systems are verified;
s4, if the checksums of all the operating systems fail to be checked, starting the starting program data by using the default of the chip;
s5, taking the operating system with the largest counter as the target operating system to be started, initializing the interrupt vector and the interrupt service program in the starting program data of the target operating system, and the entry program, relocating the interrupt vector table and the interface address of the interrupt service program, and then calling the entry program to run the target operating system.
9. The system of claim 7, wherein the operating system switching process comprises:
c1, the old operating system is started;
c2, receiving an operating system switching instruction, and entering an operating system switching module;
c3, reading the starting program data of the new operating system to be switched, using MAX (N1, N2, … Nn) +1 as a new counter, and calculating the checksum by using all the starting program data and the new counter;
c4, writing all the boot program data, the new counter and the checksum into the boot program data storage area of the new operating system;
c5, restarting;
and C6, entering the starting process of the chip starting module after power-on, and completing the switching of the operating system.
10. The system of claim 7, wherein the rollback procedure for the operational exception comprises:
the rollback flow is divided into two types of active rollback of a user and abnormal automatic rollback of an operating system:
the user actively backs: when the operating system normally runs, a user executes rollback operation through an instruction;
and (3) automatic rollback of system exception: when a hardware exception occurs in the running process of the new operating system, the operating system calls a switching flow in an exception interrupt service program and enters an operating system switching flow; or, directly erasing the data in the data storage area of the operating system startup program, entering an operating system startup process after the chip is restarted, and automatically identifying the effective operating system.
CN202210534319.7A 2022-05-17 2022-05-17 Upgrading switching method and system for multiple operating systems of smart card Pending CN114924774A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210534319.7A CN114924774A (en) 2022-05-17 2022-05-17 Upgrading switching method and system for multiple operating systems of smart card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210534319.7A CN114924774A (en) 2022-05-17 2022-05-17 Upgrading switching method and system for multiple operating systems of smart card

Publications (1)

Publication Number Publication Date
CN114924774A true CN114924774A (en) 2022-08-19

Family

ID=82809156

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210534319.7A Pending CN114924774A (en) 2022-05-17 2022-05-17 Upgrading switching method and system for multiple operating systems of smart card

Country Status (1)

Country Link
CN (1) CN114924774A (en)

Similar Documents

Publication Publication Date Title
US7512749B2 (en) Safe software revision for embedded systems
US7747997B1 (en) Firmware update in electronic devices employing SIM card for saving metadata information
US7725889B2 (en) Mobile handset capable of updating its update agent
US8595716B2 (en) Failsafe firmware updates
US20110283274A1 (en) Firmware image update and management
US20040123282A1 (en) Mobile handset with a fault tolerant update agent
US20060075284A1 (en) Method for over-the-air firmware update of NAND flash memory based mobile devices
US20070204144A1 (en) Modular BIOS update mechanism
CN111813428A (en) Method and device for upgrading terminal firmware, electronic equipment and storage medium
CN105094927A (en) Equipment firmware updating method and device
US11442718B2 (en) Embedded system and method of controlling non-volatile memory to perform firmware update
CN105677409A (en) System upgrading method and device
CN114064084A (en) ONU upgrade management method, storage medium, electronic device, and ONU
KR20050088193A (en) Mobile handset with a fault tolerant update agent
CN108170456B (en) Firmware upgrading method and device for electronic equipment
CN114924774A (en) Upgrading switching method and system for multiple operating systems of smart card
CN116521062A (en) Data processing method, device, computer equipment and storage medium
CN113467797B (en) Program updating method, device and system and computer readable storage medium
CN112667444A (en) System upgrading method, storage medium and terminal equipment
CN113778485A (en) System operation method and device of electronic chip, electronic chip and storage medium
CN112650513A (en) Program upgrading method and device, computer equipment and storage medium
CN111190627A (en) System upgrading method and device
CN115437674B (en) Firmware upgrading method, device, medium and electronic equipment
CN112230967B (en) Optical module firmware rollback online upgrading method based on traditional partition
CN111666094B (en) Real-time firmware upgrading system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination