Skip to content

Commit

Permalink
Engineer release on 2023-08-05
Browse files Browse the repository at this point in the history
Signed-off-by: Hao Yao <hao.yao@intel.com>
  • Loading branch information
hao-yao committed Aug 8, 2023
1 parent ea976df commit dae5157
Show file tree
Hide file tree
Showing 223 changed files with 139,762 additions and 25,202 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build tests

on:
push:
branches:
- main

pull_request:

jobs:
build-ipu6-on-ubuntu-2204:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Build on Ubuntu 22.04
run: |
sudo su
echo "APT::Get::Always-Include-Phased-Updates True;" | tee -a /etc/apt/apt.conf
apt-get update -q
apt-get install git cmake libexpat-dev automake libtool libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev --yes
git clone https://github.com/hao-yao/ipu6-camera-bins -b main --depth 1
cp -rv ipu6-camera-bins/include/* /usr/include/
cp -rv ipu6-camera-bins/lib/* /usr/lib/
rm -fr ipu6-camera-bins
cd ..
git clone https://github.com/intel/icamerasrc.git -b icamerasrc_slim_api --depth 1
cp ./ipu6-camera-hal/build.sh .
./build.sh
cp -rv ./out/install/include/* /usr/include
cp -rv ./out/install/lib/* /usr/lib
cp -rv ./out/install/share/* /usr/share
build-ipu6-on-ubuntu-2004:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3

- name: Build on Ubuntu 20.04
run: |
sudo su
apt-get update -q
apt-get install git cmake libexpat-dev automake libtool libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev --yes
git clone https://github.com/hao-yao/ipu6-camera-bins -b main --depth 1
cp -rv ipu6-camera-bins/include/* /usr/include/
cp -rv ipu6-camera-bins/lib/* /usr/lib/
rm -fr ipu6-camera-bins
cd ..
git clone https://github.com/intel/icamerasrc.git -b icamerasrc_slim_api --depth 1
cp ./ipu6-camera-hal/build.sh .
./build.sh
cp -rv ./out/install/include/* /usr/include
cp -rv ./out/install/lib/* /usr/lib
cp -rv ./out/install/share/* /usr/share
45 changes: 6 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,46 +389,13 @@ if ("${CMAKE_INSTALL_SUB_PATH}" STREQUAL "")
endif() #SUPPORT_LIVE_TUNING
endif()

# Install configure files
# By default ipu4 is used
if("${IPU_VER}" STREQUAL "ipu6")
if("${PRODUCTION_NAME}" STREQUAL "Andrews")
message("Install TGL Andrews configure files")
install(DIRECTORY config/ubuntu/tgl/ DESTINATION share/defaults/etc/camera)
else()
message("Install TGL IPU6 configure files")
install(DIRECTORY config/linux/ipu6/ DESTINATION share/defaults/etc/camera)
endif()
elseif("${IPU_VER}" STREQUAL "ipu6ep")
if("${PRODUCTION_NAME}" STREQUAL "ccg_platform")
message("Install ADL Platform configure files")
install(DIRECTORY config/ubuntu/adl/ DESTINATION share/defaults/etc/camera)
elseif("${PRODUCTION_NAME}" STREQUAL "Tributo")
message("Install ADL Tributo configure files")
install(DIRECTORY config/ubuntu/adl/ DESTINATION share/defaults/etc/camera)
else()
message("Install ADL IPU6EP configure files")
install(DIRECTORY config/linux/ipu6ep/ DESTINATION share/defaults/etc/camera)
endif()
elseif("${IPU_VER}" STREQUAL "ipu6epmtl")
if("${PRODUCTION_NAME}" STREQUAL "mtl-ubuntu")
message("Install MTL ubuntu configure files")
install(DIRECTORY config/ubuntu/mtl/ DESTINATION share/defaults/etc/camera)
elseif("${PRODUCTION_NAME}" STREQUAL "mtl-iotg")
message("Install MTL iotg configure files")
install(DIRECTORY config/linux/ipu6epmtl/ DESTINATION share/defaults/etc/camera)
else()
message("Install MTL configure files")
install(DIRECTORY config/linux/ipu6ep/ DESTINATION share/defaults/etc/camera)
endif()
elseif("${IPU_VER}" STREQUAL "ipu6sepla")
if("${PRODUCTION_NAME}" STREQUAL "penguin_peak")
message("Install JSL penguin peak configure files")
install(DIRECTORY config/ubuntu/jsl/ DESTINATION share/defaults/etc/camera)
endif()
# Install configure files, by default ipu4 is used
if(("${IPU_VER}" STREQUAL "") OR ("${IPU_VER}" STREQUAL "ipu4"))
message("Install camera configure files for ipu4")
install(DIRECTORY config/linux/ipu4/ DESTINATION share/defaults/etc/camera/${CMAKE_INSTALL_SUB_PATH})
else()
message("Install APL IPU4 configure files")
install(DIRECTORY config/linux/ipu4/ DESTINATION share/defaults/etc/camera)
message("Install camera configure files for" ${IPU_VER})
install(DIRECTORY config/linux/${IPU_VER}/ DESTINATION share/defaults/etc/camera/${CMAKE_INSTALL_SUB_PATH})
endif()

# Install libraries
Expand Down
65 changes: 28 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,41 @@
# ipu6-camera-hal

This repository supports MIPI cameras through the IPU6 on Intel Alder Lake, Raptor Lake and Meteor Lake platforms. There are 4 repositories that provide the complete setup:

- https://github.com/intel/ipu6-drivers (branch:ccg_plat_adlp) - kernel drivers for the IPU and sensors
- https://github.com/intel/ipu6-camera-hal (branch:ccg_plat_adlp) - HAL for processing of images in userspace
- https://github.com/intel/ipu6-camera-bins (branch:ccg_plat_adlp) - IPU firmware and proprietary image processing libraries
- https://github.com/intel/icamerasrc (branch:icamerasrc_slim_api) - Gstreamer src plugin
This repository supports MIPI cameras through the IPU6 on Intel Tiger Lake, Alder Lake, Raptor Lake and Meteor Lake platforms.
There are 4 repositories that provide the complete setup:

- https://github.com/intel/ipu6-drivers - kernel drivers for the IPU and sensors
- https://github.com/intel/ipu6-camera-bins - IPU firmware and proprietary image processing libraries
- https://github.com/intel/ipu6-camera-hal - HAL for processing of images in userspace
- https://github.com/intel/icamerasrc/tree/icamerasrc_slim_api (branch:icamerasrc_slim_api) - Gstreamer src plugin

## Content of this repository:
- IPU6 HAL

## Build instructions:
- Dependencies: ipu6-camera-bins
Please follow https://github.com/intel/ipu6-camera-bins README to install.

- Dependencies: libexpat-dev automake libtool libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

- Build and install:
Recommend to build together with icamerasrc and using `build.sh` in this repo.
1. Put ipu6-camera-hal, icameasrc and build.sh parallel as below:
```
cp build.sh .. && cd ..
# work
# ├── build.sh
# ├── icamerasrc
# ├── ipu6-camera-hal
# └── out
```

2. In `work` folder, run `./build.sh`. Output binaries will be in `out/install`. (RPM build is not implemented yet)

1. Set IPU6 version and product name for build

- For Alder Lake and Raptor Lake, set:
```shell
IPU6_VER=ipu6ep
PRODUCTION_NAME=ccg_platform
```

- For Meteor Lake, set:
```shell
IPU6_VER=ipu6epmtl
PRODUCTION_NAME=mtl-ubuntu
```

2. Then continue:
```shell
cd ipu6-camera-hal
mkdir -p ./build/out/install/usr && cd ./build/
cmake -DCMAKE_BUILD_TYPE=Release \
-DIPU_VER=${IPU6_VER} \
-DPRODUCTION_NAME=${PRODUCTION_NAME} \
-DUSE_PG_LITE_PIPE=ON \
-DUSE_STATIC_GRAPH=OFF \
-DCMAKE_INSTALL_PREFIX=/usr ..
# if don't want install to /usr, use:
# -DCMAKE_INSTALL_PREFIX=./out/install/usr and
# export PKG_CONFIG_PATH="$workdir/build/out/install/usr/lib/pkgconfig"
make -j`nproc`
sudo make install
3. Install contents in `out/install` to your `/usr`:
```sh
sudo cp -r ./out/install/include/* /usr/include
sudo cp -r ./out/install/lib/* /usr/lib
sudo cp -r ./out/install/share/* /usr/share
```

For more building details please reference the `build.sh`.
176 changes: 176 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
#!/bin/bash

function check_result() {
local res=$1
local func=$2

if [ $res -eq 0 ] ; then
echo "###############" " $func OK " "#############"
else
echo "###############" " $func FAIL " "#############"
exit 1
fi
}

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

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
;;
--board)
shift
export BOARD_LIST=$@
echo "$$"
break
;;
-?*)
echo "WARNING: not supported option: $1"
;;
*)
break
esac

shift
done

echo "=========================== Build Config ============================"
echo "SOURCE_DIR: $SOURCE_DIR"
echo "INSTALL_DIR: $INSTALL_DIR"
echo "BUILD_RPM: $BUILD_RPM"
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 "====================================================================="
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() {
rm -fr build && mkdir -p build && cd build

local target=$1
export IPU_VERSION=
if [ "$target" = "ipu_tgl" ]; then
IPU_VERSION=ipu6
elif [ "$target" = "ipu_adl" ]; then
IPU_VERSION=ipu6ep
elif [ "$target" = "ipu_mtl" ]; then
IPU_VERSION=ipu6epmtl
else
echo "Error: unsupport the target name : $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

command cmake -DCMAKE_BUILD_TYPE=Release \
-DIPU_VER=$IPU_VERSION \
-DBUILD_CAMHAL_TESTS=OFF \
-DUSE_PG_LITE_PIPE=ON \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR/install \
-DCMAKE_INSTALL_SUB_PATH=$target ..

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

make install
check_result $? "$FUNCNAME: $target"
standardize_pkg_config_path ${INSTALL_DIR}/install/lib/${target}/pkgconfig/libcamhal.pc
cd ..
}

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

for target in $BOARD_LIST
do
build_target $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}"

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 ${CONFIGURE_FLAGS} \
--prefix=$INSTALL_DIR/install DEFAULT_CAMERA=0
check_result $? $FUNCNAME

make clean
make -j
check_result $? $FUNCNAME

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

function main () {
parse_argument $@
if [ -z "$SOURCE_DIR" ] || [ -z "$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
build_icamerasrc

# TODO: Generate the RPM for hal, hal_adaptor and icamerasrc together
}

main $@
3 changes: 3 additions & 0 deletions cmake/FindIA_IMAGING.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ find_library(IA_EXC_LIB ia_exc)
find_library(IA_MKN_LIB ia_mkn)
# SENSOR_EMD_DECODER
find_library(IA_EMD_LIB ia_emd_decoder)
# DOL_FEATURE_S
find_library(IA_BCOMP_LIB ia_bcomp)
# DOL_FEATURE_E
find_library(IA_NVM_LIB ia_nvm)
find_library(IA_LOG_LIB ia_log)
find_library(IA_DVS_LIB ia_dvs)
Expand Down
Binary file added config/linux/ipu6/0315_imx274_wfov.IPU6.aiqb
Binary file not shown.
Binary file added config/linux/ipu6/AR0234_BARCODE_TGL.aiqb
Binary file not shown.
Binary file added config/linux/ipu6/AR0234_TGL_10bits.aiqb
Binary file not shown.
Binary file added config/linux/ipu6/IMX135_13P2BAD33_TGL.aiqb
Binary file not shown.
Binary file added config/linux/ipu6/IMX390_HDR_TGL.aiqb
Binary file not shown.
Binary file added config/linux/ipu6/IMX390_HDR_TGL_2.aiqb
Binary file not shown.
Binary file added config/linux/ipu6/IMX477_MOD255I_DOL_TGL.aiqb
Binary file not shown.
Binary file added config/linux/ipu6/IMX477_MOD26552_BAYER_TGL.aiqb
Binary file not shown.
Binary file added config/linux/ipu6/IMX477_MOD26552_WFOV_TGL.aiqb
Binary file not shown.
Loading

0 comments on commit dae5157

Please sign in to comment.