Skip to content

Commit a8970d5

Browse files
Introduce kernel-64k (#11078)
kernel-64k is a new aarch64 kernel which has 64k page sizes. kernel-64k contains a config_aarch64 which differs from the kernel in that it sets CONFIG_ARM64_64K_PAGES. This offering is to help with HPC scenarios. The kernel package will still be offered and will retain the default 4k page size. Co-authored-by: Christopher Co <35273088+christopherco@users.noreply.github.com>
1 parent f49c769 commit a8970d5

15 files changed

Lines changed: 14411 additions & 2 deletions

LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSES-AND-NOTICES/SPECS/data/licenses.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,7 @@
22562256
"kata-packages-uvm",
22572257
"keda",
22582258
"keras",
2259+
"kernel-64k-signed",
22592260
"kernel-signed",
22602261
"kernel-uki",
22612262
"kernel-uki-signed",
@@ -2753,6 +2754,7 @@
27532754
"kbd",
27542755
"keepalived",
27552756
"kernel",
2757+
"kernel-64k",
27562758
"kernel-headers",
27572759
"kernel-mshv",
27582760
"kernel-rt",
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
%global debug_package %{nil}
2+
%global sha512hmac bash %{_sourcedir}/sha512hmac-openssl.sh
3+
%ifarch aarch64
4+
%global buildarch aarch64
5+
%endif
6+
%define uname_r %{version}-%{release}
7+
Summary: Signed Linux Kernel for %{buildarch} systems
8+
Name: kernel-64k-signed-%{buildarch}
9+
Version: 6.6.57.1
10+
Release: 5%{?dist}
11+
License: GPLv2
12+
Vendor: Microsoft Corporation
13+
Distribution: Azure Linux
14+
Group: System Environment/Kernel
15+
URL: https://github.com/microsoft/CBL-Mariner-Linux-Kernel
16+
# This package's "version" and "release" must reflect the unsigned version that
17+
# was signed.
18+
# An important consequence is that when making a change to this package, the
19+
# unsigned version/release must be increased to keep the two versions consistent.
20+
# Ideally though, this spec will not change much or at all, so the version will
21+
# just track the unsigned package's version/release.
22+
#
23+
# To populate these sources:
24+
# 1. Build the unsigned packages as normal
25+
# 2. Sign the desired binary
26+
# 3. Place the unsigned package and signed binary in this spec's folder
27+
# 4. Build this spec
28+
Source0: kernel-64k-%{version}-%{release}.%{buildarch}.rpm
29+
Source1: vmlinuz-%{uname_r}
30+
Source2: sha512hmac-openssl.sh
31+
BuildRequires: cpio
32+
BuildRequires: grub2-rpm-macros
33+
BuildRequires: openssl
34+
BuildRequires: sed
35+
%{?grub2_configuration_requires}
36+
37+
%description
38+
This package contains the Linux kernel package with kernel signed with the production key
39+
40+
%package -n kernel-64k
41+
Summary: Linux Kernel
42+
Group: System Environment/Kernel
43+
Requires: filesystem
44+
Requires: kmod
45+
Requires(post): coreutils
46+
Requires(postun): coreutils
47+
48+
%description -n kernel-64k
49+
The kernel package contains the signed Linux kernel.
50+
51+
%prep
52+
53+
%build
54+
mkdir rpm_contents
55+
pushd rpm_contents
56+
57+
# This spec's whole purpose is to inject the signed kernel binary
58+
rpm2cpio %{SOURCE0} | cpio -idmv
59+
cp %{SOURCE1} ./boot/vmlinuz-%{uname_r}
60+
61+
popd
62+
63+
%install
64+
pushd rpm_contents
65+
66+
# Don't use * wildcard. It does not copy over hidden files in the root folder...
67+
cp -rp ./. %{buildroot}/
68+
69+
popd
70+
71+
# Recalculate sha512hmac for FIPS
72+
%{sha512hmac} %{buildroot}/boot/vmlinuz-%{uname_r} | sed -e "s,$RPM_BUILD_ROOT,," > %{buildroot}/boot/.vmlinuz-%{uname_r}.hmac
73+
cp %{buildroot}/boot/.vmlinuz-%{uname_r}.hmac %{buildroot}/lib/modules/%{uname_r}/.vmlinuz.hmac
74+
75+
%triggerin -n kernel-64k -- initramfs
76+
mkdir -p %{_localstatedir}/lib/rpm-state/initramfs/pending
77+
touch %{_localstatedir}/lib/rpm-state/initramfs/pending/%{uname_r}
78+
echo "initrd generation of kernel %{uname_r} will be triggered later" >&2
79+
80+
%triggerun -n kernel-64k -- initramfs
81+
rm -rf %{_localstatedir}/lib/rpm-state/initramfs/pending/%{uname_r}
82+
rm -rf /boot/initramfs-%{uname_r}.img
83+
echo "initrd of kernel %{uname_r} removed" >&2
84+
85+
%postun -n kernel-64k
86+
%grub2_postun
87+
88+
%post -n kernel-64k
89+
/sbin/depmod -a %{uname_r}
90+
%grub2_post
91+
92+
%files -n kernel-64k
93+
%defattr(-,root,root)
94+
%license COPYING
95+
/boot/System.map-%{uname_r}
96+
/boot/config-%{uname_r}
97+
/boot/vmlinuz-%{uname_r}
98+
/boot/.vmlinuz-%{uname_r}.hmac
99+
%defattr(0644,root,root)
100+
/lib/modules/%{uname_r}/*
101+
/lib/modules/%{uname_r}/.vmlinuz.hmac
102+
%exclude /lib/modules/%{uname_r}/build
103+
%exclude /lib/modules/%{uname_r}/kernel/drivers/gpu
104+
%exclude /lib/modules/%{uname_r}/kernel/sound
105+
%exclude /module_info.ld
106+
107+
%changelog
108+
* Thu Nov 07 2024 Rachel Menge <rachelmenge@microsoft.com> - 6.6.57.1-5
109+
- Original version for Azure Linux
110+
- Starting with release 5 to align with kernel release.
111+
- License verified
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Mocks sha512hmac using the openssl tool.
4+
# Only for use during RPM build.
5+
6+
openssl sha512 -hmac FIPS-FTW-RHT2009 -hex "$1" | cut -f 2 -d ' ' | echo "$(cat -) $1"

0 commit comments

Comments
 (0)