├── LICENSE └── PartTimeGod ├── Dockerfile ├── PARTTIMEGOD ├── build.sh ├── obj └── kernel.full └── patches.diff /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 Serafina Brocious 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /PartTimeGod/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | WORKDIR / 4 | 5 | RUN apt-get update \ 6 | && DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential clang git python2.7 python3 7 | 8 | RUN git clone --branch releng/13.1 --depth 1 https://github.com/freebsd/freebsd-src.git 9 | 10 | RUN DEBIAN_FRONTEND=noninteractive apt-get -y install lld libarchive-dev libbz2-dev 11 | 12 | WORKDIR /freebsd-src 13 | 14 | RUN mkdir /build 15 | RUN MAKEOBJDIRPREFIX=/build XCC=/usr/bin/clang XCXX=/usr/bin/clang++ XCPP=/usr/bin/clang-cpp XLD=/usr/bin/ld.lld ./tools/build/make.py TARGET=amd64 TARGET_ARCH=amd64 kernel-toolchain -j`nproc` 16 | 17 | WORKDIR / 18 | COPY . . 19 | RUN cp /PARTTIMEGOD /freebsd-src/sys/amd64/conf/ 20 | 21 | WORKDIR /freebsd-src 22 | RUN git apply /patches.diff --ignore-space-change --ignore-whitespace 23 | RUN MAKEOBJDIRPREFIX=/build XCC=/usr/bin/clang XCXX=/usr/bin/clang++ XCPP=/usr/bin/clang-cpp XLD=/usr/bin/ld.lld ./tools/build/make.py TARGET=amd64 TARGET_ARCH=amd64 KERNCONF=PARTTIMEGOD NO_MODULES=yes buildkernel -j`nproc` 24 | -------------------------------------------------------------------------------- /PartTimeGod/PARTTIMEGOD: -------------------------------------------------------------------------------- 1 | # 2 | # Part Time God -- Empire Of Steel kernel configuration file for FreeBSD/amd64 3 | # 4 | # For more information on this file, please read the config(5) manual page, 5 | # and/or the handbook section on Kernel Configuration Files: 6 | # 7 | # https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html 8 | # 9 | # The handbook is also available locally in /usr/share/doc/handbook 10 | # if you've installed the doc distribution, otherwise always see the 11 | # FreeBSD World Wide Web server (https://www.FreeBSD.org/) for the 12 | # latest information. 13 | # 14 | # An exhaustive list of options and more detailed explanations of the 15 | # device lines is also present in the ../../conf/NOTES and NOTES files. 16 | # If you are in doubt as to the purpose or necessity of a line, check first 17 | # in NOTES. 18 | # 19 | # $FreeBSD$ 20 | 21 | cpu HAMMER 22 | ident PARTTIMEGOD 23 | 24 | makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols 25 | makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support 26 | 27 | options INVARIANTS # Enable KASSERT 28 | options INVARIANT_SUPPORT 29 | 30 | options SCHED_ULE # ULE scheduler 31 | options NUMA # Non-Uniform Memory Architecture support 32 | options PREEMPTION # Enable kernel thread preemption 33 | options VIMAGE # Subsystem virtualization, e.g. VNET 34 | options INET # InterNETworking 35 | options INET6 # IPv6 communications protocols 36 | options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 37 | options ROUTE_MPATH # Multipath routing support 38 | options TCP_HHOOK # hhook(9) framework for TCP 39 | options TCP_RFC7413 # TCP Fast Open 40 | options SCTP_SUPPORT # Allow kldload of SCTP 41 | options KERN_TLS # TLS transmit & receive offload 42 | options FFS # Berkeley Fast Filesystem 43 | options SOFTUPDATES # Enable FFS soft updates support 44 | options UFS_ACL # Support for access control lists 45 | options UFS_DIRHASH # Improve performance on big directories 46 | options UFS_GJOURNAL # Enable gjournal-based UFS journaling 47 | options MD_ROOT # MD is a potential root device 48 | options PROCFS # Process filesystem (requires PSEUDOFS) 49 | options PSEUDOFS # Pseudo-filesystem framework 50 | options TMPFS # Efficient memory filesystem 51 | options COMPAT_FREEBSD4 # Compatible with FreeBSD4 52 | options COMPAT_FREEBSD5 # Compatible with FreeBSD5 53 | options COMPAT_FREEBSD6 # Compatible with FreeBSD6 54 | options COMPAT_FREEBSD7 # Compatible with FreeBSD7 55 | options COMPAT_FREEBSD9 # Compatible with FreeBSD9 56 | options COMPAT_FREEBSD10 # Compatible with FreeBSD10 57 | options COMPAT_FREEBSD11 # Compatible with FreeBSD11 58 | options COMPAT_FREEBSD12 # Compatible with FreeBSD12 59 | options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI 60 | options KTRACE # ktrace(1) support 61 | options STACK # stack(9) support 62 | options SYSVSHM # SYSV-style shared memory 63 | options SYSVMSG # SYSV-style message queues 64 | options SYSVSEM # SYSV-style semaphores 65 | options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions 66 | options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. 67 | options KBD_INSTALL_CDEV # install a CDEV entry in /dev 68 | options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) 69 | options KDTRACE_FRAME # Ensure frames are compiled in 70 | options KDTRACE_HOOKS # Kernel DTrace hooks 71 | options DDB_CTF # Kernel ELF linker loads CTF data 72 | options INCLUDE_CONFIG_FILE # Include this file in kernel 73 | 74 | # Debugging support. Always need this: 75 | options KDB # Enable kernel debugger support. 76 | options KDB_TRACE # Print a stack trace for a panic. 77 | 78 | # Kernel Sanitizers 79 | #options COVERAGE # Generic kernel coverage. Used by KCOV 80 | #options KCOV # Kernel Coverage Sanitizer 81 | # Warning: KUBSAN can result in a kernel too large for loader to load 82 | #options KUBSAN # Kernel Undefined Behavior Sanitizer 83 | #options KCSAN # Kernel Concurrency Sanitizer 84 | 85 | # Kernel dump features. 86 | options GZIO # gzip-compressed kernel and user dumps 87 | options DEBUGNET # debugnet networking 88 | options NETDUMP # netdump(4) client support 89 | options NETGDB # netgdb(4) client support 90 | 91 | # Make an SMP-capable kernel by default 92 | options SMP # Symmetric MultiProcessor Kernel 93 | options EARLY_AP_STARTUP 94 | 95 | # Bus support. 96 | device acpi 97 | device pci 98 | 99 | options COMPAT_LINUXKPI 100 | 101 | # ATA/SCSI peripherals 102 | device scbus # SCSI bus (required for ATA/SCSI) 103 | device ch # SCSI media changers 104 | device da # Direct Access (disks) 105 | device pass # Passthrough device (direct ATA/SCSI access) 106 | 107 | # Serial (COM) ports 108 | device uart # Generic UART driver 109 | 110 | # Pseudo devices. 111 | device crypto # core crypto support 112 | device aesni # AES-NI OpenCrypto module 113 | device loop # Network loopback 114 | device rdrand_rng # Intel Bull Mountain RNG 115 | device ether # Ethernet support 116 | device md # Memory "disks" 117 | device gif # IPv6 and IPv4 tunneling 118 | device firmware # firmware assist module 119 | device xz # lzma decompression 120 | 121 | # The `bpf' device enables the Berkeley Packet Filter. 122 | # Be aware of the administrative consequences of enabling this! 123 | # Note that 'bpf' is required for DHCP. 124 | device bpf # Berkeley packet filter 125 | 126 | # Linux KVM paravirtualization support 127 | device kvm_clock # KVM paravirtual clock driver 128 | 129 | # Xen HVM Guest Optimizations 130 | # NOTE: XENHVM depends on xenpci. They must be added or removed together. 131 | options XENHVM # Xen HVM kernel infrastructure 132 | device xenpci # Xen HVM Hypervisor services driver 133 | 134 | # Recommended by https://www.freebsd.org/cgi/man.cgi?query=xen&manpath=FreeBSD+13.1-RELEASE 135 | options NO_ADAPTIVE_MUTEXES 136 | options NO_ADAPTIVE_RWLOCKS 137 | options NO_ADAPTIVE_SX 138 | -------------------------------------------------------------------------------- /PartTimeGod/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p obj 4 | docker build -t ptg . 5 | docker run -v `pwd`/obj:/output ptg cp /build/freebsd-src/amd64.amd64/sys/PARTTIMEGOD/kernel.full /output 6 | -------------------------------------------------------------------------------- /PartTimeGod/obj/kernel.full: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeken/EmpireOfSteel/971a69fc4465ea9f8c26665241be5674691b3110/PartTimeGod/obj/kernel.full -------------------------------------------------------------------------------- /PartTimeGod/patches.diff: -------------------------------------------------------------------------------- 1 | diff --git a/sys/x86/xen/xen_msi.c b/sys/x86/xen/xen_msi.c 2 | index 54215cfc0..456a99b55 100644 3 | --- a/sys/x86/xen/xen_msi.c 4 | +++ b/sys/x86/xen/xen_msi.c 5 | @@ -56,7 +56,6 @@ void 6 | xen_msi_init(void) 7 | { 8 | 9 | - MPASS(num_io_irqs > 0); 10 | first_msi_irq = num_io_irqs; 11 | if (num_msi_irqs > UINT_MAX - first_msi_irq) 12 | panic("num_msi_irqs too high"); 13 | --------------------------------------------------------------------------------