CN109683983B - Method and equipment for generating and loading mirror image file - Google Patents

Method and equipment for generating and loading mirror image file Download PDF

Info

Publication number
CN109683983B
CN109683983B CN201811510641.6A CN201811510641A CN109683983B CN 109683983 B CN109683983 B CN 109683983B CN 201811510641 A CN201811510641 A CN 201811510641A CN 109683983 B CN109683983 B CN 109683983B
Authority
CN
China
Prior art keywords
system memory
memory
physical
image file
original data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811510641.6A
Other languages
Chinese (zh)
Other versions
CN109683983A (en
Inventor
初德进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Visual Technology Co Ltd
Original Assignee
Hisense Visual Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Visual Technology Co Ltd filed Critical Hisense Visual Technology Co Ltd
Priority to CN201811510641.6A priority Critical patent/CN109683983B/en
Publication of CN109683983A publication Critical patent/CN109683983A/en
Priority to PCT/CN2019/107170 priority patent/WO2020119213A1/en
Application granted granted Critical
Publication of CN109683983B publication Critical patent/CN109683983B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

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

Abstract

The invention relates to a computer technology, and discloses a method and equipment for generating and loading a mirror image file, which are used for ensuring the integrity of the mirror image file so as to ensure that intelligent equipment is smoothly and quickly started. The method comprises the following steps: the intelligent device maps the non-system memory original data to the kernel virtual space for processing and storing according to the physical address, and compresses the non-system memory original data and the system memory original data together to generate a corresponding image file, so that all important data required by system recovery can be comprehensively recorded in the image file, the integrity of the image file is ensured, the problems of screen splash and screen blank caused by important data loss when the intelligent device recovers the system based on the image file can be avoided, and smooth and rapid starting of the intelligent device is ensured.

Description

Method and equipment for generating and loading mirror image file
Technical Field
The invention relates to a computer technology, in particular to a method for generating and loading an image file.
Background
Currently, in order to speed up the booting or screen-up speed and improve the user experience, an intelligent device (e.g., a smart tv) based on the Linux technology usually prestores recovery Data in a Double Data Rate (DDR).
In the process of direct current power on and power off, the intelligent device adopts a standby To memory (STR) technology, namely, the power supply of the DDR is reserved during standby, the DDR enters a self-refresh mode, recovery data are stored in the DDR, and after the power on, the recovery data are directly read from the DDR so as To recover To a state before standby and continue To operate.
In the process of ac power on and off, the power on speed is increased, and a standby To hard disk (STD) technology is usually adopted, that is, the system running state description before standby is made, and a corresponding image file is made and stored in a nonvolatile memory, such as an Embedded Multimedia Memory Card (EMMC), and after power on, the image file is read from the EMMC, and then decompressed, skipped and run.
However, in the prior art, when an image file is made, the Linux kernel only makes a corresponding image file for the original data stored in the system memory, regardless of the original data stored in the non-system memory, and in practical applications, the original data stored in the non-system memory may also record key data of startup operation, such as frame buffer (frame buffer) data of an image, so that abnormal display of a television after startup may be caused.
The generation process of the mirror image file in the Linux system is further explained below.
In the prior art, the Linux technology-based intelligent device adopts a design model irrelevant to a specific system architecture on a DDR management level, so that good scalability is realized. Specifically, the DDR of the intelligent device is divided into a system memory and a non-system memory, the system memory is a memory which is managed by the Linux kernel with authority, and the non-system memory is a memory which is not managed by the Linux kernel with authority.
Referring to fig. 1, the system memory is composed of three levels of architectures, i.e., a memory Node (Node), a memory Zone (Zone), and a physical memory page (page).
A bus master device has the same cost for accessing any memory unit in the same memory node, and has different costs for accessing the memory units in any two different nodes.
The memory areas are located in the same memory node, and mainly include a direct read memory area (ZONE _ DMA), a NORMAL memory area (ZONE _ NORMAL), and a high-end memory area (ZONE _ high mem).
Physical memory pages, system memory is usually managed in "pages" for memory management, and the size of one physical memory page is 4K bytes.
The STD technology is similar to the STR and is a method for accelerating the startup of the smart device, and the difference is that the STD technology stores the image file for recovery into the EMMC, so that the image file is not lost after the ac power failure.
Specifically, the intelligent device collects system operation state description information before standby, where the system operation state description information at least includes: physical memory page usage status, processor operating status, operating status of external devices, etc.; then, the intelligent device will make the obtained system running state description information into a corresponding image file according to a set format and store the image file in the EMMC; when the intelligent device is started next time, the image file is read from the EMMC in a boot loader (bootloader) stage before the kernel or the system is started, and then a recovery process is executed to recover to the standby state last time.
Taking an actual project as an example, it is assumed that a certain smart device is configured with 1.5G Byte 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 reserved as non-system memory for other hardware modules of the main chip to use, for a special purpose, e.g., 100M of physical memory is reserved for a display module from the non-system memory for a framebuffer.
The non-system memory is not in the management authority range of the Linux kernel, so that the intelligent device cannot use data stored in the non-system memory when the image file is manufactured. However, in the STD boot process, some processes may need to use data stored in the non-system memory, and since the STD boot process is an alternating boot, initial values of all data in the non-system memory before initialization are all 0xff, at this time, some processes may be abnormal, and if some processes are display-related processes, the problems of screen splash and screen blank may occur in the STD boot process.
Disclosure of Invention
The embodiment of the invention provides a method and equipment for generating and loading a mirror image file, which are used for ensuring the integrity of the mirror image file so as to ensure that intelligent equipment is smoothly and quickly started.
The embodiment of the invention provides the following specific technical scheme:
a method for generating an image file comprises the following steps:
applying for a corresponding non-system memory mirror area in the system memory based on the total amount of data needing to be stored in the non-system memory;
for each non-system memory physical memory page to be processed, the following operations are respectively executed:
mapping the physical address of the physical memory page of the non-system memory into a corresponding kernel virtual address;
reading non-system memory original data from the non-system memory physical memory page, and storing the non-system memory original data and a corresponding physical address to the non-system memory mirror area based on the kernel virtual address;
applying for a corresponding system memory mirror area in a system memory, and storing original data of the system memory to be stored and a corresponding physical address to the system memory mirror area;
and compressing the stored original data and the corresponding physical address of each non-system memory, and the stored original data and the corresponding physical address of each system memory to generate a corresponding mirror image file.
Optionally, based on the total amount of data that needs to be stored in the non-system memory, before applying for the corresponding non-system memory mirror area in the system memory, the method further includes:
and determining that the image file needs to be generated by using the data stored in the non-system memory according to preset configuration information.
Optionally, the storing the original data of the non-system memory and the corresponding physical address to the mirror area of the non-system memory includes:
storing the non-system memory original data in a first area of the non-system memory mirror area;
storing the physical address corresponding to the original data of the non-system memory in a second area of the mirror image area of the non-system memory in a metadata form;
and the distance between the first area and a mirror image head area set in a system memory mirror image area is greater than the distance between the second area and the mirror image head area.
Optionally, before compressing each stored non-system memory raw data and corresponding physical address, and each stored system memory raw data and corresponding physical address by using a preset format, the method further includes:
storing the mapping relation between each non-system memory original data and the corresponding physical address in the non-system memory mirror image area in a set mirror image head area; and the number of the first and second groups,
and storing the mapping relation between each system memory original data and the corresponding physical address in the system memory mirror image area in the mirror image head area.
Optionally, further comprising:
and saving the image file to a specified position of a memory.
A loading method of an image file comprises the following steps after AC startup is carried out:
obtaining the pre-stored mirror image file, decompressing in the system memory,
for each physical memory page recorded in the decompressed image file, the following operations are respectively executed:
determining a physical address of a physical memory page according to metadata recorded in the decompressed mirror image file;
mapping the physical address of the physical memory page of the non-system memory to a corresponding kernel virtual address when the physical memory page is determined to be the physical memory page of the non-system memory according to the physical address of the physical memory page;
reading corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the non-system memory physical memory page, and storing the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the non-system memory physical memory page.
Optionally, further comprising:
when the physical memory page is determined to be a system memory physical memory page according to the physical address of the physical memory page, reading corresponding system memory original data from the decompressed mirror image file according to the kernel virtual address of the system memory physical memory page;
and storing the original data of the system memory to a corresponding position in the system memory according to the physical address of the physical memory page of the system memory.
An intelligent device at least comprises a processor, a physical memory and a storage, wherein the physical memory is a non-system memory and a system memory,
the processor is used for applying for a corresponding non-system memory mirror area in the system memory based on the total amount of data needing to be stored in the non-system memory;
for each non-system memory physical memory page to be processed, the following operations are respectively executed:
mapping the physical address of the physical memory page of the non-system memory into a corresponding kernel virtual address;
reading non-system memory original data from the non-system memory physical memory page, and storing the non-system memory original data and a corresponding physical address to the non-system memory mirror area based on the kernel virtual address;
applying for a corresponding system memory mirror area in a system memory, and storing original data of the system memory to be stored and a corresponding physical address to the system memory mirror area;
and compressing the stored original data and the corresponding physical address of each non-system memory, and the stored original data and the corresponding physical address of each system memory to generate a corresponding mirror image file.
Optionally, before applying for the corresponding non-system memory mirror area in the system memory based on the total amount of data that needs to be stored in the non-system memory, the processor is further configured to:
and determining that the image file needs to be generated by using the data stored in the non-system memory according to preset configuration information.
Optionally, when the non-system memory raw data and the corresponding physical address are stored in the non-system memory mirror area, the processor is configured to:
storing the non-system memory original data in a first area of the non-system memory mirror area;
storing the physical address corresponding to the original data of the non-system memory in a second area of the mirror image area of the non-system memory in a metadata form;
and the distance between the first area and a mirror image head area set in a system memory mirror image area is greater than the distance between the second area and the mirror image head area.
Optionally, before compressing each of the stored non-system memory raw data and the corresponding physical address, and each of the stored system memory raw data and the corresponding physical address by using a preset format, the processor is further configured to:
storing the mapping relation between each non-system memory original data and the corresponding physical address in the non-system memory mirror image area in a set mirror image head area; and the number of the first and second groups,
and storing the mapping relation between each system memory original data and the corresponding physical address in the system memory mirror image area in the mirror image head area.
Optionally, the processor is further configured to:
and saving the image file to a specified position of a memory.
An intelligent device at least comprises a processor, a physical memory and a storage, wherein the physical memory is a non-system memory and a system memory,
after the AC starting, acquiring a prestored mirror image file, and decompressing in a system memory;
for each physical memory page recorded in the decompressed image file, the following operations are respectively executed:
determining a physical address of a physical memory page according to metadata recorded in the decompressed mirror image file;
mapping the physical address of the physical memory page of the non-system memory to a corresponding kernel virtual address when the physical memory page is determined to be the physical memory page of the non-system memory according to the physical address of the physical memory page;
reading corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the non-system memory physical memory page, and storing the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the non-system memory physical memory page.
Optionally, the processor is further configured to:
when the physical memory page is determined to be a system memory physical memory page according to the physical address of the physical memory page, reading corresponding system memory original data from the decompressed mirror image file according to the kernel virtual address of the system memory physical memory page;
and storing the original data of the system memory to a corresponding position in the system memory according to the physical address of the physical memory page of the system memory.
A storage medium storing a program for implementing a method for generating an image file, the program, when executed by a processor, performing the steps of:
applying for a corresponding non-system memory mirror area in the system memory based on the total amount of data needing to be stored in the non-system memory;
for each non-system memory physical memory page to be processed, the following operations are respectively executed:
mapping the physical address of the physical memory page of the non-system memory into a corresponding kernel virtual address;
reading non-system memory original data from the non-system memory physical memory page, and storing the non-system memory original data and a corresponding physical address to the non-system memory mirror area based on the kernel virtual address;
applying for a corresponding system memory mirror area in a system memory, and storing original data of the system memory to be stored and a corresponding physical address to the system memory mirror area;
and compressing the stored original data of each non-system memory and the corresponding physical address, and the original data of each system memory and the corresponding physical address to generate a corresponding mirror image file.
A storage medium storing a program for implementing a loading method of an image file, the program, when executed by a processor, performing the steps of:
acquiring a prestored mirror image file, and decompressing in a system memory;
for each physical memory page recorded in the decompressed image file, executing the following operations:
determining a physical address of a physical memory page according to metadata recorded in the decompressed mirror image file;
mapping the physical address of the physical memory page of the non-system memory to a corresponding kernel virtual address when the physical memory page is determined to be the physical memory page of the non-system memory according to the physical address of the physical memory page;
reading corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the non-system memory physical memory page, and storing the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the non-system memory physical memory page.
In the embodiment of the invention, the intelligent device maps the non-system memory original data to the kernel virtual space for processing and storing according to the physical address, and compresses the non-system memory original data and the system memory original data together to generate the corresponding image file, so that all important data required by system recovery can be comprehensively recorded in the image file, the integrity of the image file is ensured, the problems of screen splash and screen blank caused by important data loss when the intelligent device recovers the system based on the image file can be avoided, and the smooth and quick start of the intelligent device is ensured.
Drawings
FIG. 1 is a diagram illustrating a system memory architecture in a physical memory according to the prior art;
FIG. 2 is a functional structure diagram of an intelligent device according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of an image file generation process of an intelligent device according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating physical memory allocation according to an embodiment of the invention;
FIG. 5 is a diagram illustrating the comparison between the content of the mirror image file in the prior art and the embodiment of the present invention;
fig. 6 is a schematic flowchart of a process of loading an image file by an intelligent device in an embodiment of the present invention.
Detailed Description
In order to ensure the integrity of the image file and ensure that the intelligent device is smoothly and quickly started, in the embodiment of the invention, the intelligent device using the Linux kernel selectively stores specified important data in a non-system memory and a system memory in the process of the image file, so that a corresponding image file is generated.
Preferred embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
Referring to fig. 2, in the embodiment of the present invention, an intelligent device (e.g., an intelligent television) at least includes a processor 20, a physical memory 21 (e.g., DDR), and a storage 22 (e.g., EMMC), where the processor 20 is configured to carry a Linux kernel and execute related operations to generate an image file, the physical memory 21 is configured to cache various types of data generated during a system operation process, and the storage 22 is configured to store the image file.
Based on the intelligent device, referring to fig. 3, in the embodiment of the present invention, a detailed flow of generating an image file by the intelligent device is as follows:
step 300: is the smart device determine whether to save non-system memory raw data according to preset configuration information? If yes, go to step 301; otherwise, step 305 is performed.
Of course, how to store the non-system memory raw data in the default configuration of the intelligent device, the intelligent device may also directly start the generation process of the image file from step 310 without performing the determination operation.
Step 301: and the intelligent equipment applies for a corresponding non-system memory mirror area in the system memory based on the total amount of data needing to be stored in the non-system memory.
Specifically, in the DDR, the physical memories are all set in the form of physical memory pages, so that the intelligent device needs to determine the total amount of physical memory pages occupied by the total data amount of the non-system memory raw data that needs to be stored in the non-system memory, and then applies for the total amount of physical memory pages of a corresponding size, also referred to as a non-system memory mirror region, in the system memory based on the total amount of physical memory pages occupied by the total data amount of the non-system memory raw data.
The non-system memory mirror area may be located in ZONE _ NORMAL or ZONE _ high mem, depending on the idle status of the system memory at that time, as shown in fig. 4.
Step 302: the intelligent device maps the physical address of a non-system memory physical memory page to a corresponding kernel virtual address.
In practical application, in the running process of the Linux system, the used addresses are all virtual addresses, taking a 32-bit system as an example, the Linux kernel provides a memory virtual address space with the same size for each running process, so that a plurality of processes can run simultaneously without mutual interference, and the space range of the virtual addresses is 0-4G. Therefore, in order to enable the Lunix kernel carried by the processor 20 to access the non-system memory, the ioremap function needs to be called to map the physical address of the physical memory page of the non-system memory to the kernel virtual address space, so as to obtain the corresponding memory virtual address, thereby facilitating the reading and writing of the processor 20.
Step 303: and the intelligent equipment reads the non-system memory original data from the non-system memory physical memory page and stores the non-system memory original data and the corresponding physical address to the non-system memory mirror area based on the kernel virtual address.
Specifically, referring to fig. 5, compared with the allocation of the system memory in the prior art, the embodiment of the present invention adds a non-system memory mirror area on the basis of the system memory mirror area. As shown in fig. 5, the non-system memory mirror area may be discontinuous in physical address, and specifically may be divided into a first area for storing non-system memory raw data and a second area for storing non-system memory Metadata, where the Metadata (Metadata), also called intermediate data and relay data, is data (data about data) describing data, mainly information describing data attribute (property), and is used to support functions such as indicating storage location, history data, resource lookup, file record, and the like.
In this embodiment of the present invention, the metadata is used to record the physical address of the corresponding original data, so that, when step 303 is executed, the intelligent device stores the non-system memory original data stored in one non-system memory physical memory page to a first area in a non-system memory mirror region (also stored in one system memory physical memory page, which is not described herein again), and stores the corresponding physical address in the form of metadata to a second area in the non-system memory mirror region.
The mapping relationship between the original data of the non-system memory and the corresponding physical address may be stored in a set mirror header area, as shown in fig. 5.
Optionally, because the real-time data lossless compression (Lempel-Ziv-oberhimer, LZO) format is usually adopted for compression when generating the image file, therefore, there is a need to distinguish between non-system memory metadata and system memory metadata, as well as between non-system memory raw data and system memory raw data, furthermore, the storage location of the non-system memory metadata needs to be placed in front of the non-system memory original data, that is, the distance between the first region and the mirror image header region is greater than the distance between the second region and the mirror image header region, and similarly, the storage location of the metadata in the system memory needs to be placed in front of the original data in the system memory, so that after the mirror image file is generated, when the image file is decompressed, data confusion can not be caused, the situation that metadata cannot be matched with original data can not be caused, and starting failure is caused.
Step 304: is the smart device determine whether all non-system memory physical memory pages have been processed? If yes, go to step 305; otherwise, step 302 is performed.
Step 305: the intelligent device applies for a corresponding system memory mirror area in the system memory based on the total amount of data to be stored in the system memory.
The intelligent device is similar to the mode of storing the original data of the system memory in the system memory, and the difference is that when the original data of the system memory is read, the mapping from a physical address to a memory virtual address is not needed, because the original storage position of the original data of the system memory is also positioned in the system memory, and the system memory belongs to a memory area which is managed by a Linux kernel and has authority, the intelligent device can definitely know the memory virtual address of the original storage position of the original data of the system memory.
Step 306: the intelligent device copies system memory original data and corresponding physical addresses which need to be stored in each system memory physical memory page to the system memory mirror area.
Similarly, the intelligent device also needs to copy the system memory original data stored in each page of the physical memory page of the system memory to be processed to a third region in the system memory mirror region, copy the physical address corresponding to the system memory original data to a fourth region in the system memory mirror region, and optionally, as shown in fig. 5, make the distance between the third region and the mirror head region greater than the distance between the fourth region and the mirror head region.
Step 307: the intelligent device saves the specified boot information in the mirror header area.
Specifically, the intelligent device stores the mapping relationship between each non-system memory original data and the corresponding physical address in the non-system memory mirror image area in the mirror image head area; and storing the mapping relation between the original data of each system memory and the corresponding physical address in the system memory mirror image area.
Step 308: and the intelligent equipment compresses various data stored in the system memory mirror image area and the non-system memory mirror image area according to a set format to generate a corresponding mirror image file, and stores the corresponding mirror image file in the EMMC.
Therefore, the image file is generated, the intelligent device can store the image file in the EMMC, and when the intelligent device is shut down and restarted, system recovery can be carried out based on the image file.
Based on the above embodiment, referring to fig. 6, in the embodiment of the present invention, a detailed flow of loading an image file by an intelligent device is as follows:
step 600: AC starting after intelligent equipment is shut down
Step 601: and the intelligent equipment reads the pre-stored image file from the EMMC, stores the image file in the DDR and decompresses the image file.
Specifically, the intelligent device first decompresses the compressed image file in the system memory, and then reads the metadata therein, where the metadata stores the physical addresses of the original storage locations of the non-system memory original data and the system memory original data.
Step 602: the intelligent device reads metadata of one physical memory page from the decompressed mirror image file, and determines a physical address of the physical memory page based on the metadata.
Step 603: is the smart device determining whether the physical address of the physical memory page belongs to non-system memory? If yes, go to step 604; otherwise, step 606 is performed.
Step 604: the intelligent device determines that the physical memory page is a non-system memory physical memory page, and maps a physical address of the non-system memory physical memory page to a corresponding kernel virtual address.
Similarly, the intelligent device needs to map the physical address of the physical memory page to a corresponding kernel virtual address by using an ioremap function.
Step 605: the non-system of the intelligent device reads corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the physical memory page of the non-system memory, and stores the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the physical memory page of the non-system memory, and then, executes step 607.
Therefore, the intelligent equipment restores the non-system memory original data in the image file to the original storage device in the system memory.
Step 606: the intelligent device determines that the processing memory page is a non-system memory physical memory page, reads corresponding system memory original data from the decompressed mirror file according to the kernel virtual address of the system memory physical memory page, and stores the system memory original data to a corresponding position in the system memory according to the physical address of the system memory physical memory page.
Therefore, the intelligent equipment restores the original data of the system memory in the image file to the original storage device in the system memory.
Step 607: is the smart device determining whether all physical memory pages in the image file have been processed? If yes, go to step 608; otherwise, return to step 602.
The intelligent device can recover the non-system memory original data or the system memory original data corresponding to each physical memory page by page from the mirror image file according to a certain sequence until all data are recovered.
Step 607: and the intelligent equipment determines that the loading of the image file is finished and restores the system to the image file indicating state.
And when the image file is loaded, the intelligent device can restore the system to the state indicated by the image file stored for the last time.
Based on the foregoing embodiments, referring to fig. 2, in an embodiment of the present invention, an intelligent device (e.g., an intelligent television) at least includes a processor 20, a physical memory 21 and a storage 22, where the physical memory 21 is divided into a non-system memory and a system memory, where,
in one embodiment of the present invention,
the processor 20 is configured to apply for a corresponding non-system memory mirror area in the system memory based on a total amount of data that needs to be stored in the non-system memory;
for each non-system memory physical memory page to be processed, the following operations are respectively executed:
mapping the physical address of the physical memory page of the non-system memory into a corresponding kernel virtual address;
reading non-system memory original data from the non-system memory physical memory page, and storing the non-system memory original data and a corresponding physical address to the non-system memory mirror area based on the kernel virtual address;
applying for a corresponding system memory mirror area in a system memory, and storing original data of the system memory to be stored and a corresponding physical address to the system memory mirror area;
and compressing the stored original data and the corresponding physical address of each non-system memory, and the stored original data and the corresponding physical address of each system memory to generate a corresponding mirror image file.
Optionally, based on the total amount of data that needs to be stored in the non-system memory, before applying for the corresponding non-system memory mirror area in the system memory, the processor 20 is further configured to:
and determining that the image file needs to be generated by using the data stored in the non-system memory according to preset configuration information.
Optionally, 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 configured to:
storing the non-system memory original data in a first area of the non-system memory mirror area;
storing the physical address corresponding to the original data of the non-system memory in a second area of the mirror image area of the non-system memory in a metadata form;
and the distance between the first area and a mirror image head area set in a system memory mirror image area is greater than the distance between the second area and the mirror image head area.
Optionally, before compressing each stored non-system memory raw data and corresponding physical address, and each stored system memory raw data and corresponding physical address by using a preset format, the processor 20 is further configured to:
storing the mapping relation between each non-system memory original data and the corresponding physical address in the non-system memory mirror image area in a set mirror image head area; and the number of the first and second groups,
and storing the mapping relation between each system memory original data and the corresponding physical address in the system memory mirror image area in the mirror image head area.
Optionally, the processor 20 is further configured to:
and saving the image file to a specified position of a memory.
In a still further embodiment of the method,
after the ac power-on, the processor 20 is configured to,
acquiring a prestored mirror image file, and decompressing in a system memory;
for each physical memory page recorded in the decompressed image file, the following operations are respectively executed:
determining a physical address of a physical memory page according to metadata recorded in the decompressed mirror image file;
mapping the physical address of the physical memory page of the non-system memory to a corresponding kernel virtual address when the physical memory page is determined to be the physical memory page of the non-system memory according to the physical address of the physical memory page;
reading corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the non-system memory physical memory page, and storing the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the non-system memory physical memory page.
Optionally, the processor 20 is further configured to:
when the physical memory page is determined to be a system memory physical memory page according to the physical address of the physical memory page, reading corresponding system memory original data from the decompressed mirror image file according to the kernel virtual address of the system memory physical memory page;
and storing the original data of the system memory to a corresponding position in the system memory according to the physical address of the physical memory page of the system memory.
Based on the same inventive concept, in one embodiment, there is provided a storage medium storing a program for implementing a method for generating an image file, the program, when executed by a processor 20, performing the steps of:
applying for a corresponding non-system memory mirror area in the system memory based on the total amount of data needing to be stored in the non-system memory;
for each non-system memory physical memory page to be processed, the following operations are respectively executed:
mapping the physical address of the physical memory page of the non-system memory into a corresponding kernel virtual address;
reading non-system memory original data from the non-system memory physical memory page, and storing the non-system memory original data and a corresponding physical address to the non-system memory mirror area based on the kernel virtual address;
applying for a corresponding system memory mirror area in a system memory, and storing original data of the system memory to be stored and a corresponding physical address to the system memory mirror area;
and compressing the stored original data of each non-system memory and the corresponding physical address, and the original data of each system memory and the corresponding physical address to generate a corresponding mirror image file.
Based on the same inventive concept, in one embodiment, a storage medium storing a program for implementing a loading method of an image file is provided, and when the program is executed by a processor 20, the program performs the following steps:
acquiring a prestored mirror image file, and decompressing in a system memory;
for each physical memory page recorded in the decompressed image file, executing the following operations:
determining a physical address of a physical memory page according to metadata recorded in the decompressed mirror image file;
mapping the physical address of the physical memory page of the non-system memory to a corresponding kernel virtual address when the physical memory page is determined to be the physical memory page of the non-system memory according to the physical address of the physical memory page;
reading corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the non-system memory physical memory page, and storing the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the non-system memory physical memory page.
In summary, in the embodiment of the present invention, the intelligent device maps the non-system memory raw data to the kernel virtual space according to the physical address for processing and storing, and compresses the non-system memory raw data together with the system memory raw data to generate the corresponding image file, so that all important data required for system recovery can be comprehensively recorded in the image file, thereby ensuring the integrity of the image file, further avoiding the problems of screen splash and screen blank caused by the loss of the important data when the intelligent device performs system recovery based on the image file, and ensuring smooth and fast startup of the intelligent device.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.

Claims (11)

1. A method for generating an image file, comprising:
applying a corresponding non-system memory mirror area in a system memory based on the total amount of data needing to be stored in the non-system memory, wherein the system memory is a memory with authority management of a Linux kernel, and the non-system memory is a memory without authority management of the Linux kernel;
for each non-system memory physical memory page to be processed, the following operations are respectively executed:
mapping the physical address of the physical memory page of the non-system memory into a corresponding kernel virtual address;
reading non-system memory original data from the non-system memory physical memory page, and storing the non-system memory original data and a corresponding physical address to the non-system memory mirror area based on the kernel virtual address;
applying for a corresponding system memory mirror area in a system memory, and storing original data of the system memory to be stored and a corresponding physical address to the system memory mirror area;
and compressing the stored original data and the corresponding physical address of each non-system memory, and the stored original data and the corresponding physical address of each system memory to generate a corresponding mirror image file.
2. The method of claim 1, wherein based on a total amount of data to be stored in the non-system memory, before applying for a corresponding non-system memory mirror region in the system memory, further comprising:
and determining that the image file needs to be generated by using the data stored in the non-system memory according to preset configuration information.
3. The method of claim 1, wherein the saving the non-system memory raw data and the corresponding physical address to the non-system memory mirror area comprises:
storing the non-system memory original data in a first area of the non-system memory mirror area;
storing the physical address corresponding to the original data of the non-system memory in a second area of the mirror image area of the non-system memory in a metadata form;
and the distance between the first area and a mirror image head area set in a system memory mirror image area is greater than the distance between the second area and the mirror image head area.
4. The method of claim 3, wherein before compressing the stored raw data and corresponding physical address of each non-system memory and the stored raw data and corresponding physical address of each system memory in a predetermined format, the method further comprises:
storing the mapping relation between each non-system memory original data and the corresponding physical address in the non-system memory mirror image area in a set mirror image head area; and the number of the first and second groups,
and storing the mapping relation between each system memory original data and the corresponding physical address in the system memory mirror image area in the mirror image head area.
5. The method of any one of claims 1-4, further comprising:
and saving the image file to a specified position of a memory.
6. A loading method of an image file is characterized in that after the communication startup is carried out, the loading method comprises the following steps:
acquiring a prestored mirror image file, and decompressing the prestored mirror image file in a system memory, wherein the system memory is a memory with authority management of a Linux kernel;
for each physical memory page recorded in the decompressed image file, the following operations are respectively executed:
determining a physical address of a physical memory page according to metadata recorded in the decompressed mirror image file;
according to the physical address of the physical memory page, when the physical memory page is determined to be a non-system memory physical memory page, mapping the physical address of the non-system memory physical memory page to a corresponding kernel virtual address, wherein the non-system memory is a memory which is not managed by the Linux kernel in an authorized manner;
reading corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the non-system memory physical memory page, and storing the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the non-system memory physical memory page.
7. The method of claim 6, further comprising:
when the physical memory page is determined to be a system memory physical memory page according to the physical address of the physical memory page, reading corresponding system memory original data from the decompressed mirror image file according to the kernel virtual address of the system memory physical memory page;
and storing the original data of the system memory to a corresponding position in the system memory according to the physical address of the physical memory page of the system memory.
8. An intelligent device, comprising at least a processor, a physical memory and a storage, wherein the physical memory is a non-system memory and a system memory, wherein,
the system comprises a processor and a non-system memory, wherein the processor is used for applying a corresponding non-system memory mirror image area in a system memory based on the total amount of data needing to be stored in the non-system memory, the system memory is a memory with authority management of a Linux kernel, and the non-system memory is a memory without authority management of the Linux kernel;
for each non-system memory physical memory page to be processed, the following operations are respectively executed:
mapping the physical address of the physical memory page of the non-system memory into a corresponding kernel virtual address;
reading non-system memory original data from the non-system memory physical memory page, and storing the non-system memory original data and a corresponding physical address to the non-system memory mirror area based on the kernel virtual address;
applying for a corresponding system memory mirror area in a system memory, and storing original data of the system memory to be stored and a corresponding physical address to the system memory mirror area;
and compressing the stored original data and the corresponding physical address of each non-system memory, and the stored original data and the corresponding physical address of each system memory to generate a corresponding mirror image file.
9. An intelligent device, comprising at least a processor, a physical memory and a storage, wherein the physical memory is a non-system memory and a system memory, wherein,
after the AC startup, acquiring a prestored mirror image file, and decompressing the prestored mirror image file in a system memory, wherein the system memory is a memory with authority management of a Linux kernel;
for each physical memory page recorded in the decompressed image file, the following operations are respectively executed:
determining a physical address of a physical memory page according to metadata recorded in the decompressed mirror image file;
according to the physical address of the physical memory page, when the physical memory page is determined to be a non-system memory physical memory page, mapping the physical address of the non-system memory physical memory page to a corresponding kernel virtual address, wherein the non-system memory is a memory which is not managed by the Linux kernel in an authorized manner;
reading corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the non-system memory physical memory page, and storing the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the non-system memory physical memory page.
10. A storage medium storing a program for implementing a method for generating an image file, the program, when executed by a processor, performing the steps of:
applying a corresponding non-system memory mirror area in a system memory based on the total amount of data needing to be stored in the non-system memory, wherein the system memory is a memory with authority management of a Linux kernel, and the non-system memory is a memory without authority management of the Linux kernel;
for each non-system memory physical memory page to be processed, the following operations are respectively executed:
mapping the physical address of the physical memory page of the non-system memory into a corresponding kernel virtual address;
reading non-system memory original data from the non-system memory physical memory page, and storing the non-system memory original data and a corresponding physical address to the non-system memory mirror area based on the kernel virtual address;
applying for a corresponding system memory mirror area in a system memory, and storing original data of the system memory to be stored and a corresponding physical address to the system memory mirror area;
and compressing the stored original data of each non-system memory and the corresponding physical address, and the original data of each system memory and the corresponding physical address to generate a corresponding mirror image file.
11. A storage medium storing a program for implementing a loading method of an image file, the program, when executed by a processor, performing the steps of:
acquiring a prestored mirror image file, and decompressing the prestored mirror image file in a system memory, wherein the system memory is a memory with authority management of a Linux kernel;
for each physical memory page recorded in the decompressed image file, executing the following operations:
determining a physical address of a physical memory page according to metadata recorded in the decompressed mirror image file;
according to the physical address of the physical memory page, when the physical memory page is determined to be a non-system memory physical memory page, mapping the physical address of the non-system memory physical memory page to a corresponding kernel virtual address, wherein the non-system memory is a memory which is not managed by the Linux kernel in an authorized manner;
reading corresponding non-system memory original data from the decompressed mirror image file according to the kernel virtual address of the non-system memory physical memory page, and storing the non-system memory original data to a corresponding position in the non-system memory according to the physical address of the non-system memory physical memory page.
CN201811510641.6A 2018-12-11 2018-12-11 Method and equipment for generating and loading mirror image file Active CN109683983B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201811510641.6A CN109683983B (en) 2018-12-11 2018-12-11 Method and equipment for generating and loading mirror image file
PCT/CN2019/107170 WO2020119213A1 (en) 2018-12-11 2019-09-23 Methods for generating and loading mirror file, and device

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN109683983A CN109683983A (en) 2019-04-26
CN109683983B true CN109683983B (en) 2021-09-24

Family

ID=66186618

Family Applications (1)

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

Country Status (2)

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

Families Citing this family (4)

* 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
CN113835872A (en) * 2020-06-24 2021-12-24 北京小米移动软件有限公司 Data processing method and device for reducing memory overhead and storage medium
CN114020504B (en) * 2021-10-19 2022-08-09 北京五八信息技术有限公司 Data processing method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464835A (en) * 2007-12-18 2009-06-24 英业达股份有限公司 Physical internal memory access method for operating system
CN103955389A (en) * 2014-05-06 2014-07-30 中国科学院微电子研究所 System startup method based on PCM (Phase Change Random Access Memory)
CN105302663A (en) * 2015-09-19 2016-02-03 华为技术有限公司 Mirror image starting method and terminal equipment

Family Cites Families (15)

* 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
CN100342353C (en) * 2006-04-07 2007-10-10 浙江大学 Process mapping realization method in embedded type operation 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
CN103336736B (en) * 2013-05-27 2017-04-12 华为技术有限公司 System log acquisition method and device
CN104461643B (en) * 2014-12-16 2017-12-19 中科创达软件股份有限公司 Control method, control device and the electronic equipment of electronic equipment
CN104503788A (en) * 2014-12-16 2015-04-08 电子科技大学 Setting method capable of shortening starting time of Android operating system
CN105739982B (en) * 2016-01-29 2019-05-10 浪潮(北京)电子信息产业有限公司 A kind of method and device of system suspend mode
CN107315598A (en) * 2016-04-26 2017-11-03 中国科学院微电子研究所 A kind of system recovery method and device
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
CN109683983B (en) * 2018-12-11 2021-09-24 海信视像科技股份有限公司 Method and equipment for generating and loading mirror image file

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464835A (en) * 2007-12-18 2009-06-24 英业达股份有限公司 Physical internal memory access method for operating system
CN103955389A (en) * 2014-05-06 2014-07-30 中国科学院微电子研究所 System startup method based on PCM (Phase Change Random Access Memory)
CN105302663A (en) * 2015-09-19 2016-02-03 华为技术有限公司 Mirror image starting method and terminal equipment

Also Published As

Publication number Publication date
WO2020119213A1 (en) 2020-06-18
CN109683983A (en) 2019-04-26

Similar Documents

Publication Publication Date Title
CN109683983B (en) Method and equipment for generating and loading mirror image file
CN102981864B (en) Signal conditioning package and information processing method
US20110213954A1 (en) Method and apparatus for generating minimum boot image
CN109753361B (en) Memory management method, electronic equipment and storage device
WO2017050064A1 (en) Memory management method and device for shared memory database
CN110704161B (en) Virtual machine creation method and device and computer equipment
CN110825419B (en) Firmware refreshing method and device, electronic equipment and storage medium
KR20150057068A (en) Data storage device and operating method thereof
CN104866388B (en) Data processing method and device
CN115509953A (en) Memory recovery method and device
US11409648B2 (en) Electronic apparatus and controlling method for performing memory swapping to reduce resource usage
CN106959906B (en) Information processing method, information processing device and electronic equipment
US9535796B2 (en) Method, apparatus and computer for data operation
US9904559B2 (en) Information processing apparatus and activation method therefor for processing data of a hibernation image
US10949340B2 (en) Block mapping systems and methods for storage device
US9372700B2 (en) Network boot system
CN113704177B (en) Storage method, system and related components of server firmware upgrade file
CN105068896A (en) Data processing method and device based on RAID backup
CN104268005B (en) Virtual machine awakening method and device
CN110647428B (en) Mirror image file manufacturing and recovering method, processor and embedded system
CN114020308A (en) Camera equipment upgrading method, device, equipment and medium
CN112148203B (en) Memory management method, device, electronic equipment and storage medium
CN113467698A (en) Writing method and device based on file system, computer equipment and storage medium
KR101618999B1 (en) Network boot system
KR101175355B1 (en) Apparatus for Controlling Storage, Mobile Device Including the Same and Method for Controlling Storage

Legal Events

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

Address after: 266555 Qingdao economic and Technological Development Zone, Shandong, Hong Kong Road, No. 218

Applicant after: Hisense Visual Technology Co., Ltd.

Address before: 266555 Qingdao economic and Technological Development Zone, Shandong, Hong Kong Road, No. 218

Applicant before: QINGDAO HISENSE ELECTRONICS Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant