Compiling and Installing the Read Cache Library
Procedure
- 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/
- Go to the /home directory and create an RPM build directory.
The rpmbuild tool must be installed in the environment.
yum install rpm-build
- Open the .rpmmacros file.
1vi /root/.rpmmacros - Change the value of %_topdir to /home/rpmbuild. If the file does not contain this line, add it, save the file, and exit.

- Run the rpmbuild installation command again.
1rpmdev-setuptree
- Open the .rpmmacros file.
- Open the rpmmacros file and comment out the content in the red box.
1vi /root/.rpmmacros
- 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
- 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:

- 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.