CN117453202A - Visual function module editing method for Linux C program source code - Google Patents

Visual function module editing method for Linux C program source code Download PDF

Info

Publication number
CN117453202A
CN117453202A CN202311769272.3A CN202311769272A CN117453202A CN 117453202 A CN117453202 A CN 117453202A CN 202311769272 A CN202311769272 A CN 202311769272A CN 117453202 A CN117453202 A CN 117453202A
Authority
CN
China
Prior art keywords
linux
source code
file
function module
program source
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.)
Pending
Application number
CN202311769272.3A
Other languages
Chinese (zh)
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.)
Shenzhen Brilliants Smart Hardware Co ltd
Original Assignee
Shenzhen Brilliants Smart Hardware 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 Shenzhen Brilliants Smart Hardware Co ltd filed Critical Shenzhen Brilliants Smart Hardware Co ltd
Priority to CN202311769272.3A priority Critical patent/CN117453202A/en
Publication of CN117453202A publication Critical patent/CN117453202A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to the technical field of Linux C program source code editing, in particular to a method for editing a visual function module of a Linux C program source code. The method comprises the steps of firstly extracting a function module file in a Linux kernel source code, then editing a Kconfig file, executing make menu on a top-level directory to obtain a graphical interface, and displaying the function module on the graphical interface for selection; and then, checking a required module on a graphical interface to store and generate a config file, generating a macro through Makefile, and transmitting the macro into an original Linux C program source code, so that the functional module of the Linux C program source code can perform graphical selection and is convenient to edit.

Description

Visual function module editing method for Linux C program source code
Technical Field
The invention relates to the technical field of Linux C program source code editing, in particular to a method for editing a visual function module of a Linux C program source code.
Background
In the development of electronic products, due to product requirements, most of the functions of different products in the same series are the same, and the functions of the products are different from each other in small parts. This is reflected in the Linux C program source code, which is to share a portion of code, and a small portion of code cannot be shared. At this time, a method is needed to quickly select the code, so as to achieve the purpose of quickly selecting the product.
When the function module of the Linux C program source code is subjected to a choosing and rejecting operation, two modes are adopted at present: 1. unnecessary functional modules are found out from the source code, manually deleted and then compiled again. 2. Before compiling, the appointed macros are manually added in the script, so that the unnecessary functional modules do not execute compiling. When the two modes are adopted, the macro definition of the related functional module is needed to be found out, the functional module can be known, and a certain macro definition-DMACRO_X in a compiling instruction is needed to be manually added and deleted, so that the operation is complicated.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method for editing a visual function module of a Linux C program source code, and the function module in the Linux C program source code can be used for carrying out graphic list, so that editing and deleting are convenient.
A visual function module editing method of Linux C program source code comprises the following steps:
step S10: kernel program files corresponding to all functional modules in the Linux kernel source code are obtained;
step S20: establishing a menu file, wherein the menu file records all the functional modules;
step S30: performing visualization processing on the menu file to form a graphical interface, wherein all the functional modules form a series of lists and are displayed on the graphical interface, and each list can be checked;
step S40: storing the checked graphical interface and generating a configuration file;
step S50: and performing macro definition according to the configuration file, and transmitting the macro definition into the Linux C program source code, or compiling a function module appointed by the Linux C program source code by combining the configuration file.
Further, before the step S10, the method further includes a step S01: and obtaining the complete Linux kernel source code.
Further, after the step S10, the method further includes a step S11:
creating a folder test, and copying the kernel program file into the folder test.
Further, in the step S20, the menu file is built in the folder test, and the menu file is a Kconfig file.
Further, before the step S30, the method further includes:
step S21: copying a Makefile file in the Linux kernel source code into a folder test;
step S22: the path in the Makefile code is changed, replacing all "ARCH/$ (ARCH)/Kconfig" with "Kconfig".
Further, when the step S30 is performed, in the folder test, a make menu command is executed, the Kconfig file is read, and a visual graphical interface is generated, where the visual graphical interface displays a function module list recorded by the Kconfig file in a menu form and can be checked.
Further, in the step S40, the configuration file is a. Config file.
The invention has the beneficial effects that: the method comprises the steps of listing kernel source program folders of a Linux kernel source code, and then visually selecting information of the listing to regenerate a configuration file; and macro processing is carried out on the Linux C program source code according to the configuration file to realize the selection of the functional module, so that the operation is simple and the implementation is easy.
Drawings
Fig. 1 is a schematic diagram of an operation flow of the present embodiment.
Description of the embodiments
The invention is described in detail below with reference to the accompanying drawings. As shown in fig. 1.
Referring to fig. 1, an embodiment of the present invention provides a method for editing a visual function module of a Linux C program source code, including the following steps:
step S10: kernel program files corresponding to all functional modules in a Linux kernel source code are obtained;
step S20: establishing a menu file, wherein the menu file records all functional modules;
step S30: carrying out visual processing on the menu file to form a graphical interface, wherein all the functional modules form a series of lists and are displayed on the graphical interface, and each list can be checked;
step S40: storing the checked graphical interface and generating a configuration file;
step S50: macro definition is carried out according to the configuration file, and Linux C program source codes are transmitted; or compiling the function module appointed by the Linux C program source code by combining the configuration file.
When the function module in the Linux C program source code is selected, the function module is recorded through a menu file and a list is formed in a graphical interface by adopting visual processing; visual selection is carried out according to the list content, the operation is convenient, the list corresponding to the functional module is displayed on the graphical interface, and meanwhile, the operator can also pick up the list; after the required function module is selected, the configuration file is saved and generated.
Further, before step S10, step S01 is further included: and obtaining the complete Linux kernel source code. At present, there are many versions of Linux kernel source codes on the market, many Linux kernel source codes are modified, and kernel program folders corresponding to functional modules may be deleted, so that when menu files are manufactured, one-to-one verification is needed, and the workload is very high. Only if the Linux kernel source code with the complete version is adopted, the kernel program folder in the Linux kernel source code can be kept complete, and the functional module correspondingly keeps complete so as to ensure that the menu file manufactured later cannot be in error.
Further, after step S10, step S11 is further included: and creating a folder test, and copying the kernel program file corresponding to the functional module into the folder test. Specifically, in actual operation, the scripts folder in the Linux kernel source code is copied to the folder test. The top Makefile is copied to the folder test in a subsequent step.
When the Linux kernel source code is operated, the integrity and the originality of the original Linux kernel source code are prevented from being influenced by misoperation. Therefore, the invention adopts the steps of additionally arranging a folder test and copying all kernel program files corresponding to the functional modules into the folder test. Subsequent operations do not interfere with the source code in the original system.
Further, in step S20, a menu file is built in the folder test, and the menu file is a Kconfig file. In the Linux kernel source code, a kconfig file is used for configuring a kernel, a configuration menu of the kernel and a function module list corresponding to the kernel source program file is recorded. In the Linux C program source code, a Kconfig file can be customized, and each functional module is recorded in the Kconfig file.
Further, before step S30, the method further includes:
step S21: copying a Makefile file in a Linux kernel source code into a folder test;
step S22: the path in the Makefile code is changed, replacing all "ARCH/$ (ARCH)/Kconfig" with "Kconfig".
The Makefile code records file compiling rules, and can carry out interface processing on the Kconfig file. In the interface processing, since the position of the file has already changed, the path needs to be changed, and thus the path is modified in step S22.
Further, when step S30 is performed, in the folder test, a make menu command is executed, the Kconfig file is read, a visual graphical interface is generated, and the visual graphical interface displays the function module list recorded by the Kconfig file in the form of a menu and can be checked. When the visualization processing is carried out, the method adopts a mode of executing the make menu fig command and reading the Kconfig file, thereby realizing the visualization selection and having convenient and simple operation.
Further, at the time of step S40, the configuration file is a. Config file. Specifically, the config file is a kernel configuration file of Linux. According to the config file, the corresponding configuration items can be transmitted to the source code or the compiling of the appointed code module in the macro definition mode by matching with Makefile. And when the Linux C program source code is executed, selecting the functional module according to the config file. The function module that is checked out is normal running, and the function module that is not checked out is shielded.
The invention provides a specific implementation mode, which comprises the following specific steps:
1. and obtaining source codes of the Linux system. The corresponding version is downloaded via a network, such as the https:// mirrors.edge.kernel.org/pub/linux/kernel/website. The embodiment of the invention selects linux-2.6.12.
2. A folder named test is created and linux-2.6.12/scripts, linux-2.6.12/Makefile is copied into the folder test. Namely copying the scripts folder and Makefile in the Linux system file into a folder test.
3. A Kconfig file is newly created in the folder test. The folder test includes a script folder, a Makefile file and a Kconfig file.
4. The Makefile is modified and all "ARCH/$ (ARCH)/Kconfig" within the file is replaced with "Kconfig".
5. Executing a make menu command in the folder test, generating a graphical interface, displaying a list of function modules in the graphical interface, and performing checking.
6. And checking the list of the function modules, and storing and generating a config file.
7. According to the config file, the corresponding configuration item can be transmitted to the Linux C program source code in the macro definition mode by matching with Makefile.
In the process, the Linux-2.6.12 version is a relatively complete version of the Linux system, and the internal scripts folder comprises kernel program folders, wherein each kernel program folder corresponds to one functional module; when a Kconfig file is newly built, the Kconfig file records the configuration of all the functional modules in the scripts folder; before executing the make menu command, modifying the Kconfig path in the Makefile file, executing the visual command after modification, generating a graphical interface, and displaying a function module list by the graphical interface and being capable of being checked; and finally, a list of the required functional modules is checked and stored to generate a config file, wherein the config file is a configuration file, and the corresponding configuration item can be transmitted to a Linux C program source code in a macro definition mode by matching with a Makefile. When the Linux C program source code runs, the checked functional modules are run through macro definition. The whole editing process realizes visual selection, and is simple and convenient to operate; the function module specified by the Linux C program source code can also be compiled according to the config file.
The foregoing is merely exemplary of the invention, and those skilled in the art will recognize that the invention is not limited thereto, except insofar as modifications may be made by those skilled in the art in light of the teachings of the invention.

Claims (7)

1. A visual function module editing method of Linux C program source code is characterized in that: the method comprises the following steps:
step S10: kernel program files corresponding to all functional modules in a Linux kernel source code are obtained;
step S20: establishing a menu file, wherein the menu file records all the functional modules;
step S30: performing visualization processing on the menu file to form a graphical interface, wherein all the functional modules form a series of lists and are displayed on the graphical interface, and each list can be checked;
step S40: storing the checked graphical interface and generating a configuration file;
step S50: and performing macro definition according to the configuration file, and transmitting the macro definition into the Linux C program source code, or compiling a function module appointed by the Linux C program source code by combining the configuration file.
2. The method for editing a visual function module of Linux C program source code according to claim 1, wherein: before the step S10, the method further includes a step S01: and obtaining the complete Linux kernel source code.
3. The method for editing a visual function module of Linux C program source code according to claim 1 or 2, wherein: after the step S10, the method further includes a step S11: creating a folder test, and copying the kernel program file into the folder test.
4. A method for editing a visual function module of Linux C program source code according to claim 3, wherein: in the step S20, the menu file is built in the folder test, and the menu file is a Kconfig file.
5. The method for editing a visual function module of Linux C program source code according to claim 4, wherein: before the step S30, the method further includes a step S21: copying a Makefile file in the Linux kernel source code into the folder test; step S22: the path in the Makefile code is changed, replacing all "ARCH/$ (ARCH)/Kconfig" with "Kconfig".
6. The method for editing a visual function module of Linux C program source code according to claim 5, wherein: when the step S30 is performed, in the folder test, a make menu command is executed, the Kconfig file is read, and a visual graphical interface is generated, where the visual graphical interface displays the function module recorded in the Kconfig file in the form of a menu and can be checked.
7. The method for editing a visual function module of Linux C program source code according to claim 6, wherein: the configuration file is a config file when the step S40 is performed.
CN202311769272.3A 2023-12-21 2023-12-21 Visual function module editing method for Linux C program source code Pending CN117453202A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311769272.3A CN117453202A (en) 2023-12-21 2023-12-21 Visual function module editing method for Linux C program source code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311769272.3A CN117453202A (en) 2023-12-21 2023-12-21 Visual function module editing method for Linux C program source code

Publications (1)

Publication Number Publication Date
CN117453202A true CN117453202A (en) 2024-01-26

Family

ID=89584019

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311769272.3A Pending CN117453202A (en) 2023-12-21 2023-12-21 Visual function module editing method for Linux C program source code

Country Status (1)

Country Link
CN (1) CN117453202A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050034100A1 (en) * 2003-08-04 2005-02-10 Hanbai Liu Visual programming method and system thereof
CN103984541A (en) * 2014-04-14 2014-08-13 美的集团股份有限公司 Method and system for generating application procedure based on terminal source codes
CN109714642A (en) * 2018-12-29 2019-05-03 深圳Tcl数字技术有限公司 Linux application multiplexing is in the method for intelligence system, smart television and storage medium
CN115437684A (en) * 2022-09-21 2022-12-06 麒麟软件有限公司 File-level clipping method and system for Linux kernel source code

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050034100A1 (en) * 2003-08-04 2005-02-10 Hanbai Liu Visual programming method and system thereof
CN103984541A (en) * 2014-04-14 2014-08-13 美的集团股份有限公司 Method and system for generating application procedure based on terminal source codes
CN109714642A (en) * 2018-12-29 2019-05-03 深圳Tcl数字技术有限公司 Linux application multiplexing is in the method for intelligence system, smart television and storage medium
CN115437684A (en) * 2022-09-21 2022-12-06 麒麟软件有限公司 File-level clipping method and system for Linux kernel source code

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
HUSKAR_LIU: "make menuconfig的配置原理", pages 1, Retrieved from the Internet <URL:https://blog.csdn.net/weixin_42418557/article/details/89318885> *

Similar Documents

Publication Publication Date Title
CN107577469B (en) software packaging and publishing management method
US20230236809A1 (en) Ios application program construction method and apparatus, electronic device, and storage medium
JP5295269B2 (en) Method for generating component model-based virtual software platform, method for verifying software platform architecture using the same, and apparatus therefor
US20140089897A1 (en) Integrated exchange of development tool console data
US20090077422A1 (en) Method and system for accelerating test automation of software applications
CN107864052A (en) Method and its system based on lasting application deployment configuration automatic updating
WO2015157470A1 (en) Software test automation system and method
US20100218168A1 (en) System and Method for Generating a Test Environment Script File
US20170228220A1 (en) Self-healing automated script-testing tool
CN110442371B (en) Method, device and medium for releasing codes and computer equipment
US10496379B2 (en) Facilitated production of code for software testing
CN108897547A (en) A kind of software automatic deployment and device
WO2012150932A1 (en) Automatic classification adjustment of recorded actions for automation script
CN104503772A (en) Operating system installation and test environment establishment method and device based on virtual machine
CN104503778A (en) Installation method and installation device for applications
CN111913889A (en) Test system building method and test system
US8473903B2 (en) Code edit apparatus and recording medium
CN113138790B (en) Customized integration method and device for Android set top box and integrated development system for set top box
Salvador et al. Embedded Linux Development Using Yocto Project: Leverage the power of the Yocto Project to build efficient Linux-based products
CN110647349B (en) Method for realizing continuous delivery of iOS APP
US20150033213A1 (en) Compiling method, storage medium and compiling apparatus
CN117453202A (en) Visual function module editing method for Linux C program source code
CN111858302B (en) Method and device for testing small program, electronic equipment and storage medium
CN115964045A (en) Method, device and medium for quickly and automatically constructing cross-architecture operating system
CN117667643A (en) Evolution method and device of test case set, computing device cluster and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination