WO2017173924A1 - Method and device for switching between file systems - Google Patents

Method and device for switching between file systems Download PDF

Info

Publication number
WO2017173924A1
WO2017173924A1 PCT/CN2017/077842 CN2017077842W WO2017173924A1 WO 2017173924 A1 WO2017173924 A1 WO 2017173924A1 CN 2017077842 W CN2017077842 W CN 2017077842W WO 2017173924 A1 WO2017173924 A1 WO 2017173924A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
file system
image
flash memory
memory
Prior art date
Application number
PCT/CN2017/077842
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 WO2017173924A1 publication Critical patent/WO2017173924A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/128Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • 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/44536Selecting among different versions

Definitions

  • the method further includes: acquiring the image file in the first file system by: Obtaining the image file in a system memory in a file system, wherein, when the image file is stored in an internal storage device, reading the image file from the internal storage device into the system memory, In the case where the image file is stored on the external server side, the image file is read into the system memory through a network transmission protocol.
  • the image file in the first file system is written into the flash memory of the first file system, wherein the image file is a mirror image obtained according to the running configuration file of the first file system and the system configuration file of the second file system. a package, the format of the image package being a format supported by the second file system; and restarting the first file system to switch the first file system to the second file system.
  • the technical solution provided by the present disclosure shortens the time consuming in the file system switching process and can accelerate the switching between operating systems.

Abstract

A method and device for switching between file systems. The method comprises: writing into flash of a first file system an image file of the first file system, wherein the image file is an image package obtained according to an operation configuration file of the first file system and system configuration file of a second file system, and the image package is formatted in a format supported by the second file system; and restarting the first file system so as to switch from the first file system to the second file system.

Description

切换文件系统的方法及装置Method and device for switching file system 技术领域Technical field
本公开涉及计算机技术领域,例如,涉及一种切换文件系统的方法及装置。The present disclosure relates to the field of computer technology, for example, to a method and apparatus for switching a file system.
背景技术Background technique
在相关技术中,由于操作系统Linux具有无可比拟的开源性而在设备制造商中得到越来越普遍的使用。出于兼容性的考虑,早期使用的嵌入实时操作系统Vxworks和操作系统Linux之间快速切换则成为很多设备商需要面临和解决的问题。In the related art, operating system Linux has become more and more popular among device manufacturers due to its unparalleled open source. For compatibility reasons, the fast switching between the embedded real-time operating system Vxworks and the operating system Linux has become a problem that many equipment vendors need to face and solve.
Vxworks与Linux系统切换的关键点很多,在基于文件系统的快速格式化和初始化中,由于Vxworks是基于闪存文件系统(True Flash File System,TFFS)的文件系统,而Linux是基于日志闪存文件系统(Journaling Flash File System,JFFS)的文件系统,所以在系统切换时,需要重新格式化和初始化闪存(flash)。例如,Vxworks升级到Linux系统,一般是在启动(boot)阶段,备份TFFS系统中的文件,格式初始化还原文件到JFFS系统。但这种做法有一点局限性,因为对闪存的操作非常耗时,所以整个系统升级在启动阶段需要20~30分钟,从而导致用户使用体验差。There are many key points in Vxworks and Linux system switching. In the fast format and initialization of file system, Vxworks is a file system based on True Flash File System (TFFS), and Linux is based on log flash file system ( Journaling Flash File System, JFFS) file system, so when the system is switched, you need to reformat and initialize the flash. For example, Vxworks is upgraded to a Linux system, usually in the boot phase, backing up files in the TFFS system, and formatting the restored files to the JFFS system. However, this approach has a limitation because the operation of the flash memory is very time consuming, so the entire system upgrade takes 20 to 30 minutes in the startup phase, resulting in poor user experience.
针对相关技术中,文件系统切换过程耗时太久的问题,还没有有效的解决方案。In the related art, there is no effective solution to the problem that the file system switching process takes too long.
发明内容Summary of the invention
本公开提供了一种切换文件系统的方法及装置,能够缩短文件系统切换过程的耗时,可以促进操作系统的快速切换。The present disclosure provides a method and apparatus for switching a file system, which can shorten the time consuming process of the file system switching process and can facilitate fast switching of the operating system.
本公开的第一个方面,提供了一种切换文件系统的方法,包括:In a first aspect of the present disclosure, a method of switching a file system is provided, including:
将第一文件系统中的镜像文件写入所述第一文件系统的闪存,其中,所述镜像文件为根据所述第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为所述第二文件系统所支持的格式;以及Writing an image file in the first file system to the flash memory of the first file system, where the image file is a mirror image obtained according to the running configuration file of the first file system and the system configuration file of the second file system a package, the format of the image package being a format supported by the second file system;
重启所述第一文件系统,以将所述第一文件系统切换至所述第二文件系统。 Restarting the first file system to switch the first file system to the second file system.
可选地,将第一文件系统中的镜像文件写入所述第一文件系统的闪存包括:Optionally, writing the image file in the first file system to the flash memory of the first file system includes:
在擦除所述闪存的过程中,在所述闪存中烧写所述镜像包。The image package is programmed in the flash memory during erasing of the flash memory.
可选地,在擦除所述闪存之前,所述方法还包括:Optionally, before erasing the flash memory, the method further includes:
在检测到所述闪存正在执行读写操作的情况下,将所述闪存中的内容备份到内存映像;以及Backing up the contents of the flash memory to a memory image if it is detected that the flash memory is performing a read or write operation;
对备份的所述闪存中的内容执行所述读写操作。The read and write operations are performed on the contents of the backed up flash memory.
可选地,将第一文件系统中的镜像文件写入所述第一文件系统的闪存之前,所述方法还包括:通过以下方式获取所述第一文件系统中的镜像文件:从所述第一文件系统中的系统内存中获取所述镜像文件,其中,在所述镜像文件存储在内部存储设备的情况下,从所述内部存储设备读取所述镜像文件到所述系统内存中,在所述镜像文件存储在外部服务器端的情况下,通过网络传输协议读取所述镜像文件到所述系统内存中。Optionally, before the image file in the first file system is written to the flash memory of the first file system, the method further includes: acquiring the image file in the first file system by: Obtaining the image file in a system memory in a file system, wherein, when the image file is stored in an internal storage device, reading the image file from the internal storage device into the system memory, In the case where the image file is stored on the external server side, the image file is read into the system memory through a network transmission protocol.
可选地,所述网络传输协议包括:传输控制协议TCP/因特网互联协议IP协议。Optionally, the network transmission protocol comprises: a transmission control protocol TCP/Internet Protocol IP protocol.
可选地,所述第一文件系统和所述第二文件系统均包括以下之一:嵌入实时操作系统Vxworks,视窗操作系统Windows,以及操作系统Linux。Optionally, the first file system and the second file system each comprise one of the following: an embedded real-time operating system Vxworks, a Windows operating system Windows, and an operating system Linux.
本公开的第二个方面,提供了一种切换文件系统的装置,包括:In a second aspect of the present disclosure, an apparatus for switching a file system is provided, including:
写入模块,设置为将第一文件系统中的镜像文件写入所述第一文件系统的闪存,其中,所述镜像文件为根据所述第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为所述第二文件系统所支持的格式;以及a writing module, configured to write an image file in the first file system to the flash memory of the first file system, where the image file is according to the running configuration file of the first file system and the second file system An image package obtained by the system configuration file, the format of the image package being a format supported by the second file system;
重启模块,设置为重启所述第一文件系统,以将所述第一文件系统切换至所述第二文件系统。And restarting the module, configured to restart the first file system to switch the first file system to the second file system.
可选地,所述写入模块还设置为在擦除所述闪存的过程中,在所述闪存中烧写所述镜像包。Optionally, the writing module is further configured to program the image package in the flash memory during erasing of the flash memory.
可选地,所述装置还包括:Optionally, the device further includes:
备份模块,设置为在擦除所述闪存之前,检测到所述闪存正在执行读写操作的情况下,将所述闪存中的内容备份到内存映像;以及 a backup module configured to back up content in the flash memory to a memory image if it is detected that the flash memory is performing a read or write operation before erasing the flash memory;
执行模块,设置为对备份的所述闪存中的内容执行所述读写操作。An execution module is configured to perform the read and write operations on content in the flashed backup.
可选地,所述写入模块,还设置为将第一文件系统中的镜像文件写入所述第一文件系统的闪存之前,从所述第一文件系统中的系统内存中获取所述镜像文件,其中,在所述镜像文件存储在内部存储设备的情况下,从所述内部存储设备读取所述镜像文件到所述系统内存中,在所述镜像文件存储在外部服务器端的情况下,通过网络传输协议读取所述镜像文件到所述系统内存中。Optionally, the writing module is further configured to: before the image file in the first file system is written into the flash memory of the first file system, obtain the image from the system memory in the first file system. a file, wherein, in a case where the image file is stored in an internal storage device, the image file is read from the internal storage device into the system memory, and in a case where the image file is stored on an external server side, The image file is read into the system memory by a network transfer protocol.
本公开还提供了一种非暂态计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行上述方法。The present disclosure also provides a non-transitory computer readable storage medium storing computer executable instructions arranged to perform the above method.
本公开还提供了一种电子设备,该电子设备包括:The present disclosure also provides an electronic device, the electronic device comprising:
至少一个处理器;以及At least one processor;
与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器执行上述的方法。The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform the method described above.
通过本公开,将第一文件系统中的镜像文件写入该第一文件系统的闪存,其中,该镜像文件为根据第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为该第二文件系统所支持的格式;以及重启该第一文件系统,以将该第一文件系统切换至该第二文件系统。本公开提供的技术方案,缩短了文件系统切换过程中的耗时能够加快操作系统之间的切换。Through the disclosure, the image file in the first file system is written into the flash memory of the first file system, wherein the image file is a mirror image obtained according to the running configuration file of the first file system and the system configuration file of the second file system. a package, the format of the image package being a format supported by the second file system; and restarting the first file system to switch the first file system to the second file system. The technical solution provided by the present disclosure shortens the time consuming in the file system switching process and can accelerate the switching between operating systems.
附图说明DRAWINGS
此处所说明的附图用来提供对本公开的理解,构成本申请的一部分,示意性实施例及其说明解释本公开。在附图中:The drawings described herein are provided to provide an understanding of the present disclosure, which is a part of this application, the illustrative embodiments and the description thereof. In the drawing:
图1是一实施例的切换文件系统的方法的流程图;1 is a flow chart of a method of switching a file system according to an embodiment;
图2是一实施例的一种切换文件系统的装置的结构框图一;2 is a structural block diagram 1 of an apparatus for switching a file system according to an embodiment;
图3是一实施例的一种切换文件系统的装置的结构框图二;3 is a structural block diagram 2 of an apparatus for switching a file system according to an embodiment;
图4是可选实施例的一种Vxworks系统切换到Linux系统的方法流程图;以及4 is a flow chart of a method for switching a Vxworks system to a Linux system in an alternative embodiment;
图5是一实施例的一种电子设备的硬件结构示意图。 FIG. 5 is a schematic diagram showing the hardware structure of an electronic device according to an embodiment.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本公开。在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。The present disclosure will be described in detail below with reference to the drawings in conjunction with the embodiments. The embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是区别类似的对象,而不必描述特定的顺序或先后次序。The terms "first", "second", and the like in the specification and claims of the present disclosure and the above-mentioned drawings are those which are different from each other, and do not necessarily describe a specific order or order.
在本实施例中提供了一种切换文件系统的方法,图1是本实施例的切换文件系统的方法的流程图。In the embodiment, a method for switching a file system is provided, and FIG. 1 is a flowchart of a method for switching a file system according to the embodiment.
在步骤110中,将第一文件系统中的镜像文件写入该第一文件系统的闪存(flash),其中,该镜像文件为根据第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为该第二文件系统所支持的格式。In step 110, the image file in the first file system is written into the flash of the first file system, where the image file is a system configuration according to the running configuration file of the first file system and the second file system. The image package obtained by the file. The format of the image package is the format supported by the second file system.
在步骤120中,重启该第一文件系统,以将该第一文件系统切换至该第二文件系统。In step 120, the first file system is restarted to switch the first file system to the second file system.
通过上述处理步骤,将第一文件系统中的镜像文件写入该第一文件系统的闪存,其中,该镜像文件为根据第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为该第二文件系统所支持的格式,重启该第一文件系统,以将该第一文件系统切换至该第二文件系统。该镜像包的格式为该第二文件系统所支持的格式,例如,第二文件系统可以位于Linux系统中,则镜像包的格式为Linux日志闪存文件系统(Journaling Flash File System,JFFS)格式,重启第一文件系统之后,终端调用系统内存中的镜像包,运行镜像包中的第一文件系统的运行配置文件,切换到了第二文件系统。本实施例的技术方案缩短了文件系统切换过程中的耗时,能够加快操作系统之间的切换。The image file in the first file system is written into the flash memory of the first file system by using the foregoing processing step, where the image file is obtained according to the running configuration file of the first file system and the system configuration file of the second file system. The image package is in a format supported by the second file system, and the first file system is restarted to switch the first file system to the second file system. The format of the image package is the format supported by the second file system. For example, the second file system can be located in the Linux system, and the format of the image package is the Journaling Flash File System (JFFS) format. After the first file system, the terminal invokes the image package in the system memory, runs the running configuration file of the first file system in the image package, and switches to the second file system. The technical solution of this embodiment shortens the time consuming in the file system switching process and can speed up the switching between operating systems.
在本实施例中,将第一文件系统中的镜像文件写入该第一文件系统的闪存可以包括:In this embodiment, writing the image file in the first file system to the flash memory of the first file system may include:
在擦除该闪存的过程中,在该闪存中烧写该镜像包。The image package is programmed in the flash memory during the erasing of the flash memory.
本实施例中,将镜像文件从第一文件系统的系统内存写入第一文件系统的闪存,可以边擦除内存边烧写镜像包,可以从第一文件系统的内存的头部地址开始烧写镜像包。 In this embodiment, the image file is written from the system memory of the first file system to the flash memory of the first file system, and the image package can be burned while erasing the memory, and can be burned from the head address of the memory of the first file system. Write the image package.
在本实施例中,在擦除该闪存之前,所述方法还可以包括:In this embodiment, before erasing the flash memory, the method may further include:
在检测到该闪存正在执行读写操作的情况下,将该闪存中的内容备份到内存映像,以及对备份的该闪存中的内容执行该读写操作。In the case where it is detected that the flash is performing a read or write operation, the contents of the flash are backed up to the memory image, and the read and write operations are performed on the contents of the backed up flash memory.
在执行文件切换任务的情况下,确保闪存处于空闲状态,如果此刻的闪存执行读写操作,则转移读写操作到其余位置。In the case of performing a file switching task, ensure that the flash memory is in an idle state, and if the flash memory at this moment performs a read or write operation, the read and write operations are transferred to the remaining positions.
在本实施例中,将第一文件系统中的镜像文件写入该第一文件系统的闪存之前,该方法还可以包括:通过以下方式获取第一文件系统中的镜像文件:从该第一文件系统中的系统内存中获取该镜像文件,其中,在该镜像文件存储在内部存储设备的情况下,从该内部存储设备读取该镜像文件到该系统内存中,在该镜像文件存储在外部服务器端的情况下,通过网络传输协议读取该镜像文件到该系统内存中。In this embodiment, before the image file in the first file system is written to the flash memory of the first file system, the method may further include: acquiring an image file in the first file system by: obtaining the image file from the first file system Obtaining the image file in the system memory in the system, wherein, when the image file is stored in the internal storage device, the image file is read from the internal storage device into the system memory, and the image file is stored in the external server. In the case of the end, the image file is read into the system memory by the network transfer protocol.
上述实施例的系统内存是运行第一文件系统的终端设备的系统内存,闪存中的镜像包是从系统镜像中获取得来的,系统内存中的镜像包从预先存储的地址获取得来,即在第一文件系统做好镜像文件的情况下,可以暂时将镜像文件存储在内部存储设备即本地存储或者外部服务器端(例如,网盘或云盘)。The system memory of the above embodiment is the system memory of the terminal device running the first file system, and the image package in the flash memory is obtained from the system image, and the image package in the system memory is obtained from the pre-stored address, that is, In the case that the first file system is an image file, the image file may be temporarily stored in an internal storage device, that is, a local storage or an external server (for example, a network disk or a cloud disk).
在本实施例中,该网络传输协议可以包括:传输控制协议(Transmission Control Protocol,TCP)/网络协议(Internet Protocol,IP)协议。本实施例的TCP/IP协议可以包括文件传输协议(File Transfer Protocol,FTP)以及简单文件传输协议(Trivial File Transfer Protocol,TFTP)。In this embodiment, the network transmission protocol may include: a Transmission Control Protocol (TCP)/Internet Protocol (IP) protocol. The TCP/IP protocol of this embodiment may include a File Transfer Protocol (FTP) and a Trivial File Transfer Protocol (TFTP).
在本实施例中,该第一文件系统和该第二文件系统均可以包括以下之一:嵌入实时操作系统Vxworks,视窗操作系统Windows,以及操作系统Linux。In this embodiment, the first file system and the second file system may each include one of the following: embedded real-time operating system Vxworks, Windows operating system Windows, and operating system Linux.
本实施例是关于两种不同文件系统格式的系统切换,可以包括上述三种系统。This embodiment relates to system switching of two different file system formats, and may include the above three systems.
在本实施例中还提供了一种切换文件系统的装置,该装置可以实现上述实施例及可选实施方式中的方法。如以下所使用的,术语“模块”可以实现预定功能的软件和硬件中的至少一种。尽管以下实施例所描述的装置可以以软件来实现,但是硬件,或者软件和硬件的组合也可以实现上述装置。Also provided in this embodiment is a device for switching a file system, which can implement the methods in the above embodiments and alternative embodiments. As used hereinafter, the term "module" can implement at least one of software and hardware for a predetermined function. Although the apparatus described in the following embodiments may be implemented in software, hardware, or a combination of software and hardware, may also implement the above apparatus.
图2是本实施例的一种切换文件系统的装置的结构框图一,如图2所示,该装置包括:写入模块22和重启模块24。 FIG. 2 is a structural block diagram of an apparatus for switching a file system according to the embodiment. As shown in FIG. 2, the apparatus includes: a write module 22 and a restart module 24.
写入模块22设置为将第一文件系统中的镜像文件写入该第一文件系统的闪存,其中,该镜像文件为根据第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为该第二文件系统所支持的格式。The writing module 22 is configured to write the image file in the first file system to the flash memory of the first file system, wherein the image file is obtained according to the running configuration file of the first file system and the system configuration file of the second file system. The image package is in the format supported by the second file system.
重启模块24,与写入模块22连接,设置为重启该第一文件系统,以将该第一文件系统切换至该第二文件系统。The restart module 24 is coupled to the write module 22 and configured to restart the first file system to switch the first file system to the second file system.
通过上述步骤,写入模块22将第一文件系统中的镜像文件写入该第一文件系统的闪存,其中,该镜像文件为根据第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为该第二文件系统所支持的格式,重启模块24重启该第一文件系统,以将该第一文件系统切换至该第二文件系统。上述实施例的系统镜像是运行第一文件系统的终端设备的系统内存,该镜像包的格式为该第二文件系统所支持的格式,例如,第二文件系统是Linux系统,则镜像包的格式为Linux JFFS文件系统格式,重启第一文件系统之后,终端调用系统内存中的镜像包,运行镜像包中的第一文件系统的运行配置文件,切换到了第二文件系统。本实施例的技术方案,缩短了文件系统切换过程的耗时,能够促进操作系统之间的快速切换。Through the above steps, the writing module 22 writes the image file in the first file system to the flash memory of the first file system, wherein the image file is a system configuration according to the running configuration file of the first file system and the second file system. The image packet obtained by the file is in a format supported by the second file system, and the restart module 24 restarts the first file system to switch the first file system to the second file system. The system image of the foregoing embodiment is the system memory of the terminal device running the first file system, and the format of the image package is a format supported by the second file system. For example, the second file system is a Linux system, and the format of the image package is For the Linux JFFS file system format, after restarting the first file system, the terminal invokes the image package in the system memory, runs the running configuration file of the first file system in the image package, and switches to the second file system. The technical solution of the embodiment shortens the time consuming of the file system switching process and can facilitate fast switching between operating systems.
在本实施例中,该写入模块22还可以设置为在擦除该闪存的过程中,在该闪存中烧写该镜像包。In this embodiment, the write module 22 can also be configured to program the image package in the flash memory during the erasing of the flash memory.
图3是本实施例的一种切换文件系统的装置的结构框图二,如图3所示,在上述装置实施例的基础上,该装置还可以包括:备份模块32和执行模块34。FIG. 3 is a block diagram showing the structure of an apparatus for switching a file system according to the embodiment. As shown in FIG. 3, the apparatus may further include: a backup module 32 and an execution module 34.
备份模块32设置为在擦除该内存之前,检测到该内存正在执行读写操作的情况下,将该内存中的内容备份到内存映像。The backup module 32 is configured to back up the contents of the memory to the memory image if it is detected that the memory is performing a read or write operation before erasing the memory.
执行模块34,与备份模块32连接,设置为对备份的该内存中的内容执行该读写操作。The execution module 34 is connected to the backup module 32 and configured to perform the read and write operations on the contents of the backed up memory.
该写入模块22还可以设置为将第一文件系统中的镜像文件写入所述第一文件系统的闪存之前,从该第一文件系统中的系统内存中获取该镜像文件,其中,在该镜像文件存储在内部存储设备的情况下,从该内部存储设备读取该镜像文件到该系统内存中,在该镜像文件存储在外部服务器端的情况下,通过网络传输协议读取该镜像文件到该系统内存中。The writing module 22 may be further configured to obtain the image file from the system memory in the first file system before writing the image file in the first file system to the flash memory of the first file system, where If the image file is stored in the internal storage device, the image file is read from the internal storage device into the system memory, and when the image file is stored on the external server, the image file is read by the network transmission protocol. In system memory.
上述模块是可以通过软件或硬件来实现的,对于硬件实现方式,可以通过 以下方式实现:上述模块均位于同一处理器中;或者,上述模块分别位于不同的处理器中。The above modules can be implemented by software or hardware. For hardware implementation, The following methods are implemented: the above modules are all located in the same processor; or, the above modules are respectively located in different processors.
本公开可选实施例记载的是Vxworks系统切换到Linux系统,该切换过程包括:制作镜像包,镜像包上传到Vxworks系统的内存空间,以及非易失闪存技术Nor flash基于闪存驱动的片上读写和擦除。An alternative embodiment of the present disclosure describes that the Vxworks system switches to a Linux system. The switching process includes: creating an image package, uploading the image package to the memory space of the Vxworks system, and non-volatile flash technology. Nor flash flash-based on-chip read and write. And erase.
制作镜像包过程中,此镜像包可以为Linux JFFS文件系统格式,镜像包的内容可以包含有Linux软件版本文件以及Vxworks的运行配置文件等。During the process of making an image package, the image package can be in the Linux JFFS file system format. The contents of the image package can include the Linux software version file and the running configuration file of Vxworks.
镜像包上传到Vxworks系统的内存空间过程中,若镜像包为内部系统存储(如小型快闪(Compact Flash,CF)卡或闪存(flash))则可以读取文件到系统内存;若镜像包为外部服务器存储(例如网盘或云盘),则可以通过TCP/IP协议(如FTP或TFTP)传输到系统内存。When the image package is uploaded to the memory space of the Vxworks system, if the image package is internal system storage (such as Compact Flash (CF) card or flash (flash)), the file can be read to the system memory; External server storage (such as a network disk or cloud disk) can be transferred to system memory via TCP/IP protocols such as FTP or TFTP.
本公开可选实施例记载的方法中,系统切换过程是在Vxworks运行的状态下进行,保证切换文件系统过程中不断电,且没有对闪存读写的操作,如果存在其余读写闪存的操作,则将闪存备份到内存映像,在内存映像里访问该闪存;以及镜像包大小与镜像包包含的内容有关,终端可以动态内存分配(Memory Allocation,malloc)的系统内存空间大于镜像包的大小。In the method described in the optional embodiment of the present disclosure, the system switching process is performed in a state where the Vxworks is running, ensuring that the file system is continuously powered during the process of switching the file system, and there is no operation for reading and writing to the flash memory, and if there are other operations for reading and writing the flash memory, The flash memory is backed up to the memory image, and the flash memory is accessed in the memory image; and the size of the image package is related to the content of the image package, and the system memory space of the memory memory allocation (Memory Allocation, malloc) is larger than the size of the image package.
本公开可选实施例是在Vxworks运行状态下,备份闪存中配置文件,将备份文件与Linux版本文件一起生成Linux文件系统镜像包并上传至内存空间,擦除全部闪存,烧写Linux镜像包,重启Vxworks系统。通过该方法,可以在Vxworks运行的状态下实现系统的切换升级,在启动(boot)状态下可以启动Linux版本,缩短了业务中断时间。In an alternative embodiment of the present disclosure, in the Vxworks running state, the configuration file in the flash memory is backed up, the backup file is generated together with the Linux version file to generate a Linux file system image package and uploaded to the memory space, all the flash memory is erased, and the Linux image package is programmed. Restart the Vxworks system. With this method, the system can be upgraded and upgraded in the state where Vxworks is running, and the Linux version can be started in the boot state, which shortens the service interruption time.
图4是本公开可选实施例的一种Vxworks系统切换到linux系统的方法流程图。4 is a flow chart of a method for switching a Vxworks system to a Linux system according to an alternative embodiment of the present disclosure.
在步骤410中,运行Vxworks系统。In step 410, the Vxworks system is run.
在步骤420中,备份闪存中需要保存的配置文件。In step 420, the configuration file that needs to be saved in the flash memory is backed up.
在步骤430中,与准备切换的Linux版本文件一起制作成Linux文件系统镜像包。此镜像包可以暂时保存在内部系统存储设备中(文件形式存储,存储设备可以包括CF卡或闪存等),也可以保存在外部服务器端。In step 430, a Linux file system image package is created together with the Linux version file to be switched. This image package can be temporarily saved in the internal system storage device (file format storage, the storage device can include CF card or flash memory, etc.), or it can be saved on the external server.
在步骤440中,擦除Vxworks系统的闪存。 In step 440, the flash memory of the Vxworks system is erased.
在步骤450中,申请终端的系统内存空间,若步骤430中制作的镜像包保存在内部系统存储设备中,则可以从存储设备读取镜像包到系统内存空间中;若步骤430中制作的镜像包保存在外部服务器端,则可以通过TCP/IP协议(包括FTP或TFTP等)上传镜像包到系统内存空间。In step 450, the system memory space of the terminal is applied. If the image package created in step 430 is saved in the internal system storage device, the image package may be read from the storage device into the system memory space; if the image created in step 430 is mirrored The package is saved on the external server, and the image package can be uploaded to the system memory space through TCP/IP protocol (including FTP or TFTP, etc.).
在步骤460中,对擦除后的闪存进行按地址写操作,从闪存的头部地址开始烧写存储在系统内存中的镜像包。In step 460, the erased flash memory is subjected to an address write operation, and the image package stored in the system memory is programmed from the head address of the flash memory.
在步骤470中,在烧写完成之后,重启Vxworks系统,切换到Linux系统。In step 470, after the programming is completed, the Vxworks system is restarted and switched to the Linux system.
上述步骤430中制作的镜像包,为切换后的目标文件系统格式的镜像包,镜像包包含的文件内容可以自定义。The image package created in the above step 430 is an image package of the target file system format after the switch, and the file content included in the image package can be customized.
上述步骤440中擦除闪存操作可以与步骤450调换,或者与步骤460合并,即在烧写闪存前,边擦除闪存边烧写镜像包。The erase flash operation in step 440 above may be swapped with step 450 or merged with step 460 to erase the flash while burning the image pack before burning the flash.
本公开可选实施例是基于Vxworks系统切换至Linux系统,两种不同文件系统格式的切换,均可以使用上述步骤,例如,Linux切换至Vxworks,或者Linux切换至Windows等。An alternative embodiment of the present disclosure is to switch to a Linux system based on the Vxworks system, and the switching of two different file system formats may use the above steps, for example, switching from Linux to Vxworks, or switching from Linux to Windows.
整个切换文件系统的过程在Vxworks运行状态下进行,可以保证业务流不中断。The entire process of switching file systems is performed under Vxworks running state, which ensures that the service flow is not interrupted.
采用本公开可选实施例的方法,可以缩短由于系统版本切换导致的业务中断时间。With the method of the alternative embodiment of the present disclosure, the service interruption time due to system version switching can be shortened.
通过以上的实施方式的描述,上述实施例的方法可借助软件加硬件平台的方式来实现,也可以通过硬件的方式实现。本公开的技术方案本质上可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟、光盘)中,包括一个或多个指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行上述实施例所述的方法。Through the description of the foregoing embodiments, the method in the foregoing embodiment may be implemented by means of a software plus a hardware platform, or may be implemented by using a hardware. The technical solution of the present disclosure can be embodied in the form of a software product stored in a storage medium (such as a read-only memory (ROM), a random access memory (RAM). , a disk, an optical disk, including one or more instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method described in the above embodiments.
本公开还提供了一种非暂态计算机可读存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储有计算机可执行指令,所述计算机可执行指令设置为执行以下方法:The present disclosure also provides a non-transitory computer readable storage medium. Optionally, in this embodiment, the foregoing storage medium may be configured to store computer executable instructions, the computer executable instructions being configured to perform the following methods:
将第一文件系统中的镜像文件写入该第一文件系统的闪存,其中,该镜像文件为根据第一文件系统的运行配置文件与第二文件系统的系统配置文件得到 的镜像包,该镜像包的格式为该第二文件系统所支持的格式;以及Writing an image file in the first file system to the flash memory of the first file system, where the image file is obtained according to the running configuration file of the first file system and the system configuration file of the second file system Image package, the format of the image package is the format supported by the second file system;
重启该第一文件系统,以将该第一文件系统切换至该第二文件系统。The first file system is restarted to switch the first file system to the second file system.
可选地,存储介质还被设置为存储有计算机可执行指令,所述计算机可执行指令设置为执行上述实施例的方法。Optionally, the storage medium is further arranged to store computer executable instructions arranged to perform the method of the above-described embodiments.
可选地,在本实施例中,上述存储介质可以是非暂态存储介质,包括:U盘、ROM、RAM、移动硬盘、磁碟或者光盘等多种可以存储程序代码的介质,也可以是暂态存储介质。Optionally, in this embodiment, the foregoing storage medium may be a non-transitory storage medium, including: a U disk, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk, and the like, which may store the program code, or may be temporarily State storage medium.
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行上述实施例所述的方法步骤。Optionally, in this embodiment, the processor performs the method steps described in the foregoing embodiments according to the stored program code in the storage medium.
可选地,本实施例中的示例可以参考上述实施例及可选实施方式中所描述的示例。Optionally, examples in this embodiment may refer to the examples described in the foregoing embodiments and optional embodiments.
本实施例提供了一种电子设备的硬件结构示意图。参见图5,该电子设备包括:This embodiment provides a hardware structure diagram of an electronic device. Referring to FIG. 5, the electronic device includes:
至少一个处理器(processor)50,图5中以一个处理器50为例;以及存储器(memory)51,还可以包括通信接口(Communications Interface)52和总线53。其中,处理器50、存储器51以及通信接口52可以通过总线53完成相互间的通信,存储器51为闪存。通信接口52可以传输信息。处理器50可以调用存储器51中的逻辑指令,以执行上述实施例的方法。At least one processor 50, which is exemplified by a processor 50 in FIG. 5; and a memory 51, may further include a communication interface 52 and a bus 53. The processor 50, the memory 51, and the communication interface 52 can complete communication with each other through the bus 53, and the memory 51 is a flash memory. Communication interface 52 can transmit information. Processor 50 can invoke logic instructions in memory 51 to perform the methods of the above-described embodiments.
此外,上述的存储器51中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。Furthermore, the logic instructions in the memory 51 described above may be implemented in the form of software functional units and sold or used as separate products, and may be stored in a computer readable storage medium.
存储器51作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序,如本实施例中的方法对应的程序指令或模块。处理器50通过运行存储在存储器51中的软件程序、指令或模块,从而执行功能应用以及数据处理,即实现上述方法实施例中的方法。The memory 51 is a computer readable storage medium and can be used to store a software program, a computer executable program, a program instruction or a module corresponding to the method in the embodiment. The processor 50 executes the functional application and the data processing by executing a software program, an instruction or a module stored in the memory 51, that is, implementing the method in the above method embodiment.
存储器51可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端设备的使用所创建的数据等。此外,存储器51可以包括高速随机存取存储器,还可以包括非易失性存储器。The memory 51 may include a storage program area and an storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may store data created according to use of the terminal device, and the like. Further, the memory 51 may include a high speed random access memory, and may also include a nonvolatile memory.
上述的本公开的模块或步骤可以用通用的计算装置来实现,它们可以集中 在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在一些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成多个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。The modules or steps of the present disclosure described above can be implemented with a general purpose computing device that can be centralized On a single computing device, or distributed over a network of computing devices, optionally, they may be implemented in program code executable by the computing device so that they may be stored in the storage device by the computing device To be performed, and in some cases, the steps shown or described may be performed in an order different than that herein, or they may be separately fabricated into a plurality of integrated circuit modules, or a plurality of A single integrated circuit module is implemented.
工业实用性Industrial applicability
本公开提供的切换文件系统的方法及装置,缩短了文件系统切换过程的耗时,促进操作系统之间的快速切换。 The method and apparatus for switching file systems provided by the present disclosure shorten the time consuming of the file system switching process and promote fast switching between operating systems.

Claims (11)

  1. 一种切换文件系统的方法,包括:A method of switching a file system, comprising:
    将第一文件系统中的镜像文件写入所述第一文件系统的闪存,其中,所述镜像文件为根据所述第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为所述第二文件系统所支持的格式;以及Writing an image file in the first file system to the flash memory of the first file system, where the image file is a mirror image obtained according to the running configuration file of the first file system and the system configuration file of the second file system a package, the format of the image package being a format supported by the second file system;
    重启所述第一文件系统,以将所述第一文件系统切换至所述第二文件系统。Restarting the first file system to switch the first file system to the second file system.
  2. 根据权利要求1所述的方法,其中,将第一文件系统中的镜像文件写入所述第一文件系统的闪存包括:The method of claim 1, wherein writing the image file in the first file system to the flash memory of the first file system comprises:
    在擦除所述闪存的过程中,在所述闪存中烧写所述镜像包。The image package is programmed in the flash memory during erasing of the flash memory.
  3. 根据权利要求2所述的方法,在擦除所述闪存之前,所述方法还包括:The method of claim 2, before erasing the flash memory, the method further comprising:
    在检测到所述闪存正在执行读写操作的情况下,将所述闪存中的内容备份到内存映像;以及Backing up the contents of the flash memory to a memory image if it is detected that the flash memory is performing a read or write operation;
    对备份的所述闪存中的内容执行所述读写操作。The read and write operations are performed on the contents of the backed up flash memory.
  4. 根据权利要求1所述的方法,将第一文件系统中的镜像文件写入所述第一文件系统的闪存之前,所述方法还包括:通过以下方式获取所述第一文件系统中的镜像文件:The method of claim 1, before the image file in the first file system is written to the flash memory of the first file system, the method further comprising: acquiring the image file in the first file system by: :
    从所述第一文件系统中的系统内存中获取所述镜像文件,其中,在所述镜像文件存储在内部存储设备的情况下,从所述内部存储设备读取所述镜像文件到所述系统内存中,在所述镜像文件存储在外部服务器端的情况下,通过网络传输协议读取所述镜像文件到所述系统内存中。Obtaining the image file from system memory in the first file system, wherein the image file is read from the internal storage device to the system if the image file is stored in an internal storage device In the memory, in a case where the image file is stored on the external server side, the image file is read into the system memory through a network transmission protocol.
  5. 根据权利要求4所述的方法,其中,所述网络传输协议包括:The method of claim 4 wherein said network transmission protocol comprises:
    传输控制协议TCP/因特网互联协议IP协议。Transmission Control Protocol TCP/Internet Protocol IP protocol.
  6. 根据权利要求1至5中任一项所述的方法,其中,The method according to any one of claims 1 to 5, wherein
    所述第一文件系统和所述第二文件系统均包括以下之一:嵌入实时操作系 统Vxworks,视窗操作系统Windows,以及操作系统Linux。The first file system and the second file system each include one of the following: embedding a real-time operating system Vxworks, Windows operating system Windows, and operating system Linux.
  7. 一种切换文件系统的装置,包括:A device for switching a file system, comprising:
    写入模块,设置为将第一文件系统中的镜像文件写入所述第一文件系统的闪存,其中,所述镜像文件为根据所述第一文件系统的运行配置文件与第二文件系统的系统配置文件得到的镜像包,该镜像包的格式为所述第二文件系统所支持的格式;以及a writing module, configured to write an image file in the first file system to the flash memory of the first file system, where the image file is according to the running configuration file of the first file system and the second file system An image package obtained by the system configuration file, the format of the image package being a format supported by the second file system;
    重启模块,设置为重启所述第一文件系统,以将所述第一文件系统切换至所述第二文件系统。And restarting the module, configured to restart the first file system to switch the first file system to the second file system.
  8. 根据权利要求7所述的装置,其中,所述写入模块还设置为在擦除所述闪存的过程中,在所述闪存中烧写所述镜像包。The apparatus of claim 7, wherein the write module is further configured to program the image package in the flash memory during erasing of the flash memory.
  9. 根据权利要求8所述的装置,所述装置还包括:The apparatus of claim 8 further comprising:
    备份模块,设置为在擦除所述闪存之前,检测到所述闪存正在执行读写操作的情况下,将所述闪存中的内容备份到内存映像;以及a backup module configured to back up content in the flash memory to a memory image if it is detected that the flash memory is performing a read or write operation before erasing the flash memory;
    执行模块,设置为对备份的所述闪存中的内容执行所述读写操作。An execution module is configured to perform the read and write operations on content in the flashed backup.
  10. 根据权利要求7所述的装置,其中,所述写入模块,还设置为将第一文件系统中的镜像文件写入所述第一文件系统的闪存之前,从所述第一文件系统中的系统内存中获取所述镜像文件,其中,在所述镜像文件存储在内部存储设备的情况下,从所述内部存储设备读取所述镜像文件到所述系统内存中,在所述镜像文件存储在外部服务器端的情况下,通过网络传输协议读取所述镜像文件到所述系统内存中。The apparatus according to claim 7, wherein said writing module is further configured to write an image file in said first file system from said first file system before said flash memory of said first file system Obtaining the image file in a system memory, wherein, when the image file is stored in an internal storage device, reading the image file from the internal storage device into the system memory, where the image file is stored In the case of an external server side, the image file is read into the system memory by a network transport protocol.
  11. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行权利要求1-6中任一项的方法。 A computer readable storage medium storing computer executable instructions arranged to perform the method of any of claims 1-6.
PCT/CN2017/077842 2016-04-06 2017-03-23 Method and device for switching between file systems WO2017173924A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610210382.X 2016-04-06
CN201610210382.XA CN107273370A (en) 2016-04-06 2016-04-06 Switching system method and device

Publications (1)

Publication Number Publication Date
WO2017173924A1 true WO2017173924A1 (en) 2017-10-12

Family

ID=60000866

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/077842 WO2017173924A1 (en) 2016-04-06 2017-03-23 Method and device for switching between file systems

Country Status (2)

Country Link
CN (1) CN107273370A (en)
WO (1) WO2017173924A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231176A (en) * 2020-10-14 2021-01-15 天津津航计算技术研究所 Simple and convenient log recording method for VxWorks operating system
CN113778747A (en) * 2021-08-11 2021-12-10 江苏深网科技有限公司 Method for analyzing format of mirror image file of equipment system

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110515751B (en) * 2018-05-22 2023-05-12 中车株洲电力机车研究所有限公司 Method and system for loading and running VxWorks real-time protection process

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102135908A (en) * 2010-01-25 2011-07-27 研祥智能科技股份有限公司 Method, device and computer system for switching operating system
CN103309737A (en) * 2012-03-07 2013-09-18 联想(北京)有限公司 Method and device for switching operating system
CN103425527A (en) * 2012-05-23 2013-12-04 腾讯科技(深圳)有限公司 Multi-system switching method and switching device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102135908A (en) * 2010-01-25 2011-07-27 研祥智能科技股份有限公司 Method, device and computer system for switching operating system
CN103309737A (en) * 2012-03-07 2013-09-18 联想(北京)有限公司 Method and device for switching operating system
CN103425527A (en) * 2012-05-23 2013-12-04 腾讯科技(深圳)有限公司 Multi-system switching method and switching device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231176A (en) * 2020-10-14 2021-01-15 天津津航计算技术研究所 Simple and convenient log recording method for VxWorks operating system
CN112231176B (en) * 2020-10-14 2023-03-03 天津津航计算技术研究所 Simple and convenient log recording method for VxWorks operating system
CN113778747A (en) * 2021-08-11 2021-12-10 江苏深网科技有限公司 Method for analyzing format of mirror image file of equipment system
CN113778747B (en) * 2021-08-11 2023-08-29 江苏深网科技有限公司 Equipment system mirror image file format analysis method

Also Published As

Publication number Publication date
CN107273370A (en) 2017-10-20

Similar Documents

Publication Publication Date Title
US8539471B2 (en) Updating firmware of an electronic device
CN107870968B (en) Performing real-time updates to a file system volume
CN109634645B (en) Firmware upgrading method and terminal
US8918778B2 (en) Method of fail safe flashing management device and application of the same
TW201729123A (en) Method and server for remote launching deployment utility
US20150074386A1 (en) Boot method and boot system
WO2013103023A1 (en) Information processing device, information processing method, and computer program
US20170286234A1 (en) System and method for live virtual incremental restoring of data from cloud storage
US9983791B2 (en) System management controller and method of configuration file backup and recovery
CN102521289B (en) File synchronization method, device and system
WO2018032757A1 (en) Method and device for updating component
WO2011088701A1 (en) Method and device for online upgrading cross-platform version
JP6070360B2 (en) Information processing apparatus and processing method thereof
WO2017173924A1 (en) Method and device for switching between file systems
WO2017000567A1 (en) Bootrom upgrading method and device
WO2015127730A1 (en) Method and apparatus for running version file
WO2018049798A1 (en) Method and apparatus for reconstructing cache partition
CN109582332B (en) System upgrading method and device for Internet camera
WO2018036166A1 (en) Upgrade package reading method and device
US8949588B1 (en) Mobile telephone as bootstrap device
CN104866397A (en) Computer System And Control Method
US20160170869A9 (en) Systems and methods for in-place reorganization of device storage
CN114020308A (en) Camera equipment upgrading method, device, equipment and medium
CN106611124A (en) Computer device and boot method thereof
JP2008077474A (en) Firmware update method, electronic device and firmware update program

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 17778588

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17778588

Country of ref document: EP

Kind code of ref document: A1