Skip to content

Commit

Permalink
kernel: Add kernel-devel package
Browse files Browse the repository at this point in the history
When building the kernel also create a 'kernel-devel' RPM which includes
the configured kernel source tree and extra artifacts to support
building out-of-tree modules. This is not included in the Thar image,
but is instead intended to be downloaded later on a running instance via
a TUF target, for example.

Based off a similar script provided by Ben Cressey <bcressey@amazon.com>

Signed-off-by: Samuel Mendoza-Jonas <samjonas@amazon.com>
  • Loading branch information
sam-aws committed Dec 4, 2019
1 parent 509975e commit 77d7475
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions packages/kernel/kernel.spec
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ BuildRequires: hostname
BuildRequires: kmod
BuildRequires: openssl-devel

%global kernel_sourcedir %{_usrsrc}/kernels/%{version}

%description
%{summary}.

%package devel
Summary: Configured Linux kernel source for module building
Requires: %{_cross_os}filesystem

%description devel
%{summary}.

%package modules
Summary: Modules for the Linux kernel

Expand Down Expand Up @@ -89,6 +98,30 @@ find %{buildroot}%{_cross_prefix} \

%cross_generate_attribution

# files for external module compilation
(
find * -name Kbuild\* -type f -print \
-o -name Kconfig\* -type f -print \
-o -name Makefile\* -type f -print \
-o -name module.lds -type f -print \
-o -name Platform -type f -print
find arch/*/include/ include/ -type f -o -type l
find scripts/ -executable -type f
find scripts/ ! \( -name Makefile\* -o -name Kbuild\* \) -type f
echo .config
echo Module.symvers
echo System.map
) | sort -u > kernel_devel_files

# remove x86 intermediate files like generated/asm/.syscalls_32.h.cmd
sed -i '/asm\/.*\.cmd$/d' kernel_devel_files

install -d %{buildroot}%{kernel_sourcedir}
for file in $(cat kernel_devel_files); do
install -D ${file} %{buildroot}%{kernel_sourcedir}/${file}

done

%files
%license COPYING LICENSES/preferred/GPL-2.0 LICENSES/exceptions/Linux-syscall-note
%{_cross_attribution_file}
Expand Down Expand Up @@ -124,4 +157,9 @@ find %{buildroot}%{_cross_prefix} \
%{_cross_includedir}/video/*
%{_cross_includedir}/xen/*

%files devel
%dir %{kernel_sourcedir}
%{kernel_sourcedir}/*
%{kernel_sourcedir}/.config

%changelog

0 comments on commit 77d7475

Please sign in to comment.