package kernel-source { description = "unpatched Linux kernel source tree"; website = "https://kernel.org"; exclude = true; version# = "6.18.65"; output = remoteTar { url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-"+version+".tar.gz"; checksum = "jU3iWqARXeC1Otv3xi3OTiCtrR3G65G0EEZoy8fghJ_oy3lVEiG4rLedY5z8_Xbq"; compress = gzip; }; } package kernel-version { description = "linux/version.h generated for kernel-headers"; exclude = true; source = kernel-source; libc = false; toyboxEarly = true; exec = make { defaults = false; configure = nil; make = [ "-f /source/Makefile", "O=/tmp/kbuild", "LLVM=1", "include/generated/uapi/linux/version.h", ]; check = nil; install = "mv /tmp/kbuild/include/generated/uapi/linux/version.h /work"; }; unlikely = true; cross = nil; } package kernel-headers { description = "an installation of kernel headers"; website = "https://kernel.org"; source = kernel-source; files = { // updated manually for API changes "version.h"; }; libc = false; toyboxEarly = true; exec = make { defaults = false; configure = nil; make = [ "-f /source/Makefile", "O=/tmp/kbuild", "ARCH='"+arch { default = arch; amd64 = "x86"; ppc64le = "powerpc"; riscv64 = "riscv"; }+"'", "LLVM=1", `HOSTLDFLAGS="${LDFLAGS:-''}"`, "INSTALL_HDR_PATH=/work"+prefix, "headers_install", ]; check = nil; install = ` cat \ /extra/version.h > \ /work`+prefix+`/include/linux/version.h `; }; checksum = arch { default = ""; amd64 = "2c0whi-c-uMweqQqGTguQvYbcUxKIC3h3pkjurRDdqb89fMrIYM2eRVFlyTGuJTo"; arm64 = "gqXBNbhFSc_htLi1_H5cx5F9lFLgo_2SexfNLq0dx1rblipQHwcUWd5BUGUJbU2W"; ppc64le = "eOZ5IGEsIaY1memwYnLdRjqYgy-pAX96uduw5W-SKG4aIuNuw7Ye2O_lBsNG4Mdy"; riscv64 = "lMl5M2d9LUFkzells9-X751pnWeHSA3F3dgkBDEePA1sXpsWk4rJJhbe2w7ML8Ad"; }; tools = [ rsync ]; unlikely = true; } package kernel { description = "the generic Rosa OS linux kernel"; website = "https://kernel.org"; anitya = 389470; source = kernel-source; files = { ".config": arch+".config"; "/sbin/installkernel": "installkernel"; // kernel is not aware of kmod moduledir "/sbin/depmod": "depmod"; prefix+"/oldconfig": "oldconfig"; }; env = [ "PATH="+prefix+"/sbin", ]; early = ` install -Dm0400 \ /extra/.config \ /tmp/kbuild/.config `; exclusive = true; exec = make { _kernelArch# = "ARCH='"+arch { default = arch; amd64 = "x86"; ppc64le = "powerpc"; riscv64 = "riscv"; }+"'"; defaults = false; configure = nil; // Build, install, and boot kernel before running kselftest on it. check = nil; make = [ "-f /source/Makefile", "O=/tmp/kbuild", "LLVM=1", _kernelArch, "KBUILD_BUILD_VERSION='1-Rosa'", "KBUILD_BUILD_TIMESTAMP='2106-02-07 06:28:15 UTC'", "KBUILD_BUILD_USER=kbuild", "KBUILD_BUILD_HOST=localhost", `"${ROSA_MAKE_TARGET:-all}"`, ]; install = ` if [ -n "${ROSA_MAKE_TARGET+x}" ]; then mv -fv /tmp/kbuild/.config /work exit 0 fi make \ ` + jobsFlagE + ` \ ` + loadFlagE + ` \ -f /source/Makefile \ O=/tmp/kbuild \ LLVM=1 \ ` + _kernelArch + ` \ INSTALL_PATH=/work \ install \ INSTALL_MOD_PATH=/work`+prefix+` \ DEPMOD=/sbin/depmod \ modules_install rm -v "/work`+prefix+`/lib/modules/$(make -f /source/Makefile kernelversion)/build" `; }; tools = [ flex, bison, m4, gzip, xz, tar, perl, bc, sed, awk, coreutils, diffutils, bash, python, kmod, elfutils, util-linux, ]; inputs = [ kernel-headers ]; runtime = nil; unlikely = true; } package gen_init_cpio { description = "a program in the kernel source tree for creating initramfs archive"; source = kernel-source; enter = true; exec = generic { chdir = false; build = ` mkdir -p /work`+prefix+`/bin/ cc -o /work`+prefix+`/bin/gen_init_cpio usr/gen_init_cpio.c `; }; }