Rate This Document
Findability
Accuracy
Completeness
Readability

Viewing a Source Code Porting Report

The tool checks and analyzes source files written in C, C++, Fortran, Go, interpreted languages, and assembly languages, pinpoints the lines of code to be ported, and provides porting guidance. It supports editing during porting and one-click code replacement.

Prerequisites

The analysis task is complete.

The porting reports vary with the target OS because different OSs support different SO libraries.

Viewing a Porting Report

  1. Click Source Code Porting in the navigation pane on the left. Historical reports are listed.
  2. In the historical report list, click the report name of the specified analysis task to enter the porting report page. By default the architecture source code porting report is displayed.
    Figure 1 Architecture source code porting report
    Table 1 Report parameters

    Parameter

    Description

    File Scan Statistics

    Total Files

    Total number of scanned source files, which is subject to the selected source code type and build tool.

    Dependency File Statistics

    Total Files

    Total number of architecture-related files on which the source package depends.

    Adaptable for Compatibility

    Download the file package from the Kunpeng image repository and use it to replace the current files. For details, see the handling suggestions in Architecture-Related Dependencies.

    Unconfirmed

    Perform required operations to ensure compatibility with the target hardware platform. For details, see the handling suggestions in Architecture-Related Dependencies.

    Source File Statistics

    Files to Be Modified

    Number of files to be modified.

    Code Lines to Modify

    Number of code lines to be modified.

    Porting Workload

    Estimated source code porting manpower. This parameter is displayed when the Display Workload Estimation Result parameter in Scan Parameter Settings is set to Yes.

    Architecture-Related Dependencies

    Dependency files related to the architecture. Perform operations based on the handling suggestions.

    Source Files to Be Ported

    Number of source files to be ported and number of code lines to be modified. You can click View Suggested Source Code in the Operation column to view the suggestions.

    • The file types are Makefile, C/C++ Source File, ASM File, Fortran, Python, Go, Java, Scala, Bazel, and Blade. You can filter files to view specific file types.
    • The file paths are sorted based on Unicode, and the code lines to be modified are sorted in sequence.
  3. Prepare dependencies.

    As shown in Figure 2, the current porting task involves two dependency files.

    Figure 2 Dependencies
    • You can click Download in the Handling Suggestions column to download the dynamic libraries, static library files, software packages, executable files, and JAR packages that can be adapted to the Kunpeng platform. You can also download the source code of the Kunpeng version and compile it. For some non–open-source dependency files, the download URLs are not available. You need to obtain the files yourself and use them to replace the architecture-related dependency files.
    • For those files to be modified, verify them on the Kunpeng platform first. If a file is not compatible with the Kunpeng platform, obtain a compatible version from the vendor, obtain the source code and compile it, or use alternative software.
    For example, process the libz.so.1 dependency file in the preceding figure as follows:
    1. Run the following command to check whether the dynamic library has been downloaded to the server.
      1
      rpm -qa | grep zlib
      
    2. If the dynamic library is not installed, click Download to obtain it and install it on the server. If the dynamic library has been installed, skip this step.
      1
      rpm -ivh zlib-1.2.11-20.oe1.aarch64.rpm
      

      Command output:

      1
      2
      3
      Verifying...                          ################################# [100%]
      Preparing...                          ################################# [100%]
              file /usr/lib64/libz.so.1.2.11 from install of zlib-1.2.11-20.oe1.aarch64 conflicts with file from package zlib-1.2.11-17.oe1.aarch64
      
  4. In the Operation column of the report, click View Suggested Source Code.

    When editing the original code, save the modification in time. Otherwise, the modification may be lost due to session timeout.

    Figure 3 Source code porting suggestions
    Table 2 Parameter description

    Parameter

    Description

    File List

    Lists the source files analyzed.

    Original Source Code

    Displays the original source code.

    • You can modify the source code. After the modification is complete, click Save, Roll Back, or Cancel in the upper right corner as required.
    • You can move the mouse pointer to the code with a red wavy line and click Quick Fix in the floating message to apply the change automatically. You can also select Batch Apply This Suggestion to modify the same type of code in batches.
    • If you use shortcut keys to modify the source code, pay attention to shortcut key conflicts caused by the input method or IDE environment.
    • Click in the file list on the left to download the required source file.
    • Do not rescan the assembly source code after porting and modification. A rescan may cause inaccurate analysis results.