Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpm: build and package debug hypervisor #170

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 79 additions & 7 deletions xen.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ form the core Xen userspace environment.


%package hypervisor
Summary: Libraries for Xen tools
Summary: Xen hypervisor
Provides: xen-hypervisor-abi = %{hv_abi}
Requires: xen-licenses
%if %build_hyp
Expand All @@ -353,6 +353,17 @@ Recommends: grub2-pc-modules
%description hypervisor
This package contains the Xen hypervisor

%package hypervisor-debug
Summary: Xen hypervisor - debug build
Requires: xen-licenses
%if %build_hyp
%ifarch %{ix86}
Recommends: grub2-pc-modules
%endif
%endif

%description hypervisor-debug
This package contains debug build of the Xen hypervisor

%if %build_docs
%package doc
Expand Down Expand Up @@ -505,12 +516,25 @@ XEN_TARGET_ARCH=x86_32 make -C stubdom pv-grub-if-enabled
%endif
%endif

mv dist/install dist/install-release
%if %build_hyp
# BEGIN QUBES SPECIFIC PART
# finally, build debug hypervisor
echo "CONFIG_DEBUG=y" >> xen/.config
make -C xen olddefconfig
%if %build_efi
mkdir -p dist/install/boot/efi/efi/qubes
%endif
%make_build %{?efi_flags} prefix=/usr xen
# END QUBES SPECIFIC PART
%endif

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
cp -prlP dist/install/* %{buildroot}
cp -prlP dist/install-release/* %{buildroot}
%if %build_stubdom
# TODO: this is broken with dist/install-release change
%ifnarch armv7hl aarch64
make DESTDIR=%{buildroot} %{?ocaml_flags} prefix=/usr install-stubdom
%endif
Expand All @@ -532,6 +556,22 @@ rm -f %{buildroot}/usr/sbin/flask-*
# END QUBES SPECIFIC PART
%endif

# BEGIN QUBES SPECIFIC PART
# install debug hypervisor
cp dist/install/boot/efi/efi/qubes/xen-%{upstream_version}.efi \
%{buildroot}/boot/efi/EFI/qubes/xen-debug-%{upstream_version}.efi
cp dist/install/boot/xen-%{upstream_version}.gz \
%{buildroot}/boot/xen-debug-%{upstream_version}.gz
cp dist/install/boot/xen-%{upstream_version}.config \
%{buildroot}/boot/xen-debug-%{upstream_version}.config
cp dist/install/usr/lib/debug/xen-%{upstream_version}.efi.map \
%{buildroot}/usr/lib/debug/xen-debug-%{upstream_version}.efi.map
cp dist/install/usr/lib/debug/xen-syms-%{upstream_version} \
%{buildroot}/usr/lib/debug/xen-debug-syms-%{upstream_version}
cp dist/install/usr/lib/debug/xen-syms-%{upstream_version}.map \
%{buildroot}/usr/lib/debug/xen-debug-syms%{upstream_version}.map
# END QUBES SPECIFIC PART

############ debug packaging: list files ############

find %{buildroot} -print | xargs ls -ld | sed -e 's|.*%{buildroot}||' > f1.list
Expand Down Expand Up @@ -794,6 +834,17 @@ if [ -f /sbin/grub2-mkconfig ]; then
fi
%endif

%post hypervisor-debug
if [ -f /sbin/grub2-mkconfig ]; then
if [ -f /boot/grub2/grub.cfg ]; then
/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
fi
if [ -f /boot/efi/EFI/qubes/grub.cfg ] && \
! grep -q "configfile" /boot/efi/EFI/qubes/grub.cfg; then
/sbin/grub2-mkconfig -o /boot/efi/EFI/qubes/grub.cfg
fi
fi

%if %build_ocaml
%post ocaml
%if %with_systemd_presets
Expand Down Expand Up @@ -1044,11 +1095,11 @@ fi
%if %build_hyp
%defattr(-,root,root)
%ifnarch armv7hl aarch64
/boot/xen-*.gz
/boot/xen-[0-9]*.gz
# BEGIN QUBES SPECIFIC PART
# /boot/xen.gz
# END QUBES SPECIFIC PART
/boot/xen*.config
/boot/xen-[0-9]*.config
%else
/boot/xen*
%endif
Expand All @@ -1057,15 +1108,36 @@ fi
/boot/flask/xenpolicy*
%endif
%if %build_efi
/boot/efi/EFI/qubes/*.efi
/boot/efi/EFI/qubes/xen-[0-9]*.efi
%endif
/usr/lib/debug/xen*
/usr/lib/debug/xen-[0-9]*
/usr/lib/debug/xen-syms-[0-9]*
%{_libdir}/efi/xen-[0-9]*.efi
%endif

%files hypervisor-debug
%if %build_hyp
%defattr(-,root,root)
%ifnarch armv7hl aarch64
/boot/xen-debug*.gz
# BEGIN QUBES SPECIFIC PART
# /boot/xen.gz
# END QUBES SPECIFIC PART
/boot/xen-debug*.config
%else
/boot/xen-debug*
%endif
%if %build_efi
/boot/efi/EFI/qubes/xen-debug*.efi
%endif
/usr/lib/debug/xen-debug*
%endif


%if %build_docs
%files doc
%doc docs/misc/
%doc dist/install/usr/share/doc/xen/html
%doc dist/install-release/usr/share/doc/xen/html
%endif

%files devel
Expand Down