-
Notifications
You must be signed in to change notification settings - Fork 614
Expand file tree
/
Copy pathkernel-headers.spec
More file actions
148 lines (125 loc) · 5.4 KB
/
kernel-headers.spec
File metadata and controls
148 lines (125 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# This spec file has been modified by azldev to include build configuration overlays. Version: v0.1.1-0.20260402002340-3dc8b8a0f4b6
# Do not edit manually; changes may be overwritten.
# All Azure Linux specs with overlays include this macro file, irrespective of whether new macros have been added.
%{load:%{_sourcedir}/kernel-headers.azl.macros}
# For a stable, released kernel, released_kernel should be 1. For rawhide
# and/or a kernel built from an rc or git snapshot, released_kernel should
# be 0.
%global released_kernel 1
# define buildid .local
%define specversion 6.18.5
%define tarfile_release 6.18.5
# This is needed to do merge window version magic
# This allows pkg_release to have configurable %%{?dist} tag
%define specrelease %{kextraversion}.2%{?dist}
# This package doesn't contain any binary, thus no debuginfo package is needed
%global debug_package %{nil}
Name: kernel-headers
Summary: Header files for the Linux kernel for use by glibc
License: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-2-Clause) AND ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) AND ((GPL-2.0-only WITH Linux-syscall-note) OR CDDL-1.0) AND ((GPL-2.0-only WITH Linux-syscall-note) OR Linux-OpenIB) AND ((GPL-2.0-only WITH Linux-syscall-note) OR MIT) AND ((GPL-2.0-or-later WITH Linux-syscall-note) OR BSD-3-Clause) AND ((GPL-2.0-or-later WITH Linux-syscall-note) OR MIT) AND BSD-3-Clause AND (GPL-1.0-or-later WITH Linux-syscall-note) AND GPL-2.0-only AND (GPL-2.0-only WITH Linux-syscall-note) AND (GPL-2.0-or-later WITH Linux-syscall-note) AND (LGPL-2.0-or-later WITH Linux-syscall-note) AND (LGPL-2.1-only WITH Linux-syscall-note) AND (LGPL-2.1-or-later WITH Linux-syscall-note) AND MIT
URL: http://www.kernel.org/
Version: %{specversion}
Release: %{specrelease}
# This is a tarball with headers from the kernel, which should be created
# using create_headers_tarball.sh provided in the kernel source package.
# To create the tarball, you should go into a prepared/patched kernel sources
# directory, or git kernel source repository, and do eg.:
# For a RHEL package: (...)/create_headers_tarball.sh -m RHEL_RELEASE
# For a Fedora package: kernel/scripts/create_headers_tarball.sh -r <release number>
Source0: https://github.com/microsoft/CBL-Mariner-Linux-Kernel/archive/rolling-lts/mariner-%{azurelinux_version}/%{specversion}.%{kextraversion}.tar.gz#/kernel-%{specversion}.%{kextraversion}.tar.gz
Source9999: kernel-headers.azl.macros
Obsoletes: glibc-kernheaders < 3.0-46
Provides: glibc-kernheaders = 3.0-46
%if "0%{?variant}"
Obsoletes: kernel-headers < %{specversion}-%{specrelease}
Provides: kernel-headers = %{specversion}-%{specrelease}
%endif
BuildRequires: make
BuildRequires: gcc
BuildRequires: perl
BuildRequires: rsync
%description
Kernel-headers includes the C header files that specify the interface
between the Linux kernel and userspace libraries and programs. The
header files define structures and constants that are needed for
building most standard programs and are also needed for rebuilding the
glibc package.
%package -n kernel-cross-headers
Summary: Header files for the Linux kernel for use by cross-glibc
%description -n kernel-cross-headers
Kernel-cross-headers includes the C header files that specify the interface
between the Linux kernel and userspace libraries and programs. The
header files define structures and constants that are needed for
building most standard programs and are also needed for rebuilding the
cross-glibc package.
%prep
%setup -q -n CBL-Mariner-Linux-Kernel-rolling-lts-mariner-%{azurelinux_version}-%{specversion}.%{kextraversion}
%build
make mrproper
make headers_install INSTALL_HDR_PATH=headers-native
# Determine native kernel arch and cross-compile for the other
native_karch=$(uname -m | sed 's/x86_64/x86/;s/aarch64/arm64/')
for cross_arch in arm64 x86; do
[ "$cross_arch" = "$native_karch" ] && continue
make ARCH=$cross_arch headers_install INSTALL_HDR_PATH=headers-$cross_arch
done
%install
native_karch=$(uname -m | sed 's/x86_64/x86/;s/aarch64/arm64/')
mkdir -p $RPM_BUILD_ROOT%{_includedir}
cp -rv headers-native/include/* $RPM_BUILD_ROOT%{_includedir}
for cross_arch in arm64 x86; do
[ "$cross_arch" = "$native_karch" ] && continue
cross_arch_includedir=$RPM_BUILD_ROOT%{_prefix}/${cross_arch}-linux-gnu/include
mkdir -p $cross_arch_includedir
cp -rv headers-$cross_arch/include/* $cross_arch_includedir
done
exit 0
# List of architectures we support and want to copy their headers
ARCH_LIST="arm arm64 loongarch powerpc riscv s390 x86"
ARCH=%_target_cpu
case $ARCH in
armv7hl)
ARCH=arm
;;
aarch64)
ARCH=arm64
;;
loongarch64*)
ARCH=loongarch
;;
ppc64*)
ARCH=powerpc
;;
riscv64)
ARCH=riscv
;;
s390x)
ARCH=s390
;;
x86_64|i*86)
ARCH=x86
;;
esac
cd arch-$ARCH/include
mkdir -p $RPM_BUILD_ROOT%{_includedir}
cp -a asm-generic $RPM_BUILD_ROOT%{_includedir}
# Copy all the architectures we care about to their respective asm directories
for arch in $ARCH_LIST; do
mkdir -p $RPM_BUILD_ROOT%{_prefix}/${arch}-linux-gnu/include
cp -a asm-generic $RPM_BUILD_ROOT%{_prefix}/${arch}-linux-gnu/include/
done
# Remove what we copied already
rm -rf asm-generic
# Copy the rest of the headers over
cp -a * $RPM_BUILD_ROOT%{_includedir}/
for arch in $ARCH_LIST; do
cp -a * $RPM_BUILD_ROOT%{_prefix}/${arch}-linux-gnu/include/
done
%files
%defattr(-,root,root)
%{_includedir}/*
%files -n kernel-cross-headers
%defattr(-,root,root)
%{_prefix}/*-linux-gnu/*
%changelog
%autochangelog