fix(ipu6-camera-hal): Update patches, update build, add update script because apparently I forgot to do that (#4248) (#4431)

* Update ipu6-camera-hal.spec



* Create update.rhai



* Bump commit?



* Nightly for date function



* Cursed



* Update ipu6-camera-hal.spec



* fix: Install and build

* fix: Ifcond typo

* Add myself as packager I guess

* fix: Whoops

* I am becoming the Joker



* Not taking anymore chances this is so annoying



* fix: Drop old lib file



* fix: Finally fully drop hal_adapter (thank God)



---------


(cherry picked from commit aafe2ed488)

Signed-off-by: Gilver <rockgrub@disroot.org>
Co-authored-by: Gilver <rockgrub@disroot.org>
This commit is contained in:
Raboneko
2025-04-25 10:07:55 -07:00
committed by GitHub
parent c69fe38bf6
commit 9e2834ca1a
10 changed files with 113 additions and 211 deletions
@@ -1,32 +0,0 @@
--- ipu6-camera-hal-8863bda8b15bef415f112700d0fb04e00a48dbee.old/cmake/libcamhal.pc.cmakein 2024-08-06 08:24:01.897232057 +0200
+++ ipu6-camera-hal-8863bda8b15bef415f112700d0fb04e00a48dbee/cmake/libcamhal.pc.cmakein 2024-08-06 08:25:08.361731743 +0200
@@ -1,6 +1,6 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}/@CMAKE_INSTALL_SUB_PATH@
-libdir=${prefix}/lib/@CMAKE_INSTALL_SUB_PATH@
+libdir=${prefix}/lib64/@CMAKE_INSTALL_SUB_PATH@
includedir=${prefix}/include/@CMAKE_INSTALL_SUB_PATH@/libcamhal
Name: libcamhal
--- a/src/hal/hal_adaptor/HalAdaptor.cpp
+++ b/src/hal/hal_adaptor/HalAdaptor.cpp
@@ -62,7 +62,7 @@ static void load_camera_hal_library() {
CheckAndLogError((strlen(pciID) == 0), VOID_VALUE, "%s, Failed to read PCI id. %d", __func__,
ret);
- std::string libName = "/usr/lib/";
+ std::string libName = "/usr/lib64/";
if (IPU6_UPSTREAM) {
if (strstr(pciID, "0x7d19") != nullptr /* MTL */) {
libName += "ipu_mtl_upstream";
--- ipu6-camera-hal-8863bda8b15bef415f112700d0fb04e00a48dbee.old/src/platformdata/PlatformData.h 2024-08-06 08:24:01.919232222 +0200
+++ ipu6-camera-hal-8863bda8b15bef415f112700d0fb04e00a48dbee/src/platformdata/PlatformData.h 2024-08-06 08:25:08.362731750 +0200
@@ -89,7 +89,7 @@
#define MAX_CAMERA_NUMBER 100
// Temporarily using current path to save aiqd file for none CAL platforms.
#define CAMERA_CACHE_DIR "./"
-#define CAMERA_DEFAULT_CFG_PATH "/etc/camera/"
+#define CAMERA_DEFAULT_CFG_PATH "/usr/share/camera/"
#define CAMERA_GRAPH_DESCRIPTOR_FILE "gcss/graph_descriptor.xml"
#define CAMERA_GRAPH_SETTINGS_DIR "gcss/"
#endif
@@ -1,48 +0,0 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -266,7 +266,7 @@ add_library(camhal_static STATIC ${LIBCAMHAL_SRCS})
if (NOT CAL_BUILD AND (NOT "${CMAKE_INSTALL_SUB_PATH}" STREQUAL ""))
set(CMAKE_SKIP_RPATH TRUE)
set_target_properties(camhal PROPERTIES LINK_FLAGS
- "-Wl,-rpath,/usr/lib/${CMAKE_INSTALL_SUB_PATH}")
+ "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_INSTALL_SUB_PATH}")
add_compile_definitions(SUB_CONFIG_PATH="${CMAKE_INSTALL_SUB_PATH}")
endif()
set_target_properties(camhal_static PROPERTIES OUTPUT_NAME "camhal")
@@ -399,9 +399,9 @@ endif() #ENABLE_SANDBOXING
if (NOT CAL_BUILD)
# Install headers
if ("${CMAKE_INSTALL_SUB_PATH}" STREQUAL "")
- install(DIRECTORY include/ DESTINATION usr/include/libcamhal)
+ install(DIRECTORY include/ DESTINATION include/libcamhal)
if (SUPPORT_LIVE_TUNING)
- install(FILES modules/livetune/LiveTuning.h DESTINATION usr/include/libcamhal/api)
+ install(FILES modules/livetune/LiveTuning.h DESTINATION include/libcamhal/api)
endif() #SUPPORT_LIVE_TUNING
endif()
@@ -421,18 +421,18 @@ endif()
# Install libraries
if (${CMAKE_VERSION} VERSION_LESS 3.11)
install(TARGETS camhal camhal_static
- LIBRARY DESTINATION usr/lib/${CMAKE_INSTALL_SUB_PATH}
- ARCHIVE DESTINATION usr/lib/${CMAKE_INSTALL_SUB_PATH}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CMAKE_INSTALL_SUB_PATH}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CMAKE_INSTALL_SUB_PATH}
)
else()
-install(TARGETS camhal camhal_static DESTINATION usr/lib/${CMAKE_INSTALL_SUB_PATH})
+install(TARGETS camhal camhal_static DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CMAKE_INSTALL_SUB_PATH})
endif()
# Install package config file
configure_file(${PROJECT_SOURCE_DIR}/cmake/libcamhal.pc.cmakein
${PROJECT_SOURCE_DIR}/libcamhal.pc @ONLY)
install(FILES libcamhal.pc
- DESTINATION usr/${CMAKE_INSTALL_LIBDIR}/${CMAKE_INSTALL_SUB_PATH}/pkgconfig)
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CMAKE_INSTALL_SUB_PATH}/pkgconfig)
endif() #NOT CAL_BUILD
@@ -0,0 +1,36 @@
From 1ec565d6b067d165cfbf8f68fc008e68fa94cfc0 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 2 Feb 2025 08:52:52 +0100
Subject: [PATCH] Drop -Werror
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Drop -Werror to stop the following false-positive gcc-15 warning
breaking the build:
/builddir/build/BUILD/ipu6-camera-hal-0.0-build/ipu6-camera-hal-b6f6eeb68f06cd0d4a2463b8950847b1b98cebaa/src/core/psysprocessor/PGCommon.cpp: In member function icamera::PGCommon::init():
/builddir/build/BUILD/ipu6-camera-hal-0.0-build/ipu6-camera-hal-b6f6eeb68f06cd0d4a2463b8950847b1b98cebaa/src/core/psysprocessor/PGCommon.cpp:122:73: error: argument 1 range [18446744071562067968, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
122 | mPgTerminals = std::unique_ptr<uint8_t[]>(new uint8_t[mTerminalCount]);
| ^
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7b515a..27a20fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,7 +80,6 @@ message(STATUS "install prefix: " ${CMAKE_INSTALL_PREFIX})
set (CMAKE_CXX_STANDARD 11)
add_compile_options(
-Wall
- -Werror
-fstack-protector
-fPIE
-fPIC
--
2.48.1
@@ -1,20 +0,0 @@
--- a/src/v4l2/MediaControl.cpp
+++ b/src/v4l2/MediaControl.cpp
@@ -886,6 +886,15 @@ int MediaControl::mediaCtlSetup(int cameraId, MediaCtlConf* mc, int width, int h
ivscName.c_str(), link.sinkEntityName.c_str());
link.srcEntity = ivsc->info.id;
link.srcEntityName = ivscName;
+ /*
+ * Since mainline kernel commit 48f5fd8967f8 ("media:
+ * ivsc: csi: Swap SINK and SOURCE pads") the src-pad
+ * on the mainline ivsc mc-entity is pad 1, where on
+ * older versions it is pad 0, so this needs to be set
+ * dynamically.
+ * The src-pad is the other pad of the found ivsc sink.
+ */
+ link.srcPad = !ivsc->links[i].sink->index;
break;
}
}
@@ -1,16 +1,28 @@
# Tiger Lake
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x9a19", RUN+="/usr/bin/echo /usr/lib64/ipu_tgl > /etc/ld.so.conf.d/ipu6-x86_64.conf"
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x9a19", GOTO="ipu6_tgl"
# Alder Lake-N
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x465d", RUN+="/usr/bin/echo /usr/lib64/ipu_adl > /etc/ld.so.conf.d/ipu6-x86_64.conf"
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x465d", GOTO="ipu6_adl"
# Alder Lake-P
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x462e", RUN+="/usr/bin/echo /usr/lib64/ipu_adl > /etc/ld.so.conf.d/ipu6-x86_64.conf"
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x462e", GOTO="ipu6_adl"
# Raptor Lake-P
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0xa75d", RUN+="/usr/bin/echo /usr/lib64/ipu_adl > /etc/ld.so.conf.d/ipu6-x86_64.conf"
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0xa75d", GOTO="ipu6_adl"
# Meteor Lake
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x7d19", RUN+="/usr/bin/echo /usr/lib64/ipu_mtl > /etc/ld.so.conf.d/ipu6-x86_64.conf"
# Lunar Lake
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x645d", RUN+="/usr/bin/echo /usr/lib64/ipu_lnl > /etc/ld.so.conf.d/ipu6-x86_64.conf"
# Jasper Lake
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x4e19", RUN+="/usr/bin/echo /usr/lib64/ipu_jsl > /etc/ld.so.conf.d/ipu6-x86_64.conf"
SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x7d19", GOTO="ipu6_mtl"
GOTO="ipu6_end"
LABEL="ipu6_tgl"
RUN+="/bin/ln -sf /usr/share/defaults/etc/camera/ipu6/v4l2-relayd /run/v4l2-relayd"
GOTO="ipu6_end"
LABEL="ipu6_adl"
RUN+="/bin/ln -sf /usr/share/defaults/etc/camera/ipu6ep/v4l2-relayd /run/v4l2-relayd"
GOTO="ipu6_end"
LABEL="ipu6_mtl"
RUN+="/bin/ln -sf /usr/share/defaults/etc/camera/ipu6epmtl/v4l2-relayd /run/v4l2-relayd"
GOTO="ipu6_end"
LABEL="ipu6_end"
KERNEL=="ipu-psys0", TAG+="uaccess"
+1 -1
View File
@@ -4,6 +4,6 @@ project pkg {
spec = "ipu6-camera-hal.spec"
}
labels {
weekly = 1
nightly = 1
}
}
@@ -1,3 +0,0 @@
# Move the special isys /dev/video# node out of the way of
# normal v4l2 devices such as v4l2loopback
options icamera_ipu6_isys video_nr=8,9,10,11,12,13,14,15
@@ -1,31 +1,25 @@
%global commit 289e645dffbd0ea633f10bb4f93855f1e4429e9a
%global commitdate 20240509
%global commit 8346d93d032a33b0db15bba5ad87854308c3dff5
%global commit_date 20240509
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global build_cflags %{__build_flags_lang_c} %{?_distro_extra_cflags} -Wno-alloc-size-larger-than
%global build_cxxflags %{__build_flags_lang_cxx} %{?_distro_extra_cxxflags} -Wno-alloc-size-larger-than
%global __cmake_in_source_build 1
%global ver 1.0.0
Name: ipu6-camera-hal
Summary: Hardware abstraction layer for Intel IPU6
URL: https://github.com/intel/ipu6-camera-hal
Version: %{commitdate}.%{shortcommit}
Release: 2%{?dist}
Version: %{ver}^%{commit_date}git.%{shortcommit}
Release: 1%{?dist}
License: Apache-2.0
Source0: https://github.com/intel/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
URL: https://github.com/intel/ipu6-camera-hal
Source0: %{url}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
Source1: 60-intel-ipu6.rules
Source2: v4l2-relayd-adl
Source3: v4l2-relayd-tgl
Source4: icamera_ipu6_isys.conf
Source5: ipu6-driver-select.sh
### RPM Fusion | [ipu6-camera-hal] Update to the latest commit | MODIFIED
## https://lists.rpmfusion.org/archives/list/rpmfusion-commits@lists.rpmfusion.org/thread/O6IPZMHMP7A3LQBDY4AEORTDEX4P6ESY
Patch00: 0000-lib-path.patch
### intel/ipu6-camera-hal | PR #113 | CMakeLists fixes
## https://github.com/intel/ipu6-camera-hal/pull/113
Patch01: 0001-CMakeLists-fixes.patch
### intel/ipu6-camera-hal | PR #114 | MediaControl: Dymically set mainline IVSC media-entity src-pad index
## https://github.com/intel/ipu6-camera-hal/pull/114
Patch02: 0002-set-mainline.patch
Source4: ipu6-driver-select.sh
### RPM Fusion | [ipu6-camera-hal] Fix build with gcc15
## https://lists.rpmfusion.org/archives/list/rpmfusion-commits@lists.rpmfusion.org/thread/TDMTM3WHMTHKCIN3XAUVWK3OBARW5SKO
Patch0: 0001-Drop-Werror.patch
BuildRequires: systemd-rpm-macros
BuildRequires: ipu6-camera-bins-devel >= 0.0-11
BuildRequires: cmake
@@ -33,8 +27,13 @@ BuildRequires: gcc
BuildRequires: g++
BuildRequires: expat-devel
BuildRequires: libdrm-devel
ExclusiveArch: x86_64
Requires: ipu6-camera-bins >= 0.0-11
# Fix the stupid issue when changing versioning schemes
%if 0%{?fedora} <= 43 || 0%{?rhel} <= 10
Provides: %{name} = %{commit_date}.%{shortcommit}-%{release}
%endif
ExclusiveArch: x86_64
Packager: Gilver E. <rockgrub@disroot.org>
%description
This package provides the basic Hardware Avstraction Layer (HAL) access APIs for IPU6.
@@ -49,78 +48,33 @@ This provides the necessary header files for IPU6 HAL development.
%prep
%autosetup -p1 -n %{name}-%{commit}
sed -i "s|/etc/camera/|/usr/share/camera/|g" \
src/platformdata/PlatformData.h
%build
for i in ipu_tgl ipu_adl ipu_mtl; do
export PKG_CONFIG_PATH=%{_libdir}/$i/pkgconfig/
export LDFLAGS="$RPM_LD_FLAGS -Wl,-rpath=%{_libdir}/$i"
mkdir $i && pushd $i
if [ $i = "ipu_tgl" ]; then
IPU_VERSION=ipu6
elif [ $i = "ipu_adl" ]; then
IPU_VERSION=ipu6ep
elif [ $i = "ipu_mtl" ]; then
IPU_VERSION=ipu6epmtl
else
IPU_VERSION=ipu
fi
%cmake \
-DBUILD_CAMHAL_ADAPTOR=ON \
-DBUILD_CAMHAL_PLUGIN=ON \
-DBUILD_CAMHAL_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SUB_PATH:PATH="$i" \
-DCMAKE_INSTALL_SYSCONFDIR=%{_datadir} \
-DIPU_VER="$IPU_VERSION" \
-DUSE_PG_LITE_PIPE=ON ..
%make_build
popd
done
### hal_adaptor.so dispatches between different libcamhal.so builds so only build it once!
mkdir hal_adaptor && pushd hal_adaptor
%cmake ../src/hal/hal_adaptor
%make_build
popd
%cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SYSCONFDIR:PATH="%{_datadir}/defaults/etc" \
-DBUILD_CAMHAL_ADAPTOR=ON \
-DBUILD_CAMHAL_PLUGIN=ON \
-DIPU_VERSIONS="ipu6;ipu6ep;ipu6epmtl" \
-DUSE_PG_LITE_PIPE=ON
%cmake_build
%install
for i in ipu_tgl ipu_adl ipu_mtl; do
pushd $i
%make_install
rm %{buildroot}%{_libdir}/$i/libcamhal.a
rm -r %{buildroot}%{_libdir}/$i/pkgconfig
popd
done
pushd hal_adaptor
%make_install
popd
%cmake_install
# camera-hal will try to use the static libs instead of .so files if present
# Fedora does -devel-static packages, maybe I could do this as well in a different spec so it will not affect builds?
rm %{buildroot}%{_libdir}/libcamhal/plugins/*.a
install -Dpm 0644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/60-intel-ipu6.rules
### v4l2-relayd configuration examples (mtl uses same config as adl)
install -Dpm 0644 %{SOURCE2} %{buildroot}%{_datadir}/camera/ipu_adl/v4l2-relayd
install -Dpm 0644 %{SOURCE2} %{buildroot}%{_datadir}/camera/ipu_mtl/v4l2-relayd
install -Dpm 0644 %{SOURCE3} %{buildroot}%{_datadir}/camera/ipu_tgl/v4l2-relayd
### Make kmod-intel-ipu6 use /dev/video7 leaving /dev/video0 for loopback
install -Dpm 0644 %{SOURCE4} %{buildroot}%{_modprobedir}/icamera_ipu6_isys.conf
install -Dpm 0644 %{SOURCE2} %{buildroot}%{_datadir}/defaults/etc/camera/ipu6/v4l2-relayd
install -Dpm 0644 %{SOURCE3} %{buildroot}%{_datadir}/defaults/etc/camera/ipu6ep/v4l2-relayd
install -Dpm 0644 %{SOURCE3} %{buildroot}%{_datadir}/defaults/etc/camera/ipu6epmtl/v4l2-relayd
### Script to switch between proprietary and open IPU6 stacks
install -Dpm 0755 %{SOURCE5} %{buildroot}%{_bindir}/ipu6-driver-select
### Needed for GStreamer ICamera builds.
ln -sf hal_adaptor %{buildroot}%{_includedir}/libcamhal
ln -sf hal_adaptor.pc %{buildroot}%{_libdir}/pkgconfig/libcamhal.pc
install -Dpm 0755 %{SOURCE4} %{buildroot}%{_bindir}/ipu6-driver-select
%posttrans
### Ensure that v4l2-relayd service enabled if ipu6-driver-select is installed
if [ ! -f /etc/modprobe.d/ipu6-driver-select.conf ]; then
/usr/bin/ipu6-driver-select proprietary
fi
### Skip triggering if udevd isn't accessible
if [ -S /run/udev/control ]; then
/usr/bin/udevadm control --reload
@@ -128,20 +82,18 @@ if [ -S /run/udev/control ]; then
fi
%files
%doc README.md
%doc SECURITY.md
%license LICENSE
%ghost %{_sysconfdir}/modprobe.d/ipu6-driver-select.conf
%{_bindir}/ipu6-driver-select
%{_libdir}/ipu*/libcamhal.so*
%{_libdir}/libhal_adaptor.so.*
%{_datadir}/camera
%{_modprobedir}/icamera_ipu6_isys.conf
%{_libdir}/libcamhal.so.*
%{_libdir}/libcamhal
%{_datadir}/defaults
%{_udevrulesdir}/60-intel-ipu6.rules
%files devel
%{_includedir}/hal_adaptor
%{_includedir}/libcamhal
%{_libdir}/libhal_adaptor.so
%{_libdir}/pkgconfig/hal_adaptor.pc
%{_libdir}/libcamhal.so
%{_libdir}/pkgconfig/libcamhal.pc
@@ -3,12 +3,12 @@
set -e
function show_help () {
echo "Usage: 'ipu6-driver-select [ proprietary | open ]'"
echo "Usage: 'ipu6-driver-select [ proprietary | foss ]'"
exit 1
}
function needs_reboot () {
echo "Reboot your system for the changes to take effect"
function needs_pipewire_restart () {
echo "Run 'systemctl --user restart pipewire' for the changes to take effect"
exit 0
}
@@ -17,17 +17,13 @@ if (( $# != 1 )); then
fi
case "$1" in
"open")
echo "blacklist icamera-ipu6" > /etc/modprobe.d/ipu6-driver-select.conf
echo "blacklist icamera-ipu6-isys" >> /etc/modprobe.d/ipu6-driver-select.conf
echo "blacklist icamera-ipu6-psys" >> /etc/modprobe.d/ipu6-driver-select.conf
systemctl disable v4l2-relayd.service
needs_reboot
"foss")
systemctl disable --now v4l2-relayd.service
needs_pipewire_restart
;;
"proprietary")
echo "blacklist intel-ipu6" > /etc/modprobe.d/ipu6-driver-select.conf
systemctl enable v4l2-relayd.service
needs_reboot
systemctl enable --now v4l2-relayd.service
needs_pipewire_restart
;;
*)
show_help
+9
View File
@@ -0,0 +1,9 @@
rpm.global("commit", gh_commit("intel/ipu6-camera-hal"));
if rpm.changed() {
rpm.release();
rpm.global("commit_date", date());
let v = gh("intel/ipu6-camera-hal");
v.truncate(6);
v.crop(1);
rpm.global("ver", v);
}