Equipment starting method and system, computer program product and implementation method
By setting hidden partitions on the hard disk and starting the operating system with preinstalled operating system files, the problem of operating system being vulnerable to attacks at startup is solved, and the system is stable and securely booted.
Patent Information
- Application Number
- CN202411448102.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-11
AI Technical Summary
When the existing operating system starts, since the relevant files of the kernel and file system are directly stored on the hard disk, it is susceptible to user misoperation or malicious programs, resulting in system startup failure, instability or crash, data loss and other problems.
By setting a hidden partition on the device's hard disk, pre-installed operating system files are stored in the first partition and user data are stored in the second partition. At startup, the operating system kernel and file system are loaded into memory through the bootloader in the preinstalled operating system file, and the file system is associated with the second partition to access user data through the operating system.
Ensure that the operating system can be restored to its initial state every time the device is started, preventing misoperation or malicious program attacks, avoiding system corruption and data loss, and improving system stability and security.
Smart Images

Figure CN119415174A_ABST
Abstract
Description
Technical Field
[0001] The present specification relates to the field of communication technology, and in particular to a device startup method, system, computer program product, and a method for implementing a self-recovery system. Background Art
[0002] The operating system includes a kernel and a file system. The kernel can manage hardware resources and provide low-level services, such as CPU scheduling, memory management, process management, device drivers, and network communications. The file system can define how to organize and name files on storage devices, and provide interfaces for operations such as file creation, deletion, opening, reading, and writing. Since the kernel of the operating system and several related files of the file system are directly stored on the hard disk, operations performed on the kernel of the operating system and related files of the file system (such as user misoperation or attacks by malicious programs) will be written to the hard disk, affecting the next startup of the operating system. Summary of the invention
[0003] One or more embodiments of the present specification provide a device startup method, comprising: in response to a power-on instruction, running a boot program in a preinstalled operating system file to load the kernel and file system of the operating system in the preinstalled operating system file into the memory of the device; and running the kernel and file system of the operating system in the memory of the device.
[0004] According to the method described in some embodiments of the present specification, the pre-installed operating system file is stored in the first partition of the hard disk of the device; the hard disk of the device also has a second partition; the method also includes: associating the second partition with the file system of the operating system so that the second partition can be accessed through the operating system; the second partition is used to store user data; the first partition and the second partition are hidden partitions.
[0005] According to the method described in some embodiments of this specification, the pre-installed operating system file is in the image file format; the operating system is a Linux system; the kernel and the file system are customized.
[0006] According to the method described in some embodiments of this specification, the preinstalled operating system file is stored in a mobile storage medium outside the device.
[0007] One or more embodiments of the present specification provide a device startup system, including: a boot module, which runs a boot program in a preinstalled operating system file in response to a power-on instruction to load the kernel and file system of the operating system in the preinstalled operating system file into the memory of the device; and an operation module, which is used to run the kernel and file system of the operating system in the memory of the device.
[0008] The system according to some embodiments of the present specification is characterized in that it also includes: an access module, which is used to associate the file system in the operating system with the second partition of the device for storing user data so that the second partition can be accessed through the operating system.
[0009] One or more embodiments of the present specification provide a computer program product, including computer codes, and when at least part of the computer codes is executed by a processor, any of the above-described methods can be implemented.
[0010] One or more embodiments of the present specification provide a method for implementing a self-recovery system, including: customizing an operating system kernel and a file system; generating and storing a preinstalled operating system file based on the operating system kernel and the file system; when starting a device, loading the operating system kernel and the file system in the preinstalled operating system file into the device's memory through a boot program in the preinstalled operating system file, so that the operating system kernel and the file system run in the device's memory.
[0011] According to the implementation method described in some embodiments of this specification, the operating system is a Linux operating system; the pre-installed operating system file is in an image file format; and the kernel of the customized operating system includes: tailoring the original kernel based on the configuration requirements of a preset device so that the kernel of the operating system can run in the memory together with the file system.
[0012] According to the implementation method described in some embodiments of this specification, customizing the file system of the operating system includes: deleting a temporary file storage directory or a temporary directory storage directory in the file system.
[0013] According to the implementation method described in some embodiments of the present specification, it also includes: storing the pre-installed operating system file in the first partition of the hard disk of the device; when starting the device, associating the file system with the second partition of the hard disk of the device so that the second partition can be accessed through the operating system, wherein the second partition is used to store user data; setting both the first partition and the second partition to be hidden partitions.
[0014] According to the implementation method described in some embodiments of the present specification, it also includes: configuring the system command related to the file system to: when the output data of the system command includes file-related information of the first partition and / or the second partition, deleting the file-related information of the first partition and / or the second partition in the output data, wherein the file-related information includes the storage path and / or file name of the file in the first partition and / or the second partition; or configuring the system command related to the file system to: when the input data of the system command includes file-related information of the first partition and / or the second partition, deleting the file-related information of the first partition and / or the second partition in the input data before executing.
[0015] According to the implementation method described in some embodiments of the present specification, it also includes: customizing a command line tool; generating and storing pre-installed operating system files based on the kernel of the operating system and the file system, further including: generating and storing the pre-installed operating system files based on the kernel of the operating system, the file system, and the command line tool; wherein the command line tool is configured to: when the code of the command line tool includes file-related information in the first partition and / or the second partition, the file-related information in the first partition and / or the second partition in the code is represented in ciphertext; the file-related information includes the storage path and / or file name of the file in the first partition and / or the second partition. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] This specification will be further explained by way of exemplary embodiments, which will be described in detail by way of the accompanying drawings. The same numbers in the drawings represent the same structures or steps.
[0017] Figure 1 It is a module diagram of an operating system according to some embodiments of this specification.
[0018] Figure 2 It is a flowchart of a device startup method according to some embodiments of this specification.
[0019] Figure 3 It is a flowchart of a method for implementing a self-recovery system according to some embodiments of this specification.
[0020] Figure 4 is an exemplary block diagram of a device startup system according to some embodiments of the present specification. DETAILED DESCRIPTION
[0021] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the embodiments will be described in detail below with reference to the accompanying drawings. Obviously, the contents described below are some examples or embodiments of this specification. For ordinary technicians in this field, without paying creative work, the technical solutions or means disclosed in this specification can also be applied to other scenarios based on these technical contents.
[0022] It should be understood that the "system", "device", "unit" and / or "module" used in this specification is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.
[0023] Unless otherwise specified, technical terms used in this specification to describe components, elements, etc. do not refer to the singular, but may also include the plural. Generally speaking, terms such as "include", "comprise", etc. only indicate that the steps, elements, or components that have been clearly identified are included, and these steps, elements, and components do not constitute an exclusive list, such as the method or device described may also include other steps or components.
[0024] Flowcharts are used in this specification to illustrate the operation steps performed by the device or system of the relevant embodiments, but unless otherwise specified, the order used to describe these steps should not be understood as a limitation on the order in which the steps are performed. A person of ordinary skill in the art can adjust the order in which these steps are performed based on the knowledge and information conveyed by the embodiments of this specification, and the adjustment includes but is not limited to swapping the order, merging multiple steps, and splitting a certain step.
[0025] Operating System (OS) is the basic software of a computer, which is used to control and manage the hardware and software resources of the computer and provide a convenient environment for users. The operating system can be an interface between the user and the computer, or an interface between the computer hardware and other software. The functions of the operating system may include: managing the hardware, software and data resources of the computer system, controlling the running of programs, maximizing the use of computer system resources, providing various forms of user interfaces, and providing necessary services and corresponding interfaces for the development of other software.
[0026] Figure 1 is a schematic diagram of a module of an operating system shown in some embodiments of this specification, see Figure 1As shown, in some embodiments, the operating system may include a kernel and a file system. In some embodiments, the kernel may manage hardware resources and provide underlying services, such as CPU scheduling, memory management, process management, device drivers, and network communications. The kernel may be a bridge between system software and hardware, and may ensure that hardware resources are effectively and safely allocated to various applications for use. In some embodiments, the file system may define how to organize and name files on a storage device, and provide interfaces for operations such as file creation, deletion, opening, reading, and writing.
[0027] See also Figure 1 As shown, in some embodiments, the operating system, such as a customized operating system, may further include a command line tool, such as a command line script. In some embodiments, the command line tool may be a collection of a series of executable commands for automating tasks in the operating system. By writing a command line, the user can simplify a complex operation process into a single command, thereby improving work efficiency. In some embodiments, command line tools, such as command line scripts, are used in a variety of operating systems, such as Shell scripts in Unix / Linux systems, and batch scripts (such as .bat files) in Windows systems. In some embodiments, the commands in the script are executed in sequence and may include control structures such as conditional judgments and loops to achieve more complex logical processing.
[0028] In some embodiments, the kernel of the operating system is stored in the hard disk and loaded from the hard disk into the memory through the boot program. Exemplarily, in some embodiments, in response to the power-on instruction, when the device starts, the computer is powered on, the processor is reset, the boot instruction in the BIOS (basic input / output system) is searched and executed, a hardware self-check is performed, and the system configuration information is detected. The BIOS obtains the bootable device according to the setting, reads and executes the boot program of the bootable device, and the boot program loads the kernel of the operating system stored in the hard disk into the memory and runs the operating system. In other embodiments, in response to the power-on instruction, when the device starts, the computer is powered on, the processor is reset, the boot instruction in the UFEI (unified extensible firmware interface) is searched and executed, a hardware self-check is performed, and the system configuration information is detected. UEFI maintains a list of boot items and selects the boot device according to the user's configuration or preset policy. After determining the bootable device, the boot program of the bootable device is loaded from the boot program of the bootable device, and the boot program loads the kernel of the operating system stored in the hard disk into the memory and runs the operating system.
[0029] In some embodiments, the file system of the operating system is further loaded into the memory. Exemplarily, the file system can store the user's files on the hard disk to ensure that the data is not lost after a power outage; in order to improve the efficiency of file access, the file system can also load some key data (such as index nodes, directory entry cache, etc.) into the memory. When the user needs to access the file through the operating system, the data can be read directly from the memory without having to read from the hard disk every time, thereby improving the overall performance of the system. In some embodiments, some memory-based file systems (such as ramfs, tmpfs, etc.) can run completely in memory. Such file systems can be used to store temporary files or cache data to increase data access speed and reduce read and write operations on the hard disk. In some embodiments, the operation of the file system may involve the collaborative work of the hard disk and the memory.
[0030] Since the kernel of the operating system and several related files of the file system are directly stored on the hard disk, operations performed on the kernel of the operating system and related files of the file system (such as modification or deletion of related files due to attacks or misoperations) will be written to the hard disk, affecting the next startup of the operating system. For example, after restarting, a valid kernel cannot be found to start, resulting in startup failure, system instability or even crash, data loss, system update obstruction, and software that relies on specific system files cannot run normally.
[0031] Based on this, one or more embodiments of the present specification provide a device startup method, so that when the device starts, the operations performed on the kernel of the operating system and related files of the file system during the previous operation of the device will not be written (or saved), that is, each time the device starts, the operating system can be restored to the initial state of the operating system customized for the device, thereby ensuring that the device can start and run stably.
[0032] Figure 2 is a schematic diagram of the main process of the device startup method shown in some embodiments of this specification, Figure 2 The process shown can be executed by a computer device. In some embodiments, Figure 2 The process shown can be executed by a device startup system 900 deployed on a computer device. Figure 2 As shown, a device startup method provided by one or more embodiments of this specification may include the following steps.
[0033] Step 100, in response to a boot instruction, runs a boot program in a preinstalled operating system file to load the kernel and file system of the operating system in the preinstalled operating system file into the memory of the device.
[0034] Step 200: Run the kernel of the operating system and the file system in the memory of the device.
[0035] In one or more embodiments of the present specification, in step 100, the power-on instruction may be a power-on request sent by a user. Exemplarily, the power-on instruction may be a command sent by a user through a physical interaction method, such as by pressing a physical button (such as a power button or a reset button), or may be a command such as a restart sent by a user through a corresponding option on a graphical user interface.
[0036] In some embodiments, after the user presses the physical power button or selects the restart option from the menu, the computer device can run a boot program in a preinstalled operating system file. The preinstalled operating system file can be in an image file format, specifically an ISO image, or a GHO image, an IMG image, or other images such as VHD, DMG, and WIM. Taking the preinstalled operating system file in the ISO image format as an example, in some embodiments, the preinstalled operating system file can include a boot program, an operating system kernel, and an operating system file system. The optional preinstalled operating system file can further include some customized tools or customized software.
[0037] Among them, the bootloader is one of the first programs to run when the computer system starts. The bootloader can load the operating system kernel into the memory during the computer startup process and hand over control to the operating system. The bootloader can be a key component in the computer startup process. It is used to initialize hardware devices, test hardware status, and prepare for the loading of the operating system.
[0038] In some embodiments, continuing with the previous example, the kernel and file system of the operating system in the preinstalled operating system file in the ISO image format are loaded into the memory of the device through the boot program.
[0039] It should be noted that, in some embodiments, the device always automatically runs the boot program in the preinstalled operating system file based on the boot instruction. In other words, the device runs the boot program in the preinstalled operating system file every time it is started. The aforementioned running of the boot program in the preinstalled operating system file is configured as a regular, default running mode implemented when the device is started, rather than a single, accidental running mode implemented based on a temporary startup or system recovery command.
[0040] In some embodiments, the operating system that runs on the device each time it starts is the kernel of the operating system in the preinstalled operating system file, such as the kernel of the operating system in the preinstalled operating system file in the image file format, rather than running the related files (system files) of the operating system kernel directly stored on the hard disk.
[0041] In some embodiments, the operating system that can be run on the device may only include the operating system provided by the preinstalled operating system file, and does not have other operating systems such as a general operating system stored in a hard disk.
[0042] It should be noted that the aforementioned operating system stored in the hard disk refers to the basic software of the computer, which may include multiple executable files, and although the pre-installed operating system files are also stored in the hard disk in some embodiments, the pre-installed operating system files are files of a specific format rather than software. In some embodiments, the pre-installed operating system files can be understood as a storage or backup form of the operating system, and the pre-installed operating system files may include the data and settings of the aforementioned operating system, but need to be mounted or decompressed before use (for example, the kernel and file system in the pre-installed operating system files are loaded into the memory through the boot program in the pre-installed operating system files).
[0043] In some embodiments, the operating system included in the preinstalled operating system file can be a Linux-based operating system. In some embodiments, the preinstalled operating system file can also be based on a Unix-based operating system, a Window-based operating system, or other systems. In some embodiments, the operating system included in the preinstalled operating system file can be customized, for example, it has a customized kernel and / or a customized file system.
[0044] The customized kernel and customized file system can have a relatively smaller size so that they can be completely loaded into the device's memory and run.
[0045] The customized file system may not have a temporary storage directory, wherein the temporary storage directory may be a temporary file storage directory or a temporary directory storage directory, such as the / tmp directory. Exemplarily, in some related technologies, the operating system includes a tmp directory for storing temporary files or for storing temporary directories. In some embodiments, the tmp directory may be established on a hard disk, such as a Window system where the tmp file is generally located in the C drive root directory or the TEMP directory under the Windows directory, and another example where the tmp directory is generally located in the root directory of the Linux system / tmp or / var / tmp. In some embodiments, the contents stored in some temporary storage directories will be cleared after the system is restarted, but some will be retained, such as the contents of the / tmp directory in the Linux system will usually be cleared after restarting, while / var / tmp may be retained. Based on this, some malicious programs such as viruses may be written to the temporary storage directory, such as the / tmp directory or / var / tmp directory in the Linux system. In the file system customized in this embodiment, since the / tmp directory is not available, malicious programs such as viruses may be prevented from being written to the / tmp directory in some cases. Furthermore, since the customized file system in this embodiment runs completely in the memory through the boot program, the normal operation of the file system will not be affected even if the / tmp directory is not created in the hard disk of the device.
[0046] In some embodiments, the customized operating system may also include customized command line tools, such as command line scripts. In step 100, a boot program in a preinstalled operating system file may be run to load the kernel, file system, and command line script of the operating system in the preinstalled operating system file into the memory of the device.
[0047] In some embodiments, step 100 may be implemented by the guidance module 910 .
[0048] In one or more embodiments of the present specification, in step 200, the kernel and file system of the operating system in the preinstalled operating system file, or the kernel and file system of the operating system and some customized tools and / or customized software are loaded into the memory of the device through the boot program and run in the memory of the device. Based on this, the operating system will be restored from the preinstalled operating system file each time the device is started. Since the operating system exists in the preinstalled operating system file such as the ISO file, after the system is restarted, all operations on the operating system, such as operations on the kernel, operations on the file system, or operations on customized tools / customized software, will be reset, thereby preventing damage to the operating system due to user misoperation, and also preventing the storage and operation of malicious programs.
[0049] Exemplarily, several related files of the operating system are stored in a partition of the hard disk, such as the C drive, and are loaded into the memory of the device for operation through the boot program. In some embodiments, a kernel file in the C drive is deleted due to a user's misoperation. As a related art, when the device is restarted, the operating system fails to start due to the lack of a kernel file. In one or more embodiments of the present specification, when a user deletes a kernel file by mistake, the user's misoperation will not affect the pre-installed operating system files. This is because when the device is restarted, the boot program still loads the kernel and file system of the operating system from the pre-installed operating system files into the memory of the device for operation. There is no lack of a kernel file due to misoperation, so there will be no startup failure.
[0050] In other embodiments, malicious programs such as viruses, Trojans, worms, ransomware, etc. can modify a file system related file in the hard disk to achieve the purpose of destruction, stealing data, occupying system and network resources, encrypting the target victim's files and locking them. Exemplarily, malicious programs can achieve illegal access to the system and data theft by replacing or tampering with files, injecting malicious code, etc. As a related technology, when the device is restarted, the replaced or tampered files and the injected malicious code will not be reset. In one or more embodiments of this specification, even if the currently running operating system is attacked by a malicious program, its replaced or tampered files and injected malicious code cannot be retained. When the device is started, the boot program still loads the kernel and file system of the operating system that have not been replaced or tampered with and injected with malicious code from the pre-installed operating system file into the memory for operation.
[0051] In some embodiments, step 200 may be implemented by the execution module 920 .
[0052] The device startup method in one or more optional embodiments of the present specification further includes step 300 .
[0053] Step 300: associate the storage partition with the file system of the operating system so that the storage partition can be accessed through the operating system.
[0054] In one or more embodiments of the present specification, the storage partition may be located on the hard disk of the device, and the storage partition includes a first partition and a second partition. In some embodiments, the pre-installed operating system files are stored in the first partition of the hard disk of the device, and the user data is stored in the second partition of the hard disk of the device. In step 300, the second partition is associated with the file system of the operating system so that the second partition can be accessed through the operating system. In some embodiments, the aforementioned association can be understood as mounting, and mounting is the process of making the files stored in the device accessible through the file system. For example, the second partition of the hard disk of the device is mounted to the file system of the operating system running in the memory, for example, it is mounted to a certain point in the file system tree, so that the directories and files on the second partition can be accessed through the path. The mounting operation may include hardware-level operations, and may also involve the allocation of software and system resources to ensure the security and availability of data. In some embodiments, taking the Linux system as an example, mounting can be implemented by the mount command, mounting a storage device to an existing directory, and accessing this directory is equivalent to accessing the storage device. In other embodiments, the Windows system can automatically perform the mounting operation.
[0055] In some embodiments, user data may include software installed by the user, stored files and data, etc. In some embodiments, the second partition is associated with the file system of the operating system to allow the user to browse, create, modify, and delete files and directories on the second partition through an interface or command line tool provided by the operating system.
[0056] In some embodiments, the first partition and the second partition may be hidden partitions. In some embodiments, the customized operating system may access the hidden second partition through a known path. Since the first partition and the second partition are hidden, malware cannot attack data in the first partition and the second partition without obtaining the path, thereby preventing the pre-installed operating system files from being maliciously attacked.
[0057] In some embodiments, step 300 may be implemented by access module 930 .
[0058] Figure 3 is a flowchart of a method for implementing a self-recovery system according to some embodiments of this specification, see Figure 3 As shown, in one or more embodiments of the present specification, a method for implementing a self-recovery system is provided, including the following steps.
[0059] Step 600, customizing the kernel and file system of the operating system.
[0060] Step 700: Generate and store pre-installed operating system files based on the kernel and file system of the operating system.
[0061] Step 800, when starting the device, the kernel and file system of the operating system in the preinstalled operating system file are loaded into the memory of the device through the boot program in the preinstalled operating system file, so that the kernel and file system of the operating system run in the memory of the device.
[0062] In one or more embodiments of the present specification, in step 600, the developer can customize the kernel and file system of the system. Kernel customization and file system customization can be important links in the development of embedded Linux systems. Taking the Linux system as an example, kernel customization can involve configuring and compiling the Linux kernel according to specific hardware and requirements. In some embodiments, kernel customization can include selecting supported functions, device drivers, file system types, etc., and optimizing the performance and security of the kernel. Through kernel customization, a more efficient and stable kernel can be created to meet the specific requirements of embedded systems. A customized file system can provide the required libraries, tools, applications, etc. to meet the operating requirements of the embedded system.
[0063] In some embodiments, the operating system may be a Linux system. In some embodiments, customizing the kernel and file system of the operating system may include: tailoring the original kernel based on the configuration requirements of the preset device so that the kernel of the operating system and the file system can both run in the memory.
[0064] Exemplarily, customizing the kernel of the operating system may further include: determining the hardware configuration of the device such as the processor, memory, storage, etc., evaluating the resource requirements of the operating system kernel and the file system, removing unnecessary modules and functions in the kernel to reduce memory usage, and optimizing the kernel configuration to adapt it to the hardware environment of the device. Exemplarily, customizing the file system of the operating system may include: selecting a lightweight file system suitable for embedded systems, and modifying or trimming the file system to meet the requirements of memory and operating efficiency.
[0065] In some embodiments, the file system of the customized operating system may include tailoring of the file system to reduce the storage space occupied by the system and improve operating efficiency. In the process of tailoring the file system, some unnecessary directories and files may be deleted, such as temporary files, backup files, unnecessary input method files, help files, etc., and some unused library files, drivers, etc. may also be deleted as required. In some embodiments, the file system of the customized operating system may further include: deleting a temporary file storage directory or a temporary directory storage directory in the file system, such as the aforementioned / tmp directory, so it will not be repeated here.
[0066] In one or more embodiments of the present specification, in step 700, the pre-installed operating system file may be in an image file format such as the aforementioned ISO file, and therefore will not be described in detail herein.
[0067] In one or more embodiments of the present specification, step 800 is similar to the aforementioned steps 100 and 200, and thus will not be described in detail herein.
[0068] In some embodiments of this specification, the operating system of the device runs in the memory in a form similar to LiveCD. In some related embodiments, LiveCD can be an operating system that is pre-stored on a removable storage device and can be started without being specific to computer hardware. Exemplarily, the operating system of LiveCD can be started on the first device when it is mounted on the first device, and can also be started on the second device when it is mounted on the second device, without relying on a specific device. The media used by the operating system in the form of LiveCD include CD-ROM (Live CD), DVD (Live DVD), USB flash drive (LiveUSB), etc. In some embodiments, the operating mechanism of LiveCD is to operate by "putting the files originally placed on the hard disk into the virtual disk in the memory". In some embodiments, after exiting LiveCD and restarting, the computer can be restored to the original operating system. In some related embodiments, LiveCD enables users to experience the operating system without installing it on the hard disk, which is suitable for various scenarios such as system installation, hardware testing, troubleshooting, and providing a safe environment.
[0069] In some embodiments of the present specification, the running form of the operating system of the device can be understood as running in the memory in the form of a Live hard disk. Exemplarily, the preinstalled operating system file is not stored in advance on a removable storage device like a LiveCD, but is stored in a hard disk, such as the first partition of the hard disk. During operation, the device reads the preinstalled operating system file in, for example, a mirror format from the hard disk, such as the first partition of the hard disk (similar to the LiveCD reading the mirror file from the CD-ROM) and completely loads the operating system corresponding to the preinstalled operating system file into the memory of the device for operation, without performing any write operation on the hard disk.
[0070] In some embodiments of this specification, the device does not have the aforementioned original operating system (for example, an operating system composed of several system files stored in a hard disk), but relies on the pre-installed operating system file stored in the first partition of the hard disk of the device to run, or relies on the Live hard disk to run. In other words, in some embodiments, the device itself does not have an executable operating system installed, and the operating system and file system in the pre-installed operating system file need to be loaded into the memory before it can run. It should be noted that the operating system in the pre-installed operating system file will not be installed to the hard disk (for example, the operating system in the pre-installed operating system file will not be "decompressed" into several system files and stored on the hard disk).
[0071] In some other possible embodiments, the preinstalled operating system files may be stored in a removable storage device in advance, such as a LiveCD, and the device may not have the aforementioned original operating system, but instead relies on the preinstalled operating system files stored in the removable storage device to run. In other words, in some embodiments, the device itself does not have an executable operating system installed, and an additional removable storage medium storing the preinstalled operating system files needs to be mounted to run.
[0072] In one or more embodiments of the present specification, the pre-installed operating system file can be stored in the first partition of the hard disk of the aforementioned device. When the device is started, the file system is associated with the second partition of the hard disk of the aforementioned device so that the second partition can be accessed through the operating system, wherein the second partition is used to store user data. In some embodiments, both the first partition and the second partition are set as hidden partitions, and non-hidden content, such as an interactive interface provided to the user, runs in the memory of the device. Therefore, even if a malicious program can relatively easily find the non-hidden content and launch an attack and tamper with the non-hidden content, the malicious program cannot write the pre-installed operating system file, and the tampered part will be restored when the device is restarted.
[0073] In some embodiments, a device, such as a hard disk of the device, may include a hidden first partition for storing pre-installed operating system files, a hidden second partition for storing user data, and a non-hidden third partition.
[0074] In one or more embodiments of the present specification, since the device only includes pre-installed operating system files and does not involve the operating system, malicious programs such as viruses cannot find the relevant files (system files) that constitute the operating system. Since the first partition storing the pre-installed operating system files is a hidden partition, it is also difficult for malicious programs to directly find the pre-installed operating system files stored in the first partition. Since the second partition is also a hidden partition, it is also difficult for malicious programs to directly find user data stored in the second partition.
[0075] In one or more embodiments of the present specification, the implementation method of the self-recovery system also includes: configuring the system command related to the file system to: when the output data of the system command includes file-related information of the first partition and / or the second partition, deleting the file-related information of the first partition and / or the second partition in the output data, wherein the file-related information includes the storage path and / or file name of the file in the first partition and / or the second partition.
[0076] In some embodiments, the system commands related to the file system may include one or more system commands that involve the file system when executed, such as searching / listing directory contents and files that meet the conditions, displaying information related to the file system such as resource information, etc. Exemplarily, in a Linux system or a Unix system, commands such as ls (listing directory contents), ps (displaying current processes), df (displaying disk space usage), find (finding files in a directory tree), top (displaying system processes and resource usage), and mount (mounting a file system) can be used to view system status, processes, disk usage, find files, and monitor system performance. These commands will not cause damage to the system when used normally. However, if a malicious user or attacker uses these commands to perform improper operations, such as deleting key files, tampering with system configurations, or executing malicious scripts, it may cause damage to the system.
[0077] In one or more embodiments of the present specification, the file-related information of the hidden partition, such as the hidden first partition and the hidden second partition, is deleted from the output data of the system command. Exemplarily, taking the find command as an example, the output of the find command may be a list of one or more file names that meet the conditions set in the find command. In some embodiments, the malicious program may use the find command to search for all files with the extension .txt and output the paths of these files. In one or more embodiments of the present specification, the find command is configured to delete the data related to the hidden partition from its output data, such as deleting the .txt files located in the hidden partition before outputting.
[0078] Continuing with the previous example, the find command could include: find / path / to / search -type f -name "*.txt".
[0079] In some embodiments, the output data of executing the aforementioned find command may include: / path / to / search / file1.txt, / path / to / search / subdir / file2.txt, / path / to / search / anotherdir / file3.txt, wherein, since file1.txt, file2.txt, and file3.txt are located in a hidden partition, the find command is configured to delete the file-related information (such as the file name and the path corresponding to the file) of file1.txt, file2.txt, and file3.txt before outputting, or may not output any content.
[0080] In some embodiments, in the customization of the file system, the implementation of commands such as df, find, and mount in busybox can be modified to hide specific directories (i.e., file-related information related to hidden partitions is deleted in the output data of the commands), or shell scripts are written to simulate the behavior of these commands to hide specific directories. For example, taking the find command as an example, a shell script can be written that accepts the same parameters as find and deletes the related information of the hidden directory or returns an empty result when outputting data.
[0081] In one or more embodiments of the present specification, the system command related to the file system can also be configured as follows: when the input data of the system command includes file-related information of the first partition and / or the second partition, the file-related information of the first partition and / or the second partition in the input data is deleted before execution.
[0082] In some embodiments, the find command is a command line tool for finding files and directories. Exemplarily, the input parameters of the find command may include a directory that specifies the find command to start searching, which may be a path or multiple paths. Exemplarily, the input parameters of the find command may include search conditions, such as the attributes of the file or directory to be found, which may be one or more of the name, type, size, and time. Exemplarily, the input data of the find directory may also include operations performed on the search results, such as printing, deleting, moving, executing commands, etc. In some embodiments, the output data of the find command may be a list of found files and directories, which may involve relevant information of hidden directories. In order to prevent the output data from involving relevant information of hidden directories, in some embodiments, taking the find command as an example, a shell script may be written that receives the same parameters as find, but checks whether the input path parameters include hidden directories before calling the find instruction to perform the search. If so, the path may be skipped (i.e., the search is no longer performed on the path) or an empty result is returned. Exemplarily, a shell script may be written that accepts the same parameters as the find command, but uses the sed command to delete the path involving the hidden directory from the parameter list before calling the find command, and then calls the system's find command and passes the modified parameters. Since the input parameters of the system's find command do not contain the path involving the hidden directory after modification, the output data thereof will not involve the relevant information of the hidden directory. In some embodiments, when a user uses the find command re-implemented by the shell script, the user enters the search conditions, such as searching for all files under the A directory, the B directory, and the C directory (i.e., the original input parameters entered by the user, where the user may include an illegal user such as a malicious program, etc.), wherein the C directory is a hidden directory, then when the shell script is run, the C directory in the search conditions is first deleted, and then the A directory and the B directory in the search conditions (i.e., the modified input parameters) are passed to the system's find command, and after the system's find command is executed, all files under the A directory and all files under the B directory are output, but no files under the C directory, i.e., the hidden directory, are output. In one or more embodiments of the present specification, since the first partition and the second partition can both be hidden partitions, when the user uses the find command re-implemented by the shell script, the user enters the search criteria, such as searching for all files under the first partition and the second partition (that is, the original input parameters entered by the user, where the user includes illegal users such as malicious programs, etc.), and since all partitions to be searched are hidden partitions, the shell script can pass empty input parameters (that is, modified input parameters) to the system's find command and the system's find command returns an empty result, or the shell script directly returns an empty result.
[0083] Based on the above settings, malicious programs cannot obtain files located in the hidden partition through system commands, such as the pre-installed operating system files located in the hidden first partition, or the user data located in the hidden second partition. Therefore, they cannot damage the pre-installed operating system files, nor can they tamper with or steal user data.
[0084] In one or more embodiments of the present specification, the implementation method of the self-recovery system also includes: customizing a command line tool. In some embodiments, the generation and storage of pre-installed operating system files based on the kernel and file system of the operating system in step 700 may further include: generating and storing pre-installed operating system files based on the kernel, file system, and command line tool of the operating system. Among them, command line tools such as command line scripts can be configured as follows: when the code of the command line tool includes file-related information in the first partition and / or the second partition, the file-related information in the first partition and / or the second partition in the code is represented in ciphertext. In some embodiments, the file-related information includes the storage path and / or file name of the file in the first partition and / or the second partition.
[0085] In some embodiments, the command line tool may involve information related to a hidden partition or information related to files located under a hidden partition, and some command line tools can be opened to view the code or instructions they contain. In order to avoid information leakage of hidden files in the command line tool code, the file-related information in the hidden first partition and the hidden second partition in the code can be represented in ciphertext, for example, in binary form, to avoid the file-related information being directly readable.
[0086] Figure 4 is an exemplary block diagram of a device startup system according to some embodiments of this specification, see Figure 4 As shown, the device startup system 900 may include: a boot module 910 and an operation module 920. In some embodiments, the boot module 910 responds to the boot instruction and runs a boot program in a preinstalled operating system file to load the kernel and file system of the operating system in the preinstalled operating system file into the memory of the device. In some embodiments, the operation module 920 is used to run the kernel and file system of the operating system in the memory of the device.
[0087] See also Figure 4 As shown, in some embodiments, the device startup system 900 may further include: an access module 930. In some embodiments, the access module 930 is used to associate the file system in the operating system with the second partition of the device for storing user data so that the second partition can be accessed through the operating system.
[0088] For more information about each module, see Figure 2~Figure 3The relevant description of will not be repeated here. It should be understood that Figure 4 The system and its modules shown can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. Those skilled in the art will understand that the above methods and systems can be implemented using computer executable instructions and / or control codes contained in a processor, such as a disk, CD or DVD-ROM, etc., and such codes are provided in a carrier medium or a memory of a programmable device. The system and its modules of this specification can not only be implemented by hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., but can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above hardware circuits and software (e.g., firmware).
[0089] It should be noted that the above description of the system and its modules is only for convenience of description and does not limit this specification to the scope of the embodiments. It is understandable that for those skilled in the art, after understanding the principle of the system, it is possible to arbitrarily combine the modules without deviating from this principle to form a subsystem connected to other modules. Or some modules may be split to obtain more modules or multiple units under the module. Such variations are all within the scope of the disclosure of this specification.
[0090] In one or more embodiments of the present specification, a computer program product is also provided, including computer instructions or computer codes, which can implement the above-mentioned device startup method when at least part of the computer instructions or computer codes are executed by a processor. In some embodiments, the computer program product may only involve computer instructions or computer codes, which may be carried by a storage medium or a processing device. In other embodiments, the computer program product may also be a storage medium or a processing device containing the aforementioned computer instructions or computer codes. The processing device may include one or more processors, and a storage medium.
[0091] In some embodiments, the processor may be a combination of one or more of the following processors: a central processing unit (CPU), an application specific integrated circuit (ASIC), an application specific instruction set processor (ASIP), a graphics processing unit (GPU), a physical processing unit (PPU), a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic device (PLD), a programmable logic controller (PLC), a reduced instruction set computer (RISC), and a microprocessor.
[0092] In some embodiments, the storage medium may include a combination of one or more of the following: a mass storage, a removable storage, a volatile read-write memory, and a read-only memory (ROM). Exemplary mass storage may include a magnetic disk, an optical disk, a solid-state hard disk, and the like. Exemplary removable storage may include a flash disk, a floppy disk, an optical disk, a memory card, a compressed hard disk, a magnetic tape, and the like. Exemplary volatile read-write memory may include a random access memory (RAM). Exemplary random access memory may include a dynamic random access memory (DRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), a static random access memory (SRAM), a thyristor random access memory (T-RAM), and a zero capacitance memory (Z-RAM), and the like. Exemplary read-only memory may include a masked read-only memory (MROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a compact disk read-only memory (CD-ROM), and a digital multifunction hard disk read-only memory, and the like.
[0093] The beneficial effects that may be brought about by the embodiments of this specification include but are not limited to: (1) loading the operating system in the pre-installed operating system file into the memory for execution. When the device is started, the operating system is equivalent to being reset. Modifications to the operating system will not affect the pre-installed operating system files, thereby avoiding misoperation and malicious program attacks; (2) setting the partition storing the pre-installed operating system files and the partition storing user data as hidden partitions so that malicious programs cannot find them; (3) tailoring the operating system to allow it to be completely loaded into the memory for execution; (4) filtering the output related to the hidden partition in the system command to prevent malicious programs from searching for related files under the hidden partition through the system command; (5) setting the command line tool to cipher text to avoid information leakage related to the hidden partition.
[0094] It should be noted that different embodiments may produce different beneficial effects. In different embodiments, the beneficial effects that may be produced may be any one or a combination of the above, or any other beneficial effects that may be obtained.
[0095] The basic concepts have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example and does not constitute a limitation of this specification. Although not explicitly stated here, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are taught in this specification, so such modifications, improvements and corrections still belong to the spirit and scope of the exemplary embodiments of this specification.
Claims
1. A device startup method, characterized in that: include: In response to the power-on instruction, running a boot program in a preinstalled operating system file to load the kernel and the file system of the operating system in the preinstalled operating system file into the memory of the device; The kernel and the file system of the operating system are run in the memory of the device.
2. The method according to claim 1, characterized in that The preinstalled operating system file is stored in the first partition of the hard disk of the device; The hard disk of the device also has a second partition; The method further includes: associating the second partition with a file system of the operating system so that the second partition can be accessed through the operating system; The second partition is used to store user data; The first partition and the second partition are hidden partitions.
3. The method according to claim 1, characterized in that: The pre-installed operating system file is in the image file format; The operating system is a Linux system; the kernel and the file system are customized.
4. A device startup system, characterized in that: include: A boot module, in response to a boot instruction, runs a boot program in a preinstalled operating system file to load the kernel and file system of the operating system in the preinstalled operating system file into the memory of the device; The running module is used to run the kernel and the file system of the operating system in the memory of the device.
5. The system according to claim 4, characterized in that Also includes: The access module is used to associate the file system in the operating system with a second partition of the device for storing user data so that the second partition can be accessed through the operating system.
6. A computer program product, comprising computer codes, which, when at least part of the computer codes are executed by a processor, can implement the method according to any one of claims 1 to 3.
7. A method for implementing a self-recovery system, characterized in that: include: Customize the operating system kernel and file system; Generating and storing a preinstalled operating system file based on the operating system kernel and the file system; When starting the device, the kernel and file system of the operating system in the preinstalled operating system file are loaded into the memory of the device through the boot program in the preinstalled operating system file, so that the kernel and file system of the operating system run in the memory of the device.
8. The implementation method according to claim 7, characterized in that: The operating system is a Linux operating system; The pre-installed operating system file is in the image file format; Customizing the kernel of the operating system includes: tailoring the original kernel based on the configuration requirements of the preset device so that the kernel of the operating system and the file system can both run in the memory.
9. The implementation method according to claim 7, characterized in that: Customizing the file system of the operating system includes: deleting a temporary file storage directory or a temporary directory storage directory in the file system.
10. The implementation method according to claim 7, characterized in that: Also includes: Storing the preinstalled operating system file in a first partition of a hard disk of the device; When starting the device, associating the file system with a second partition of the hard disk of the device so that the second partition can be accessed by the operating system, wherein the second partition is used to store user data; The first partition and the second partition are both set as hidden partitions.
11. The implementation method according to claim 10, characterized in that: Also includes: The system command related to the file system is configured to: when the output data of the system command includes the file related information of the first partition and / or the second partition, delete the file related information of the first partition and / or the second partition in the output data, wherein the file related information includes the storage path and / or file name of the file in the first partition and / or the second partition; Alternatively, the system command related to the file system is configured as follows: when the input data of the system command includes file-related information of the first partition and / or the second partition, the file-related information of the first partition and / or the second partition in the input data is deleted before execution.
12. The implementation method according to claim 10, characterized in that: Also includes: Custom command line tools; The generating and storing the pre-installed operating system file based on the kernel of the operating system and the file system further includes: generating and storing the pre-installed operating system file based on the kernel of the operating system, the file system, and the command line tool; Wherein, the command line tool is configured as follows: when the code of the command line tool includes information related to files in the first partition and / or the second partition, the information related to files in the first partition and / or the second partition in the code is represented in ciphertext; the file related information includes the storage path and / or file name of the file in the first partition and / or the second partition.