Skip to content

Commit

Permalink
Merge pull request #123 from zouxiaoh/iotg_ipu6
Browse files Browse the repository at this point in the history
ARL PV release for kernel v6.11-rc3
  • Loading branch information
zouxiaoh authored Sep 26, 2024
2 parents 9c87043 + 725ebe7 commit cb5d40d
Show file tree
Hide file tree
Showing 92 changed files with 2,864 additions and 36,421 deletions.
550 changes: 263 additions & 287 deletions CMakeLists.txt

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ There are 4 repositories that provide the complete setup:
# └── out
```
2. In `work` folder, run `./build.sh`. Output binaries will be in `out/install`. (RPM build is not implemented yet)
Notice: To disable 'dma-drm', should remove '--enable-gstdrmformat=yes' in build.sh manually.
The featuer depends on 'gstreamer >= 1.23' and 'libva-drm'.
2. For example, in `work` folder, run `./build.sh -d --board ipu_mtl`. Output binaries will be in `out/ipu_mtl/install`.
Notice: Use `./build.sh --board ipu_mtl` to disable dma build.
The dma build depends on 'gstreamer >= 1.23' and 'libva-drm'.
3. Install contents in `out/install` to your `/usr`:
3. Install built out drivers in `out/<target>/install` to target:
```sh
sudo cp -r ./out/install/etc/* /etc/
sudo cp -r ./out/install/include/* /usr/include/
sudo cp -r ./out/install/lib/* /usr/lib/
sudo cp -r ./out/install/usr/* /usr/
cp -r ./out/<target>/install/etc* /etc/
cp -r ./out/<target>/install/usr/include/* /usr/include/
cp -r ./out/<target>/install/usr/lib/* /usr/lib/
```
For more building details please reference the `build.sh`.
136 changes: 66 additions & 70 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,22 @@ function check_result() {

function parse_argument() {
export SOURCE_DIR=${PWD}
export INSTALL_DIR=${PWD}/out
export TARGET_BUILD_INSTALL_DIR=${PWD}/out
export BOARD_LIST="ipu_tgl ipu_adl ipu_mtl"
export BUILD_RPM=ON
export BUILD_RPM=OFF
export ENABLE_DMA_DRM=OFF

while true; do
case $1 in
-s|--source)
export SOURCE_DIR=$2
echo "$2"
shift
;;
-i|--install)
export INSTALL_DIR=$2
echo "$2"
shift
;;
--no-rpm)
export BUILD_RPM=OFF
;;
-d|--dma)
export ENABLE_DMA_DRM=ON
;;
--board)
shift
export BOARD_LIST=$@
echo "$$"
break
export BOARD_LIST=$2
echo "$2"
;;
-?*)
echo "WARNING: not supported option: $1"
Expand All @@ -51,123 +43,127 @@ function parse_argument() {

echo "=========================== Build Config ============================"
echo "SOURCE_DIR: $SOURCE_DIR"
echo "INSTALL_DIR: $INSTALL_DIR"
echo "INSTALL_DIR: $TARGET_BUILD_INSTALL_DIR"
echo "BUILD_RPM: $BUILD_RPM"
echo "ENABLE_DMA_DRM: $ENABLE_DMA_DRM"
echo "BOARD_LIST: $BOARD_LIST"
echo "====================================================================="
}

function print_helper() {
echo
echo "========================= Command Helper ============================"
echo "./build_release.sh -s source_dir -i install_dir --board target1 targert2 ..."
echo "==== disable dma ===="
echo "./build.sh --board target"
echo "==== enable dma ===="
echo "./build.sh -d --board target"
echo "====================================================================="
echo
}

standardize_pkg_config_path(){
if [[ ! -f $1 ]]; then echo "file $1 not exsist."; exit 0; fi
sed -i '1c prefix=\/usr' $*
}

function build_target() {
function build_libcamhal() {
rm -fr build && mkdir -p build && cd build

local target=$1
export IPU_VERSION=

rm -fr $TARGET_BUILD_INSTALL_DIR/$target && mkdir -p $TARGET_BUILD_INSTALL_DIR/$target
export BUILD_INSTALL_DIR=$TARGET_BUILD_INSTALL_DIR/$target/install

export IPU_VERSIONS=
if [ "$target" = "ipu_tgl" ]; then
IPU_VERSION=ipu6
IPU_VERSIONS=ipu6
elif [ "$target" = "ipu_adl" ]; then
IPU_VERSION=ipu6ep
IPU_VERSIONS=ipu6ep
elif [ "$target" = "ipu_mtl" ]; then
IPU_VERSION=ipu6epmtl
IPU_VERSIONS=ipu6epmtl
else
echo "Error: unsupport the target name : $target"
echo "Error: doesn't support the target : $target"
exit -1
fi

# indicate the install folder of binary package
# export PKG_CONFIG_PATH=~/work/linux/camera_submit/camera/out/install/lib/$target/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/usr/lib/$target/pkgconfig:$PKG_CONFIG_PATH
sed -i 's|^prefix=.*|prefix='$BUILD_INSTALL_DIR/usr/'|' $BUILD_INSTALL_DIR/usr/lib/pkgconfig/*.pc

command cmake -DCMAKE_BUILD_TYPE=Release \
-DIPU_VER=$IPU_VERSION \
-DBUILD_CAMHAL_TESTS=OFF \
-DIPU_VERSIONS=$IPU_VERSIONS \
-DBUILD_CAMHAL_TESTS=ON \
-DUSE_PG_LITE_PIPE=ON \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR/install \
-DCMAKE_INSTALL_SUB_PATH=$target ..
-DUSE_STATIC_GRAPH=ON \
-DUSE_STATIC_GRAPH_AUTOGEN=ON \
-DCMAKE_C_FLAGS=-O2 \
-DCMAKE_CXX_FLAGS=-O2 \
-DBUILD_CAMHAL_ADAPTOR=ON \
-DBUILD_CAMHAL_PLUGIN=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
..

# make and install
make -j`nproc`
check_result $? "$FUNCNAME: $target"

make install
make DESTDIR=$BUILD_INSTALL_DIR install
check_result $? "$FUNCNAME: $target"
standardize_pkg_config_path ${INSTALL_DIR}/install/usr/lib/${target}/pkgconfig/libcamhal.pc

cd ..
}

function build_hal() {
function build_libcamhal_target() {
cd $SOURCE_DIR/ipu6-camera-hal

for target in $BOARD_LIST
do
build_target $target
build_libcamhal $target
done
}

function build_hal_adaptor() {
cd $SOURCE_DIR/ipu6-camera-hal/src/hal/hal_adaptor
rm -fr build && mkdir -p build && cd build

command cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR/install ../

# make and install
make -j
check_result $? $FUNCNAME

make install
check_result $? $FUNCNAME
standardize_pkg_config_path ${INSTALL_DIR}/install/lib/pkgconfig/hal_adaptor.pc
}

function build_icamerasrc() {
cd $SOURCE_DIR/icamerasrc/

export CAMHAL_LIBS="-L$INSTALL_DIR/install/lib -lhal_adaptor"
export CAMHAL_CFLAGS="-I$INSTALL_DIR/install/include/hal_adaptor \
-I$INSTALL_DIR/install/include/hal_adaptor/api \
-I$INSTALL_DIR/install/include/hal_adaptor/utils \
-I$INSTALL_DIR/install/include/hal_adaptor/linux"
export CHROME_SLIM_CAMHAL=ON
export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:${PKG_CONFIG_PATH}"
export DEFAULT_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH=$DEFAULT_PKG_CONFIG_PATH:/usr/lib/x86_64-linux-gnu/pkgconfig:$BUILD_INSTALL_DIR/usr/lib/pkgconfig

sed -i 's|^prefix=.*|prefix='$BUILD_INSTALL_DIR/usr/'|' $BUILD_INSTALL_DIR/usr/lib/pkgconfig/libcamhal.pc

rm -fr config.h.in autom4te.cache/ aclocal.m4 *-libtool config.guess compile \
config.sub configure depcomp install-sh ltmain.sh m4
autoreconf --install
CFLAGS="-O2" CXXFLAGS="-O2" ./configure --with-haladaptor=yes --enable-gstdrmformat=yes ${CONFIGURE_FLAGS} \
--prefix=$INSTALL_DIR/install DEFAULT_CAMERA=0

export CAMHAL_CFLAGS="-I$BUILD_INSTALL_DIR/usr/include/libcamhal \
-I$BUILD_INSTALL_DIR/usr/include/libcamhal/api \
-I$BUILD_INSTALL_DIR/usr/include/libcamhal/utils \
-I$BUILD_INSTALL_DIR/usr/include/libcamhal/linux"

export CHROME_SLIM_CAMHAL=ON

local ENABLE_FEATURE_ARGS=
if [ "$ENABLE_DMA_DRM" = "ON" ]; then
ENABLE_FEATURE_ARGS+="--enable-gstdrmformat=yes "
fi

CFLAGS="-O2" CXXFLAGS="-O2" ./configure --prefix=/usr DEFAULT_CAMERA=0 ${ENABLE_FEATURE_ARGS}
check_result $? $FUNCNAME

make clean
make -j
check_result $? $FUNCNAME

make install
make DESTDIR=$BUILD_INSTALL_DIR install
check_result $? $FUNCNAME
find $INSTALL_DIR/install/ -name "*.la" -exec rm -f "{}" \;
standardize_pkg_config_path ${INSTALL_DIR}/install/lib/pkgconfig/libgsticamerasrc.pc

find $BUILD_INSTALL_DIR -name "*.la" -exec rm -f "{}" \;
}

function main () {
parse_argument $@
if [ -z "$SOURCE_DIR" ] || [ -z "$INSTALL_DIR" ] || [ -z "$BOARD_LIST" ]; then
if [ -z "$SOURCE_DIR" ] || [ -z "$TARGET_BUILD_INSTALL_DIR" ] || [ -z "$BOARD_LIST" ]; then
print_helper
exit 1
fi
rm -fr $INSTALL_DIR/install $INSTALL_DIR/rpm && mkdir -p $INSTALL_DIR/install $INSTALL_DIR/rpm
build_hal
build_hal_adaptor

rm -fr $TARGET_BUILD_INSTALL_DIR && mkdir -p $TARGET_BUILD_INSTALL_DIR

build_libcamhal_target
build_icamerasrc

# TODO: Generate the RPM for hal, hal_adaptor and icamerasrc together
Expand Down
99 changes: 46 additions & 53 deletions cmake/FindIA_IMAGING.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,76 +23,69 @@ endif()
include(FindPackageHandleStandardArgs)

find_package(PkgConfig)
pkg_check_modules(IA_IMAGING ia_imaging)
if(NOT IA_IMAGING_FOUND)
message(FATAL_ERROR "IA_IMAGING not found")
pkg_check_modules(IA_IMAGING${TARGET_SUFFIX} ia_imaging${TARGET_SUFFIX})
if(NOT IA_IMAGING${TARGET_SUFFIX}_FOUND)
message(FATAL_ERROR "IA_IMAGING${TARGET_SUFFIX} not found")
endif()

set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${IA_IMAGING_LIBRARY_DIRS})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${IA_IMAGING${TARGET_SUFFIX}_LIBRARY_DIRS})

# Libraries
find_library(IA_CCA_LIB ia_cca)
find_library(IA_AIQ_LIB ia_aiq)
find_library(IA_AIQB_PARSER_LIB ia_aiqb_parser)
find_library(IA_CMC_PARSER_LIB ia_cmc_parser)
if (NOT ENABLE_SANDBOXING)
find_library(IA_LARD_LIB ia_lard)
endif() #ENABLE_SANDBOXING
find_library(IA_EXC_LIB ia_exc)
find_library(IA_MKN_LIB ia_mkn)
find_library(IA_CCA${TARGET_SUFFIX}_LIB ia_cca${TARGET_SUFFIX})
find_library(IA_AIQ${TARGET_SUFFIX}_LIB ia_aiq${TARGET_SUFFIX})
find_library(IA_AIQB_PARSER${TARGET_SUFFIX}_LIB ia_aiqb_parser${TARGET_SUFFIX})
find_library(IA_CMC_PARSER${TARGET_SUFFIX}_LIB ia_cmc_parser${TARGET_SUFFIX})
find_library(IA_EXC${TARGET_SUFFIX}_LIB ia_exc${TARGET_SUFFIX})
find_library(IA_MKN${TARGET_SUFFIX}_LIB ia_mkn${TARGET_SUFFIX})
# SENSOR_EMD_DECODER
find_library(IA_EMD_LIB ia_emd_decoder)
find_library(IA_EMD${TARGET_SUFFIX}_LIB ia_emd_decoder${TARGET_SUFFIX})
# DOL_FEATURE_S
find_library(IA_BCOMP_LIB ia_bcomp)
find_library(IA_BCOMP${TARGET_SUFFIX}_LIB ia_bcomp${TARGET_SUFFIX})
# DOL_FEATURE_E
find_library(IA_NVM_LIB ia_nvm)
find_library(IA_LOG_LIB ia_log)
find_library(IA_DVS_LIB ia_dvs)
find_library(IA_COORDINATE_LIB ia_coordinate)
find_library(IA_LTM_LIB ia_ltm)
find_library(IA_DVS_LIB ia_dvs)
find_library(IA_ISP_BXT_LIB ia_isp_bxt)
find_library(BXT_IA_PAL_LIB broxton_ia_pal)
if (USE_PG_LITE_PIPE)
find_library(P2P_LIB_NAME ia_p2p_${IPU_VER})
endif()
find_library(IA_NVM${TARGET_SUFFIX}_LIB ia_nvm${TARGET_SUFFIX})
find_library(IA_LOG${TARGET_SUFFIX}_LIB ia_log${TARGET_SUFFIX})
find_library(IA_DVS${TARGET_SUFFIX}_LIB ia_dvs${TARGET_SUFFIX})
find_library(IA_COORDINATE${TARGET_SUFFIX}_LIB ia_coordinate${TARGET_SUFFIX})
find_library(IA_LTM${TARGET_SUFFIX}_LIB ia_ltm${TARGET_SUFFIX})
find_library(IA_DVS${TARGET_SUFFIX}_LIB ia_dvs${TARGET_SUFFIX})
find_library(IA_ISP_BXT${TARGET_SUFFIX}_LIB ia_isp_bxt${TARGET_SUFFIX})
find_library(BXT_IA_PAL${TARGET_SUFFIX}_LIB broxton_ia_pal${TARGET_SUFFIX})

set(IA_IMAGING_LIBS
${IA_CCA_LIB}
${IA_AIQ_LIB}
${IA_AIQB_PARSER_LIB}
${IA_CMC_PARSER_LIB}
${IA_EXC_LIB}
${IA_MKN_LIB}
${IA_EMD_LIB}
${IA_BCOMP_LIB}
${IA_NVM_LIB}
${IA_LOG_LIB}
${IA_DVS_LIB}
${IA_COORDINATE_LIB}
${IA_LTM_LIB}
${IA_DVS_LIB}
${IA_OB_LIB}
set(IA_IMAGING${TARGET_SUFFIX}_LIBS
${IA_CCA${TARGET_SUFFIX}_LIB}
${IA_AIQ${TARGET_SUFFIX}_LIB}
${IA_AIQB_PARSER${TARGET_SUFFIX}_LIB}
${IA_CMC_PARSER${TARGET_SUFFIX}_LIB}
${IA_EXC${TARGET_SUFFIX}_LIB}
${IA_MKN${TARGET_SUFFIX}_LIB}
${IA_EMD${TARGET_SUFFIX}_LIB}
${IA_BCOMP${TARGET_SUFFIX}_LIB}
${IA_NVM${TARGET_SUFFIX}_LIB}
${IA_LOG${TARGET_SUFFIX}_LIB}
${IA_DVS${TARGET_SUFFIX}_LIB}
${IA_COORDINATE${TARGET_SUFFIX}_LIB}
${IA_LTM${TARGET_SUFFIX}_LIB}
${IA_DVS${TARGET_SUFFIX}_LIB}
${IA_OB${TARGET_SUFFIX}_LIB}
${IA_ISP_BXT${TARGET_SUFFIX}_LIB}
${BXT_IA_PAL${TARGET_SUFFIX}_LIB}
)

if (NOT ENABLE_SANDBOXING)
set(IA_IMAGING_LIBS
${IA_IMAGING_LIBS}
${IA_LARD_LIB}
)
find_library(IA_LARD${TARGET_SUFFIX}_LIB ia_lard${TARGET_SUFFIX})
set(IA_IMAGING${TARGET_SUFFIX}_LIBS ${IA_IMAGING${TARGET_SUFFIX}_LIBS} ${IA_LARD${TARGET_SUFFIX}_LIB})
endif() #ENABLE_SANDBOXING

if (USE_PG_LITE_PIPE)
set(IA_IMAGING_LIBS ${IA_IMAGING_LIBS} ${P2P_LIB_NAME})
find_library(IA_P2P${TARGET_SUFFIX}_LIB ia_p2p${TARGET_SUFFIX})
set(IA_IMAGING${TARGET_SUFFIX}_LIBS ${IA_IMAGING${TARGET_SUFFIX}_LIBS} ${IA_P2P${TARGET_SUFFIX}_LIB})
endif()

set(IA_IMAGING_LIBS ${IA_IMAGING_LIBS} ${IA_ISP_BXT_LIB} ${BXT_IA_PAL_LIB})

# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if
# all listed variables are TRUE
find_package_handle_standard_args(IA_IMAGING
REQUIRED_VARS IA_IMAGING_INCLUDE_DIRS IA_IMAGING_LIBS)
find_package_handle_standard_args(IA_IMAGING${TARGET_SUFFIX}
REQUIRED_VARS IA_IMAGING${TARGET_SUFFIX}_INCLUDE_DIRS IA_IMAGING${TARGET_SUFFIX}_LIBS)

if(NOT IA_IMAGING_FOUND)
message(FATAL_ERROR "IA_IMAGING not found")
if(NOT IA_IMAGING${TARGET_SUFFIX}_FOUND)
message(FATAL_ERROR "IA_IMAGING${TARGET_SUFFIX} not found")
endif()
18 changes: 9 additions & 9 deletions cmake/FindLIBGCSS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
include(FindPackageHandleStandardArgs)

find_package(PkgConfig)
pkg_check_modules(LIBGCSS libgcss)
if(NOT LIBGCSS_FOUND)
message(FATAL_ERROR "LIBGCSS not found")
pkg_check_modules(LIBGCSS${TARGET_SUFFIX} libgcss${TARGET_SUFFIX})
if(NOT LIBGCSS${TARGET_SUFFIX}_FOUND)
message(FATAL_ERROR "LIBGCSS${TARGET_SUFFIX} not found")
endif()

set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBGCSS_LIBRARY_DIRS})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${LIBGCSS${TARGET_SUFFIX}_LIBRARY_DIRS})

# Libraries
find_library(GCSS_LIB gcss)
set(LIBGCSS_LIBS ${GCSS_LIB})
find_library(GCSS${TARGET_SUFFIX}_LIB gcss${TARGET_SUFFIX})
set(LIBGCSS${TARGET_SUFFIX}_LIBS ${GCSS${TARGET_SUFFIX}_LIB})

# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if
# all listed variables are TRUE
find_package_handle_standard_args(LIBGCSS REQUIRED_VARS LIBGCSS_INCLUDE_DIRS LIBGCSS_LIBS)
find_package_handle_standard_args(LIBGCSS${TARGET_SUFFIX} REQUIRED_VARS LIBGCSS${TARGET_SUFFIX}_INCLUDE_DIRS LIBGCSS${TARGET_SUFFIX}_LIBS)

if(NOT LIBGCSS_FOUND)
message(FATAL_ERROR "LIBGCSS not found")
if(NOT LIBGCSS${TARGET_SUFFIX}_FOUND)
message(FATAL_ERROR "LIBGCSS${TARGET_SUFFIX} not found")
endif()

Loading

0 comments on commit cb5d40d

Please sign in to comment.