Files
hakurei/internal/rosa/package/kernel/package.az
Ophestra 443a7a30f6 internal/rosa: use string pair for files
This is a much cleaner representation than the separator syntax.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-05-21 14:07:20 +09:00

162 lines
3.1 KiB
Go

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";
riscv64 = "z0MI2uSA31k_HtIsqGoCy-Vcf3mYm_zBDR_jN1tntg2Fdvz6YTwCU9YlHbYnpNbx";
};
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 = {
".config": arch {
amd64 = "kernel_amd64.config";
arm64 = "kernel_arm64.config";
riscv64 = "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
`;
};
}