WO2016155524A1 - 一种系统安全升级的方法和装置 - Google Patents

一种系统安全升级的方法和装置 Download PDF

Info

Publication number
WO2016155524A1
WO2016155524A1 PCT/CN2016/076830 CN2016076830W WO2016155524A1 WO 2016155524 A1 WO2016155524 A1 WO 2016155524A1 CN 2016076830 W CN2016076830 W CN 2016076830W WO 2016155524 A1 WO2016155524 A1 WO 2016155524A1
Authority
WO
WIPO (PCT)
Prior art keywords
partition
boot
parameter
boot partition
configuration state
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.)
Ceased
Application number
PCT/CN2016/076830
Other languages
English (en)
French (fr)
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of WO2016155524A1 publication Critical patent/WO2016155524A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities

Definitions

  • the present invention relates to the field of computers, and in particular, to a method and apparatus for system security upgrade.
  • System upgrades usually include upgrades of bootloaders, OS, middleware, applications, and more.
  • embedded products such as smart TVs
  • various boxes such as Internet Protocol TV (IPTV) boxes, Over The Top (OTT) boxes, Digital Video Broadcasting (DVB) boxes, Set-top boxes, etc.
  • IPTV Internet Protocol TV
  • OTT Over The Top
  • DVD Digital Video Broadcasting
  • Set-top boxes etc.
  • whose built-in memory is usually a computer flash memory device (NAND) medium or an embedded multi-media card (eMMC) medium
  • NAND and eMMC are characterized by the occurrence of bad blocks and damage.
  • System upgrades will increase the read and write of NAND or eMMC. If the power is suddenly turned off during the upgrade process, the possibility of damage to the storage medium is greatly increased.
  • Android system upgrades usually include updates to the bootloader, operating system kernel (kernel), system (system), recovery (recovery), cache (cache) and other partitions. When the system is upgraded online, the contents of some or all of the partitions are often updated.
  • the system upgrade includes all upgrades and partial upgrades.
  • the usual practice is to update the contents of the bootloader, kernel, system and other partitions in turn. If the critical partition such as the bootloader partition is damaged due to power failure, the whole system will not be able to start, and the device will not operate normally, which is commonly referred to as causing the device to become "brick.”
  • a method for system security upgrade including:
  • the device When the device is powered on, detecting a configuration state parameter of each boot partition recorded in the parameter partition, and filtering out a boot partition indicating that the configuration state parameter represents a successful state; wherein the system includes at least two boot partitions, each of which Code for booting the system is stored in the boot partition;
  • the configured configuration state parameter value of the one boot partition is set to represent the success status in the parameter partition.
  • the probability of the device being unavailable due to the damage of the critical partition during the system upgrade can be greatly reduced, and the multiple boot partitions can be used to realize the rapid recovery and start of the device without affecting the normal running time of the system, thereby providing convenience for the user and further improving the reliability of the system.
  • sexuality improve the availability of equipment, and ensure that the system can be upgraded safely and reliably.
  • the configuration state parameter values of each boot partition recorded in the parameter partition are set to represent the success status.
  • the system includes at least two boot partitions that are the same boot partition, and the system is an embedded system.
  • detecting a configuration state parameter of each boot partition recorded in the parameter partition detecting a configuration state parameter of each boot partition recorded in the parameter partition, and filtering out a boot partition indicating that the configuration state parameter represents a successful state, specifically:
  • the configuration state parameters of each boot partition recorded in the parameter partition are sequentially detected by executing the code stored in the initialization partition; wherein each configuration state parameter of the boot partition is read to determine whether the success status is represented. If yes, mark the one boot partition as the boot partition to be operated; otherwise, mark the boot partition as the boot partition to be repaired;
  • the method further includes:
  • the configuration state parameter value of the one to be repaired boot partition is set to represent a successful state in the parameter partition.
  • a device for system security upgrade comprising:
  • a screening unit configured to: when the device is powered on, detect a configuration state parameter of each boot partition recorded in the parameter partition, and filter out a boot partition whose configuration state parameter represents a successful state; wherein the system includes at least two boot partitions, each Code for booting the system is stored in a boot partition;
  • a processing unit configured to set, in the parameter partition, a configuration state parameter of the filtered one of the boot partitions to represent a failure state, and run a code stored in the one boot partition for guiding system startup;
  • a determining unit configured to determine, in the parameter partition, a configuration state parameter value of the one boot partition that is selected to be a successful state when the execution is successful.
  • the probability of the device being unavailable due to the damage of the critical partition during the system upgrade can be greatly reduced, and the multiple boot partitions can be used to realize the rapid recovery and start of the device without affecting the normal running time of the system, thereby providing convenience for the user and further improving the reliability of the system.
  • sexuality improve the availability of equipment, and ensure that the system can be upgraded safely and reliably.
  • the system detected by the screening unit includes at least two boot partitions that are the same boot partition, and the system is an embedded system.
  • the screening unit is further configured to:
  • the configuration state parameter values of each boot partition recorded in the parameter partition are set to characterize the success status.
  • the screening unit when the device is powered on, detecting the configuration state parameter of each boot partition recorded in the parameter partition, and filtering out a boot partition indicating that the configuration state parameter represents a successful state, the screening unit is specifically configured to:
  • the configuration state parameters of each boot partition recorded in the parameter partition are sequentially detected by executing the code stored in the initialization partition; wherein each configuration state parameter of the boot partition is read to determine whether the success status is represented. If yes, mark the one boot partition as the boot partition to be operated; otherwise, mark the boot partition as the boot partition to be repaired;
  • the determining unit is further configured to:
  • the configuration state parameter value of the one to be repaired boot partition is set to represent a successful state in the parameter partition.
  • FIG. 1 is a schematic flowchart of a method for system security upgrade according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of parameter partitioning in an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a memory partition of an Android device according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of an apparatus for system security upgrade according to an embodiment of the present invention.
  • Partition management of storage media such as NAND/eMMC is closely related to system upgrades.
  • boot code ROM code
  • it always jumps to the fixed partition to execute its related code, and does not jump to other partitions according to whether the partition is damaged or not. If the bootloader is damaged due to power failure, the system upgrade will not work properly, which may further invalidate the device and affect the normal use of the user.
  • an initialization (Init) partition is designed, and multiple backups of the boot partition are performed to greatly improve the reliability of the system upgrade.
  • a method for system security upgrade is provided, and the specific process is as follows:
  • Step 100 When the device is powered on, detecting a configuration state parameter of each boot partition recorded in the parameter partition, and filtering out a boot partition indicating that the configuration state parameter represents a successful state; wherein the system includes at least two boot partitions, each boot partition The code for booting the system startup is recorded in the middle.
  • the system includes at least two boot partitions that are the same boot partition and can be mutually backed up.
  • the system is an embedded system.
  • the configuration state parameter values of each boot partition recorded in the parameter partition are set to represent the success status.
  • the parameter partition uses a key-value method to store some parameters necessary for the boot process, including parameters that characterize the configuration state of the boot partition. Specifically, refer to FIG. 2, and use SUCCESS to characterize the successful configuration state. Use "FAILD" to characterize the failed configuration state, and set the configuration status parameter value of each boot partition recorded in the parameter partition to the "SUCCESS" state before the device is powered on for the first time (ie, the factory).
  • the specific process is: executing the read-only chip ROM after the device is powered on The boot code saved in the boot code; after executing the boot code, by executing the code stored in the initialization partition, sequentially detecting the configuration state parameters of each boot partition recorded in the parameter partition; wherein, each configuration state parameter of the boot partition is read , to determine whether to represent the success status, and if so, mark the one boot partition as the boot partition to be operated; otherwise, mark the one boot partition as the boot partition to be repaired; A boot partition is filtered out in the operation boot partition.
  • Step 101 Set the configured configuration state parameter of the one boot partition in the parameter partition to represent the failed state, and run the code stored in the boot partition for booting the system startup.
  • Step 102 When it is determined that the execution is successful, set the configured configuration state parameter value of the one boot partition in the parameter partition to represent the success status.
  • the configuration state parameter value of the one boot partition selected in the parameter partition is set to represent the successful state
  • the code stored in the one boot partition is copied to each marked to be repaired.
  • the configuration state parameter value of the one to be repaired boot partition is set to represent the success status in the parameter partition.
  • bootloader0 there are two boot partitions in the system.
  • the two boot partitions are backups of each other.
  • bootloader0 and bootloader1 are used to indicate the boot partitions that are mutually backed up.
  • the configuration status of bootloader0 is detected as "SUCCESS" status, and the configuration status of bootloader1 is used.
  • FAILD For the "FAILD” state, after the device successfully executes the code stored in bootloader0, the code stored in bootloader0 needs to be copied to bootloader1.
  • the configuration state of bootloader1 is set. Changed to the "SUCCESS" state, so that the boot partition that has been corrupted can be restored to normal.
  • the code execution of the initialization partition, the boot partition, and other partitions of the device's memory is to first load the partitioned code into the memory (such as DDR or IRAM), and the CPU reads from the memory. Load the code corresponding to the partition.
  • the following describes the method for security upgrade of the above system by taking a memory partition of an Android device as an example.
  • the memory of the Android device is the eMMC/NAND partition. See Figure 3, including: Parameter, Init, Bootloader0, Bootloader1,...BootloaderN, Kernel, Android, recovery, cache, Other (other) and other partitions. among them:
  • the Parameter partition uses a simple key-value method to store some of the parameters necessary during the boot process, including the bootloader0/bootloader1/...bootloaderN configuration.
  • SUCCESS is used to characterize the successful configuration state
  • FAILD is used to characterize the failed configuration state.
  • the status of these boot partitions is "SUCCESS" state.
  • the Init partition stores an initialization code that determines which boot partition to jump to based on the parameters of the boot partition of the record of the parameter partition.
  • BootLoader0, BootLoader1, ... BootLoaderN are multiple backups of the same boot partition.
  • Each boot partition stores a piece of code ready to boot the operating system in preparation for booting the operating system.
  • Kernel partition refers to the kernel partition of the operating system. It usually stores the kernel and driver related code, such as Linux kernel.
  • the android partition includes android related components, usually storing android related framework code, virtual machine code, used library, etc.
  • the recovery partition refers to the recovery partition of android.
  • the partition contains a simple Linux system for upgrading; the cache partition is used to save the upgrade package of the system upgrade download; the Other partition refers to other partitions, which are defined by each product.
  • the code in the read-only chip "ROM” chip is the first to execute the code (ROM code). After the boot code is executed, it will jump to the code of the Init partition.
  • the boot partition executes the code stored by the partition.
  • modify the configuration status of the damaged backup boot partition to "SUCCESS" modify the configuration status of the damaged backup boot partition to "SUCCESS"; finally, execute the execution right to the kernel for the subsequent startup process, which will not be described in detail.
  • the device always jumps to a fixed point after executing the core ROM code when the device is powered on.
  • the zone is executed without jumping to another partition depending on whether the partition is corrupted.
  • the ROM code is executed to jump to the Init partition, and the Init partition determines which boot partition to jump to according to the configuration state of the boot partition recorded in the parameter partition, because the content of the Init partition does not It is changed by system upgrade, so in theory the partition will not be damaged due to the upgrade, and the multiple backup mechanism of the bootloader guarantees the reliability of the bootloader.
  • Other partitions such as Kernel can only be updated in recovery mode. If the update fails (such as power failure), after recovery, the recovery mode will continue to update the contents of the kernel and other partitions, thus ensuring the reliability of other partitions.
  • the Recovery mode refers specifically to the Android recovery mode, and its essence is to update the upgrade package.
  • an embodiment of the present invention provides a device for security upgrade of a system, including: a screening unit 40, a processing unit 41, and a determining unit 42, wherein:
  • the screening unit 40 is configured to: when the device is powered on, detect a configuration state parameter of each boot partition recorded in the parameter partition, and filter out a boot partition whose configuration state parameter represents a successful state; wherein the system includes at least two boot partitions, each Code for booting the system is stored in a boot partition;
  • the processing unit 41 is configured to set, in the parameter partition, the configured configuration state parameter of the one boot partition that is filtered to represent a failure state, and run a code stored in the boot partition for guiding system startup;
  • the determining unit 42 is configured to: when the execution is successful, set the configured configuration state parameter value of the one boot partition in the parameter partition to represent the success status.
  • the system detected by the screening unit includes at least two boot partitions that are the same boot partition, and the system is an embedded system.
  • the screening unit 40 is further configured to:
  • the configuration state parameter values of each boot partition recorded in the parameter partition are set to characterize the success status.
  • the filtering unit 40 when the device is powered on, detecting the configuration state parameter of each boot partition recorded in the parameter partition, and filtering out a boot partition indicating that the configuration state parameter represents a successful state, the filtering unit 40 is specifically configured to:
  • the configuration state parameters of each boot partition recorded in the parameter partition are sequentially detected by executing the code stored in the initialization partition; wherein each configuration state parameter of the boot partition is read to determine whether the success status is represented. If yes, mark the boot partition as the boot partition to be operated; otherwise, mark the boot partition as the boot partition to be repaired;
  • the configuration state of the one boot partition to be filtered out in the parameter partition is determined.
  • the determining unit 42 is further configured to:
  • the configuration state parameter value of the to-be-repaired boot partition is set to represent a successful state in the parameter partition.
  • the device when the device is powered on, detecting the configuration state parameter of each boot partition recorded in the parameter partition, and filtering out a boot partition in which the configuration state parameter represents a successful state;
  • the configuration state parameter of a boot partition is set to represent the failure state, and the code stored in the boot partition for booting the system startup is run; when the execution is successful, the configuration state parameter value of the above one boot partition is set in the parameter partition.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions are provided for implementing one or more processes and/or block diagrams in the flowchart The steps of a function specified in a box or multiple boxes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本发明公开了一种系统安全升级的方法和装置,以解决由于系统升级出现的设备不可用率高的情况。该方法为,在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区;在参数分区内将筛选出的上述一个引导分区的配置状态参数设置为表征失败状态,并运行该引导分区中存储的用于引导系统启动的代码;确定执行成功时,在参数分区内将筛选出的上述一个引导分区的配置状态参数值设置为表征成功状态。这样,能够大大降低由于系统升级导致设备不可用的概率,提升系统的可靠性,提高设备的可用性,确保系统能够安全可靠地升级。

Description

一种系统安全升级的方法和装置
本申请要求2015年03月27日递交的申请号为201510142360.X、发明名称为“一种系统安全升级的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机领域,尤其涉及一种系统安全升级的方法和装置。
背景技术
系统升级,通常包括引导分区(bootloader),OS,中间件,应用等组件的升级。在嵌入式产品,如智能电视机,各种盒子如交互式网络电视(Internet protocol TV,IPTV)盒子,过顶(Over The Top,OTT)盒子,数字视频广播(Digital Video Broadcasting,DVB)盒子,机顶盒等,其内置的存储器通常是计算机闪存设备(NAND)介质或者内嵌式存储器(Embedded Multi Media Card,eMMC)介质,NAND和eMMC的特点是容易出现坏块、导致其损坏。系统升级会加大对NAND或eMMC的读写,如果在升级过程中,突然断电,更会使存储介质损坏的可能性大大增加。常见的升级,例如:安卓系统的升级通常包括对bootloader,操作系统内核(kernel),系统(system),恢复(recovery),缓存(cache)等分区的内容进行更新。系统在线升级的时候,往往更新其中部分分区或者全部分区的内容。
由此可知,系统升级包括全部升级和部分升级。通常的做法是依次更新bootloader,kernel,system等分区的内容,如果关键分区如bootloader分区由于断电导致破坏,整个系统将无法启动,设备无法正常运行,俗称导致设备变“砖”。
发明内容
本发明的目的是提供一种系统安全升级的方法和装置,以解决由于系统升级出现的设备不可用率高的情况。
本发明的目的是通过以下技术方案实现的:
一种系统安全升级的方法,包括:
在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区;其中,系统包括至少两个引导分区,每一个 引导分区中均存储有用于引导系统启动的代码;
在所述参数分区内将筛选出的所述一个引导分区的配置状态参数设置为表征失败状态,并运行所述一个引导分区中存储的用于引导系统启动的代码;
确定执行成功时,在所述参数分区内将筛选出的所述一个引导分区的配置状态参数值设置为表征成功状态。
这样,能够大大降低由于系统升级时关键分区损坏导致设备不可用的概率,利用多个引导分区实现设备的快速恢复启动,不影响系统的正常运行时间,为用户提供了方便,进一步提升系统的可靠性,提高设备的可用性,确保系统能够安全可靠地升级。
较佳的,在设备首次开机之前,将参数分区内记录的每一个引导分区的配置状态参数值均设置为表征成功状态。
较佳,系统包括的至少两个引导分区为相同的引导分区,所述系统为嵌入式系统。
可选的,在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区,具体包括:
在设备开机后,执行只读芯片ROM中保存的引导代码;
在引导代码执行完毕后,通过执行初始化分区中存储的代码,依次检测参数分区内记录的每一个引导分区的配置状态参数;其中,每读取一个引导分区的配置状态参数,判断是否表征成功状态,若是,则将所述一个引导分区标记为待操作引导分区,否则,将所述一个引导分区标记为待修复引导分区;
从已标记的待操作引导分区中筛选出一个引导分区。
可选的,确定执行成功时,在所述参数分区内将所述一个引导分区的配置状态参数值设置为表征成功状态之后,进一步包括:
将所述一个引导分区内存储的代码复制到每一个已标记的待修复引导分区中;
每确定所述一个引导分区内存储的代码成功复制到一个待修复引导分区后,在参数分区内将所述一个待修复引导分区的配置状态参数值设置为表征成功状态。
一种系统安全升级的装置,包括:
筛选单元,用于在该设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区;其中,系统包括至少两个引导分区,每一个引导分区中均存储有用于引导系统启动的代码;
处理单元,用于在所述参数分区内将筛选出的所述一个引导分区的配置状态参数设置为表征失败状态,并运行所述一个引导分区中存储的用于引导系统启动的代码;
确定单元,用于确定执行成功时,在所述参数分区内将筛选出的所述一个引导分区的配置状态参数值设置为表征成功状态。
这样,能够大大降低由于系统升级时关键分区损坏导致设备不可用的概率,利用多个引导分区实现设备的快速恢复启动,不影响系统的正常运行时间,为用户提供了方便,进一步提升系统的可靠性,提高设备的可用性,确保系统能够安全可靠地升级。
较佳的,所述筛选单元检测的系统包括的至少两个引导分区为相同的引导分区,所述系统为嵌入式系统。
较佳的,所述筛选单元进一步用于:
在设备首次开机之前,将参数分区内记录的每一个引导分区的配置状态参数值均设置为表征成功状态。
较佳的,在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区时,所述筛选单元具体用于:
在设备开机后,执行只读芯片ROM中保存的引导代码;
在引导代码执行完毕后,通过执行初始化分区中存储的代码,依次检测参数分区内记录的每一个引导分区的配置状态参数;其中,每读取一个引导分区的配置状态参数,判断是否表征成功状态,若是,则将所述一个引导分区标记为待操作引导分区,否则,将所述一个引导分区标记为待修复引导分区;
从已标记的待操作引导分区中筛选出一个引导分区。
较佳的,确定执行成功时,在所述参数分区内将筛选出的所述一个引导分区的配置状态参数值设置为表征成功状态之后,所述确定单元进一步用于:
将筛选出的所述一个引导分区内存储的代码复制到每一个已标记的待修复引导分区中;
每确定筛选出的所述一个引导分区内存储的代码成功复制到一个待修复引导分区后,在参数分区内将所述一个待修复引导分区的配置状态参数值设置为表征成功状态。
附图说明
图1为本发明实施例中系统安全升级的方法流程示意图;
图2为本发明实施例中参数分区的示意图;
图3为本发明实施例中安卓设备的存储器分区示意图;
图4为本发明实施例中系统安全升级的装置结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,并不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
存储介质(如NAND/eMMC)的分区管理与系统升级密切相关。通常系统升级时,执行完芯片上的引导代码(ROM code)后总是跳转到固定分区执行其相关代码,而不会根据分区是否损坏跳转到别的分区,如果升级过程中关键分区例如引导分区(bootloader)由于断电出现毁坏情况时,会导致系统升级无法正常进行,进一步导致设备不可用,影响用户的正常使用。和通常的做法不同,本发明实施例中设计了初始化(Init)分区,并对引导分区进行了多个分区的备份,用以大大提高系统升级的可靠性。
参阅图1所示,本发明实施例中,提供一种系统安全升级的方法,具体流程如下:
步骤100:在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区;其中,系统包括至少两个引导分区,每一个引导分区中均记录有用于引导系统启动的代码。
具体的,系统包括的至少两个引导分区为相同的引导分区,可以互为备份,该系统为嵌入式系统。
进一步的,在设备次开机之前,将参数分区内记录的每一个引导分区的配置状态参数值均设置为表征成功状态。
例如,参数(parameter)分区采用key-value方式存放一些启动过程必须的参数,包括表征引导分区的配置状态的参数,具体的,可参阅图2所示,用“SUCCESS”表征成功的配置状态,用“FAILD”表征失败的配置状态,在设备首次开机(即出厂)之前,将参数分区内记录的每一个引导分区的配置状态参数值均设置为“SUCCESS”状态。
具体的,在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区,具体过程为:在设备开机后,执行只读芯片ROM中保存的引导代码;在引导代码执行完毕后,通过执行初始化分区中存储的代码,依次检测参数分区内记录的每一个引导分区的配置状态参数;其中,每读取一个引导分区的配置状态参数,判断是否表征成功状态,若是,则将该一个引导分区标记为待操作引导分区,否则,将该一个引导分区标记为待修复引导分区;从已标记的待 操作引导分区中筛选出一个引导分区。
步骤101:在参数分区内将筛选出的上述一个引导分区的配置状态参数设置为表征失败状态,并运行该一个引导分区中存储的用于引导系统启动的代码。
步骤102:确定执行成功时,在参数分区内将筛选出的上述一个引导分区的配置状态参数值设置为表征成功状态。
需要说明的是,这里检测到一个配置状态为成功状态的引导分区后,执行该引导分区的代码时,将该引导分区的配置状态设置为失败状态,在成功执行完该引导分区的代码后,将将该引导分区的配置状态设置为成功状态,这样做能够确保在执行完某一个引导分区的代码后,参数分区中保存的该分区的配置状态是正确的,如果不执行这样的操作,在执行引导分区的代码时若由于断电或电路板短路等原因导致升级失败时,将导致参数分区内记录该引导分区的配置状态出现错误,再次升级时可能会继续出现升级失败的情形。
进一步的,确定执行成功时,在参数分区内将筛选出的上述一个引导分区的配置状态参数值设置为表征成功状态之后,将上述一个引导分区内存储的代码复制到每一个已标记的待修复引导分区中;每确定上述一个引导分区内存储的代码成功复制到一个待修复引导分区后,在参数分区内将该一个待修复引导分区的配置状态参数值设置为表征成功状态。
例如,系统中存在两个引导分区,这两个引导分区互为备份,这里用bootloader0和bootloader1来表示这个互为备份的引导分区,检测到bootloader0的配置状态为“SUCCESS”状态,bootloader1的配置状态为“FAILD”状态,设备开机后成功执行完bootloader0中存储的代码后,需要将bootloader0中存储的代码复制到bootloader1中,在确定bootloader0中存储的代码成功复制到bootloader1中后,将bootloader1的配置状态修改为“SUCCESS”状态,这样,能够实现对出现毁坏情况的引导分区恢复至正常情况。
进一步的,需要说明的是,初始化分区、引导分区以及设备的存储器的其他分区的代码执行,都是先将分区的代码下载(load)到内存中(如DDR或IRAM),CPU从内存中读取对应分区的代码进行加载。
具体的,下面以一安卓(Android)设备的存储器分区为例针对上述系统安全升级的方法进行详细说明。
Android设备的存储器即eMMC/NAND分区情况,参阅图3所示,包括:Parameter,Init区,Bootloader0,Bootloader1,…BootloaderN,Kernel,Android,recovery,cache, 其他(other)等分区。其中:
Parameter分区采用简单的key-value方式存放一些启动过程中必须的参数,包括bootloader0/bootloader1/…bootloaderN的配置(boot)状态。这里用“SUCCESS”表征成功的配置状态,用“FAILD”表征失败的配置状态,初始化时,这些引导分区的状态都是“SUCCESS”状态。
Init分区存储有一段初始化代码,该初始化代码根据parameter分区的记录的引导分区的参数决定跳转到哪个引导分区,其中BootLoader0,BootLoader1,…BootLoaderN是同一个引导分区的多个备份。
每一个引导分区都存储有一段为启动操作系统做准备的代码,为启动操作系统做准备。
Kernel分区是指操作系统的内核分区,通常存储有内核、驱动相关代码,如Linux kernel;android分区包括android相关的组件,通常存储有android相关的框架代码、虚拟机代码、用到的库等;recovery分区是指android的recovery分区,该分区包含一个简单的Linux系统,用于升级;cache分区用以保存系统升级下载的升级包;Other分区是指其他分区,由各个产品自己定义。
当设备开机时,最先执行只读芯片“ROM”芯片里面的代码即引导代码(ROM code),该引导代码执行完毕之后,会跳转到Init分区的代码,Init分区的代码会检查parameter分区的Bootloader0_Boot_state的值,如果是“SUCCESS”,则从该分区执行;如果是“FAILD”,记录Bootloader_Boot_state=FAILD的引导分区,进一步的继续检查Bootloader1_Boot_state的值…如此下去,直到找到一个配置状态为“SUCCESS”的引导分区执行该分区存储的代码。在执行一个引导分区存储的代码时,首先把该引导分区对应的Bootloader_Boot_state设置为“FAILED”,直到引导分区存储的代码成功执行完毕后才把其对应的Bootloader_Boot_state改为“SUCCESS”。如果该引导分区存储有损坏的代码,导致该引导分区存储的代码将不会被完全成功执行,从而该引导分区对应的Bootloader_Boot_state不会被改写为“SUCCESS”。在该引导分区存储的代码成功执行完毕之后,要负责恢复Bootloader_Boot_state=FAILD的引导分区,即把该引导分区存储的代码复制到到损坏的备份引导分区中,在确定该引导分区存储的代码成功复制到到损坏的备份引导分区中之后,将损坏的备份引导分区的配置状态修改为“SUCCESS”;最后把执行权交给kernel做后面的启动过程,此过程不做详细描述。
需要说明的是,通常情况下,设备开机时执行完芯ROM code后总是跳转到固定分 区执行,而不会根据分区是否损坏跳转到别的分区。本发明实施例中,设备开机时执行完ROM code后通过跳转到Init分区,Init分区根据parameter分区中记录的引导分区的配置状态决定跳转到哪个引导分区中,由于Init分区的内容不会通过系统升级而改变,所以理论上该分区不会因为升级而损坏,而bootloader的多个备份机制保证了bootloader的可靠性。Kernel等其他分区只有在恢复(recovery)模式下进行更新,如果更新失败(如断电),重启后,恢复(recovery)模式会继续更新kernel等分区的内容,从而保证了其他分区的可靠性,Recovery模式特指Android recovery模式,其实质是更新升级包。
基于上述技术方案,参阅图4所示,本发明实施例中提供一种系统安全升级的装置,包括:筛选单元40,处理单元41和确定单元42,其中:
筛选单元40,用于在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区;其中,系统包括至少两个引导分区,每一个引导分区中均存储有用于引导系统启动的代码;
处理单元41,用于在参数分区内将筛选出的上述一个引导分区的配置状态参数设置为表征失败状态,并运行该引导分区中存储的用于引导系统启动的代码;
确定单元42,用于确定执行成功时,在参数分区内将筛选出的上述一个引导分区的配置状态参数值设置为表征成功状态。
较佳的,所述筛选单元检测的系统包括的至少两个引导分区为相同的引导分区,该系统为嵌入式系统。
较佳的,筛选单元40进一步用于:
在设备首次开机之前,将参数分区内记录的每一个引导分区的配置状态参数值均设置为表征成功状态。
较佳的,在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区时,筛选单元40具体用于:
在设备开机后,执行只读芯片ROM中保存的引导代码;
在引导代码执行完毕后,通过执行初始化分区中存储的代码,依次检测参数分区内记录的每一个引导分区的配置状态参数;其中,每读取一个引导分区的配置状态参数,判断是否表征成功状态,若是,则将该引导分区标记为待操作引导分区,否则,将该引导分区标记为待修复引导分区;
从已标记的待操作引导分区中筛选出一个引导分区。
较佳的,确定执行成功时,在参数分区内将筛选出的上述一个引导分区的配置状态 参数值设置为表征成功状态之后,确定单元42进一步用于:
将筛选出的上述一个引导分区内存储的代码复制到每一个已标记的待修复引导分区中;
每确定筛选出的该一个引导分区内存储的代码成功复制到一个待修复引导分区后,在参数分区内将该待修复引导分区的配置状态参数值设置为表征成功状态。
综上所述,本发明实施例中,在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区;在参数分区内将上述一个引导分区的配置状态参数设置为表征失败状态,并运行该一个引导分区中存储的用于引导系统启动的代码;确定执行成功时,在参数分区内将上述一个引导分区的配置状态参数值设置为表征成功状态。这样,能够大大降低由于系统升级导致设备不可用的概率,提升系统的可靠性,提高设备的可用性,确保系统能够安全可靠地升级。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图 一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明实施例进行各种改动和变型而不脱离本发明实施例的精神和范围。这样,倘若本发明实施例的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (10)

  1. 一种系统安全升级的方法,其特征在于,包括:
    在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区;其中,系统包括至少两个引导分区,每一个引导分区中均存储有用于引导系统启动的代码;
    在所述参数分区内将筛选出的所述一个引导分区的配置状态参数设置为表征失败状态,并运行所述一个引导分区中存储的用于引导系统启动的代码;
    确定执行成功时,在所述参数分区内将筛选出的所述一个引导分区的配置状态参数值设置为表征成功状态。
  2. 如权利要求1所述的方法,其特征在于,进一步包括:
    在设备首次开机之前,将参数分区内记录的每一个引导分区的配置状态参数值均设置为表征成功状态。
  3. 如权利要求1所述的方法,其特征在于,系统包括的至少两个引导分区为相同的引导分区,所述系统为嵌入式系统。
  4. 如权利要求1、2或3所述的方法,其特征在于,在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区,具体包括:
    在设备开机后,执行只读芯片ROM中保存的引导代码;
    在引导代码执行完毕后,通过执行初始化分区中存储的代码,依次检测参数分区内记录的每一个引导分区的配置状态参数;其中,每读取一个引导分区的配置状态参数,判断是否表征成功状态,若是,则将所述一个引导分区标记为待操作引导分区,否则,将所述一个引导分区标记为待修复引导分区;
    从已标记的待操作引导分区中筛选出一个引导分区。
  5. 如权利要求4所述的方法,其特征在于,确定执行成功时,在所述参数分区内将筛选出的所述一个引导分区的配置状态参数值设置为表征成功状态之后,进一步包括:
    将筛选出的所述一个引导分区内存储的代码复制到每一个已标记的待修复引导分区中;
    每确定筛选出的所述一个引导分区内存储的代码成功复制到一个待修复引导分区后,在参数分区内将所述一个待修复引导分区的配置状态参数值设置为表征成功状态。
  6. 一种系统安全升级的装置,其特征在于,包括:
    筛选单元,用于在该设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区;其中,系统包括至少两个引导分区,每一个引导分区中均存储有用于引导系统启动的代码;
    处理单元,用于在所述参数分区内将所述一个引导分区的配置状态参数设置为表征失败状态,并运行所述一个引导分区中存储的用于引导系统启动的代码;
    确定单元,用于确定执行成功时,在所述参数分区内将筛选出的所述一个引导分区的配置状态参数值设置为表征成功状态。
  7. 如权利要求6所述的装置,其特征在于,所述筛选单元检测的系统包括的至少两个引导分区为相同的引导分区,所述系统为嵌入式系统。
  8. 如权利要求6所述的装置,其特征在于,所述筛选单元进一步用于:
    在设备首次开机之前,将参数分区内记录的每一个引导分区的配置状态参数值均设置为表征成功状态。
  9. 如权利要求6、7、8所述的装置,其特征在于,在设备开机时,检测参数分区内记录的每一个引导分区的配置状态参数,筛选出配置状态参数表征成功状态的一个引导分区时,所述筛选单元具体用于:
    在设备开机后,执行只读芯片ROM中保存的引导代码;
    在引导代码执行完毕后,通过执行初始化分区中存储的代码,依次检测参数分区内记录的每一个引导分区的配置状态参数;其中,每读取一个引导分区的配置状态参数,判断是否表征成功状态,若是,则将所述一个引导分区标记为待操作引导分区,否则,将所述一个引导分区标记为待修复引导分区;
    从已标记的待操作引导分区中筛选出一个引导分区。
  10. 如权利要求9所述的装置,其特征在于,确定执行成功时,在所述参数分区内将筛选出的所述一个引导分区的配置状态参数值设置为表征成功状态之后,所述确定单元进一步用于:
    将筛选出的所述一个引导分区内存储的代码复制到每一个已标记的待修复引导分区中;
    每确定筛选出的所述一个引导分区内存储的代码成功复制到一个待修复引导分区后,在参数分区内将所述一个待修复引导分区的配置状态参数值设置为表征成功状态。
PCT/CN2016/076830 2015-03-27 2016-03-21 一种系统安全升级的方法和装置 Ceased WO2016155524A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510142360.XA CN106156626B (zh) 2015-03-27 2015-03-27 一种系统安全升级的方法和装置
CN201510142360.X 2015-03-27

Publications (1)

Publication Number Publication Date
WO2016155524A1 true WO2016155524A1 (zh) 2016-10-06

Family

ID=57006561

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/076830 Ceased WO2016155524A1 (zh) 2015-03-27 2016-03-21 一种系统安全升级的方法和装置

Country Status (2)

Country Link
CN (1) CN106156626B (zh)
WO (1) WO2016155524A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113064608A (zh) * 2020-01-02 2021-07-02 广东博智林机器人有限公司 一种ota升级方法、装置、设备和介质
CN113905365A (zh) * 2021-12-13 2022-01-07 龙旗电子(惠州)有限公司 安卓终端单双卡配置方法、装置及设备

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109409032A (zh) * 2018-10-24 2019-03-01 山东超越数控电子股份有限公司 一种安全关键系统的系统内核安全判断方法
CN109542480A (zh) * 2018-11-16 2019-03-29 深圳市邻友通科技发展有限公司 美甲打印装置的操作系统升级方法、装置和介质
CN111142949B (zh) * 2019-12-26 2022-03-25 联想(北京)有限公司 一种信息处理方法和电子设备

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102104750A (zh) * 2009-12-22 2011-06-22 康佳集团股份有限公司 一种网络电视自动升级的方法
CN102289397A (zh) * 2011-09-13 2011-12-21 全星科技(珠海)有限公司 一种机顶盒的嵌入式系统自动恢复方法及装置
CN102508686A (zh) * 2011-11-30 2012-06-20 苏州希图视鼎微电子有限公司 一种系统安全升级的实现方法及其系统

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101520735B (zh) * 2008-12-18 2013-09-18 康佳集团股份有限公司 一种启动闪存内引导程序的方法及其网络电视和机顶盒
CN101483659B (zh) * 2009-02-23 2011-12-07 成都市华为赛门铁克科技有限公司 启动服务器的方法、装置与系统
WO2013024497A1 (en) * 2011-08-12 2013-02-21 Power-One Italy S.P.A. Method and system for protected transmission of files
CN102331958A (zh) * 2011-11-02 2012-01-25 赵玉燕 Linux系统下硬盘启动的方法
CN102662715B (zh) * 2012-04-23 2016-03-23 深圳市掌讯通讯设备有限公司 一种嵌入式操作系统启动方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102104750A (zh) * 2009-12-22 2011-06-22 康佳集团股份有限公司 一种网络电视自动升级的方法
CN102289397A (zh) * 2011-09-13 2011-12-21 全星科技(珠海)有限公司 一种机顶盒的嵌入式系统自动恢复方法及装置
CN102508686A (zh) * 2011-11-30 2012-06-20 苏州希图视鼎微电子有限公司 一种系统安全升级的实现方法及其系统

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113064608A (zh) * 2020-01-02 2021-07-02 广东博智林机器人有限公司 一种ota升级方法、装置、设备和介质
CN113905365A (zh) * 2021-12-13 2022-01-07 龙旗电子(惠州)有限公司 安卓终端单双卡配置方法、装置及设备
CN113905365B (zh) * 2021-12-13 2022-03-15 龙旗电子(惠州)有限公司 安卓终端单双卡配置方法、装置及设备

Also Published As

Publication number Publication date
CN106156626A (zh) 2016-11-23
CN106156626B (zh) 2020-04-10

Similar Documents

Publication Publication Date Title
JP5575338B2 (ja) 情報処理装置、情報処理方法、およびコンピュータプログラム
CN109358882B (zh) 一种电视终端进行固件升级的方法及装置
TWI501253B (zh) 於裝置開機期間處置來自非揮發性記憶體之錯誤
CN107003864B (zh) 恢复片上系统设备
WO2016155524A1 (zh) 一种系统安全升级的方法和装置
US20130061090A1 (en) Partial rebooting recovery apparatus and method
KR20070039841A (ko) 디지털방송처리장치 및 디지털방송처리장치 부트로더의업그레이드 방법
JP2014099097A5 (zh)
WO2016206514A1 (zh) 启动处理方法及装置
US7818622B2 (en) Method for recovering data processing system failures
CN104461594A (zh) 嵌入式操作系统的升级方法及装置
WO2018024198A1 (zh) 机顶盒的应用程序升级方法、系统及机顶盒
CN106775674B (zh) 一种基于通用引导加载程序的设备及其启动方法
CN102880478B (zh) 软件更新方法
CN114265603A (zh) 基于不对称分区的系统升级方法、装置和电子设备
CN104424140A (zh) 统一可扩展固件接口驱动器
CN104536841B (zh) 一种Android系统Data分区自修复方法及系统
WO2021103745A1 (zh) 一种引导程序的保护设计方法
CN114115958A (zh) 程序启动方法及终端设备
WO2015184732A1 (zh) 引导程序的存储方法、故障恢复方法及设备、计算机存储介质
CN116257384A (zh) 终端的启动方法、电子设备和计算机可读存储介质
KR20080066381A (ko) 소프트웨어의 업그레이드 방법
CN104298618B (zh) 一种智能终端的命令处理方法及装置
CN119473432A (zh) 系统启动方法、装置、计算机设备和存储介质
JP6011687B1 (ja) 記憶装置およびその制御方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16771279

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16771279

Country of ref document: EP

Kind code of ref document: A1