blob: 0861c3d7a207e95cff6e4018446e0099256ecb34 (
plain)
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
|
#!/bin/mkpkg
# description: Linux kernel for the rawnix.org netinstall image
# url: https://www.kernel.org/
#
# This is NOT the system kernel port. It builds the EFI-stub kernel
# with root= compiled into CONFIG_CMDLINE, for use by mkinstall.sh.
# It is never installed on a running system:
#
# cd /usr/local/src/linux-7.2.11-img && mkpkg -is
# tar xf linux-7.2.11-img#7.2.11-1.pkg.tar.gz -C /root/
name=linux-7.2.11-img
_name=linux
version=7.2.11
_version=7.2.11-img
release=1
source=(https://cdn.kernel.org/pub/linux/kernel/v7.x/$_name-$version.tar.xz
config-${_version}
)
sha256sums=(
"fd0fc479f983a8c05313f13e9c36330fe6651cf725396748c40d5cd93fa1e6a4"
"eb45de7a3f5e5eeb93c9f9caf99e03b17631751ac4be5b61b34847f13d6c7dfb"
)
build() {
# A kernel controls its own flags; nothing from mkpkg.conf reaches it.
unset CFLAGS CXXFLAGS LDFLAGS CPPFLAGS PKG_CONFIG_PATH MAKEFLAGS
_nm=$SRC/nm-epipe
rm -f $_nm
printf '%s\n' \
'#!/bin/sh' \
'llvm-nm "$@"' \
'_s=$?' \
'if [ $_s -gt 128 ]; then exit 0; fi' \
'exit $_s' > $_nm
chmod 755 $_nm
test -s $_nm || { echo "nm wrapper is empty"; return 1; }
cd $_name-$version
cp $SRC/config-${_version} .config
make LLVM=1 olddefconfig
# Assert what the image depends on survived olddefconfig. Each of
# these is a silent failure otherwise: no EFI_STUB and the firmware
# will not load the kernel at all, no CMDLINE and it loads and
# panics with no root device, a wrong LOCALVERSION and the module
# tree does not match the vmlinuz name mkinstall.sh looks for, no
# USB and the stick it booted from is gone after handoff.
grep -q '^CONFIG_LOCALVERSION="-img"' .config || { echo "CONFIG_LOCALVERSION is not -img"; return 1; }
grep -q '^CONFIG_EFI_STUB=y' .config || { echo "CONFIG_EFI_STUB lost"; return 1; }
grep -q '^CONFIG_CMDLINE_BOOL=y' .config || { echo "CONFIG_CMDLINE_BOOL lost"; return 1; }
grep -q '^CONFIG_CMDLINE=".*root=' .config || { echo "CONFIG_CMDLINE has no root="; return 1; }
grep -q '^CONFIG_MODULES=y' .config || { echo "CONFIG_MODULES not enabled"; return 1; }
grep -q '^CONFIG_USB=y' .config || { echo "CONFIG_USB lost"; return 1; }
make LLVM=1 NM=$_nm -j$(nproc)
make LLVM=1 NM=$_nm INSTALL_MOD_PATH=$PKG INSTALL_MOD_STRIP=1 modules_install
install -Dm644 arch/x86/boot/bzImage $PKG/boot/vmlinuz-$_version
install -Dm644 System.map $PKG/boot/System.map-$_version
install -Dm644 .config $PKG/boot/config-$_version
rm -f $PKG/lib/modules/$_version/build
rm -f $PKG/lib/modules/$_version/source
}
signify() {
untrusted comment: public key
RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}
# vim: filetype=sh
|