summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangYoun Kwak <sy.kwak@samsung.com>2024-08-12 17:00:45 +0900
committerChanwoo Choi <cw00.choi@samsung.com>2024-08-12 20:34:42 +0900
commit6440ce166b344c79e609f3c8d482c633c659561f (patch)
treeefad78acbfd39caefa089534162c5d232a042811
parentcf73100ad16c5b92a71c4f84161b98a38aaf2885 (diff)
downloadrootstrap-6440ce166b344c79e609f3c8d482c633c659561f.tar.gz
rootstrap-6440ce166b344c79e609f3c8d482c633c659561f.tar.bz2
rootstrap-6440ce166b344c79e609f3c8d482c633c659561f.zip
Separate common packages included in both headless and headed image
Since the headless image does not have some packages compared to the headed image, it is required to separate these packages from hal rootstrap. To separate headed-only packages, hal rootstrap will be created like below: * rootstrap for common packages: Package name: hal-rootstrap Directory: /opt/data/hal-rootstrap/common * rootstrap for headed-only packages: Package name: hal-rootstrap-headed Directory: /opt/data/hal-rootstrap/headed Speaking of hal backend packages, they should do "BuildRequires" like: * If backend package requires headed packages, do "BuildRequires" for both hal-rootstrap and hal-rootstrap-headed. * If backend package does not use any headed packages, do "BuildRequires" for hal-rootstrap only. Change-Id: I0b0576a73299d3dd92cc404cc547b295ff9a0355 Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
-rw-r--r--CMakeLists.txt15
-rwxr-xr-xgenerate_rootstrap.sh27
-rwxr-xr-xmodify_pc.py4
-rw-r--r--packaging/hal-rootstrap-headed.pc.in14
-rw-r--r--packaging/hal-rootstrap.pc.in2
-rw-r--r--packaging/hal-rootstrap.spec58
6 files changed, 91 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe9d563..2ec8d1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,14 +1,23 @@
PROJECT(hal-rootstrap)
+SET(HAL_ROOTSTRAP "${PROJECT_NAME}")
+SET(HAL_ROOTSTRAP_HEADED "${PROJECT_NAME}-headed")
+
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "${PREFIX}/bin")
SET(INCLUDEDIR "${PREFIX}/include")
SET(LIBDIR ${CMAKE_LIBDIR_PREFIX})
-CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${PROJECT_NAME}.pc.in
- ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${PROJECT_NAME}.pc
+CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${HAL_ROOTSTRAP}.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${HAL_ROOTSTRAP}.pc
+ @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${HAL_ROOTSTRAP}.pc
+ DESTINATION ${LIBDIR}/pkgconfig)
+
+CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${HAL_ROOTSTRAP_HEADED}.pc.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${HAL_ROOTSTRAP_HEADED}.pc
@ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${PROJECT_NAME}.pc
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/${HAL_ROOTSTRAP_HEADED}.pc
DESTINATION ${LIBDIR}/pkgconfig)
ADD_SUBDIRECTORY(script)
diff --git a/generate_rootstrap.sh b/generate_rootstrap.sh
index b2ab78a..69e9b98 100755
--- a/generate_rootstrap.sh
+++ b/generate_rootstrap.sh
@@ -1,15 +1,16 @@
#!/bin/bash
function prepare_generation {
- if [[ ! -f "./rs-config" ]]; then
- echo "There is no rs-config."
+ local config_file="./rs-config"
+ local copy_dest=$1
+
+ if [[ ! -f "${config_file}" ]]; then
+ echo "There is no config file(${config_file})."
exit 1
fi
- local copy_dest=$1
-
- sed -i 's@^export BUILD_REQUIRED_INSTALLED_PATH=""@export BUILD_REQUIRED_INSTALLED_PATH="/"@' "./rs-config"
- sed -i 's@^export GBS_BUILDROOT=""@export GBS_BUILDROOT="'${copy_dest}'"@' "./rs-config"
+ sed -i 's@^export BUILD_REQUIRED_INSTALLED_PATH=.*$@export BUILD_REQUIRED_INSTALLED_PATH="/"@' "${config_file}"
+ sed -i 's@^export GBS_BUILDROOT=.*$@export GBS_BUILDROOT="'${copy_dest}'"@' "${config_file}"
}
function generate_rootstrap_ix86 {
@@ -94,8 +95,11 @@ function generate_rootstrap_riscv64 {
function generate_rootstrap {
local arch=$1
+ local rootstrap_type=$2
+ local rootstrap_resource_dir="./rs_resource"
- cp -r '/tmp/rs_resource' .
+ rm -rf "${rootstrap_resource_dir}"
+ cp -r "/tmp/rs_resource/${ROOTSTRAP_TYPE}" "${rootstrap_resource_dir}"
case "${arch}" in
"arm")
@@ -126,12 +130,13 @@ function generate_rootstrap {
}
ARCH=$1
-COPY_DEST=$2
+ROOTSTRAP_TYPE=$2
+COPY_DEST=$3
-if [[ -z "${ARCH}" ]] || [[ -z "${COPY_DEST}" ]]; then
- echo "2 parameters are required: <architecture> <generate destination>"
+if [[ -z "${ARCH}" ]] || [[ -z "${ROOTSTRAP_TYPE}" ]] || [[ -z "${COPY_DEST}" ]]; then
+ echo "3 parameters are required: <architecture> <rootstrap type> <generate destination>"
exit 1
fi
prepare_generation "${COPY_DEST}"
-generate_rootstrap "${ARCH}"
+generate_rootstrap "${ARCH}" "${ROOTSTRAP_TYPE}"
diff --git a/modify_pc.py b/modify_pc.py
index 771d674..adea07c 100755
--- a/modify_pc.py
+++ b/modify_pc.py
@@ -51,11 +51,11 @@ def write_to_pc(fname):
f.write("CXXflags: {}\n".format(' '.join(cxxflags)))
f.close()
-hal_rootstrap_pc_path = argv[1]
+rootstrap_pc_path = argv[1]
pc_dir = argv[2]
pc_files = listdir(pc_dir)
for pc_file in pc_files:
parse_pc("{}/{}".format(pc_dir, pc_file))
-write_to_pc(hal_rootstrap_pc_path)
+write_to_pc(rootstrap_pc_path)
diff --git a/packaging/hal-rootstrap-headed.pc.in b/packaging/hal-rootstrap-headed.pc.in
new file mode 100644
index 0000000..eb84c3c
--- /dev/null
+++ b/packaging/hal-rootstrap-headed.pc.in
@@ -0,0 +1,14 @@
+# Package Information for pkg-config
+
+package_name=hal-rootstrap
+prefix=/opt/data/hal-rootstrap@PREFIX@
+exec_prefix=/opt/data/hal-rootstrap@EXEC_PREFIX@
+hal_rootstrap_dir=/opt/data/hal-rootstrap/headed
+hal_rootstrap_libdir=${hal_rootstrap_dir}@LIBDIR@
+hal_rootstrap_include_dir=${hal_rootstrap_dir}@INCLUDEDIR@
+
+Name: ${package_name}
+Description: ${package_name} interface
+Version: @VERSION@
+
+Requires:
diff --git a/packaging/hal-rootstrap.pc.in b/packaging/hal-rootstrap.pc.in
index f42c89f..5ce9317 100644
--- a/packaging/hal-rootstrap.pc.in
+++ b/packaging/hal-rootstrap.pc.in
@@ -3,7 +3,7 @@
package_name=hal-rootstrap
prefix=/opt/data/hal-rootstrap@PREFIX@
exec_prefix=/opt/data/hal-rootstrap@EXEC_PREFIX@
-hal_rootstrap_dir=/opt/data/hal-rootstrap
+hal_rootstrap_dir=/opt/data/hal-rootstrap/common
hal_rootstrap_libdir=${hal_rootstrap_dir}@LIBDIR@
hal_rootstrap_include_dir=${hal_rootstrap_dir}@INCLUDEDIR@
diff --git a/packaging/hal-rootstrap.spec b/packaging/hal-rootstrap.spec
index 56ab38d..9d79f30 100644
--- a/packaging/hal-rootstrap.spec
+++ b/packaging/hal-rootstrap.spec
@@ -1,6 +1,10 @@
-%define name hal-rootstrap
-%define devel_name hal-rootstrap-devel
-%define hal_rootstrap_install_path /opt/data/hal-rootstrap
+%define name hal-rootstrap
+%define devel_name hal-rootstrap-devel
+%define hal_rootstrap_install_path /opt/data/hal-rootstrap/common
+
+%define headed_name hal-rootstrap-headed
+%define headed_devel_name hal-rootstrap-headed-devel
+%define hal_rootstrap_headed_install_path /opt/data/hal-rootstrap/headed
Name: hal-rootstrap
Summary: Package for rootstrap of hal
@@ -42,6 +46,22 @@ Group: System/Base
%description checker
Checker for the hal rootstrap
+### hal-rootstrap-headed
+%package -n %{headed_name}
+Summary: Package for rootstrap of hal, for headed image
+
+%description -n %{headed_name}
+Package for rootstrap of hal, for headed image
+
+### hal-rootstrap-headed-devel
+%package -n %{headed_devel_name}
+Summary: %{headed_name} interface
+Group: Development/Libraries
+Requires: %{headed_name} = %{version}-%{release}
+
+%description -n %{headed_devel_name}
+${headed_name} Interface for product vendor developer
+
%prep
%setup -q
%cmake . -DCMAKE_LIBDIR_PREFIX=%{_libdir}
@@ -52,11 +72,19 @@ make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
mkdir %{buildroot}
-./generate_rootstrap.sh "%{_arch}" "%{buildroot}%{hal_rootstrap_install_path}"
-
mkdir -p %{buildroot}%{_libdir}/pkgconfig/
+
+# hal-rootstrap
+./generate_rootstrap.sh "%{_arch}" "common" "%{buildroot}%{hal_rootstrap_install_path}"
cp packaging/hal-rootstrap.pc %{buildroot}%{_libdir}/pkgconfig/
./modify_pc.py "%{buildroot}%{_libdir}/pkgconfig/hal-rootstrap.pc" "%{buildroot}%{hal_rootstrap_install_path}/%{_libdir}/pkgconfig"
+rm -f "%{buildroot}%{hal_rootstrap_install_path}/%{_libdir}/pkgconfig/*.pc"
+
+# hal-rootstrap-headed
+./generate_rootstrap.sh "%{_arch}" "headed" "%{buildroot}%{hal_rootstrap_headed_install_path}"
+cp packaging/hal-rootstrap-headed.pc %{buildroot}%{_libdir}/pkgconfig/
+./modify_pc.py "%{buildroot}%{_libdir}/pkgconfig/hal-rootstrap-headed.pc" "%{buildroot}%{hal_rootstrap_headed_install_path}/%{_libdir}/pkgconfig"
+rm -f "%{buildroot}%{hal_rootstrap_headed_install_path}/%{_libdir}/pkgconfig/*.pc"
mkdir -p %{buildroot}%{_sysconfdir}/hal/rootstrap
install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/hal/rootstrap
@@ -70,16 +98,22 @@ ln -sf %{_sysconfdir}/hal/rootstrap/hal-rootstrap-checker-rpmmacros %{_sysconfdi
rm -f %{_sysconfdir}/rpm/macros.hal-rootstrap-checker
%files
-%{hal_rootstrap_install_path}/etc/*
-%{hal_rootstrap_install_path}/lib*/*
-%{hal_rootstrap_install_path}/usr/share/*
-%{hal_rootstrap_install_path}/usr/lib*/*
+%{hal_rootstrap_install_path}
+%exclude %dir %{hal_rootstrap_install_path}/%{_includedir}
%files -n %{devel_name}
%defattr(-,root,root,-)
-%{hal_rootstrap_install_path}/%{_includedir}/*
-%{hal_rootstrap_install_path}/%{_libdir}/pkgconfig/*.pc
-%{_libdir}/pkgconfig/*.pc
+%{hal_rootstrap_install_path}/%{_includedir}
+%{_libdir}/pkgconfig/hal-rootstrap.pc
+
+%files -n %{headed_name}
+%{hal_rootstrap_headed_install_path}
+%exclude %dir %{hal_rootstrap_headed_install_path}/%{_includedir}
+
+%files -n %{headed_devel_name}
+%defattr(-,root,root,-)
+%{hal_rootstrap_headed_install_path}/%{_includedir}
+%{_libdir}/pkgconfig/hal-rootstrap-headed.pc
%files checker
%defattr(-,root,root,-)