WO2020119213A1 - Methods for generating and loading mirror file, and device - Google Patents

Methods for generating and loading mirror file, and device Download PDF

Info

Publication number
WO2020119213A1
WO2020119213A1 PCT/CN2019/107170 CN2019107170W WO2020119213A1 WO 2020119213 A1 WO2020119213 A1 WO 2020119213A1 CN 2019107170 W CN2019107170 W CN 2019107170W WO 2020119213 A1 WO2020119213 A1 WO 2020119213A1
Authority
WO
WIPO (PCT)
Prior art keywords
system memory
physical
memory
page
image file
Prior art date
Application number
PCT/CN2019/107170
Other languages
French (fr)
Chinese (zh)
Inventor
初德进
Original Assignee
海信视像科技股份有限公司
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 海信视像科技股份有限公司 filed Critical 海信视像科技股份有限公司
Publication of WO2020119213A1 publication Critical patent/WO2020119213A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for loading

Definitions

  • the invention relates to computer technology, in particular to a method for generating and loading image files.
  • smart devices based on Linux technology usually prestore the recovered data in double-rate synchronous dynamic random access memory (Double Data Rate).
  • the smart device will adopt the standby to memory (Suspend To Ram, STR) technology, that is, to retain the power supply of DDR during standby, make it enter the self-refresh mode, and save the recovered data in DDR. , Read the recovery data directly from DDR to recover to the state before standby and continue to run.
  • Standby to memory Suspend To Ram, STR
  • the standby to hard disk (Suspend To Dis, STD) technology is usually used, which describes the system operating status before standby, makes a corresponding image file, and saves it to non-volatile memory.
  • STD Standby to hard disk
  • EMMC Embedded Multimedia Card
  • the Linux kernel when creating an image file, the Linux kernel will only create the corresponding image file for the original data stored in the system memory, and ignore the original data stored in the non-system memory.
  • the non-system memory The original data saved in may also record the key data of the boot operation, such as the image frame buffer (framebuffer) data, therefore, it will cause the TV to display abnormally after booting.
  • an embodiment of the present invention provides a method for generating an image file, including:
  • Compress the saved original data of each non-system memory and the corresponding physical address and save the saved original data of each system memory and the corresponding physical address, and generate a corresponding image file.
  • an embodiment of the present application provides a method for loading an image file, including:
  • the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address
  • the kernel virtual address of the non-system memory physical memory page read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
  • an embodiment of the present application provides an intelligent device, including a processor and a memory;
  • the memory is used to store computer programs
  • the processor executes the computer program to execute:
  • Compress the saved original data of each non-system memory and the corresponding physical address and save the saved original data of each system memory and the corresponding physical address, and generate a corresponding image file.
  • an embodiment of the present application provides an intelligent device, including a processor and a memory, where:
  • the memory is used to store computer programs
  • the processor is configured to execute the computer program to execute:
  • the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address
  • the kernel virtual address of the non-system memory physical memory page read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
  • an embodiment of the present application provides a storage medium that stores a program for implementing a method of generating an image file.
  • the program is executed by a processor, the following steps are performed:
  • an embodiment of the present application provides a storage medium that stores a program for implementing a method of loading an image file.
  • the program is executed by a processor, the following steps are performed:
  • the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address
  • the kernel virtual address of the non-system memory physical memory page read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
  • Figure 1 is a schematic diagram of the system memory architecture in physical memory under the prior art
  • FIG. 2 is a schematic diagram of a functional structure of a smart device in an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a process of generating a mirror file by a smart device in an embodiment of the present invention
  • FIG. 4 is a schematic diagram of physical memory allocation in an embodiment of the present invention.
  • FIG. 5 is a schematic diagram comparing the contents of a mirror file in the prior art and the embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a process of loading a mirror file by a smart device in an embodiment of the present invention.
  • the DDR of the smart device is divided into system memory and non-system memory.
  • the system memory is a memory that the Linux kernel has permission to manage, while the non-system memory is memory that the Linux kernel has no right to manage.
  • the system memory is composed of a three-level architecture of a memory node (Node), a memory zone (Zone), and a physical memory page (page).
  • Node memory node
  • Zone memory zone
  • page physical memory page
  • Memory node a method of describing physical memory in a computer system
  • a bus master device costs the same cost to access any memory unit located in the same memory node, and it costs the same to access memory units in any two different nodes The cost is different.
  • the memory area is located in the same memory node. There are mainly direct read memory area (ZONE_DMA), ordinary memory area (ZONE_NORMAL), and high-end memory area (ZONE_HIGHMEM).
  • ZONE_DMA direct read memory area
  • ZONE_NORMAL ordinary memory area
  • ZONE_HIGHMEM high-end memory area
  • Physical memory pages System memory is usually managed in units of "pages". The size of a physical memory page is 4K bytes.
  • STD technology is similar to STR, and it is a method to speed up the startup of smart devices. The difference is that STD technology will save the image file used for recovery to EMMC, so that the image file will not be lost after AC power failure.
  • the smart device collects the system operating state description information before standby.
  • the system operating state description information includes at least: physical memory page usage state, processor operating state, external device operating state, etc.; then, the smart device will Make the obtained system operating state description information into a corresponding image file according to the set format and save it in EMMC; the next time the smart device performs AC boot, it will be read from EMMC in the bootloader stage before the kernel or system startup Image file, and then perform the recovery process to restore to the last standby state.
  • a smart device is configured with 1.5G of physical memory, where the size of ZONE_NORMAL is 295M, and the size of ZONE_HIGHMEM is 634M, that is, the system memory occupies 929M of physical memory, and the remaining 607M of physical memory is used as
  • the non-system memory is reserved for other hardware modules of the main chip for special purposes, for example, 100M of physical memory is reserved for the frame module from the non-system memory for the display module.
  • Non-system memory is not within the scope of the Linux kernel's management authority, so when creating an image file, the smart device will not use data saved in non-system memory. However, during the STD boot process, some processes may need to use data saved in non-system memory. Because it is an AC boot, the initial value of all data in non-system memory before initialization is 0xff. Some of the above processes are abnormal. If some of the above processes are related to the display, it will cause the screen and white screen problems during the STD boot process.
  • the smart device using the Linux kernel selectively saves the specified important non-system memory and system memory during the image file process. Data to generate the corresponding image file.
  • the smart device eg, smart TV
  • the smart device includes at least a processor 20, physical memory 21 (eg, DDR), and memory 22 (eg, EMMC), where the processor 20 , Used to carry the Linux kernel, and perform related operations to generate an image file, the physical memory 21 is used to cache various data generated during the operation of the system, and the memory 22 is used to save the image file.
  • processor 20 Used to carry the Linux kernel, and perform related operations to generate an image file
  • the physical memory 21 is used to cache various data generated during the operation of the system
  • the memory 22 is used to save the image file.
  • the detailed process of the smart device generating the image file is as follows:
  • Step 300 Based on the preset configuration information, the smart device determines whether it is necessary to save the original data of non-system memory? If yes, go to step 301; otherwise, go to step 305.
  • the smart device may directly perform the image file generation process from step 310 without performing a judgment operation.
  • Step 301 Based on the total amount of data that needs to be saved in the non-system memory, the smart device applies for the corresponding non-system memory mirror area in the system memory.
  • the physical memory is set in the form of physical memory pages. Therefore, the smart device needs to first determine the physical memory occupied by the total amount of non-system memory original data that needs to be saved in the non-system memory The total amount of pages, and then, based on the total amount of physical memory pages occupied by the total data amount of the original data of the non-system memory, apply for the total amount of physical memory pages of corresponding size in the system memory, also known as the non-system memory mirror area.
  • the above non-system memory mirror area can be located in ZONE_NORMAL or ZONE_HIGHMEM, depending on the idle state of the system memory at that time, as shown in Figure 4.
  • Step 302 The smart device maps the physical address of a non-system memory physical memory page to the corresponding kernel virtual address.
  • the addresses used in the Linux system are all virtual addresses.
  • the Linux kernel will provide the same size virtual memory address space for each running process, which allows multiple processes to work simultaneously. Run without interfering with each other, the virtual address space range is 0-4G. Therefore, in order to allow the Lunix kernel carried by the processor 20 to access non-system memory, the ioremap function needs to be called to map the physical address of the non-system memory physical memory page to the kernel virtual address space to obtain the corresponding memory virtual address to facilitate the processor 20 to read and write.
  • Step 303 The smart device reads the non-system memory raw data from the one non-system memory physical memory page, and saves the non-system memory raw data and the corresponding physical address based on the kernel virtual address to the Non-system memory mirror area.
  • a non-system memory mirror area is added on the basis of the system memory mirror area.
  • the non-system memory mirror area can be discontinuous in physical address. Specifically, it can be divided into a first area that stores non-system memory original data and a second area that stores non-system memory metadata.
  • metadata also known as intermediary data, relay data, is data describing data (data about data), mainly describing information of data properties (property), used to support, for example, indicating storage location, historical data, resource search, file records And other functions.
  • the metadata is used to record the physical address of the corresponding original data. Therefore, when step 303 is performed, the smart device saves the original data of the non-system memory saved in a physical memory page of the non-system memory to the non-system memory
  • the first area in the mirror area also stored in a system memory physical memory page, which will not be repeated here
  • the corresponding physical address is saved in the form of metadata to the second area in the non-system memory mirror area.
  • mapping relationship between the original data of the non-system memory and the corresponding physical addresses can be saved in the set mirror header area, as shown in Figure 5.
  • the real-time data lossless compression (Lempel-Ziv-Oberhumer, LZO) format is usually used for compression. Therefore, it is necessary to distinguish between non-system memory metadata and system memory metadata Open, and distinguish the non-system memory raw data from the system memory raw data, and the storage location of the non-system memory metadata needs to be placed in front of the non-system memory raw data, that is, between the first area and the mirror head area The distance is greater than the distance between the second area and the mirror head area. Similarly, the storage location of the system memory metadata must be placed in front of the original data in the system memory. In this way, after the mirror file is generated, the mirror file When decompressing, it will not cause data confusion, and will not cause the metadata to be unmatched with the original data, causing boot failure.
  • LZO real-time data lossless compression
  • Step 304 The smart device determines whether all non-system memory physical memory pages have been processed? If yes, go to step 305; otherwise, go to step 302.
  • Step 305 The smart device applies the corresponding system memory mirror area in the system memory based on the total amount of data to be saved in the system memory.
  • Smart devices store the original data in the system memory in the system memory in a similar way to the original data in the non-system memory. The difference is that when reading the original data in the system memory, there is no need to map the physical address to the virtual address of the memory. Because the original storage location of the original data of the system memory is also located in the system memory, and the system memory belongs to the memory area that the Linux kernel has permission to manage, so the smart device can clearly know the memory virtual address of the original storage location of the original data of the system memory.
  • Step 306 The smart device copies the original data of the system memory and the corresponding physical address to be saved in the physical memory pages of each system memory to the system memory mirror area.
  • smart devices also need to use page-by-page processing to separately copy the original data of the system memory saved in the physical memory page of each page of system memory to be processed to the third area in the system memory mirror area, and copy the above system
  • the physical address corresponding to the original memory data is copied to the fourth area in the mirror area of the system memory, and, in an embodiment of the present application, as shown in FIG. 5, the distance between the third area and the mirror head area Is larger than the distance between the fourth area and the mirror head area.
  • Step 307 The smart device saves the specified boot information in the image header area.
  • the smart device saves the mapping relationship between each non-system memory original data in the non-system memory mirror area and the corresponding physical address in the mirror header area; and, saves each system memory original data in the system memory mirror area and the corresponding The mapping relationship between the physical addresses.
  • Step 308 The smart device compresses various types of data stored in the system memory mirror area and the non-system memory mirror area according to the set format, generates a corresponding mirror file, and saves it in the EMMC.
  • the image file has been generated, and the smart device can save the image file in the EMMC.
  • the system recovery can be performed based on the image file.
  • Step 600 Start the AC after the smart device is turned off
  • Step 601 The smart device reads the pre-stored image file from the EMMC, saves it to the DDR and decompresses it.
  • the smart device first decompresses the compressed image file in the system memory, and then reads the metadata therein.
  • the metadata stores the physical address of the original storage location of the non-system memory original data and the system memory original data. .
  • Step 602 The smart device reads the metadata of one physical memory page from the decompressed image file, and determines the physical address of the one physical memory page based on the metadata.
  • Step 603 The intelligent device determines whether the physical address of the one physical memory page belongs to non-system memory? If yes, go to step 604; otherwise, go to step 606.
  • Step 604 The smart device determines that the physical memory page is a non-system memory physical memory page, and maps the physical address of the non-system memory physical memory page to a corresponding kernel virtual address.
  • the smart device needs to use the ioremap function to map the physical address of the physical memory page to the corresponding kernel virtual address.
  • Step 605 The smart device reads the corresponding non-system memory raw data from the decompressed image file according to the kernel virtual address of the non-system memory physical memory page, and according to the physical address of the non-system memory physical memory page, The original data in the non-system memory is saved to a corresponding location in the non-system memory, and then step 607 is executed.
  • the smart device restores the non-system memory original data in the image file to the original storage device in the system memory.
  • Step 606 The smart device determines that the processed memory page is a non-system memory physical memory, and reads the corresponding system memory raw data from the decompressed image file according to the kernel virtual address of the system memory physical memory page, and according to The physical address of the physical memory page of the system memory saves the original data of the system memory to a corresponding location in the system memory.
  • the smart device restores the original data of the system memory in the image file to the original storage device in the system memory.
  • Step 607 The smart device determines whether all physical memory pages in the image file have been processed? If yes, go to step 608; otherwise, go back to step 602.
  • the smart device will restore the non-system memory original data or system memory original data corresponding to each physical memory page page by page from the image file in a certain order, until all data is restored.
  • Step 607 The smart device determines that the image file is loaded and restores the system to the image file indication state.
  • the smart device can restore the system to the state indicated by the last image file saved.
  • a smart device eg, a smart TV
  • a smart device includes at least a processor 20, a physical memory 21, and a memory 22.
  • the physical memory 21 is divided into non-system memory and system memory. among them,
  • the processor 20 is used to apply for a corresponding non-system memory mirror area in the system memory based on the total amount of data that needs to be saved in the non-system memory;
  • Virtual address save the original data of the non-system memory and the corresponding physical address to the mirror area of the non-system memory;
  • Compress the saved original data of each non-system memory and the corresponding physical address and save the saved original data of each system memory and the corresponding physical address, and generate a corresponding image file.
  • the processor 20 is further used to:
  • the preset configuration information it is determined that the data saved in the non-system memory needs to be used to generate the image file.
  • the processor 20 when the original data of the non-system memory and the corresponding physical address are stored in the non-system memory mirror area, the processor 20 is used to:
  • the distance between the first area and the mirror head area set in the mirror area of the system memory is greater than the distance between the second area and the mirror head area.
  • the processor 20 is used to pre-compress the saved original data of each non-system memory and the corresponding physical address, and the saved original data of each system memory and the corresponding physical address in a preset format Further use:
  • mapping relationship between the original data of each non-system memory and the corresponding physical address in the non-system memory mirror area is stored in the set mirror header area;
  • mapping relationship between the original data of each system memory and the corresponding physical address in the system memory mirror area is stored in the mirror head area.
  • the processor 20 is further used to:
  • the processor 20 is used to,
  • the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address
  • the kernel virtual address of the non-system memory physical memory page read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
  • the processor 20 is further used to:
  • the corresponding system memory is read from the decompressed image file according to the kernel virtual address of the system memory physical memory page Raw data;
  • the original data of the system memory is saved to a corresponding location in the system memory.
  • a storage medium which stores a program for implementing a method of generating an image file.
  • the program is executed by the processor 20, the following steps are performed:
  • a storage medium stores a program for implementing a method for loading an image file, and when the program is executed by the processor 20, the following steps are performed:
  • the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address
  • the kernel virtual address of the non-system memory physical memory page read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
  • the smart device maps the non-system memory raw data to the kernel virtual space for processing and storage according to the physical address, and compresses the system memory raw data to generate the corresponding image file, so that it can In the image file, comprehensively record all important data required for system recovery, thereby ensuring the integrity of the image file, and thereby avoiding the problem of flower screen and white screen due to the loss of important data when the smart device performs system recovery based on the image file. Ensure the smooth and quick boot of the smart device.
  • the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
  • computer usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • each flow and/or block in the flowchart and/or block diagram and a combination of the flow and/or block in the flowchart and/or block diagram may be implemented by computer program instructions.
  • These computer program instructions can be provided to the processor of a general-purpose computer, special-purpose computer, embedded processing machine, or other programmable data processing device to produce a machine that enables the generation of instructions executed by the processor of the computer or other programmable data processing device
  • These computer program instructions may also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, the instructions
  • the device implements the functions specified in one block or multiple blocks of the flowchart one flow or multiple flows and/or block diagrams.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operating steps are performed on the computer or other programmable device to produce computer-implemented processing, which is executed on the computer or other programmable device
  • the instructions provide steps for implementing the functions specified in one block or multiple blocks of the flowchart one flow or multiple flows and/or block diagrams.

Abstract

Methods for generating and loading a mirror file, and a device. The method comprises: an intelligent device processing and storing original data in a non-system memory by mapping the same to a kernel virtual space according a physical address; and compressing said original data, and original data in a system memory, to generate a corresponding mirror file. The method enables all important data required for system recovery to be thoroughly stored in a mirror file, thereby ensuring integrity of the mirror file. Accordingly, when an intelligent device performs system recovery on the basis of the mirror file, problems such as screen color distortion or blank screen resulting from loss of important data can be avoided, thereby ensuring smooth and quick startup of the intelligent device.

Description

一种镜像文件的生成及加载方法、设备Method and device for generating and loading image file
相关申请的交叉引用Cross-reference of related applications
本申请要求在2018年12月11日提交中国专利局、申请号为201811510641.6申请名称为″一种镜像文件的生成及加载方法、设备″的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application filed on December 11, 2018, with the application number 201811510641.6, which is entitled "A method and device for generating and loading image files", the entire content of which is incorporated by reference in In this application.
技术领域Technical field
本发明涉及计算机技术,特别涉及一种镜像文件的生成及加载方法。The invention relates to computer technology, in particular to a method for generating and loading image files.
背景技术Background technique
目前,基于Linux技术的智能设备(如,智能电视)为了加快开机或亮屏速度,提升用户体验,通常会在双倍速率同步动态随机存储器(Double Data Rate,DDR)中预存恢复数据。At present, in order to speed up the booting or bright screen speed and improve the user experience, smart devices based on Linux technology (such as smart TVs) usually prestore the recovered data in double-rate synchronous dynamic random access memory (Double Data Rate).
在直流开关机过程中,智能设备会采用待机到内存(Suspend To Ram,STR)技术,即在待机时保留DDR的供电,使其进入自刷新模式,并将恢复数据保存在DDR中,开机后,直接从DDR中读取恢复数据从而恢复至待机前的状态,继续运行。In the process of DC switching on and off, the smart device will adopt the standby to memory (Suspend To Ram, STR) technology, that is, to retain the power supply of DDR during standby, make it enter the self-refresh mode, and save the recovered data in DDR. , Read the recovery data directly from DDR to recover to the state before standby and continue to run.
而在交流开关机过程中,加快开机速度,通常采用待机到硬盘(Suspend To  Dis,STD)技术,即将待机前的系统运行状态描述,制作成相应的镜像文件,保存到非易失性存储器,如,嵌入式多媒体存储卡(Embedded Multi Media Card,EMMC)中,开机后,从EMMC中读取镜像文件,然后解压、跳转、运行。In the process of AC switching on and off, to speed up the booting, the standby to hard disk (Suspend To Dis, STD) technology is usually used, which describes the system operating status before standby, makes a corresponding image file, and saves it to non-volatile memory. For example, in an Embedded Multimedia Card (EMMC), after booting, read the image file from EMMC, and then decompress, jump, and run.
然而,已有技术下,在制作镜像文件时,Linux内核只会针对系统内存中保存的原始数据制作相应的镜像文件,而无视非系统内存中保存的原始数据,而实际应用中,非系统内存中保存的原始数据也有可能记录有开机运行的关键数据,如,图像的帧缓存(framebuffer)数据,因此,就会导致开机后电视显示异常。However, under the existing technology, when creating an image file, the Linux kernel will only create the corresponding image file for the original data stored in the system memory, and ignore the original data stored in the non-system memory. In actual applications, the non-system memory The original data saved in may also record the key data of the boot operation, such as the image frame buffer (framebuffer) data, therefore, it will cause the TV to display abnormally after booting.
发明内容Summary of the invention
一方面,本发明实施例提供一种镜像文件的生成方法,包括:On the one hand, an embodiment of the present invention provides a method for generating an image file, including:
基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区;Based on the total amount of data to be saved in non-system memory, apply for the corresponding non-system memory mirror area in system memory;
针对待处理的各个非系统内存物理内存页,分别执行以下操作:For each non-system physical memory page to be processed, perform the following operations:
将非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;Map the physical address of the non-system memory physical memory page to the corresponding kernel virtual address;
从所述非系统内存物理内存页中读取非系统内存原始数据,并基于所述内核虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区;Reading non-system memory raw data from the non-system memory physical memory page, and saving the non-system memory raw data and the corresponding physical address based on the kernel virtual address to the non-system memory mirror area;
在系统内存中申请相应的系统内存镜像区,并将需要保存的系统内存原始数据及相应的物理地址保存至所述系统内存镜像区;Apply for the corresponding system memory mirror area in the system memory, and save the original data of the system memory and the corresponding physical address to be saved in the system memory mirror area;
对保存的各个非系统内存原始数据及相应的物理地址,和保存的各个系统内存原始数据及相应的物理地址进行压缩,生成相应的镜像文件。Compress the saved original data of each non-system memory and the corresponding physical address, and save the saved original data of each system memory and the corresponding physical address, and generate a corresponding image file.
另一方面,本申请实施例提供一种镜像文件的加载方法,包括:On the other hand, an embodiment of the present application provides a method for loading an image file, including:
在交流开机后,获取预存的镜像文件,在系统内存中进行解压,After the AC is turned on, obtain the pre-stored image file and decompress it in the system memory.
针对解压后的镜像文件中记录的各个物理内存页,分别执行以下操作:For each physical memory page recorded in the decompressed image file, perform the following operations:
根据解压后的镜像文件中记录的元数据,确定物理内存页的物理地址;According to the metadata recorded in the decompressed image file, determine the physical address of the physical memory page;
根据所述物理内存页的物理地址,确定所述物理内存页为非系统内存物理内存页时,将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;When it is determined that the physical memory page is a non-system memory physical memory page according to the physical address of the physical memory page, the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address;
按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应位置。According to the kernel virtual address of the non-system memory physical memory page, read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
另一方面,本申请实施例提供一种智能设备,包括处理器、和存储器;On the other hand, an embodiment of the present application provides an intelligent device, including a processor and a memory;
所述存储器,用于存储计算机程序;The memory is used to store computer programs;
所述处理器,执行所述计算机程序以执行:The processor executes the computer program to execute:
基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区;Based on the total amount of data to be saved in non-system memory, apply for the corresponding non-system memory mirror area in system memory;
针对待处理的各个非系统内存物理内存页,分别执行以下操作:For each non-system physical memory page to be processed, perform the following operations:
将非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;Map the physical address of the non-system memory physical memory page to the corresponding kernel virtual address;
从所述非系统内存物理内存页中读取非系统内存原始数据,并基于所述内 核虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区;Reading non-system memory raw data from the non-system memory physical memory page, and saving the non-system memory raw data and the corresponding physical address based on the inner core virtual address to the non-system memory mirror area;
在系统内存中申请相应的系统内存镜像区,并将需要保存的系统内存原始数据及相应的物理地址保存至所述系统内存镜像区;Apply for the corresponding system memory mirror area in the system memory, and save the original data of the system memory and the corresponding physical address to be saved in the system memory mirror area;
对保存的各个非系统内存原始数据及相应的物理地址,和保存的各个系统内存原始数据及相应的物理地址进行压缩,生成相应的镜像文件。Compress the saved original data of each non-system memory and the corresponding physical address, and save the saved original data of each system memory and the corresponding physical address, and generate a corresponding image file.
另一方面,本申请实施例提供一种智能设备,包括处理器和存储器,其中:On the other hand, an embodiment of the present application provides an intelligent device, including a processor and a memory, where:
所述存储器,用于存储计算机程序;The memory is used to store computer programs;
所述处理器,用于执行所述计算机程序以执行:The processor is configured to execute the computer program to execute:
在进行交流开机之后,获取预存的镜像文件,在系统内存中进行解压;After the AC boot, obtain the pre-stored image file and decompress it in the system memory;
针对解压后的镜像文件中记录的各个物理内存页,分别执行以下操作:For each physical memory page recorded in the decompressed image file, perform the following operations:
根据解压后的镜像文件中记录的元数据,确定物理内存页的物理地址;According to the metadata recorded in the decompressed image file, determine the physical address of the physical memory page;
根据所述物理内存页的物理地址,确定所述物理内存页为非系统内存物理内存页时,将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;When it is determined that the physical memory page is a non-system memory physical memory page according to the physical address of the physical memory page, the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address;
按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应位置。According to the kernel virtual address of the non-system memory physical memory page, read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
另一方面,本申请实施例提供一种存储介质,存储有用于实现镜像文件的生成方法的程序,所述程序被处理器运行时,执行以下步骤:On the other hand, an embodiment of the present application provides a storage medium that stores a program for implementing a method of generating an image file. When the program is executed by a processor, the following steps are performed:
基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区;Based on the total amount of data to be saved in non-system memory, apply for the corresponding non-system memory mirror area in system memory;
针对待处理的各个非系统内存物理内存页,分别执行以下操作:For each non-system physical memory page to be processed, perform the following operations:
将非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;Map the physical address of the non-system memory physical memory page to the corresponding kernel virtual address;
从所述非系统内存物理内存页中读取非系统内存原始数据,并基于所述内核虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区;Reading non-system memory raw data from the non-system memory physical memory page, and saving the non-system memory raw data and the corresponding physical address based on the kernel virtual address to the non-system memory mirror area;
在系统内存中申请相应的系统内存镜像区,并将需要保存的系统内存原始数据及相应的物理地址保存至所述系统内存镜像区;Apply for the corresponding system memory mirror area in the system memory, and save the original data of the system memory and the corresponding physical address to be saved in the system memory mirror area;
对保存的各个非系统内存原始数据及相应的物理地址,和各个系统内存原始数据及相应的物理地址进行压缩,生成相应的镜像文件。Compress the original data and corresponding physical addresses of each non-system memory and the original data and corresponding physical addresses of each system memory to generate corresponding mirror files.
另一方面,本申请实施例提供一种存储介质,存储有用于实现镜像文件的加载方法的程序,所述程序被处理器运行时,执行以下步骤:On the other hand, an embodiment of the present application provides a storage medium that stores a program for implementing a method of loading an image file. When the program is executed by a processor, the following steps are performed:
在交流开机之后,获取预存的镜像文件,在系统内存中进行解压;After the AC is turned on, obtain the pre-stored image file and decompress it in the system memory;
针对解压后的镜像文件中记录的各个物理内存页,执行以下操作:For each physical memory page recorded in the decompressed image file, perform the following operations:
根据解压后的镜像文件中记录的元数据,确定物理内存页的物理地址;According to the metadata recorded in the decompressed image file, determine the physical address of the physical memory page;
根据所述物理内存页的物理地址,确定所述物理内存页为非系统内存物理内存页时,将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;When it is determined that the physical memory page is a non-system memory physical memory page according to the physical address of the physical memory page, the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address;
按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中 读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应位置。According to the kernel virtual address of the non-system memory physical memory page, read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
附图说明BRIEF DESCRIPTION
图1为已有技术下物理内存中系统内存架构示意图;Figure 1 is a schematic diagram of the system memory architecture in physical memory under the prior art;
图2为本发明实施例中智能设备功能结构示意图;2 is a schematic diagram of a functional structure of a smart device in an embodiment of the present invention;
图3为本发明实施例中智能设备生成镜像文件流程示意图;3 is a schematic diagram of a process of generating a mirror file by a smart device in an embodiment of the present invention;
图4为本发明实施例中物理内存分配示意图;4 is a schematic diagram of physical memory allocation in an embodiment of the present invention;
图5为已有技术下和本发明实施例中镜像文件内容对比示意图;FIG. 5 is a schematic diagram comparing the contents of a mirror file in the prior art and the embodiment of the present invention;
图6为本发明实施例中智能设备加载镜像文件流程示意图。6 is a schematic diagram of a process of loading a mirror file by a smart device in an embodiment of the present invention.
具体实施方式detailed description
相关技术,基于Linux技术的智能设备在DDR管理层面采用了与具体体系架构不相关的设计模型,实现了良好的可伸缩性。具体的,智能设备的DDR被划分为系统内存和非系统内存,系统内存为Linux内核有权限管理的内存,而非系统内存为Linux内核无权管理的内存。Related technologies, smart devices based on Linux technology adopt a design model that is not related to the specific architecture at the DDR management level, and achieves good scalability. Specifically, the DDR of the smart device is divided into system memory and non-system memory. The system memory is a memory that the Linux kernel has permission to manage, while the non-system memory is memory that the Linux kernel has no right to manage.
参阅图1所示,系统内存又是由内存节点(Node),内存区域(Zone)和物理内存页(page)三级架构组成。Referring to FIG. 1, the system memory is composed of a three-level architecture of a memory node (Node), a memory zone (Zone), and a physical memory page (page).
内存节点,计算机系统中对物理内存的一种描述方法,一个总线主设备访问位于同一个内存节点中的任意内存单元所花的代价相同,而访问任意两个不 同节点中的内存单元所花的代价不同。Memory node, a method of describing physical memory in a computer system, a bus master device costs the same cost to access any memory unit located in the same memory node, and it costs the same to access memory units in any two different nodes The cost is different.
内存区域,位于同一个内存节点之内,主要有直接读取内存区域(ZONE_DMA)、普通内存区域(ZONE_NORMAL)、高端内存区域(ZONE_HIGHMEM)几种。The memory area is located in the same memory node. There are mainly direct read memory area (ZONE_DMA), ordinary memory area (ZONE_NORMAL), and high-end memory area (ZONE_HIGHMEM).
物理内存页,系统内存通常是以″页″为单位管理进行内存管理的,一个物理内存页的大小为4K Byte。Physical memory pages. System memory is usually managed in units of "pages". The size of a physical memory page is 4K bytes.
STD技术与STR类似,都是加快智能设备启动的方法,不同的是STD技术会将用于恢复的镜像文件保存至EMMC中,这样,可以保证交流断电后镜像文件不丢失。STD technology is similar to STR, and it is a method to speed up the startup of smart devices. The difference is that STD technology will save the image file used for recovery to EMMC, so that the image file will not be lost after AC power failure.
具体的,智能设备会采集待机前的系统运行状态描述信息,所述系统运行状态描述信息至少包括:物理内存页使用状态、处理器运行状态、外部设备的运行状态等等;然后,智能设备会将获得的系统运行状态描述信息按照设定格式制作成相应的镜像文件保存在EMMC中;下次智能设备进行交流开机时,会在内核或系统启动之前的启动加载(bootloader)阶段从EMMC读取镜像文件,然后执行恢复流程,恢复到上次待机的状态。Specifically, the smart device collects the system operating state description information before standby. The system operating state description information includes at least: physical memory page usage state, processor operating state, external device operating state, etc.; then, the smart device will Make the obtained system operating state description information into a corresponding image file according to the set format and save it in EMMC; the next time the smart device performs AC boot, it will be read from EMMC in the bootloader stage before the kernel or system startup Image file, and then perform the recovery process to restore to the last standby state.
示例性的,假设某一智能设备配置有物理内存1.5G Byte,其中ZONE_NORMAL的大小为295M,ZONE_HIGHMEM的大小为634M,即系统内存共占用929M的物理内存,而剩下的607M的物理内存被作为非系统内存预留给主芯片的其它硬件模块使用,用作特殊用途,如,从非系统内存中为显示模块预留100M的物理内存用于framebuffer。Exemplarily, suppose a smart device is configured with 1.5G of physical memory, where the size of ZONE_NORMAL is 295M, and the size of ZONE_HIGHMEM is 634M, that is, the system memory occupies 929M of physical memory, and the remaining 607M of physical memory is used as The non-system memory is reserved for other hardware modules of the main chip for special purposes, for example, 100M of physical memory is reserved for the frame module from the non-system memory for the display module.
非系统内存不在Linux内核的管理权限范围内,因此在制作镜像文件时,智 能设备不会使用非系统内存中保存的数据。然而,在STD开机过程中,某些进程可能需要使用到非系统内存中保存的数据,由于是交流开机,因此,在初始化前非系统内存中所有数据的初始值均为0xff此时,会导致上述某些进程异常,如果上述某些进程是与显示相关的进程,就会导致STD开机过程中出现花屏、白屏问题。Non-system memory is not within the scope of the Linux kernel's management authority, so when creating an image file, the smart device will not use data saved in non-system memory. However, during the STD boot process, some processes may need to use data saved in non-system memory. Because it is an AC boot, the initial value of all data in non-system memory before initialization is 0xff. Some of the above processes are abnormal. If some of the above processes are related to the display, it will cause the screen and white screen problems during the STD boot process.
为了保证镜像文件的完整性,以确保智能设备顺利快速开机,本发明实话例中,使用Linux内核的智能设备在镜像文件的过程中,有选择地保存非系统内存和系统内存中的指定的重要数据,从而生成相应的镜像文件。In order to ensure the integrity of the image file and ensure that the smart device starts up smoothly and quickly, in the actual example of the present invention, the smart device using the Linux kernel selectively saves the specified important non-system memory and system memory during the image file process. Data to generate the corresponding image file.
下面结合附图对本发明实施方式作进一步详细说明。The embodiments of the present invention will be further described in detail below with reference to the drawings.
参阅图2所示,本发明实施例中,智能设备(如,智能电视)中至少包含有处理器20、物理内存21(如,DDR)和存储器22(如,EMMC),其中,处理器20,用于承载Linux内核,并执行相关操作生成镜像文件,物理内存21用于缓存系统运行过程中产生的各类数据,存储器22用于保存镜像文件。Referring to FIG. 2, in the embodiment of the present invention, the smart device (eg, smart TV) includes at least a processor 20, physical memory 21 (eg, DDR), and memory 22 (eg, EMMC), where the processor 20 , Used to carry the Linux kernel, and perform related operations to generate an image file, the physical memory 21 is used to cache various data generated during the operation of the system, and the memory 22 is used to save the image file.
基于上述智能设备,参阅图3所示,本发明实施例中,智能设备生成镜像文件的详细流程如下:Based on the above smart device, referring to FIG. 3, in the embodiment of the present invention, the detailed process of the smart device generating the image file is as follows:
步骤300:智能设备根据预设的配置信息,判断是否需要保存非系统内存原始数据?若是,则执行步骤301;否则,执行步骤305。Step 300: Based on the preset configuration information, the smart device determines whether it is necessary to save the original data of non-system memory? If yes, go to step 301; otherwise, go to step 305.
当然,如何智能设备的默认配置是需要保存非系统内存原始数据,则智能设备也可以不用执行判断操作,而是直接从步骤310开始执行镜像文件的生成流程。Of course, if the default configuration of the smart device is to save the non-system memory original data, the smart device may directly perform the image file generation process from step 310 without performing a judgment operation.
步骤301:智能设备基于非系统内存中需要保存的数据总量,在系统内存中 申请相应的非系统内存镜像区。Step 301: Based on the total amount of data that needs to be saved in the non-system memory, the smart device applies for the corresponding non-system memory mirror area in the system memory.
具体的,由于在DDR中,物理内存均是以物理内存页的形式设置的,因此,智能设备需要先确定,非系统内存中需要保存的非系统内存原始数据的总数据量所占用的物理内存页总量,然后,基于上述非系统内存原始数据的总数据量所占用的物理内存页总量,在系统内存中申请相应大小的物理内存页总量,也称为非系统内存镜像区。Specifically, in DDR, the physical memory is set in the form of physical memory pages. Therefore, the smart device needs to first determine the physical memory occupied by the total amount of non-system memory original data that needs to be saved in the non-system memory The total amount of pages, and then, based on the total amount of physical memory pages occupied by the total data amount of the original data of the non-system memory, apply for the total amount of physical memory pages of corresponding size in the system memory, also known as the non-system memory mirror area.
上述非系统内存镜像区,可以位于ZONE_NORMAL中,也可以位于ZONE_HIGHMEM中,这取决于当时系统内存的空闲情况,具体如图4所示。The above non-system memory mirror area can be located in ZONE_NORMAL or ZONE_HIGHMEM, depending on the idle state of the system memory at that time, as shown in Figure 4.
步骤302:智能设备将一个非系统内存物理内存页的物理地址映射为相应的内核虚拟地址。Step 302: The smart device maps the physical address of a non-system memory physical memory page to the corresponding kernel virtual address.
实际应用中,Linux系统运行过程中,使用的地址都是虚拟地址,以32位系统为例,Linux内核会为每个运行的进程提供大小相同的内存虚拟地址空间,这使得多个进程可以同时运行而又不会互相干扰,虚拟地址的空间范围为0-4G。因此,为了让处理器20承载的Lunix内核能够访问到非系统内存,需要调用ioremap函数将非系统内存物理内存页的物理地址映射到内核虚拟地址空间,获得相应的内存虚拟地址,以便于处理器20进行读写。In actual applications, the addresses used in the Linux system are all virtual addresses. Taking the 32-bit system as an example, the Linux kernel will provide the same size virtual memory address space for each running process, which allows multiple processes to work simultaneously. Run without interfering with each other, the virtual address space range is 0-4G. Therefore, in order to allow the Lunix kernel carried by the processor 20 to access non-system memory, the ioremap function needs to be called to map the physical address of the non-system memory physical memory page to the kernel virtual address space to obtain the corresponding memory virtual address to facilitate the processor 20 to read and write.
步骤303:智能设备从所述一个非系统内存物理内存页中读取非系统内存原始数据,并基于所述内核虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区。Step 303: The smart device reads the non-system memory raw data from the one non-system memory physical memory page, and saves the non-system memory raw data and the corresponding physical address based on the kernel virtual address to the Non-system memory mirror area.
具体的,参阅图5所示,本申请实施例,在系统内存镜像区的基础上,增添了非系统内存镜像区。非系统内存镜像区在物理地址上可以是不连续的,具体的,可以分为存储非系统内存原始数据的第一区域,和存储非系统内存元数 据的第二区域,其中,元数据(Metadata),又称中介数据、中继数据,为描述数据的数据(data about data),主要是描述数据属性(property)的信息,用来支持如,指示存储位置、历史数据、资源查找、文件记录等功能。Specifically, referring to FIG. 5, in the embodiment of the present application, a non-system memory mirror area is added on the basis of the system memory mirror area. The non-system memory mirror area can be discontinuous in physical address. Specifically, it can be divided into a first area that stores non-system memory original data and a second area that stores non-system memory metadata. Among them, metadata (Metadata) ), also known as intermediary data, relay data, is data describing data (data about data), mainly describing information of data properties (property), used to support, for example, indicating storage location, historical data, resource search, file records And other functions.
本申请实施例中,元数据用于记录相应的原始数据的物理地址,因此,在执行步骤303时,智能设备将一个非系统内存物理内存页中保存的非系统内存原始数据保存至非系统内存镜像区中的第一区域(也是保存在一个系统内存物理内存页中,在此不再赘述),以及将相应的物理地址以元数据的形式保存至非系统内存镜像区中的第二区域。In the embodiment of the present application, the metadata is used to record the physical address of the corresponding original data. Therefore, when step 303 is performed, the smart device saves the original data of the non-system memory saved in a physical memory page of the non-system memory to the non-system memory The first area in the mirror area (also stored in a system memory physical memory page, which will not be repeated here), and the corresponding physical address is saved in the form of metadata to the second area in the non-system memory mirror area.
非系统内存原始数据和相应的物理地址之间的映射关系,可以保存在设定的镜像头区域中,具体如图5所示。The mapping relationship between the original data of the non-system memory and the corresponding physical addresses can be saved in the set mirror header area, as shown in Figure 5.
在本申请的一种实施方式中,由于生成镜像文件时,通常采用实时数据无损压缩(Lempel-Ziv-Oberhumer,LZO)格式进行压缩,因此,需要将非系统内存元数据和系统内存元数据区分开,以及将非系统内存原始数据和系统内存原始数据区分开,并且,需要将非系统内存元数据的存储位置放置在非系统内存原始数据的前面,即令上述第一区域与镜像头区域之间的距离,大于上述第二区域与镜像头区域之间的距离,同理,也需要将系统内存元数据的存储位置放置在系统内存原始数据的前面,这样,生成镜像文件后,在进行镜像文件解压时,才不会引起数据混乱,不会导致元数据与原始数据无法匹配,造成开机启动失败。In an embodiment of the present application, since the image file is generated, the real-time data lossless compression (Lempel-Ziv-Oberhumer, LZO) format is usually used for compression. Therefore, it is necessary to distinguish between non-system memory metadata and system memory metadata Open, and distinguish the non-system memory raw data from the system memory raw data, and the storage location of the non-system memory metadata needs to be placed in front of the non-system memory raw data, that is, between the first area and the mirror head area The distance is greater than the distance between the second area and the mirror head area. Similarly, the storage location of the system memory metadata must be placed in front of the original data in the system memory. In this way, after the mirror file is generated, the mirror file When decompressing, it will not cause data confusion, and will not cause the metadata to be unmatched with the original data, causing boot failure.
步骤304:智能设备判断是否所有的非系统内存物理内存页处理完毕?若是,则执行步骤305;否则,执行步骤302。Step 304: The smart device determines whether all non-system memory physical memory pages have been processed? If yes, go to step 305; otherwise, go to step 302.
步骤305:智能设备基于系统内存中需要保存的数据总量,在系统内存中申 请相应的系统内存镜像区。Step 305: The smart device applies the corresponding system memory mirror area in the system memory based on the total amount of data to be saved in the system memory.
智能设备,在系统内存中保存系统内存原始数据的方式,与保存非系统内存原始数据的方式相类似,其区别在于,读取系统内存原始数据时,无需进行物理地址到内存虚拟地址的映射,因为,系统内存原始数据的原始存储位置也位于系统内存中,而系统内存属于Linux内核有权限管理的内存区域,因此,智能设备可以明确知道系统内存原始数据的原始存储位置的内存虚拟地址。Smart devices store the original data in the system memory in the system memory in a similar way to the original data in the non-system memory. The difference is that when reading the original data in the system memory, there is no need to map the physical address to the virtual address of the memory. Because the original storage location of the original data of the system memory is also located in the system memory, and the system memory belongs to the memory area that the Linux kernel has permission to manage, so the smart device can clearly know the memory virtual address of the original storage location of the original data of the system memory.
步骤306:智能设备将各个系统内存物理内存页中需要保存的系统内存原始数据及相应的物理地址,复制至所述系统内存镜像区。Step 306: The smart device copies the original data of the system memory and the corresponding physical address to be saved in the physical memory pages of each system memory to the system memory mirror area.
同理,智能设备也需要采用按页处理的方式,分别将待处理的每一页系统内存物理内存页中保存的系统内存原始数据复制到系统内存镜像区中的第三区域,以及将上述系统内存原始数据对应的物理地址复制到系统内存镜像区中的第四区域,以及,在本申请的一种实施方式中,如图5所示,令上述第三区域与镜像头区域之间的距离,大于上述第四区域与镜像头区域之间的距离。Similarly, smart devices also need to use page-by-page processing to separately copy the original data of the system memory saved in the physical memory page of each page of system memory to be processed to the third area in the system memory mirror area, and copy the above system The physical address corresponding to the original memory data is copied to the fourth area in the mirror area of the system memory, and, in an embodiment of the present application, as shown in FIG. 5, the distance between the third area and the mirror head area Is larger than the distance between the fourth area and the mirror head area.
步骤307:智能设备在镜像头区域中保存指定的引导信息。Step 307: The smart device saves the specified boot information in the image header area.
具体的,智能设备会在镜像头区域中保存非系统内存镜像区中各个非系统内存原始数据及相应的物理地址之间的映射关系;以及,保存系统内存镜像区中各个系统内存原始数据及相应的物理地址之间的映射关系。Specifically, the smart device saves the mapping relationship between each non-system memory original data in the non-system memory mirror area and the corresponding physical address in the mirror header area; and, saves each system memory original data in the system memory mirror area and the corresponding The mapping relationship between the physical addresses.
步骤308:智能设备按照设定格式,对系统内存镜像区和非系统内存镜像区中保存的各类数据进行压缩,生成相应的镜像文件,并保存至EMMC中。Step 308: The smart device compresses various types of data stored in the system memory mirror area and the non-system memory mirror area according to the set format, generates a corresponding mirror file, and saves it in the EMMC.
至此,镜像文件便已生成完毕,智能设备可以将镜像文件保存在EMMC中, 在智能设备关机并重启时,可以基于镜像文件进行系统恢复。At this point, the image file has been generated, and the smart device can save the image file in the EMMC. When the smart device is shut down and restarted, the system recovery can be performed based on the image file.
基于上述实施例,参阅图6所示,本发明实施例中,智能设备加载镜像文件的详细流程如下:Based on the above embodiment, as shown in FIG. 6, in the embodiment of the present invention, the detailed process of loading the mirror file by the smart device is as follows:
步骤600:智能设备关机后进行交流开机Step 600: Start the AC after the smart device is turned off
步骤601:智能设备从EMMC中读取预存的镜像文件,保存至DDR中并进行解压。Step 601: The smart device reads the pre-stored image file from the EMMC, saves it to the DDR and decompresses it.
具体的,智能设备首先会在系统内存中将压缩后的镜像文件解压完毕,然后读取其中的元数据,元数据中保存有非系统内存原始数据和系统内存原始数据的原始存储位置的物理地址。Specifically, the smart device first decompresses the compressed image file in the system memory, and then reads the metadata therein. The metadata stores the physical address of the original storage location of the non-system memory original data and the system memory original data. .
步骤602:智能设备从解压后的镜像文件中读取一个物理内存页的元数据,基于所述元数据确定所述一个物理内存页的物理地址。Step 602: The smart device reads the metadata of one physical memory page from the decompressed image file, and determines the physical address of the one physical memory page based on the metadata.
步骤603:智能设备判断所述一个物理内存页的物理地址是否归属于非系统内存?若是,则执行步骤604;否则,执行步骤606。Step 603: The intelligent device determines whether the physical address of the one physical memory page belongs to non-system memory? If yes, go to step 604; otherwise, go to step 606.
步骤604:智能设备确定所述物理内存页为非系统内存物理内存页,并将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地址。Step 604: The smart device determines that the physical memory page is a non-system memory physical memory page, and maps the physical address of the non-system memory physical memory page to a corresponding kernel virtual address.
同理,智能设备需要采用ioremap函数,将所述物理内存页的物理地址映射为相应的内核虚拟地址。Similarly, the smart device needs to use the ioremap function to map the physical address of the physical memory page to the corresponding kernel virtual address.
步骤605:智能设备按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应 位置,接着,执行步骤607。Step 605: The smart device reads the corresponding non-system memory raw data from the decompressed image file according to the kernel virtual address of the non-system memory physical memory page, and according to the physical address of the non-system memory physical memory page, The original data in the non-system memory is saved to a corresponding location in the non-system memory, and then step 607 is executed.
这样,智能设备便在系统内存中将镜像文件中的非系统内存原始数据,恢复至了原始存储装置。In this way, the smart device restores the non-system memory original data in the image file to the original storage device in the system memory.
步骤606:智能设备确定所述处理内存页为非系统内存物理内存,并按照所述系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的系统内存原始数据,以及按照所述系统内存物理内存页的物理地址,将所述系统内存原始数据保存至系统内存中的对应位置。Step 606: The smart device determines that the processed memory page is a non-system memory physical memory, and reads the corresponding system memory raw data from the decompressed image file according to the kernel virtual address of the system memory physical memory page, and according to The physical address of the physical memory page of the system memory saves the original data of the system memory to a corresponding location in the system memory.
这样,智能设备便在系统内存中将镜像文件中的系统内存原始数据,恢复至了原始存储装置。In this way, the smart device restores the original data of the system memory in the image file to the original storage device in the system memory.
步骤607:智能设备判断镜像文件中所有的物理内存页是否处理完毕?若是,执行步骤608;否则,返回步骤602。Step 607: The smart device determines whether all physical memory pages in the image file have been processed? If yes, go to step 608; otherwise, go back to step 602.
智能设备会按照一定的顺序,从镜像文件中逐页恢复每一个物理内存页对应的非系统内存原始数据或系统内存原始数据,直至全部数据恢复完毕。The smart device will restore the non-system memory original data or system memory original data corresponding to each physical memory page page by page from the image file in a certain order, until all data is restored.
步骤607:智能设备确定镜像文件加载完毕,将系统恢复至镜像文件指示状态。Step 607: The smart device determines that the image file is loaded and restores the system to the image file indication state.
至此,镜像文件已加载完毕,智能设备可以将系统恢复至最后一次保存的镜像文件所指示的状态。At this point, the image file has been loaded, and the smart device can restore the system to the state indicated by the last image file saved.
基于上述实施例,参阅图2所示,本发明实施例中,智能设备(如,智能电视)至少包括处理器20、物理内存21和存储器22,物理内存21划分为非系统内存和系统内存,其中,Based on the above embodiment, referring to FIG. 2, in the embodiment of the present invention, a smart device (eg, a smart TV) includes at least a processor 20, a physical memory 21, and a memory 22. The physical memory 21 is divided into non-system memory and system memory. among them,
在一个实施例中,In one embodiment,
处理器20,用于基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区;The processor 20 is used to apply for a corresponding non-system memory mirror area in the system memory based on the total amount of data that needs to be saved in the non-system memory;
针对待处理的各个非系统内存物理内存页,分别执行以下操作:For each non-system physical memory page to be processed, perform the following operations:
将非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;Map the physical address of the non-system memory physical memory page to the corresponding kernel virtual address;
从所述非系统内存物理内存页中读取非系统内存原始数据,并基于所述内核Reading raw data from non-system memory from the non-system memory physical memory page, and based on the kernel
虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区;Virtual address, save the original data of the non-system memory and the corresponding physical address to the mirror area of the non-system memory;
在系统内存中申请相应的系统内存镜像区,并将需要保存的系统内存原始数据及相应的物理地址保存至所述系统内存镜像区;Apply for the corresponding system memory mirror area in the system memory, and save the original data of the system memory and the corresponding physical address to be saved in the system memory mirror area;
对保存的各个非系统内存原始数据及相应的物理地址,和保存的各个系统内存原始数据及相应的物理地址进行压缩,生成相应的镜像文件。Compress the saved original data of each non-system memory and the corresponding physical address, and save the saved original data of each system memory and the corresponding physical address, and generate a corresponding image file.
在本申请的一种实施方式中,基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区之前,处理器20进一步用于:In an embodiment of the present application, based on the total amount of data that needs to be saved in the non-system memory, before applying for the corresponding non-system memory mirror area in the system memory, the processor 20 is further used to:
根据预设的配置信息,确定需要使用非系统内存中保存的数据生成镜像文件。According to the preset configuration information, it is determined that the data saved in the non-system memory needs to be used to generate the image file.
在本申请的一种实施方式中,所述将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区时,处理器20用于:In an implementation manner of the present application, when the original data of the non-system memory and the corresponding physical address are stored in the non-system memory mirror area, the processor 20 is used to:
将所述非系统内存原始数据保存在所述非系统内存镜像区的第一区域;Storing the non-system memory original data in the first area of the non-system memory mirror area;
将所述非系统内存原始数据对应的物理地址,以元数据形式保存在所述非 系统内存镜像区的第二区域;Storing the physical address corresponding to the original data in the non-system memory in the second area of the non-system memory mirror area in the form of metadata;
其中,所述第一区域与系统内存镜像区中设定的镜像头区域之间的距离,大于所述第二区域与所述镜像头区域之间的距离。Wherein, the distance between the first area and the mirror head area set in the mirror area of the system memory is greater than the distance between the second area and the mirror head area.
在本申请的一种实施方式中,采用预设格式,对保存的各个非系统内存原始数据及相应的物理地址,和保存的各个系统内存原始数据及相应的物理地址进行压缩之前,处理器20进一步用于:In one embodiment of the present application, the processor 20 is used to pre-compress the saved original data of each non-system memory and the corresponding physical address, and the saved original data of each system memory and the corresponding physical address in a preset format Further use:
将非系统内存镜像区中各个非系统内存原始数据及相应的物理地址之间的映射关系,保存在设定的镜像头区域中;以及,The mapping relationship between the original data of each non-system memory and the corresponding physical address in the non-system memory mirror area is stored in the set mirror header area; and,
将系统内存镜像区中各个系统内存原始数据及相应的物理地址之间的映射关系,保存在所述镜像头区域中。The mapping relationship between the original data of each system memory and the corresponding physical address in the system memory mirror area is stored in the mirror head area.
在本申请的一种实施方式中,处理器20进一步用于:In an embodiment of the present application, the processor 20 is further used to:
将所述镜像文件保存至存储器的指定位置。Save the image file to a specified location in memory.
在又一个实施例中,In yet another embodiment,
在进行交流开机之后,处理器20用于,After the AC is turned on, the processor 20 is used to,
获取预存的镜像文件,在系统内存中进行解压;Obtain the pre-stored image file and decompress it in the system memory;
针对解压后的镜像文件中记录的各个物理内存页,分别执行以下操作:For each physical memory page recorded in the decompressed image file, perform the following operations:
根据解压后的镜像文件中记录的元数据,确定物理内存页的物理地址;According to the metadata recorded in the decompressed image file, determine the physical address of the physical memory page;
根据所述物理内存页的物理地址,确定所述物理内存页为非系统内存物理内存页时,将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;When it is determined that the physical memory page is a non-system memory physical memory page according to the physical address of the physical memory page, the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address;
按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应位置。According to the kernel virtual address of the non-system memory physical memory page, read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
在本申请的一种实施方式中,处理器20进一步用于:In an embodiment of the present application, the processor 20 is further used to:
根据所述物理内存页的物理地址,确定所述物理内存页为系统内存物理内存页时,按照所述系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的系统内存原始数据;When it is determined that the physical memory page is a system memory physical memory page according to the physical address of the physical memory page, the corresponding system memory is read from the decompressed image file according to the kernel virtual address of the system memory physical memory page Raw data;
按照所述系统内存物理内存页的物理地址,将所述系统内存原始数据保存至系统内存中的对应位置。According to the physical address of the physical memory page of the system memory, the original data of the system memory is saved to a corresponding location in the system memory.
基于同一发明构思,在一个实施例中,提供一种存储介质,存储有用于实现镜像文件的生成方法的程序,所述程序被处理器20运行时,执行以下步骤:Based on the same inventive concept, in one embodiment, a storage medium is provided, which stores a program for implementing a method of generating an image file. When the program is executed by the processor 20, the following steps are performed:
基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区;Based on the total amount of data to be saved in non-system memory, apply for the corresponding non-system memory mirror area in system memory;
针对待处理的各个非系统内存物理内存页,分别执行以下操作:For each non-system physical memory page to be processed, perform the following operations:
将非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;Map the physical address of the non-system memory physical memory page to the corresponding kernel virtual address;
从所述非系统内存物理内存页中读取非系统内存原始数据,并基于所述内核虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区;Reading non-system memory raw data from the non-system memory physical memory page, and saving the non-system memory raw data and the corresponding physical address based on the kernel virtual address to the non-system memory mirror area;
在系统内存中申请相应的系统内存镜像区,并将需要保存的系统内存原始数据及相应的物理地址保存至所述系统内存镜像区;Apply for the corresponding system memory mirror area in the system memory, and save the original data of the system memory and the corresponding physical address to be saved in the system memory mirror area;
对保存的各个非系统内存原始数据及相应的物理地址,和各个系统内存原始数据及相应的物理地址进行压缩,生成相应的镜像文件。Compress the original data and corresponding physical addresses of each non-system memory and the original data and corresponding physical addresses of each system memory to generate corresponding mirror files.
基于同一发明构思,在一个实施例中,提供一种存储介质,存储有用于实现镜像文件的加载方法的程序,所述程序被处理器20运行时,执行以下步骤:Based on the same inventive concept, in one embodiment, a storage medium is provided that stores a program for implementing a method for loading an image file, and when the program is executed by the processor 20, the following steps are performed:
获取预存的镜像文件,在系统内存中进行解压;Obtain the pre-stored image file and decompress it in the system memory;
针对解压后的镜像文件中记录的各个物理内存页,执行以下操作:For each physical memory page recorded in the decompressed image file, perform the following operations:
根据解压后的镜像文件中记录的元数据,确定物理内存页的物理地址;According to the metadata recorded in the decompressed image file, determine the physical address of the physical memory page;
根据所述物理内存页的物理地址,确定所述物理内存页为非系统内存物理内存页时,将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;When it is determined that the physical memory page is a non-system memory physical memory page according to the physical address of the physical memory page, the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address;
按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应位置。According to the kernel virtual address of the non-system memory physical memory page, read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
综上所述,本发明实施例中,智能设备将非系统内存原始数据,按照物理地址映射至内核虚拟空间进行处理及保存,与系统内存原始数据一起压缩生成相应的镜像文件,这样,便能够在镜像文件中,全面记录系统恢复所需要的所有重要数据,从而保证了镜像文件的完整性,进而可以避免智能设备基于镜像文件进行系统恢复时,因重要数据丢失而出现花屏、白屏问题,确保了智能设备的顺利快速开机。In summary, in the embodiment of the present invention, the smart device maps the non-system memory raw data to the kernel virtual space for processing and storage according to the physical address, and compresses the system memory raw data to generate the corresponding image file, so that it can In the image file, comprehensively record all important data required for system recovery, thereby ensuring the integrity of the image file, and thereby avoiding the problem of flower screen and white screen due to the loss of important data when the smart device performs system recovery based on the image file. Ensure the smooth and quick boot of the smart device.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结 合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and/or block in the flowchart and/or block diagram and a combination of the flow and/or block in the flowchart and/or block diagram may be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, special-purpose computer, embedded processing machine, or other programmable data processing device to produce a machine that enables the generation of instructions executed by the processor of the computer or other programmable data processing device An apparatus for realizing the functions specified in one block or multiple blocks of one flow or multiple flows of a flowchart and/or one block or multiple blocks of a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, the instructions The device implements the functions specified in one block or multiple blocks of the flowchart one flow or multiple flows and/or block diagrams.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operating steps are performed on the computer or other programmable device to produce computer-implemented processing, which is executed on the computer or other programmable device The instructions provide steps for implementing the functions specified in one block or multiple blocks of the flowchart one flow or multiple flows and/or block diagrams.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要 求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic inventive concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
显然,本领域的技术人员可以对本发明实施例进行各种改动和变型而不脱离本发明实施例的精神和范围。这样,倘若本发明实施例的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various modifications and variations to the embodiments of the present invention without departing from the spirit and scope of the embodiments of the present invention. In this way, if these modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and equivalent technologies thereof, the present invention is also intended to include these modifications and variations.

Claims (11)

  1. 一种镜像文件的生成方法,其特征在于,包括:A method for generating an image file is characterized by including:
    基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区;Based on the total amount of data to be saved in non-system memory, apply for the corresponding non-system memory mirror area in system memory;
    针对待处理的各个非系统内存物理内存页,分别执行以下操作:For each non-system physical memory page to be processed, perform the following operations:
    将非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;Map the physical address of the non-system memory physical memory page to the corresponding kernel virtual address;
    从所述非系统内存物理内存页中读取非系统内存原始数据,并基于所述内核虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区;Reading non-system memory raw data from the non-system memory physical memory page, and saving the non-system memory raw data and the corresponding physical address based on the kernel virtual address to the non-system memory mirror area;
    在系统内存中申请相应的系统内存镜像区,并将需要保存的系统内存原始数据及相应的物理地址保存至所述系统内存镜像区;Apply for the corresponding system memory mirror area in the system memory, and save the original data of the system memory and the corresponding physical address to be saved in the system memory mirror area;
    对保存的各个非系统内存原始数据及相应的物理地址,和保存的各个系统内存原始数据及相应的物理地址进行压缩,生成相应的镜像文件。Compress the saved original data of each non-system memory and the corresponding physical address, and save the saved original data of each system memory and the corresponding physical address, and generate a corresponding image file.
  2. 如权利要求1所述的方法,其特征在于,基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区之前,进一步包括:The method according to claim 1, characterized in that before applying for the corresponding non-system memory mirrored area in the system memory based on the total amount of data to be saved in the non-system memory, the method further comprises:
    根据预设的配置信息,确定需要使用非系统内存中保存的数据生成镜像文件。According to the preset configuration information, it is determined that the data saved in the non-system memory needs to be used to generate the image file.
  3. 如权利要求1所述的方法,其特征在于,所述将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区,包括:The method according to claim 1, wherein the storing the original data of the non-system memory and the corresponding physical address in the non-system memory mirror area includes:
    将所述非系统内存原始数据保存在所述非系统内存镜像区的第一区域;Storing the non-system memory original data in the first area of the non-system memory mirror area;
    将所述非系统内存原始数据对应的物理地址,以元数据形式保存在所述非系统内存镜像区的第二区域;Storing the physical address corresponding to the original data in the non-system memory in the second area of the non-system memory mirror area in the form of metadata;
    其中,所述第一区域与系统内存镜像区中设定的镜像头区域之间的距离,大于所述第二区域与所述镜像头区域之间的距离。Wherein, the distance between the first area and the mirror head area set in the mirror area of the system memory is greater than the distance between the second area and the mirror head area.
  4. 如权利要求3所述的方法,其特征在于,采用预设格式,对保存的各个非系统内存原始数据及相应的物理地址,和保存的各个系统内存原始数据及相应的物理地址进行压缩之前,进一步包括:The method according to claim 3, characterized in that before storing the original data and corresponding physical addresses of each non-system memory and the original data and corresponding physical addresses of each saved system memory in a preset format, Further includes:
    将非系统内存镜像区中各个非系统内存原始数据及相应的物理地址之间的映射关系,保存在设定的镜像头区域中;以及,The mapping relationship between the original data of each non-system memory and the corresponding physical address in the non-system memory mirror area is stored in the set mirror header area; and,
    将系统内存镜像区中各个系统内存原始数据及相应的物理地址之间的映射关系,保存在所述镜像头区域中。The mapping relationship between the original data of each system memory and the corresponding physical address in the system memory mirror area is stored in the mirror head area.
  5. 如权利要求1-4任一项所述的方法,其特征在于,进一步包括:The method according to any one of claims 1-4, further comprising:
    将所述镜像文件保存至存储器的指定位置。Save the image file to a specified location in memory.
  6. 一种镜像文件的加载方法,其特征在于,包括:A method for loading an image file is characterized by including:
    在进行交流开机之后,获取预存的镜像文件,在系统内存中进行解压,After the AC boot, obtain the pre-stored image file and decompress it in the system memory
    针对解压后的镜像文件中记录的各个物理内存页,分别执行以下操作:For each physical memory page recorded in the decompressed image file, perform the following operations:
    根据解压后的镜像文件中记录的元数据,确定物理内存页的物理地址;According to the metadata recorded in the decompressed image file, determine the physical address of the physical memory page;
    根据所述物理内存页的物理地址,确定所述物理内存页为非系统内存物理内存页时,将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地 址;According to the physical address of the physical memory page, when it is determined that the physical memory page is a non-system memory physical memory page, the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address;
    按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应位置。According to the kernel virtual address of the non-system memory physical memory page, read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
  7. 如权利要求6所述的方法,其特征在于,进一步包括:The method of claim 6, further comprising:
    根据所述物理内存页的物理地址,确定所述物理内存页为系统内存物理内存页时,按照所述系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的系统内存原始数据;When it is determined that the physical memory page is a system memory physical memory page according to the physical address of the physical memory page, the corresponding system memory is read from the decompressed image file according to the kernel virtual address of the system memory physical memory page Raw data;
    按照所述系统内存物理内存页的物理地址,将所述系统内存原始数据保存至系统内存中的对应位置。According to the physical address of the physical memory page of the system memory, the original data of the system memory is saved to a corresponding location in the system memory.
  8. 一种智能设备,其特征在于,包括处理器和存储器,其中:An intelligent device, characterized by comprising a processor and a memory, wherein:
    所述存储器,用于存储计算机指令;The memory is used to store computer instructions;
    所述处理器,用于执行所述计算机指令以执行:The processor is configured to execute the computer instructions to execute:
    基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区;Based on the total amount of data to be saved in non-system memory, apply for the corresponding non-system memory mirror area in system memory;
    针对待处理的各个非系统内存物理内存页,分别执行以下操作:For each non-system physical memory page to be processed, perform the following operations:
    将非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;Map the physical address of the non-system memory physical memory page to the corresponding kernel virtual address;
    从所述非系统内存物理内存页中读取非系统内存原始数据,并基于所述内核虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区;Reading non-system memory raw data from the non-system memory physical memory page, and saving the non-system memory raw data and the corresponding physical address based on the kernel virtual address to the non-system memory mirror area;
    在系统内存中申请相应的系统内存镜像区,并将需要保存的系统内存原始数据及相应的物理地址保存至所述系统内存镜像区;Apply for the corresponding system memory mirror area in the system memory, and save the original data of the system memory and the corresponding physical address to be saved in the system memory mirror area;
    对保存的各个非系统内存原始数据及相应的物理地址,和保存的各个系统内存原始数据及相应的物理地址进行压缩,生成相应的镜像文件。Compress the saved original data of each non-system memory and the corresponding physical address, and save the saved original data of each system memory and the corresponding physical address, and generate a corresponding image file.
  9. 一种智能设备,其特征在于,至少包括处理器和存储器,其中:An intelligent device characterized by at least including a processor and a memory, wherein:
    所述存储器,用于存储计算机指令;The memory is used to store computer instructions;
    所述处理器,用于执行所述计算机指令以执行:The processor is configured to execute the computer instructions to execute:
    在进行交流开机之后,获取预存的镜像文件,在系统内存中进行解压;After the AC boot, obtain the pre-stored image file and decompress it in the system memory;
    针对解压后的镜像文件中记录的各个物理内存页,分别执行以下操作:For each physical memory page recorded in the decompressed image file, perform the following operations:
    根据解压后的镜像文件中记录的元数据,确定物理内存页的物理地址;According to the metadata recorded in the decompressed image file, determine the physical address of the physical memory page;
    根据所述物理内存页的物理地址,确定所述物理内存页为非系统内存物理内存页时,将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;When it is determined that the physical memory page is a non-system memory physical memory page according to the physical address of the physical memory page, the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address;
    按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应位置。According to the kernel virtual address of the non-system memory physical memory page, read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
  10. 一种存储介质,其特征在于,存储有用于实现镜像文件的生成方法的程序,所述程序被处理器运行时,执行以下步骤:A storage medium characterized by storing a program for implementing a method of generating an image file, and when the program is executed by a processor, the following steps are performed:
    基于非系统内存中需要保存的数据总量,在系统内存中申请相应的非系统内存镜像区;Based on the total amount of data to be saved in non-system memory, apply for the corresponding non-system memory mirror area in system memory;
    针对待处理的各个非系统内存物理内存页,分别执行以下操作:For each non-system physical memory page to be processed, perform the following operations:
    将非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;Map the physical address of the non-system memory physical memory page to the corresponding kernel virtual address;
    从所述非系统内存物理内存页中读取非系统内存原始数据,并基于所述内核虚拟地址,将所述非系统内存原始数据及相应的物理地址,保存至所述非系统内存镜像区;Reading non-system memory raw data from the non-system memory physical memory page, and saving the non-system memory raw data and the corresponding physical address based on the kernel virtual address to the non-system memory mirror area;
    在系统内存中申请相应的系统内存镜像区,并将需要保存的系统内存原始数据及相应的物理地址保存至所述系统内存镜像区;Apply for the corresponding system memory mirror area in the system memory, and save the original data of the system memory and the corresponding physical address to be saved in the system memory mirror area;
    对保存的各个非系统内存原始数据及相应的物理地址,和各个系统内存原始数据及相应的物理地址进行压缩,生成相应的镜像文件。Compress the original data and corresponding physical addresses of each non-system memory and the original data and corresponding physical addresses of each system memory to generate corresponding mirror files.
  11. 一种存储介质,其特征在于,存储有用于实现镜像文件的加载方法的程序,所述程序被处理器运行时,执行以下步骤:A storage medium characterized by storing a program for implementing a method of loading an image file, and when the program is executed by a processor, the following steps are performed:
    获取预存的镜像文件,在系统内存中进行解压;Obtain the pre-stored image file and decompress it in the system memory;
    针对解压后的镜像文件中记录的各个物理内存页,执行以下操作:For each physical memory page recorded in the decompressed image file, perform the following operations:
    根据解压后的镜像文件中记录的元数据,确定物理内存页的物理地址;According to the metadata recorded in the decompressed image file, determine the physical address of the physical memory page;
    根据所述物理内存页的物理地址,确定所述物理内存页为非系统内存物理内存页时,将所述非系统内存物理内存页的物理地址映射为相应的内核虚拟地址;When it is determined that the physical memory page is a non-system memory physical memory page according to the physical address of the physical memory page, the physical address of the non-system memory physical memory page is mapped to a corresponding kernel virtual address;
    按照所述非系统内存物理内存页的内核虚拟地址,从解压后的镜像文件中读取相应的非系统内存原始数据,并按照所述非系统内存物理内存页的物理地址,将所述非系统内存原始数据保存至非系统内存中的对应位置。According to the kernel virtual address of the non-system memory physical memory page, read the corresponding non-system memory raw data from the decompressed image file, and according to the non-system memory physical memory page physical address, the non-system The original memory data is saved to a corresponding location in non-system memory.
PCT/CN2019/107170 2018-12-11 2019-09-23 Methods for generating and loading mirror file, and device WO2020119213A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811510641.6 2018-12-11
CN201811510641.6A CN109683983B (en) 2018-12-11 2018-12-11 Method and equipment for generating and loading mirror image file

Publications (1)

Publication Number Publication Date
WO2020119213A1 true WO2020119213A1 (en) 2020-06-18

Family

ID=66186618

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/107170 WO2020119213A1 (en) 2018-12-11 2019-09-23 Methods for generating and loading mirror file, and device

Country Status (2)

Country Link
CN (1) CN109683983B (en)
WO (1) WO2020119213A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020504A (en) * 2021-10-19 2022-02-08 北京五八信息技术有限公司 Data processing method and device, electronic equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109683983B (en) * 2018-12-11 2021-09-24 海信视像科技股份有限公司 Method and equipment for generating and loading mirror image file
CN110647753B (en) * 2019-09-30 2021-04-16 Oppo广东移动通信有限公司 Method, device and equipment for acquiring kernel file and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6195749B1 (en) * 2000-02-10 2001-02-27 Advanced Micro Devices, Inc. Computer system including a memory access controller for using non-system memory storage resources during system boot time
CN103336736A (en) * 2013-05-27 2013-10-02 华为技术有限公司 System log acquisition method and device
CN105739982A (en) * 2016-01-29 2016-07-06 浪潮(北京)电子信息产业有限公司 System hibernation method and apparatus
CN107765990A (en) * 2016-08-17 2018-03-06 中兴通讯股份有限公司 A kind of system disk management method and device
CN107894932A (en) * 2016-09-29 2018-04-10 厦门雅迅网络股份有限公司 The method and its system of data consistency before and after holding system reboot
CN109683983A (en) * 2018-12-11 2019-04-26 青岛海信电器股份有限公司 A kind of generation of image file and loading method, equipment

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100342353C (en) * 2006-04-07 2007-10-10 浙江大学 Process mapping realization method in embedded type operation system
CN101464835A (en) * 2007-12-18 2009-06-24 英业达股份有限公司 Physical internal memory access method for operating system
CN101639782A (en) * 2009-07-14 2010-02-03 上海市共进通信技术有限公司 System bootloading method based on embedded operating system
CN101917350B (en) * 2010-09-13 2012-08-15 南京中兴特种软件有限责任公司 Network card drive-based zero copy Ethernet message capturing and transmitting implementation method under Linux
JP2012243287A (en) * 2011-05-24 2012-12-10 Sony Corp Information processing unit and information processing method
US9158550B2 (en) * 2011-06-16 2015-10-13 Vmware, Inc. Caching based operating system installation
CN102207881B (en) * 2011-07-07 2014-01-22 电子科技大学 Quick operation system start-up method based on Android
CN103955389B (en) * 2014-05-06 2017-09-29 中国科学院微电子研究所 A kind of system start method based on PCM
CN104503788A (en) * 2014-12-16 2015-04-08 电子科技大学 Setting method capable of shortening starting time of Android operating system
CN104461643B (en) * 2014-12-16 2017-12-19 中科创达软件股份有限公司 Control method, control device and the electronic equipment of electronic equipment
CN105302663B (en) * 2015-09-19 2019-02-01 华为技术有限公司 A kind of mirror image starting-up method and terminal device
CN107315598A (en) * 2016-04-26 2017-11-03 中国科学院微电子研究所 A kind of system recovery method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6195749B1 (en) * 2000-02-10 2001-02-27 Advanced Micro Devices, Inc. Computer system including a memory access controller for using non-system memory storage resources during system boot time
CN103336736A (en) * 2013-05-27 2013-10-02 华为技术有限公司 System log acquisition method and device
CN105739982A (en) * 2016-01-29 2016-07-06 浪潮(北京)电子信息产业有限公司 System hibernation method and apparatus
CN107765990A (en) * 2016-08-17 2018-03-06 中兴通讯股份有限公司 A kind of system disk management method and device
CN107894932A (en) * 2016-09-29 2018-04-10 厦门雅迅网络股份有限公司 The method and its system of data consistency before and after holding system reboot
CN109683983A (en) * 2018-12-11 2019-04-26 青岛海信电器股份有限公司 A kind of generation of image file and loading method, equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020504A (en) * 2021-10-19 2022-02-08 北京五八信息技术有限公司 Data processing method and device, electronic equipment and storage medium
CN114020504B (en) * 2021-10-19 2022-08-09 北京五八信息技术有限公司 Data processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109683983A (en) 2019-04-26
CN109683983B (en) 2021-09-24

Similar Documents

Publication Publication Date Title
WO2020119213A1 (en) Methods for generating and loading mirror file, and device
US20140136767A1 (en) Memory system having memory controller with cache memory and nvram and method of operating same
TWI596541B (en) Data accessing system, data accessing appraratus and method for accessing data
WO2016165597A1 (en) Processing method and device for data storage
US20120311240A1 (en) Information processing apparatus, information processing method, and storage medium
JP5932171B2 (en) Method and system for object-based transactions in a storage system
JP2006268139A (en) Data reproduction device, method and program and storing system
US11422860B2 (en) Optimizing save operations for OS/hypervisor-based persistent memory
CN104866388B (en) Data processing method and device
KR102533726B1 (en) Electronic apparatus and controlling method thereof
US9798793B1 (en) Method for recovering an index on a deduplicated storage system
US9904559B2 (en) Information processing apparatus and activation method therefor for processing data of a hibernation image
KR101920474B1 (en) In-memory virtual desktop system
US9372700B2 (en) Network boot system
CN114328007B (en) Container backup and restoration method, device and medium thereof
WO2011120335A1 (en) Method, device and computer for data operation
CN105068896A (en) Data processing method and device based on RAID backup
US11226738B2 (en) Electronic device and data compression method thereof
US10204002B1 (en) Method for maintaining a cache index on a deduplicated storage system
JP6080492B2 (en) Information processing apparatus, activation method, and program
CN103678713A (en) Method for recovering NTFS (New Technology File System) highly-compressed file in VMware scenario
CN113448722A (en) Mapping method of process memory and instance processing method based on serverless architecture
US10289307B1 (en) Method for handling block errors on a deduplicated storage system
KR101618999B1 (en) Network boot system
US11221985B2 (en) Metadata space efficient snapshot operation in page storage

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: 19896104

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: 19896104

Country of ref document: EP

Kind code of ref document: A1