CN106502629B - Initramfs firmware Compilation Method and system based on openwrt translation and compiling environment - Google Patents

Initramfs firmware Compilation Method and system based on openwrt translation and compiling environment Download PDF

Info

Publication number
CN106502629B
CN106502629B CN201610856698.6A CN201610856698A CN106502629B CN 106502629 B CN106502629 B CN 106502629B CN 201610856698 A CN201610856698 A CN 201610856698A CN 106502629 B CN106502629 B CN 106502629B
Authority
CN
China
Prior art keywords
file
init
compressed
firmware
new
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610856698.6A
Other languages
Chinese (zh)
Other versions
CN106502629A (en
Inventor
张俊安
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SUZHOU MAIKE NETWORK SAFETY TECHNOLOGY Co Ltd
Original Assignee
SUZHOU MAIKE NETWORK SAFETY TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SUZHOU MAIKE NETWORK SAFETY TECHNOLOGY Co Ltd filed Critical SUZHOU MAIKE NETWORK SAFETY TECHNOLOGY Co Ltd
Priority to CN201610856698.6A priority Critical patent/CN106502629B/en
Publication of CN106502629A publication Critical patent/CN106502629A/en
Application granted granted Critical
Publication of CN106502629B publication Critical patent/CN106502629B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/22Microcontrol or microprogram arrangements
    • G06F9/24Loading of the microprogram
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Abstract

Present invention discloses initramfs firmware Compilation Methods and system based on openwrt translation and compiling environment, include the following steps: S1, the .init.data section content in the kernel file vmlinux of compiling completion is saved into the init_data file comprising the rootfs file compressed;Init_data file declustering is that 3 files are respectively designated as head, body, tail by S2, and body file is compressed rootfs file system;Rootfs file to be updated is packaged compression and forms new compressed file, and keeps its compressed format identical as the compressed format of the body file in S2 step and file size by S3;Head file, tail file mergences in S4, the compressed file that S3 step is generated and S2 step generate new_init_data file;The content update of the new_init_data file in the .init.data section into kernel file vmlinux, is obtained new vmlinux kernel file by S5;New vmlinux kernel file is packaged and generates corresponding firmware by S6.The invention enables firmware compilation speeds to be substantially improved, and compiling system disk occupies little space, and portability greatly enhances, and meets the exploitation of firmware version iteratively faster.

Description

Initramfs firmware Compilation Method and system based on openwrt translation and compiling environment
Technical field
The present invention relates to initramfs firmware Compilation Method and systems, in particular to a kind of to be based on openwrt translation and compiling environment Initramfs firmware Compilation Method and system.
Background technique
It is carried out on embedded device in software new function R&D process, needs to carry out iteratively faster exploitation in the short time, So just it is faced with frequent iteration version.The publication of each version must include firmware, use openwrt compiling system at present Compiling is longer firmware compiling duration, and version publication is so just caused to generate bottleneck in software development process.
When being compiled using openwrt, basic principle: translation and compiling environment is constructed since 0, utilizes the compiling built Environment carries out firmware compiling, and whole process includes tools chain compiling, kernel compiling, software package compiles, firmware generates, this method Be disadvantageous in that: compiling duration is considerably long, and occupancy disk space is very big, and multiple branch's versions are sent out parallel if it exists Cloth then greatly prolongs version issuing time, is unsatisfactory for the demand of iteratively faster exploitation.
Also, the portability of the firmware translation and compiling environment of openwrt is poor, and translation and compiling environment can only be in current translation and compiling environment It uses, can not share on other PC and run, developer oneself is caused to need continuous compiler test solid during research and development Part, each research staff requires to consume a longer time and compile for firmware, increases development time cost.
Certainly, also have and be compiled using the image_builder tool of openwrt, the basic principle is that saving The files such as kernel, the rootfs generated after openwrt compiling.User-defined file can be repacked new firmware by user In, disadvantage is that, do not support the firmware of initramfs format to be packaged.
Summary of the invention
The object of the invention is to provide a kind of based on openwrt to solve the above-mentioned problems in the prior art The initramfs firmware Compilation Method and system of translation and compiling environment.
The purpose of the invention will be achieved through the following technical solutions:
Initramfs firmware Compilation Method based on openwrt translation and compiling environment, includes the following steps:
S1 is received user instructions, by compiling complete kernel file vmlinux in .init.data section content save to In init_data file comprising the rootfs file compressed;
The init_data file is split as 3 parts according to two cut-points by S2,3 formed after fractionation file difference It is named as head, body, tail, wherein body file is compressed rootfs file system;
S3 receives rootfs file to be updated, and the rootfs file to be updated is packaged compression and forms new pressure Contracting file, and keep its compressed format identical as the compressed format of the body file in S2 step and file size;
Head file, tail file mergences in S4, the compressed file that S3 step is generated and S2 step generate new_ Init_data file;
S5, by .init.data section of the content update of the new_init_data file into kernel file vmlinux In, obtain new vmlinux kernel file;
New vmlinux kernel file is packaged according to goal systems firmware format and generates corresponding firmware by S6.
Preferably, the initramfs firmware Compilation Method based on openwrt translation and compiling environment, in which:
In two cut-points in the S2 step, first cut-point is the start bit of the rootfs file compressed It sets, second cut-point is determined according to the digit of fixer system.
Preferably, the initramfs firmware Compilation Method based on openwrt translation and compiling environment, in which:
In S2 step, when the digit of the fixer system is 32, second cut-point is fourth from the last byte;
When the digit of the fixer system is 64, second cut-point is the 8th byte reciprocal.
Preferably, the initramfs firmware Compilation Method based on openwrt translation and compiling environment, in which:
Body file size in the S3 step, in the insufficient S2 step of the size of the new compressed file When, 0 byte content is filled in the new compressed file.
Initramfs firmware compiling system based on openwrt translation and compiling environment, including
File extraction unit will be in the kernel file vmlinux of compiling completion for receiving user instructions .init.data section content is saved into the init_data file comprising the rootfs file compressed;
File declustering unit, for the init_data file to be split as 3 parts according to two cut-points, wherein first A cut-point is the initial position of the rootfs file compressed, and second cut-point carries out true according to the digit of fixer system Fixed, 3 files are respectively designated as head, body, tail after fractionation, and wherein body file is compressed rootfs file system System;
The rootfs file to be updated is packaged compression for receiving rootfs file to be updated by dilatation unit New compressed file is formed, and keeps its compressed format identical as the compressed format of the body file in S2 step and file size;
Synthesis unit, for closing head file, the tail file in the compressed file of dilatation cellular manufacture and S2 step And generate new_init_data file;
Updating unit, for by new_init_data up-to-date into kernel file vmlinux .init.data in section, new vmlinux kernel file is obtained;
And generation unit, for new vmlinux kernel file to be packaged generation pair according to goal systems firmware format The firmware answered.
Preferably, the initramfs firmware compiling system based on openwrt translation and compiling environment, in which: the file First cut-point of split cells is the initial position of the rootfs file compressed;When the digit of the fixer system is 32 Position, second cut-point are fourth from the last byte;When the digit of the fixer system is 64, second cut-point is 8th byte reciprocal.
Preferably, the initramfs firmware compiling system based on openwrt translation and compiling environment, in which: the dilatation Kernel patch file is provided in unit.
The advantages of technical solution of the present invention, is mainly reflected in:
Deft design of the present invention, process is simple, makes firmware compilation speed substantially using this firmware Compilation Method and system It is promoted, and compiling system disk occupies little space, portability greatly enhances, and meets the exploitation of firmware version iteratively faster.
Detailed description of the invention
Fig. 1 is process schematic of the invention;
Fig. 2 is process schematic of the invention.
Specific embodiment
The purpose of the present invention, advantage and feature, by by the non-limitative illustration of preferred embodiment below carry out diagram and It explains.These embodiments are only the prominent examples using technical solution of the present invention, it is all take equivalent replacement or equivalent transformation and The technical solution of formation, all falls within the scope of protection of present invention.
The initramfs firmware compiling system based on openwrt translation and compiling environment that the present invention discloses, as shown in Fig. 1, packet Include sequentially connected file extraction unit, file declustering unit, dilatation unit, synthesis unit, updating unit and generation unit.
The file extraction unit, will be in the kernel file vmlinux of compiling completion for receiving user instructions .init.data section content is saved into the init_data file comprising the rootfs file compressed.
The file declustering unit is used to the init_data file being split as 3 parts according to two cut-points, wherein First cut-point is the initial position of the rootfs file compressed, and second cut-point is carried out according to the digit of fixer system It determines, 3 files are respectively designated as head, body, tail after fractionation, and wherein body file is compressed rootfs text Part.
The dilatation unit is packaged pressure for receiving rootfs file to be updated, by the rootfs file to be updated Contracting forms new compressed file, and makes compressed format and file size phase of its compressed format with the body file in S2 step Together;The kernel for the rootfs file compressed to be carried out to dilatation in compilation process is provided in the dilatation unit Patch file, the kernel patch is in compilation process, when generating rootfs file, rootfs tail of file is filled specified Rootfs file after dilatation is compiled into kernel file by the empty file of size, Lai Shixian dilatation, compiling system.
The synthesis unit is used for head file, the tail file in the compressed file of dilatation cellular manufacture and S2 step Merge and generates new_init_data file.
The updating unit is used for new_init_data up-to-date into kernel file vmlinux .init.data in section, new vmlinux kernel file is obtained.
The generation unit is used to be packaged to generate by new vmlinux kernel file according to goal systems firmware format and correspond to Firmware.
The volume for the initramfs firmware compiling system based on openwrt translation and compiling environment that invention further discloses above-mentioned Process is translated, as shown in Fig. 2, is included the following steps:
S1, the file extraction unit receive user instructions, in the kernel file vmlinux that compiling is completed .init.data section content saves into the init_data file comprising the rootfs file compressed and sends the file to Split cells.
The received init_data file is split as 3 parts according to two cut-points by S2, the file declustering unit, Wherein, first cut-point is the initial position of the rootfs file compressed, and second cut-point is according to the position of fixer system Number is determined.
Wherein, the digit of the fixer system refers to that target device using the system digit after the starting of this firmware, is compiling It is preceding it is known that fixer system digit, common have 32 and 64 systems, also, what is saved due to tail is rootfs text The length of part is saved in 32 systems using 4 bytes, is saved in 64 systems using 8 bytes, therefore works as the firmware system When the digit of system is 32, second cut-point is fourth from the last byte;When the digit of the fixer system is 64, Second cut-point is the 8th byte reciprocal.
Formed after fractionation 3 files are respectively designated as head, body, tail, wherein body file is after compressing Rootfs file, and send the file after fractionation to dilatation unit.
S3, the dilatation unit receive the file after rootfs file and fractionation to be updated, will be described to be updated Rootfs file is packaged compression and forms new compressed file, and makes the compression of the body file in its compressed format and split cells Format and file size are identical, when the body file size in the insufficient S2 step of the size of the new compressed file, 0 byte content is filled in the new compressed file;When the size of the new compressed file is greater than the body text in the S2 step When part size, then compiling failure is assert, because version publication firmware size is floated to a very small extent every time, and compiling Kernel can be defaulted according to demand reserves certain space, and equally in embedded environment, the space flash is limited, to the big of firmware Small is also to have the upper limit, for example, existing rootfs size is 17M, can reserve the sky of 27M to rootfs in kernel compiling Between;Send new compressed file to the synthesis unit.
S4, the new compressed file that the synthesis unit generates the dilatation unit and file split cells in S2 step Head file, the tail file mergences generation new_init_data file torn open.
S5, the updating unit is by the content update of the new_init_data file into kernel file vmlinux .init.data section in, obtain new vmlinux kernel file.
New vmlinux kernel file is packaged to generate and be corresponded to by S6, the production unit according to goal systems firmware format Firmware.
System and method through the invention can reduce disk occupied space: this is because openwrt default compiling ring Border reaches the space of 20GB, and the system for using this method only takes up space about 4GB.
Also, the present invention supports multiple-limb version to issue parallel: this is because compiling a version using this system only needs 5 minutes are wanted, and is compiled using openwrt and is once at least also required to a few hours, when having multiple versions while issuing, total volume The time translated compiles efficiency and greatly improves with regard to poor very big.
Meanwhile this busy portable enhancing: this is because original openwrt compiling system reaches after the completion of compiling for the first time The space of 20G, and can not transplant, developer must respectively compile, and it is time-consuming and laborious, about using occupied space total after this system 4G, and can be operated normally in other translation and compiling environments, no dependence condition.
Still there are many embodiment, all technical sides formed using equivalents or equivalent transformation by the present invention Case is within the scope of the present invention.

Claims (7)

1. the initramfs firmware Compilation Method based on openwrt translation and compiling environment, characterized by the following steps:
S1 is received user instructions, by compiling complete kernel file vmlinux in .init.data section content save to In init_data file;
The init_data file is split as 3 parts according to two cut-points by S2, and 3 formed after fractionation file is named respectively For head, body, tail, wherein body file is compressed rootfs file;
S3 receives rootfs file to be updated, and the rootfs file to be updated is packaged compression and forms new compression text Part, and keep its compressed format identical as the compressed format of the body file in S2 step and file size;
Head file, tail file mergences in S4, the compressed file that S3 step is generated and S2 step generate new_init_ Data file;
S5, by the content update of the new_init_data file in the .init.data section into kernel file vmlinux, Obtain new vmlinux kernel file;
New vmlinux kernel file is packaged according to goal systems firmware format and generates corresponding firmware by S6.
2. the initramfs firmware Compilation Method according to claim 1 based on openwrt translation and compiling environment, feature exist In: in two cut-points in the S2 step, first cut-point is the initial position of the rootfs file compressed, second A cut-point is determined according to the digit of fixer system.
3. the initramfs firmware Compilation Method according to claim 2 based on openwrt translation and compiling environment, feature exist In:
In S2 step, when the digit of the fixer system is 32, second cut-point is fourth from the last byte;
When the digit of the fixer system is 64, second cut-point is the 8th byte reciprocal.
4. the initramfs firmware Compilation Method according to claim 1 based on openwrt translation and compiling environment, feature exist In: in the S3 step, when the body file size in the insufficient S2 step of the size of the new compressed file, 0 byte content is filled in the new compressed file.
5. the initramfs firmware compiling system based on openwrt translation and compiling environment, it is characterised in that: including
File extraction unit, for receiving user instructions, by the .init.data section in the kernel file vmlinux of compiling completion Content is saved into init_data file;
File declustering unit, for the init_data file to be split as 3 parts according to two cut-points, 3 formed after fractionation A file is respectively designated as head, body, tail, and wherein body file is compressed rootfs file;
The rootfs file to be updated is packaged compression and is formed by dilatation unit for receiving rootfs file to be updated New compressed file, and keep its compressed format identical as the compressed format of the body file in S2 step and file size;
Synthesis unit, for the head file in the compressed file of dilatation cellular manufacture and S2 step, tail file mergences is raw At new_init_data file;
Updating unit, for the .init.data section by new_init_data up-to-date into kernel file vmlinux In, obtain new vmlinux kernel file;
And generation unit, it is corresponding for new vmlinux kernel file to be packaged generation according to goal systems firmware format Firmware.
6. the initramfs firmware compiling system according to claim 5 based on openwrt translation and compiling environment, feature exist In: first cut-point of the file declustering unit is the initial position of the rootfs file compressed, second cut-point It is determined according to the digit of fixer system;When the digit of the fixer system is 32, second cut-point is inverse 4th byte;When the digit of the fixer system is 64, second cut-point is the 8th byte reciprocal.
7. the initramfs firmware compiling system according to claim 5 based on openwrt translation and compiling environment, feature exist In: kernel patch file is provided in the dilatation unit.
CN201610856698.6A 2016-09-28 2016-09-28 Initramfs firmware Compilation Method and system based on openwrt translation and compiling environment Active CN106502629B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610856698.6A CN106502629B (en) 2016-09-28 2016-09-28 Initramfs firmware Compilation Method and system based on openwrt translation and compiling environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610856698.6A CN106502629B (en) 2016-09-28 2016-09-28 Initramfs firmware Compilation Method and system based on openwrt translation and compiling environment

Publications (2)

Publication Number Publication Date
CN106502629A CN106502629A (en) 2017-03-15
CN106502629B true CN106502629B (en) 2019-08-27

Family

ID=58290621

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610856698.6A Active CN106502629B (en) 2016-09-28 2016-09-28 Initramfs firmware Compilation Method and system based on openwrt translation and compiling environment

Country Status (1)

Country Link
CN (1) CN106502629B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116932011B (en) * 2023-09-14 2024-02-06 合肥大唐存储科技有限公司 SSD firmware segment encryption and burning method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101425018A (en) * 2008-12-05 2009-05-06 深圳创维数字技术股份有限公司 Embedded firmware upgrading method and device based on sectional form
CN104461533A (en) * 2014-12-03 2015-03-25 重庆蓝岸通讯技术有限公司 System firmware customizing method based on Marvell LTE (Long Term Evolution) platform
CN105302554A (en) * 2015-10-23 2016-02-03 深圳市创维电器科技有限公司 Android system automatic program construction method and system
CN105867976A (en) * 2016-04-01 2016-08-17 浪潮电子信息产业股份有限公司 Easy-to-apply server firmware online refreshing method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101232397B (en) * 2008-02-22 2010-10-27 成都市华为赛门铁克科技有限公司 Apparatus and method for renovating multi controller systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101425018A (en) * 2008-12-05 2009-05-06 深圳创维数字技术股份有限公司 Embedded firmware upgrading method and device based on sectional form
CN104461533A (en) * 2014-12-03 2015-03-25 重庆蓝岸通讯技术有限公司 System firmware customizing method based on Marvell LTE (Long Term Evolution) platform
CN105302554A (en) * 2015-10-23 2016-02-03 深圳市创维电器科技有限公司 Android system automatic program construction method and system
CN105867976A (en) * 2016-04-01 2016-08-17 浪潮电子信息产业股份有限公司 Easy-to-apply server firmware online refreshing method

Also Published As

Publication number Publication date
CN106502629A (en) 2017-03-15

Similar Documents

Publication Publication Date Title
US8898662B2 (en) Method and device for generating software installation packet
CN105550296B (en) A kind of data lead-in method based on spark-SQL big data processing platforms
Dong et al. R2: Incremental reprogramming using relocatable code in networked embedded systems
CN105718287B (en) A kind of program streaming execution method of intelligent terminal
CN105550293A (en) Background refreshing method based on Spark-SQL big data processing platform
CN105867977B (en) The upgrading of DSP user program and Flash method for down loading
CN106610839B (en) Method for issuing upgrade package, lightweight upgrade method, device and system
CN105224370A (en) A kind of method and apparatus of loading ELF document
CN104731569A (en) Data processing method and relevant equipment
CN104184814A (en) Method and system for generating and compounding embedded firmware differential upgrading file
CN102693145A (en) Differential upgrading method for embedded system
CN105487907A (en) Difference package manufacturing method and device
CN103645888B (en) System and method for automatically building operation system
CN114723033B (en) Data processing method, data processing device, AI chip, electronic device and storage medium
WO2016078263A1 (en) Upgrading control device and terminal, terminal upgrading method and system, and storage medium
Dong et al. R3: Optimizing relocatable code for efficient reprogramming in networked embedded systems
CN109445823A (en) A kind of MCU firmware fast updating method
JP2014211696A (en) Method for optimizing binary code of language having access to binarized decimal number type variable, and computer and computer program therefor
CN113283613A (en) Deep learning model generation method, optimization method, device, equipment and medium
CN104077161A (en) Client application updating method and device
CN106502629B (en) Initramfs firmware Compilation Method and system based on openwrt translation and compiling environment
Dong et al. Optimizing relocatable code for efficient software update in networked embedded systems
CN115328454A (en) Program compiling and program loading method
CN103970569A (en) Server BIOS offline upgrading method
CN105224347B (en) data configuration method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: Room 301-302, 3rd Floor, Tiancheng Information Building, No. 88 South Tiancheng Road, High Speed Rail New City, Xiangcheng District, Suzhou City, Jiangsu Province, 215133

Patentee after: SUZHOU MAXNET NETWORK SAFETY TECHNOLOGY Co.,Ltd.

Address before: 3/F, Mingde Institute, Southeast University, No. 399 Linquan Street, Industrial Park, Suzhou City, Jiangsu Province, 215021

Patentee before: SUZHOU MAXNET NETWORK SAFETY TECHNOLOGY Co.,Ltd.