Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling and Installing the Read Cache Library

Procedure

  1. Download the Ucache branch code from the ocf repository and package it.
    cd /home
    git clone https://gitee.com/kunpeng_compute/ocf.git -b UCache
    tar -zcvf lava-ocf-adaptor-1.0.0.tar.gz ocf/
  2. Go to the /home directory and create an RPM build directory.

    The rpmbuild tool must be installed in the environment.

    yum install rpm-build
    1. Open the .rpmmacros file.
      1
      vi /root/.rpmmacros
      
    2. Change the value of %_topdir to /home/rpmbuild. If the file does not contain this line, add it, save the file, and exit.

    3. Run the rpmbuild installation command again.
      1
      rpmdev-setuptree
      
  3. Open the rpmmacros file and comment out the content in the red box.
    1
    vi /root/.rpmmacros
    

  4. Copy the source package and SPEC file to the /home/rpmbuild subdirectory.
    1
    2
    cp /home/lava-ocf-adaptor-1.0.0.tar.gz /home/rpmbuild/SOURCE
    cp /home/ocf/lava-ocf-adaptor.spec /home/rpmbuild/SPEC
    
  5. Compile the RPM package.

    Default package build command:

    rpmbuild -bb /home/rpmbuild/SPECS/lava-ocf-adaptor.spec

    After the compilation is complete, the following RPM packages are generated:

  6. Install the following RPM package.
    cd /home/rpmbuild/RPMS/aarch64/
    rpm -ivh lava-ocf-adaptor-1.0.0-1.aarch64.rpm

    lava-ocf-adaptor-1.0.0-1.aarch64.rpm contains the following files:

    ocf_adaptor.h describes all external interfaces. Other header files define structures and error codes.

    To integrate the read cache into an application, add the link option -llava_cache during application compilation.