forked from rosa/hakurei
internal/rosa/package: migrate kernel
This introduces bindings for extra paths and KnownChecksum, and exposes a passthrough special case. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
160
internal/rosa/package/kernel/package.az
Normal file
160
internal/rosa/package/kernel/package.az
Normal file
@@ -0,0 +1,160 @@
|
||||
package kernel-source {
|
||||
description = "unpatched Linux kernel source tree";
|
||||
website = "https://kernel.org";
|
||||
|
||||
version* = "6.12.87";
|
||||
output = remoteTar {
|
||||
url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
|
||||
"snapshot/linux-"+version+".tar.gz";
|
||||
checksum = "QTl5teIy0K5KsOLYGHQ3FbnPCZNRH2bySXVzghiOoHDdM3zAcSPUkmdly85lMzHx";
|
||||
compress = gzip;
|
||||
};
|
||||
}
|
||||
|
||||
package kernel-headers {
|
||||
description = "an installation of kernel headers";
|
||||
website = "https://kernel.org";
|
||||
|
||||
source = kernel-source;
|
||||
|
||||
files = [
|
||||
// updated manually for API changes
|
||||
"version.h",
|
||||
];
|
||||
toyboxEarly = true;
|
||||
|
||||
exec = make {
|
||||
skipConfigure = true;
|
||||
make = [
|
||||
"-f /usr/src/kernel-headers/Makefile",
|
||||
"O=/tmp/kbuild",
|
||||
"LLVM=1",
|
||||
`HOSTLDFLAGS="${LDFLAGS:-''}"`,
|
||||
"INSTALL_HDR_PATH=/work/system",
|
||||
"headers_install",
|
||||
];
|
||||
skipCheck = true;
|
||||
install = `
|
||||
cat \
|
||||
/usr/src/version.h > \
|
||||
/work/system/include/linux/version.h
|
||||
`;
|
||||
};
|
||||
|
||||
checksum = arch {
|
||||
default = "";
|
||||
|
||||
amd64 = "lCmBNcMeUmXifg0vecKOPy3GAaFcJSmOPnf3wit9xYTDSTsFADPt1xxUFfmTn1fD";
|
||||
arm64 = "PlRxp4JzZeMGx7CScRlT1NBzc2NVyJlb8Gm8sa3ofFght9ZT101ZJhcIXiCkHSHM";
|
||||
};
|
||||
inputs = [ rsync ];
|
||||
}
|
||||
|
||||
package kernel {
|
||||
description = "the generic Rosa OS linux kernel";
|
||||
website = "https://kernel.org";
|
||||
anitya = 375621;
|
||||
|
||||
source = kernel-source;
|
||||
patches = [
|
||||
"f54a91f5337cd918eb86cf600320d25b6cfd8209.patch",
|
||||
"6ce6fbfddc5b127e4f57c3b5bfdcf40239a4fc2f.patch",
|
||||
];
|
||||
files = [
|
||||
arch {
|
||||
amd64 = ".config:kernel_amd64.config";
|
||||
arm64 = ".config:kernel_arm64.config";
|
||||
riscv64 = ".config:kernel_riscv64.config";
|
||||
},
|
||||
|
||||
".installkernel:installkernel",
|
||||
".depmod:depmod",
|
||||
];
|
||||
|
||||
env = [
|
||||
"PATH=/system/sbin",
|
||||
];
|
||||
|
||||
early = `
|
||||
install -Dm0400 \
|
||||
/usr/src/.config \
|
||||
/tmp/kbuild/.config
|
||||
install -Dm0500 \
|
||||
/usr/src/.installkernel \
|
||||
/sbin/installkernel
|
||||
`;
|
||||
|
||||
exclusive = true;
|
||||
|
||||
exec = make {
|
||||
omitDefaults = true;
|
||||
skipConfigure = true;
|
||||
|
||||
// Build, install, and boot kernel before running kselftest on it.
|
||||
skipCheck = true;
|
||||
|
||||
make = [
|
||||
"-f /usr/src/kernel/Makefile",
|
||||
"O=/tmp/kbuild",
|
||||
|
||||
"LLVM=1",
|
||||
"KBUILD_BUILD_VERSION='1-Rosa'",
|
||||
"KBUILD_BUILD_TIMESTAMP='2106-02-07 06:28:15 UTC'",
|
||||
"KBUILD_BUILD_USER=kbuild",
|
||||
"KBUILD_BUILD_HOST=localhost",
|
||||
"all",
|
||||
];
|
||||
|
||||
install = `
|
||||
# kernel is not aware of kmod moduledir
|
||||
install -Dm0500 \
|
||||
/usr/src/.depmod \
|
||||
/sbin/depmod
|
||||
|
||||
make \
|
||||
` + jobsFlagE + ` \
|
||||
-f /usr/src/kernel/Makefile \
|
||||
O=/tmp/kbuild \
|
||||
LLVM=1 \
|
||||
INSTALL_PATH=/work \
|
||||
install \
|
||||
INSTALL_MOD_PATH=/work/system \
|
||||
DEPMOD=/sbin/depmod \
|
||||
modules_install
|
||||
rm -v "/work/system/lib/modules/$(make -f /usr/src/kernel/Makefile kernelversion)/build"
|
||||
`;
|
||||
};
|
||||
|
||||
inputs = [
|
||||
flex,
|
||||
bison,
|
||||
m4,
|
||||
tar,
|
||||
perl,
|
||||
bc,
|
||||
sed,
|
||||
gawk,
|
||||
coreutils,
|
||||
diffutils,
|
||||
python,
|
||||
|
||||
xz,
|
||||
gzip,
|
||||
kmod,
|
||||
elfutils,
|
||||
util-linux,
|
||||
kernel-headers,
|
||||
];
|
||||
}
|
||||
|
||||
package gen_init_cpio {
|
||||
description = "a program in the kernel source tree for creating initramfs archive";
|
||||
source = kernel-source;
|
||||
|
||||
exec = generic {
|
||||
build = `
|
||||
mkdir -p /work/system/bin/
|
||||
cc -o /work/system/bin/gen_init_cpio usr/gen_init_cpio.c
|
||||
`;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user