Rate This Document
Findability
Accuracy
Completeness
Readability

Installation Using Source Code (KAE 2.0)

The KAE 2.0 source package contains the KAE kernel driver, UADK framework, KAEOpensslEngine, KAEZstd, KAELz4, and KAEZlib. The kernel driver and UADK are necessary, and the other modules are optional. This document involves the KAEZlib library, KAEZstd library, and KAELz4 library. You can use scripts for installation and need to check whether the installation is successful.

Prerequisites

  • You have downloaded the KAE 2.0 source package from https://gitee.com/kunpengcompute/KAE/tree/kae2/ or by running git clone https://gitee.com/kunpengcompute/KAE.git -b kae2.
  • The system environment meets the requirements described in Preparing for the Installation.
  • Run the yum install -y make kernel-devel libtool numactl-devel openssl-devel lz4-devel libzstd-devel chrpath command to install dependencies.

Procedure

  1. Use a remote login tool to log in to the Linux CLI as the root user.
  2. Copy the KAE source package to a custom directory and decompress the package.
  3. (Optional) Install all modules using a script.

    Go to the directory of the KAE source package and run the sh build.sh all command to install all the preceding components. If the encryption and decryption module is not required, perform the following steps to install them by module.

  4. Install the kernel driver.
    1. Install the kernel driver in the KAE source code directory.
      1
      2
      cd KAE
      sh build.sh driver
      

      After compilation, uacce.ko, hisi_qm.ko, hisi_sec2.ko, hisi_hpre.ko, hisi_zip.ko, and hisi_rde.ko are generated. The installation path is /lib/modules/`uname -r`/extra.

    2. Check whether the drivers are installed.
      • Check whether the accelerator engine file system exists in /sys/class/uacce.
        1
        ll /sys/class/uacce/
        
        If the following information is displayed, the drivers have been installed:
        1
        2
        3
        4
        5
        6
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_hpre-2 -> ../../devices/pci0000:78/0000:78:00.0/0000:79:00.0/uacce/hisi_hpre-2
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_hpre-3 -> ../../devices/pci0000:b8/0000:b8:00.0/0000:b9:00.0/uacce/hisi_hpre-3
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_sec2-0 -> ../../devices/pci0000:74/0000:74:01.0/0000:76:00.0/uacce/hisi_sec2-0
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_sec2-1 -> ../../devices/pci0000:b4/0000:b4:01.0/0000:b6:00.0/uacce/hisi_sec2-1
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_zip-4 -> ../../devices/pci0000:74/0000:74:00.0/0000:75:00.0/uacce/hisi_zip-4
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_zip-5 -> ../../devices/pci0000:b4/0000:b4:00.0/0000:b5:00.0/uacce/hisi_zip-5
        
      • Use lsmod to check whether the drivers are successfully installed.
        1
        lsmod | grep uacce
        
        If the following information is displayed, the drivers have been installed:
        1
        uacce                  32768  3 hisi_sec2,hisi_qm,hisi_zip
        
    • If no device file is queried after the device is restarted and a driver is installed, a possible cause is that the OS has a built-in accelerator driver. You can uninstall the driver and then reload it. Alternatively, add the command for reloading the driver to the startup script re.local. The following uses hisi_sec2 as an example.
      1
      2
      rmmod hisi_sec2
      modprobe hisi_sec2
      
    • If no device file is queried after you run sh build.sh cleanup and then reinstall the driver, check that the license is successfully installed. For details, see "Obtaining a License" in Preparing for the Installation.
    • In KAE 2.0, the encryption and decryption as well as decompression drivers are installed together by default. You can manually uninstall unnecessary driver files.
  5. Install the user-mode driver.
    1. Run the following command in the KAEdriver source code directory to install the UADK driver development library:
      1
      sh build.sh uadk
      

      The UADK framework contains the user-mode driver. The dynamic library files of the user-mode driver are libwd.so and libwd_crypto.so. The default installation path of UADK is /usr/include/uadk. The dynamic library file is in /usr/local/lib.

    2. Check whether the UADK framework is installed.
      1
      ll /usr/local/lib/libwd*
      
      The installation is successful if the following information is displayed:
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      -rwxr-xr-x. 1 root root     961 Aug 22 17:23 /usr/local/lib/libwd_comp.la
      lrwxrwxrwx. 1 root root      19 Aug 22 17:23 /usr/local/lib/libwd_comp.so -> libwd_comp.so.2.5.0
      lrwxrwxrwx. 1 root root      19 Aug 22 17:23 /usr/local/lib/libwd_comp.so.2 -> libwd_comp.so.2.5.0
      -rwxr-xr-x. 1 root root  377872 Aug 22 17:23 /usr/local/lib/libwd_comp.so.2.5.0
      -rwxr-xr-x. 1 root root     973 Aug 22 17:23 /usr/local/lib/libwd_crypto.la
      lrwxrwxrwx. 1 root root      21 Aug 22 17:23 /usr/local/lib/libwd_crypto.so -> libwd_crypto.so.2.5.0
      lrwxrwxrwx. 1 root root      21 Aug 22 17:23 /usr/local/lib/libwd_crypto.so.2 -> libwd_crypto.so.2.5.0
      -rwxr-xr-x. 1 root root  715616 Aug 22 17:23 /usr/local/lib/libwd_crypto.so.2.5.0
      -rwxr-xr-x. 1 root root     907 Aug 22 17:23 /usr/local/lib/libwd.la
      lrwxrwxrwx. 1 root root      14 Aug 22 17:23 /usr/local/lib/libwd.so -> libwd.so.2.5.0
      lrwxrwxrwx. 1 root root      14 Aug 22 17:23 /usr/local/lib/libwd.so.2 -> libwd.so.2.5.0
      -rwxr-xr-x. 1 root root 1342080 Aug 22 17:23 /usr/local/lib/libwd.so.2.5.0
      
  6. Compile and install the KAEZlib library, KAEZstd library, and KAELz4 library.

    KAEZlib library

    After installing KAEZlib, you can compile and install the KAEGzip decompression tool as required. The tool integrates the KAE hardware acceleration API, enabling you to compress and decompress files more conveniently. For details, see 6.c and 6.d.

    1. Perform the compilation and installation.
      1
      sh build.sh zlib
      

      The zlib library is installed in /usr/local/kaezip.

    2. Check whether the zlib compression library is successfully installed.
      1
      ll /usr/local/kaezip/lib/
      
      The installation is successful if the following information is displayed:
      1
      2
      3
      4
      5
      6
      7
      8
      lrwxrwxrwx. 1 root root     40 Aug 29 10:20 libkaezip.so -> /usr/local/kaezip/lib/libkaezip.so.2.0.0
      lrwxrwxrwx. 1 root root     40 Aug 29 10:20 libkaezip.so.0 -> /usr/local/kaezip/lib/libkaezip.so.2.0.0
      -rwxr-xr-x. 1 root root 148096 Aug 29 10:20 libkaezip.so.2.0.0
      -rw-r--r--. 1 root root 145674 Aug 29 10:20 libz.a
      lrwxrwxrwx. 1 root root     14 Aug 29 10:20 libz.so -> libz.so.1.2.11
      lrwxrwxrwx. 1 root root     14 Aug 29 10:20 libz.so.1 -> libz.so.1.2.11
      -rwxr-xr-x. 1 root root 144784 Aug 29 10:20 libz.so.1.2.11
      drwxr-xr-x. 2 root root   4096 Aug 29 10:20 pkgconfig
      
    3. Optional: Compile and install KAEGzip.
      1
      sh build.sh gzip
      

      The tool is installed in /usr/local/kaegzip.

    4. Optional: Check whether KAEGzip is successfully installed.
      1
      ldd /usr/local/kaegzip/gzip
      
      The installation is successful if the following information is displayed:
      1
      2
      3
      4
      5
      6
      7
      8
      9
      [root@localhost /]# ldd /usr/local/kaegzip/gzip 
      	linux-vdso.so.1 (0x0000ffff7fbc1000)
      	libz.so.1 => /usr/local/kaezip/lib/libz.so.1 (0x0000ffff7fb50000)
      	libwd.so.2 => /usr/local/lib/libwd.so.2 (0x0000ffff7fae0000)
      	libkaezip.so => /usr/local/kaezip/lib/libkaezip.so (0x0000ffff7fa90000)
      	libc.so.6 => /usr/lib64/libc.so.6 (0x0000ffff7f8e0000)
      	/lib/ld-linux-aarch64.so.1 (0x0000ffff7fb84000)
      	libwd_comp.so.2 => /usr/local/lib/libwd_comp.so.2 (0x0000ffff7f8a0000)
      	libnuma.so.1 => /usr/lib64/libnuma.so.1 (0x0000ffff7f870000)
      

    KAEZstd library

    1. Perform the compilation and installation.
      1
      sh build.sh zstd
      

      The KAEZstd library is installed in /usr/local/kaezstd.

    2. Check whether the installation is successful.
      1
      ll /usr/local/kaezstd/lib/
      
      The installation is successful if the following information is displayed:
      1
      2
      3
      4
      5
      6
      7
      8
      9
      -rwxr-xr-x. 1 root root  82688 Aug 29 10:40 libkaezstd.a
      lrwxrwxrwx. 1 root root     42 Aug 29 10:40 libkaezstd.so -> /usr/local/kaezstd/lib/libkaezstd.so.2.0.0
      lrwxrwxrwx. 1 root root     42 Aug 29 10:40 libkaezstd.so.0 -> /usr/local/kaezstd/lib/libkaezstd.so.2.0.0
      -rwxr-xr-x. 1 root root  76880 Aug 29 10:40 libkaezstd.so.2.0.0
      -rw-r--r--. 1 root root 996750 Aug 29 10:40 libzstd.a
      lrwxrwxrwx. 1 root root     16 Aug 29 10:40 libzstd.so -> libzstd.so.1.5.2
      lrwxrwxrwx. 1 root root     16 Aug 29 10:40 libzstd.so.1 -> libzstd.so.1.5.2
      -rwxr-xr-x. 1 root root 908616 Aug 29 10:40 libzstd.so.1.5.2
      drwxr-xr-x. 2 root root   4096 Aug 29 10:40 pkgconfig
      

    KAELz4 library

    1. Perform the compilation and installation.
      1
      sh build.sh lz4
      

      The KAELz4 library is installed in /usr/local/kaelz4.

    2. Check whether the installation is successful.
      1
      ll /usr/local/kaelz4/lib/
      
      The installation is successful if the following information is displayed:
      1
      2
      3
      4
      5
      6
      7
      8
      9
      -rwxr-xr-x 1 root root 208716 Oct 24 14:26 libkaelz4.a
      lrwxrwxrwx 1 root root     40 Oct 24 14:26 libkaelz4.so -> /usr/local/kaelz4/lib/libkaelz4.so.1.0.0
      lrwxrwxrwx 1 root root     40 Oct 24 14:26 libkaelz4.so.0 -> /usr/local/kaelz4/lib/libkaelz4.so.1.0.0
      -rwxr-xr-x 1 root root 145296 Oct 24 14:26 libkaelz4.so.1.0.0
      -rw-r--r-- 1 root root 318592 Oct 24 14:27 liblz4.a
      lrwxrwxrwx 1 root root     15 Oct 24 14:27 liblz4.so -> liblz4.so.1.9.4
      lrwxrwxrwx 1 root root     15 Oct 24 14:27 liblz4.so.1 -> liblz4.so.1.9.4
      -rwxr-xr-x 1 root root 276320 Oct 24 14:27 liblz4.so.1.9.4
      drwxr-xr-x 2 root root   4096 Oct 24 14:27 pkgconfig
      
  7. Check whether the installation is successful.
    • Check whether the accelerator engine of the KAEZlib library takes effect by running the ldd command to confirm that KAEZlib links the libwd library.
      1
      ldd /usr/local/kaezip/lib/libz.so.1.2.11
      
      If the following information is displayed, the KAEZlib library has been installed. You can also run the ldd command to check whether the libwd library is used.
      1
      2
      3
      4
      5
      6
      7
              linux-vdso.so.1 (0x0000ffffa631d000)
      	libc.so.6 => /usr/lib64/libc.so.6 (0x0000ffffa6110000)
      	libkaezip.so => /usr/local/kaezip/lib/libkaezip.so (0x0000ffffa60df000)
      	libwd.so.2 => /usr/local/lib/libwd.so.2 (0x0000ffffa607e000)
      	libwd_comp.so.2 => /usr/local/lib/libwd_comp.so.2 (0x0000ffffa605d000)
      	/lib/ld-linux-aarch64.so.1 (0x0000ffffa62e0000)
      	libnuma.so.1 => /usr/lib64/libnuma.so.1 (0x0000ffffa6038000)
      
    • Check whether the accelerator engine of the KAEZstd library takes effect by running the ldd command to confirm that KAEZstd links the libwd library.
      1
      ldd /usr/local/kaezstd/lib/libkaezstd.so
      
      If the following information is displayed, the KAEZstd library has been installed.
      1
      2
      3
      4
      5
      6
              linux-vdso.so.1 (0x0000ffff89774000)
              libwd.so.2 => /usr/local/lib/libwd.so.2 (0x0000ffff896b5000)
              libwd_comp.so.2 => /usr/local/lib/libwd_comp.so.2 (0x0000ffff89684000)
              libc.so.6 => /usr/lib64/libc.so.6 (0x0000ffff894d5000)
              /lib/ld-linux-aarch64.so.1 (0x0000ffff89737000)
              libnuma.so.1 => /usr/lib64/libnuma.so.1 (0x0000ffff894b0000)
      
    • Check whether the accelerator engine of the KAELz4 library takes effect by running the ldd command to confirm that KAELz4 links the libwd library.
      1
      ldd /usr/local/kaelz4/lib/libkaelz4.so
      
      If the following information is displayed, the KAELz4 library has been installed.
      1
      2
      3
      4
      5
      6
      	linux-vdso.so.1 (0x0000ffff84add000)
      	libwd.so.2 => /usr/local/lib/libwd.so.2 (0x0000ffff84a0e000)
      	libwd_comp.so.2 => /usr/local/lib/libwd_comp.so.2 (0x0000ffff849dd000)
      	libc.so.6 => /usr/lib64/libc.so.6 (0x0000ffff8482e000)
      	/lib/ld-linux-aarch64.so.1 (0x0000ffff84aa0000)
      	libnuma.so.1 => /usr/lib64/libnuma.so.1 (0x0000ffff84809000)