Compilation control device and program
The compilation control device simplifies path management by using absolute and relative paths to ensure consistent path information across container and host environments, reducing the management load in device driver compilation.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- TOSHIBA TEC KK
- Filing Date
- 2024-01-10
- Publication Date
- 2026-06-16
AI Technical Summary
The path of the kernel source mounted on a container differs from the path on the host, requiring different management of path information when compiling a device driver on the container versus the host, leading to increased management load.
A compilation control device that includes a container management unit, path determination unit, and mounting units to manage and compile device drivers using absolute and relative paths, ensuring consistent path information management across environments.
Reduces the management burden of path information by allowing the use of the same path information for compiling device drivers on both container and host environments, simplifying the compilation process.
Smart Images

Figure 0007874668000001 
Figure 0007874668000002 
Figure 0007874668000003
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to a compilation control device and a program.
Background Art
[0002] As a method for compiling a device driver, there is a method of using container technology to compile a device driver mounted on a container. To compile a device driver, kernel source and path information of the kernel source are required. Therefore, when compiling a device driver on a container, the kernel source is mounted on the container.
Prior Art Documents
Patent Documents
[0003]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0004] However, the path of the kernel source mounted on the container may be different from the path of the kernel source on the host. Therefore, different management of the path information of the kernel source is required between the case of compiling the device driver on the host and the case of compiling the device driver on the container.
[0005] The problem to be solved by the embodiments of the present invention is to provide a compilation control device and a program that can reduce the management load of the path information of the kernel source when compiling a device driver.
Means for Solving the Problems
[0006] In one embodiment, the compilation control device includes a container management unit that starts a container in response to a first command specifying a pair of absolute and relative paths; a first mounting unit that mounts the kernel source to the container based on the absolute path; a path determination unit that determines a second mounting path for the driver source in the container based on the relative path and the first mounting path of the kernel source in the container; a second mounting unit that mounts the driver source to the container based on the second mounting path; and a compilation unit that compiles the driver source using the kernel source on the container. [Brief explanation of the drawing]
[0007] [Figure 1] Figure 1 is a block diagram showing an example of the hardware configuration of a compilation control device according to this embodiment. [Figure 2] Figure 2 is a block diagram showing an example of the functional configuration of a compile control device according to an embodiment. [Figure 3] Figure 3 shows an example of a compilation command executed on the container of the compilation control device according to this embodiment. [Figure 4] Figure 4 is a flowchart showing an example of the compilation process in the compilation control device according to this embodiment. [Figure 5] Figure 5 is a flowchart showing an example of the absolute path acquisition process in the compilation control device according to the embodiment. [Figure 6] Figure 6 is a flowchart showing an example of the relative path acquisition process in the compilation control device according to the embodiment. [Figure 7] Figure 7 shows a first example of a first compilation command to be input to the compilation control device according to the embodiment. [Figure 8] Figure 8 shows a second example of a first compilation command input to the compilation control device according to the embodiment. [Figure 9]Figure 9 shows an example of path information for kernel source and driver source on the host of the compilation control device according to the embodiment. [Figure 10] Figure 10 shows an example of path information for kernel source and driver source on a container of the compilation control device according to the embodiment. [Figure 11] Figure 11 shows a first example of a second compilation command input to the compilation control device according to the embodiment. [Figure 12] Figure 12 shows a second example of a second compilation command input to the compilation control device according to the embodiment. [Modes for carrying out the invention]
[0008] The compilation control device according to this embodiment will be described below with reference to the drawings. The compilation control device according to this embodiment is an information processing device that has the function of compiling device drivers using the Linux kernel in a Linux® development environment. Device drivers are, for example, drivers for MFP (multifunction peripheral), BCP (barcode printer), and POS (point of sale). Hereinafter, Linux will be referred to as the "host OS" or "host". The source code of the Linux kernel will be referred to as the "kernel source". The source code of the device driver will be referred to as the "driver source".
[0009] 1. Structure First, the configuration of the compilation control device according to the embodiment will be described.
[0010] 1.1 Hardware Configuration Figure 1 shows an example of the hardware configuration of a compilation control device according to an embodiment.
[0011] As shown in FIG. 1, the compilation control device 1 includes a control circuit 11, a storage 12, a communication module 13, a user interface 14, a drive 15, and a storage medium 16.
[0012] The control circuit 11 is a circuit that globally controls each component of the compilation control device 1. The control circuit 11 includes a CPU (central processing unit), a RAM (random access memory), a ROM (read only memory), and the like. The ROM of the control circuit 11 stores programs and the like used by the compilation control device 1 for various processes. The CPU of the control circuit 11 controls the entire compilation control device 1 according to the programs stored in the ROM of the control circuit 11. The RAM of the control circuit 11 has a working area for the CPU of the control circuit 11.
[0013] The storage 12 includes, for example, an HDD (Hard Disk Drive) or an SSD (Solid State Drive). The storage 12 stores information used in various processes in the compilation control device 1.
[0014] The communication module 13 is a circuit used for transmitting and receiving data between the compilation control device 1 and a network not shown in the figure.
[0015] The user interface 14 is a device that controls communication between the compilation control device 1 and the user. The user interface 14 includes an input device and an output device. The input device includes, for example, a touch panel, a keyboard, and operation buttons. The output device includes, for example, a printer, a speaker, and a display.
[0016] The drive 15 is a device for reading software stored in the storage medium 16. The drive 15 includes, for example, a CD (Compact Disk) drive or a DVD (Digital Versatile Disk) drive.
[0017] The storage medium 16 is a medium for storing software by electrical, magnetic, optical, mechanical, or chemical means. The storage medium 16 may also store programs for executing various processes in the compile control device 1.
[0018] 1.2 Functional Configuration Figure 2 is a block diagram showing an example of the functional configuration of a compile control device according to an embodiment.
[0019] As shown in Figure 2, the CPU of the control circuit 11 loads the program stored in the ROM or storage medium 16 of the control circuit 11 into the RAM of the control circuit 11. Then, the CPU of the control circuit 11 interprets and executes the program loaded into the RAM of the control circuit 11. In this way, the compilation control device 1 functions as a computer equipped with a container management unit 21, a path determination unit 22, a first mount unit 23, a second mount unit 24, and a compilation unit 25. The storage 12 of the compilation control device 1 stores the kernel source 31 and the driver source 32.
[0020] The container management unit 21 functions as a platform for realizing a container-type virtual environment. The container management unit 21 manages the startup and shutdown of containers in response to the execution of compilation commands. The container management unit 21 also manages the directory structure on the containers. The container management unit 21 is, for example, a Docker engine. The containers are, for example, Docker containers.
[0021] Figure 3 shows an example of a compilation command indicating that the compilation process will be executed on the container of the compilation control device according to the embodiment. Hereinafter, the compilation command indicating that the compilation process will be executed on the container will be referred to as the first compilation command.
[0022] As shown in Figure 3, the first compilation command is, for example, a make command executed on a Docker container. The first compilation command can be accompanied by first path information and second path information as command options. Here, one of the first and second path information specifies the absolute path information of the kernel source 31, starting from the top directory in the host's directory structure. The other of the first and second path information specifies the relative path information of the kernel source 31, starting from the driver source 32 in the host's directory structure.
[0023] Returning to Figure 2, let's explain the functional configuration of the compile control device 1.
[0024] The path determination unit 22 determines the paths (mount paths) for mounting the kernel source 31 and driver source 32 onto the container. Specifically, the path determination unit 22 determines the mount path of the kernel source 31 based on the absolute path information specified as a command option in the first compilation command. The path determination unit 22 also determines the mount path of the driver source 32 based on the relative path information specified as a command option in the first compilation command and the mount path of the kernel source 31. The path determination unit 22 transmits the determined mount paths of the kernel source 31 and the driver source 32 to the first mount unit 23 and the second mount unit 24, respectively.
[0025] The first mount unit 23 mounts the kernel source 31 onto the container based on the mount path of the kernel source 31 obtained from the path determination unit 22.
[0026] The second mounting unit 24 mounts the driver source 32 onto the container based on the mount path of the driver source 32 obtained from the path determination unit 22.
[0027] The compilation unit 25 is a compiler. The compilation unit 25 uses the kernel source 31 mounted on the container to compile the driver source 32 mounted on the container.
[0028] 2. Operation Next, the operation of the compilation control device according to the embodiment will be described.
[0029] 2.1 Compilation Process Figure 4 is a flowchart showing an example of the compilation process in a compilation control device according to the embodiment. The compilation process is a series of processes executed by the compilation control device 1 in response to a first compilation command.
[0030] As shown in Figure 4, when the user enters the first compilation command (start), the container management unit 21 starts the container (ACT11). It is assumed that the first compilation command includes the first and second path information.
[0031] The path determination unit 22 obtains absolute path information from the command options of the first compilation command (ACT12). Details on how to obtain absolute path information will be described later.
[0032] The path determination unit 22 determines the mount path of the kernel source 31 as the first mount path based on the absolute path information obtained in the processing of ACT12 (ACT13).
[0033] The container management unit 21 determines whether the mount path of the kernel source 31, which was determined in the processing of ACT13, is in the directory structure of the container started in the processing of ACT11 (ACT14).
[0034] If the mount path of kernel source 31 does not exist in the container's directory structure (ACT14; no), the container management unit 21 creates a directory corresponding to the mount path of kernel source 31 (ACT15).
[0035] If the mount path of kernel source 31 is in the container's directory structure (ACT14; yes), or after processing in ACT15, the first mount unit 23 mounts kernel source 31 to the first mount path (ACT16).
[0036] The path determination unit 22 obtains relative path information from the command options of the first compilation command (ACT17). Details on how to obtain relative path information will be described later.
[0037] The path determination unit 22 determines the mount path of the driver source 32 as the second mount path based on the relative path information obtained in the processing of ACT17 (ACT18).
[0038] The container management unit 21 determines whether the mount path of the driver source 32, determined in the processing of ACT18, is in the directory structure of the container started in the processing of ACT11 (ACT19).
[0039] If the mount path of the driver source 32 does not exist in the container's directory structure (ACT19; no), the container management unit 21 creates a directory corresponding to the mount path of the driver source 32 (ACT20).
[0040] If the mount path of the driver source 32 is in the container's directory structure (ACT19; yes), or after processing ACT20, the second mount unit 24 mounts the driver source 32 to the second mount path (ACT21).
[0041] The compilation unit 25 uses the kernel source 31 mounted in the container during the ACT16 process to compile the driver source 32 mounted in the container during the ACT21 process (ACT22).
[0042] After processing ACT22, the container management unit 21 terminates the containers started in the processing of ACT11 (ACT23).
[0043] Once ACT23 processing is complete, the compilation process ends (end).
[0044] 2.2 Absolute Path Acquisition Process Figure 5 is a flowchart showing an example of the absolute path acquisition process in the compilation control device according to the embodiment. The processes ACT31 to ACT33 shown in Figure 5 provide details of the process of ACT12 in Figure 4.
[0045] As shown in Figure 5, when the absolute path acquisition process starts (start), the path determination unit 22 determines whether the first path information of the command options of the first compilation command specifies an absolute path (ACT31).
[0046] If the first path information specifies an absolute path (ACT31; yes), the path determination unit 22 acquires the first path information as an absolute path (ACT32).
[0047] If the first path information does not specify an absolute path (ACT31; no), the path determination unit 22 obtains the second path information as an absolute path (ACT33).
[0048] After the processing of ACT32 or ACT33, the absolute path acquisition process ends (end).
[0049] 2.3 Relative path acquisition process Figure 6 is a flowchart showing an example of the relative path acquisition process in the compilation control device according to the embodiment. The processes ACT41 to ACT43 shown in Figure 6 illustrate the details of the process of ACT17 in Figure 4.
[0050] As shown in Figure 6, when the relative path acquisition process starts (start), the path determination unit 22 determines whether the first path information of the command options of the first compilation command specifies a relative path (ACT41).
[0051] If the first path information specifies a relative path (ACT41; yes), the path determination unit 22 acquires the first path information as a relative path (ACT42).
[0052] If the first path information does not specify a relative path (ACT41; no), the path determination unit 22 obtains the second path information as a relative path (ACT43).
[0053] After the processing of ACT42 or ACT43, the relative path acquisition process ends (end).
[0054] 2.4 Specific Examples (Example 1) Figure 7 shows a first example of a first compilation command to be input to the compilation control device according to the embodiment. The first example corresponds to a case where the first compilation command specifies a relative path in the first path information and an absolute path in the second path information in the command options.
[0055] In the example in Figure 7, the first compilation command specifies the first path information ".. / .. / linux-src" in the environment variable KERNEL_SRC. The first compilation command also specifies the second path information " / home / test / linux-src" in the environment variable KERNEL_ROUTE_PATH. In other words, the first compilation command specifies a relative path in the first path information and an absolute path in the second path information.
[0056] Therefore, in the absolute path acquisition process, the path determination unit 22 acquires the second path information " / home / test / linux-src" as the absolute path of the kernel source 31 (ACT33). Then, the path determination unit 22 determines the acquired absolute path as the mount path of the kernel source 31 (ACT13).
[0057] Furthermore, during the relative path acquisition process, the path determination unit 22 acquires the first path information ".. / .. / linux-src" as the relative path to the kernel source 31 starting from the driver source 32 (ACT42). Then, the path determination unit 22 determines the mount path of the driver source 32 based on the acquired relative path (ACT18). Specifically, for example, the path determination unit 22 decides that the mount path (absolute path) of the driver source 32 is " / home / test / X / Y" (where X and Y are arbitrary folders).
[0058] (Example 2) Figure 8 shows a second example of a first compilation command input to the compilation control device according to the embodiment. The second example corresponds to a case where the first compilation command specifies an absolute path in the first path information and a relative path in the second path information in the command options.
[0059] In the example in Figure 8, the first compilation command specifies the first path information " / home / test / linux-src" in the environment variable KERNEL_SRC. The first compilation command also specifies the second path information ".. / .. / linux-src" in the environment variable KERNEL_RELATE_PATH. In other words, the first compilation command specifies an absolute path in the first path information and a relative path in the second path information.
[0060] Therefore, in the absolute path acquisition process, the path determination unit 22 acquires the first path information " / home / test / linux-src" as the absolute path of the kernel source 31 (ACT32). Then, the path determination unit 22 determines the acquired absolute path as the mount path of the kernel source 31 (ACT13).
[0061] Furthermore, during the relative path acquisition process, the path determination unit 22 acquires the second path information ".. / .. / linux-src" as the relative path to the kernel source 31 starting from the driver source 32 (ACT43). Then, the path determination unit 22 determines the mount path of the driver source 32 based on the acquired relative path (ACT18). Specifically, for example, the path determination unit 22 decides that the mount path (absolute path) of the driver source 32 is " / home / test / X / Y".
[0062] (Directory structure) In either of the first and second specific examples described above, a directory structure equivalent to the directory structure containing the kernel source 31 and driver source 32 on the host can be constructed on the container.
[0063] Figure 9 shows an example of the path information for kernel source and driver source on the host of the compilation control device according to the embodiment. Figure 10 shows an example of the path information for kernel source and driver source on the container of the compilation control device according to the embodiment. Figure 10 shows the directory structure constructed on the container when a compilation process based on the first compilation command is executed on a host having the directory structure shown in Figure 9.
[0064] As shown in Figures 9 and 10, the directory structure built on the container by executing the compilation process based on the first compilation command will be equivalent to the directory structure built on the host. More specifically, assume that the absolute path of kernel source 31 on the host is " / home / test / linux-src", and the relative path of kernel source 31 from driver source 32 is ".. / .. / linux-src". In this case, on the container generated by executing the compilation process based on the first compilation command, the mount path of kernel source 31 will be the absolute path " / home / test / linux-src". Also, the mount path of driver source 32 will be the path where the relative path of kernel source 31 from driver source 32 is ".. / .. / linux-src".
[0065] 3. Effects according to the embodiment According to the embodiment, the container management unit 21 starts a container in response to a first compilation command that specifies a pair of absolute and relative paths. The first mount unit 23 mounts the kernel source 31 to the container based on the absolute path specified by the first compilation command. The path determination unit 22 determines the mount path of the driver source 32 in the container based on the relative path specified by the first compilation command and the mount path of the kernel source 31 in the container. The second mount unit 24 mounts the driver source 32 to the container based on the mount path of the driver source 32 determined by the path determination unit 22. The compilation unit 25 compiles the driver source 32 on the container using the kernel source 31. As a result, even when compiling the driver source 32 on the container, the same path information as the compilation command (second compilation command) used when compiling the driver source 32 on the host can be used.
[0066] To elaborate, the second compilation command specifies either an absolute or relative path on the host, as shown in Figures 11 and 12.
[0067] Figure 11 shows a first example of a second compilation command to be input to the compilation control device according to the embodiment. Figure 12 shows a second example of a second compilation command to be input to the compilation control device according to the embodiment. The first example corresponds to the case where a relative path to the kernel source 31 is specified. The second example corresponds to the case where an absolute path to the kernel source 31 is specified. The first and second examples show examples of second compilation commands when the directory structure shown in Figure 9 is constructed on the host.
[0068] As shown in Figure 11, when specifying a relative path to kernel source 31, the second compilation command specifies the relative path to kernel source 31, ".. / .. / linux-src", starting from the driver source 32 on the host, as a command option. As shown in Figure 12, when specifying an absolute path to kernel source 31, the second compilation command specifies the absolute path to kernel source 31, " / home / test / linux-src", starting from the top directory on the host, as a command option.
[0069] On the other hand, a directory structure equivalent to that on the host may not be built on the container. If the kernel source 31 and driver source 32 are mounted to a container directory structure that differs from the directory structure on the host, the absolute path of the kernel source 31 on the container and the relative path of the kernel source 31 relative to the driver source 32 will differ from the absolute and relative paths on the host. Therefore, the first compilation command will have to specify different path information than the path information specified in the second compilation command, which may make management complicated.
[0070] According to the embodiment, the compilation command specifies first path information and second path information as command options. One of the first and second path information specifies the absolute path of the kernel source 31 starting from the top directory on the host. The other of the first and second path information specifies the relative path of the kernel source 31 starting from the driver source 32 on the host. If the container does not have a directory structure corresponding to the mount path, the container management unit 21 generates such a directory structure in the container. This allows the first compilation command to specify path information using path information that may be specified in the second compilation command. Therefore, the management burden of path information used in the compilation process can be reduced.
[0071] 4. Variations, etc. Various modifications can be applied to the embodiments described above.
[0072] In the embodiments described above, the case in which KERNEL_SRC, KERNEL_ROUTE_PATH, and KERNEL_RELATE_PATH are used as environment variables specified in the command options of the first compilation command has been explained, but the invention is not limited to this. For example, other string environment variables may be used as environment variables specified in the command options of the first compilation command.
[0073] Furthermore, in the above-described embodiment, the first mounting unit 23 and the second mounting unit 24 mount the kernel source 31 and driver source 32 based on absolute and relative paths, respectively, but this is not limited to this. For example, symbolic links or the like may be used as long as they are accessible paths.
[0074] While several embodiments of the present invention have been described, these embodiments are presented as examples only and are not intended to limit the scope of the invention. These novel embodiments can be carried out in a variety of other forms, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments and their variations are included in the scope and spirit of the invention, as well as in the claims and their equivalents. [Explanation of Symbols]
[0075] 1...Compilation control unit, 11...Control circuit, 12...Storage, 13...Communication module, 14...User interface, 15...Drive, 16...Storage medium, 21...Container management unit, 22...Path determination unit, 23...First mount unit, 24...Second mount unit, 25...Compilation unit, 31...Kernel source, 32...Driver source.
Claims
1. A container management unit starts a container in response to a first command that specifies a pair of absolute and relative paths, A first mounting unit mounts the kernel source to the container based on the aforementioned absolute path, A path determination unit that determines a second mount path for the driver source in the container based on the relative path and the first mount path for the kernel source in the container, A second mounting unit mounts the driver source to the container based on the second mounting path, A compilation unit that compiles the driver source using the kernel source on the container, A compilation control device equipped with the following features.
2. The aforementioned absolute path is the absolute path of the kernel source starting from the top directory on the host. The aforementioned relative path is the relative path to the kernel source, starting from the driver source on the host. The compilation control device according to claim 1.
3. The container management unit, if the container does not have a directory structure corresponding to the first mount path and the second mount path, generates the directory structure in the container. The compilation control device according to claim 1.
4. The aforementioned compilation unit, In response to a second command specifying either the absolute path or the relative path, the driver source is compiled on the host using the kernel source. The compilation control device according to claim 2.
5. Computers, A container management unit starts a container in response to a first command that specifies a pair of absolute and relative paths, A first mounting unit mounts the kernel source to the container based on the aforementioned absolute path, A path determination unit that determines a second mount path for the driver source in the container based on the relative path and the first mount path for the kernel source in the container, A second mounting unit mounts the driver source to the container based on the second mounting path, A compilation unit that compiles the driver source using the kernel source on the container, A program designed to function as such.