From 0acd87954b67f23b41dc73259225ecf30b9a1e87 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Wed, 26 Jul 2023 07:20:17 -0600 Subject: [PATCH] Meta: Add Serenity Kernel to gn build --- Meta/gn/secondary/BUILD.gn | 4 + Meta/gn/secondary/Kernel/BUILD.gn | 869 ++++++++++++++++++ Meta/gn/secondary/Kernel/Prekernel/BUILD.gn | 51 + .../Kernel/generate_version_header.py | 28 + .../secondary/Kernel/post_process_kernel.py | 60 ++ .../StateMachineGenerator/BUILD.gn | 6 + .../Userland/Libraries/LibC/BUILD.gn | 21 + .../Userland/Libraries/LibC/libc_headers.gni | 118 +++ .../Userland/Libraries/LibVT/BUILD.gn | 12 + 9 files changed, 1169 insertions(+) create mode 100644 Meta/gn/secondary/Kernel/BUILD.gn create mode 100644 Meta/gn/secondary/Kernel/Prekernel/BUILD.gn create mode 100755 Meta/gn/secondary/Kernel/generate_version_header.py create mode 100644 Meta/gn/secondary/Kernel/post_process_kernel.py create mode 100644 Meta/gn/secondary/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/BUILD.gn create mode 100644 Meta/gn/secondary/Userland/Libraries/LibC/BUILD.gn create mode 100644 Meta/gn/secondary/Userland/Libraries/LibC/libc_headers.gni create mode 100644 Meta/gn/secondary/Userland/Libraries/LibVT/BUILD.gn diff --git a/Meta/gn/secondary/BUILD.gn b/Meta/gn/secondary/BUILD.gn index d98c13a6a8a..0434b528237 100644 --- a/Meta/gn/secondary/BUILD.gn +++ b/Meta/gn/secondary/BUILD.gn @@ -11,6 +11,10 @@ group("default") { testonly = true } +group("serenity") { + deps = [ "//Kernel(//Meta/gn/build/toolchain:serenity)" ] +} + # A pool called "console" in the root BUILD.gn is magic and represents ninja's # built-in console pool. (Requires a GN with `gn --version` >= 552353.) pool("console") { diff --git a/Meta/gn/secondary/Kernel/BUILD.gn b/Meta/gn/secondary/Kernel/BUILD.gn new file mode 100644 index 00000000000..a88d2535578 --- /dev/null +++ b/Meta/gn/secondary/Kernel/BUILD.gn @@ -0,0 +1,869 @@ +import("//Meta/gn/build/serenity_target.gni") +import("//Meta/gn/build/sysroot.gni") +import("//Meta/gn/build/write_cmake_config.gni") + +assert(current_os == "serenity") + +declare_args() { + # Turn off optimizations and up debug symbols for the kernel only + enable_extra_kernel_debug_symbols = true + + # Enable UBSAN for kernel objects. Detects undefined behavior and traps. + enable_kernel_undefined_sanitizer = true +} + +group("Kernel") { + deps = [ ":install_kernel" ] +} + +write_cmake_config("kernel_debug_gen") { + input = "Debug.h.in" + output = "$target_gen_dir/Debug.h" + deps = [ "//AK:ak_debug_gen" ] + values = [ + "AC97_DEBUG=", + "AHCI_DEBUG=", + "ACPI_DEBUG=", + "APIC_DEBUG=", + "APIC_SMP_DEBUG=", + "ARP_DEBUG=", + "ATA_DEBUG=", + "BBFS_DEBUG=", + "BXVGA_DEBUG=", + "COMMIT_DEBUG=", + "CONTEXT_SWITCH_DEBUG=", + "DUMP_REGIONS_ON_CRASH=", + "E1000_DEBUG=", + "ETHERNET_DEBUG=", + "EXEC_DEBUG=", + "EXT2_BLOCKLIST_DEBUG=", + "EXT2_DEBUG=", + "EXT2_VERY_DEBUG=", + "FAT_DEBUG=", + "FORK_DEBUG=", + "FUTEX_DEBUG=", + "FUTEXQUEUE_DEBUG=", + "HPET_COMPARATOR_DEBUG=", + "HPET_DEBUG=", + "ICMP_DEBUG=", + "INTEL_GRAPHICS_DEBUG=", + "INTEL_HDA_DEBUG=", + "INTERRUPT_DEBUG=", + "IO_DEBUG=", + "IOAPIC_DEBUG=", + "ISO9660_DEBUG=", + "ISO9660_VERY_DEBUG=", + "IPV4_DEBUG=", + "IPV4_SOCKET_DEBUG=", + "IRQ_DEBUG=", + "KEYBOARD_DEBUG=", + "KMALLOC_DEBUG=", + "KMALLOC_VERIFY_NO_SPINLOCK_HELD=", + "LOCAL_SOCKET_DEBUG=", + "LOCK_DEBUG=", + "LOCK_IN_CRITICAL_DEBUG=", + "LOCK_RANK_ENFORCEMENT=", + "LOCK_RESTORE_DEBUG=", + "LOCK_SHARED_UPGRADE_DEBUG=", + "LOCK_TRACE_DEBUG=", + "LOOPBACK_DEBUG=", + "MASTERPTY_DEBUG=", + "MOUSE_DEBUG=", + "MEMORY_DEVICE_DEBUG=", + "MULTIPROCESSOR_DEBUG=", + "NETWORK_TASK_DEBUG=", + "NVME_DEBUG=", + "OFFD_DEBUG=", + "PAGE_FAULT_DEBUG=", + "PATA_DEBUG=", + "PCI_DEBUG=", + "POLL_SELECT_DEBUG=", + "PROCESS_DEBUG=", + "PROCFS_DEBUG=", + "PS2MOUSE_DEBUG=", + "PTMX_DEBUG=", + "ROUTING_DEBUG=", + "RTL8168_DEBUG=", + "SCHEDULER_DEBUG=", + "SCHEDULER_RUNNABLE_DEBUG=", + "SIGNAL_DEBUG=", + "SLAVEPTY_DEBUG=", + "SMP_DEBUG=", + "SOCKET_DEBUG=", + "STORAGE_DEVICE_DEBUG=", + "SYSFS_DEBUG=", + "TCP_DEBUG=", + "TCP_SOCKET_DEBUG=", + "THREAD_DEBUG=", + "TTY_DEBUG=", + "UDP_DEBUG=", + "UHCI_DEBUG=", + "UHCI_VERBOSE_DEBUG=", + "USB_DEBUG=", + "VFS_DEBUG=", + "VMWARE_BACKDOOR_DEBUG=", + "VIRTIO_DEBUG=", + "VIRTUAL_CONSOLE_DEBUG=", + "WAITBLOCK_DEBUG=", + "WAITQUEUE_DEBUG=", + ] +} + +config("Kernel_config") { + configs = [ "//AK:ak_headers" ] + include_dirs = [ "//Userland/Libraries" ] + + cflags_cc = [] + ldflags = [] + + defines = [ + "KERNEL", + "ENABLE_COMPILETIME_FORMAT_CHECK", + "SANITIZE_PTRS", + ] + + if (enable_extra_kernel_debug_symbols) { + cflags_cc += [ + "-Og", + "-ggdb3", + ] + } else { + cflags_cc += [ "-O2" ] + } + + if (enable_kernel_undefined_sanitizer) { + cflags_cc += [ "-fsanitize=undefined" ] + ldflags = [ "-fsanitize=undefined" ] + } + + cflags_cc += [ + "-fsigned-char", + "-Wno-unknown-warning-option", + "-fno-rtti", + "-ffreestanding", + "-fbuiltin", + "-fno-asynchronous-unwind-tables", + "-fstack-protector-strong", + "-fno-exceptions", + "-fno-delete-null-pointer-checks", + "-fno-semantic-interposition", + "-fsized-deallocation", + "-Wvla", + "-nostdlib", + ] + ldflags += [ + "-Wl,-z,notext", + "-nostdlib", + ] + + # Toolchain-specific flags + if (serenity_toolchain == "GNU") { + cflags_cc += [ + "-fzero-call-used-regs=used-gpr", + "-fstack-clash-protection", + "-Wno-address-of-packed-member", + "-Wno-dangling-reference", + ] + lib_dirs = [ + "$toolchain_root/$serenity_arch-pc-serenity/lib", + "$toolchain_root/lib/gcc/$serenity_arch-pc-serenity/$serenity_compiler_version", + ] + ldflags += [ "-Wl,-z,pack-relative-relocs" ] + libs = [ "gcc" ] + } else { + assert(serenity_toolchain == "Clang", "") + cflags_cc += [ + "-Wno-address-of-packed-member", + "-faligned-allocation", + "-Wno-unused-const-variable", + ] + ldflags += [ + "-Wl,--build-id=none", + "-Wl,--pack-dyn-relocs=relr", + ] + + # FIXME: Why doesn't the cmake need this path anymore? + lib_dirs = [ "$toolchain_root/lib/clang/$serenity_compiler_version/lib/$serenity_arch-pc-serenity/" ] + libs = [ "clang_rt.builtins" ] + } + + # Architecture-specific flags + if (current_cpu == "aarch64") { + cflags_cc += [ + "-mno-outline-atomics", + "-Wno-nonnull", # FIXME: Remove once MemoryManager.cpp doesn't need it + "-mgeneral-regs-only", + "-fno-threadsafe-statics", + + # Unaligned memory access will cause a trap, so to make sure the compiler doesn't generate + # those unaligned accesses, these flags are added. + "-mstrict-align", + "-Wno-cast-align", + ] + libs = [ "atomic" ] + } else if (current_cpu == "x86_64") { + cflags_cc += [ + "-mno-80387", + "-mno-mmx", + "-mno-sse", + "-mno-sse2", + + # Auto initialize trivial types on the stack, we use "pattern" as + # it's the only option portable across compilers going forward. + # + # This is designed to help avoid uninitialized variables bugs and + # information disclosures coming from the kernel stack. + # + # FIXME: It appears to conflict with something during the boot of the + # aarch64 kernel, we should investigate and remove this special case. + "-ftrivial-auto-var-init=pattern", + + "-mcmodel=large", + "-mno-red-zone", + ] + if (serenity_toolchain == "GNU") { + cflags_cc += [ + "-faligned-new=8", + "-mpreferred-stack-boundary=3", + ] + } else { + assert(serenity_toolchain == "Clang", "") + cflags_cc += [ + "-fnew-alignment=8", + "-mstack-alignment=8", + ] + } + } + + # FIXME: KCOV flags + # FIXME: Source based code coverage flags + # FIXME: KASAN/KUBSAN flags + # FIXME: IPO flags +} + +source_set("kernel_heap") { + configs += [ ":Kernel_config" ] + sources = [ "Heap/kmalloc.cpp" ] + deps = [ + ":kernel_debug_gen", + "//Userland/Libraries/LibC:install_libc_headers", + ] +} + +source_set("aarch64_no_mmu") { + deps = [ + ":kernel_debug_gen", + "//Userland/Libraries/LibC:install_libc_headers", + ] + + configs += [ ":Kernel_config" ] + sources = [ + "Arch/aarch64/Exceptions.cpp", + "Arch/aarch64/MMU.cpp", + "Arch/aarch64/RPi/MMIO.cpp", + "Arch/aarch64/pre_init.cpp", + ] + + # NOTE: These files cannot use a stack protector and sanitizers, as these will cause accesses to global variables to be inserted + # by the compiler. The CPU cannot access global variables without the MMU as the kernel is linked for a virtual address in high memory. + cflags_cc = [ + "-fno-stack-protector", + "-fno-sanitize=all", + ] +} + +source_set("mini_stdlib_sources") { + deps = [ + ":kernel_debug_gen", + "//Userland/Libraries/LibC:install_libc_headers", + ] + + configs += [ ":Kernel_config" ] + sources = [ "Library/MiniStdLib.cpp" ] + + if (serenity_toolchain == "GNU") { + # Prevent naively implemented string functions (like strlen) from being "optimized" into a call to themselves. + cflags_cc = [ + "-fno-tree-loop-distribution", + "-fno-tree-loop-distribute-patterns", + ] + } +} + +source_set("arch_sources") { + deps = [ + ":kernel_debug_gen", + "//Userland/Libraries/LibC:install_libc_headers", + "//Userland/Libraries/LibVT:generate_vt_state_machine(//Meta/gn/build/toolchain:serenity)", + ] + + configs += [ ":Kernel_config" ] + if (current_cpu == "x86_64") { + sources = [ + "Arch/Processor.cpp", + "Arch/x86_64/ASM_wrapper.cpp", + "Arch/x86_64/Boot/ap_setup.S", + "Arch/x86_64/CMOS.cpp", + "Arch/x86_64/CPU.cpp", + "Arch/x86_64/CPUID.cpp", + "Arch/x86_64/CurrentTime.cpp", + "Arch/x86_64/DebugOutput.cpp", + "Arch/x86_64/Delay.cpp", + "Arch/x86_64/Firmware/ACPI/StaticParsing.cpp", + "Arch/x86_64/Firmware/MultiProcessor/Parser.cpp", + "Arch/x86_64/Firmware/PCBIOS/Mapper.cpp", + "Arch/x86_64/Firmware/PCBIOS/SysFSComponent.cpp", + "Arch/x86_64/Firmware/PCBIOS/SysFSDirectory.cpp", + "Arch/x86_64/Hypervisor/BochsDisplayConnector.cpp", + "Arch/x86_64/Hypervisor/VMWareBackdoor.cpp", + "Arch/x86_64/I8042Reboot.cpp", + "Arch/x86_64/ISABus/HID/VMWareMouseDevice.cpp", + "Arch/x86_64/ISABus/I8042Controller.cpp", + "Arch/x86_64/ISABus/IDEController.cpp", + "Arch/x86_64/ISABus/SerialDevice.cpp", + "Arch/x86_64/InterruptEntry.cpp", + "Arch/x86_64/InterruptManagement.cpp", + "Arch/x86_64/Interrupts.cpp", + "Arch/x86_64/Interrupts/APIC.cpp", + "Arch/x86_64/Interrupts/IOAPIC.cpp", + "Arch/x86_64/Interrupts/PIC.cpp", + "Arch/x86_64/PCI/Controller/HostBridge.cpp", + "Arch/x86_64/PCI/IDELegacyModeController.cpp", + "Arch/x86_64/PCI/Initializer.cpp", + "Arch/x86_64/PCI/MSI.cpp", + "Arch/x86_64/PCSpeaker.cpp", + "Arch/x86_64/PageDirectory.cpp", + "Arch/x86_64/PowerState.cpp", + "Arch/x86_64/Processor.cpp", + "Arch/x86_64/ProcessorInfo.cpp", + "Arch/x86_64/RTC.cpp", + "Arch/x86_64/SafeMem.cpp", + "Arch/x86_64/Shutdown.cpp", + "Arch/x86_64/SmapDisabler.cpp", + "Arch/x86_64/SyscallEntry.cpp", + "Arch/x86_64/Time/APICTimer.cpp", + "Arch/x86_64/Time/HPET.cpp", + "Arch/x86_64/Time/HPETComparator.cpp", + "Arch/x86_64/Time/PIT.cpp", + "Arch/x86_64/Time/RTC.cpp", + "Arch/x86_64/TrapFrame.cpp", + "Arch/x86_64/VGA/IOArbiter.cpp", + + # TODO: Share these with the aarch64 build + "Interrupts/SpuriousInterruptHandler.cpp", + "kprintf.cpp", + ] + } else { + assert(current_cpu == "aarch64", "") + deps = [ ":aarch64_no_mmu" ] + sources = [ + "Arch/Processor.cpp", + "Arch/aarch64/BootPPMParser.cpp", + "Arch/aarch64/CPUID.cpp", + "Arch/aarch64/CurrentTime.cpp", + "Arch/aarch64/Dummy.cpp", + "Arch/aarch64/Firmware/ACPI/StaticParsing.cpp", + "Arch/aarch64/InterruptManagement.cpp", + "Arch/aarch64/Interrupts.cpp", + "Arch/aarch64/MainIdRegister.cpp", + "Arch/aarch64/PageDirectory.cpp", + "Arch/aarch64/Panic.cpp", + "Arch/aarch64/PowerState.cpp", + "Arch/aarch64/Processor.cpp", + "Arch/aarch64/RPi/DebugOutput.cpp", + "Arch/aarch64/RPi/Framebuffer.cpp", + "Arch/aarch64/RPi/GPIO.cpp", + "Arch/aarch64/RPi/InterruptController.cpp", + "Arch/aarch64/RPi/Mailbox.cpp", + "Arch/aarch64/RPi/MiniUART.cpp", + "Arch/aarch64/RPi/SDHostController.cpp", + "Arch/aarch64/RPi/Timer.cpp", + "Arch/aarch64/RPi/UART.cpp", + "Arch/aarch64/RPi/Watchdog.cpp", + "Arch/aarch64/SafeMem.cpp", + "Arch/aarch64/SmapDisabler.cpp", + "Arch/aarch64/TrapFrame.cpp", + "Arch/aarch64/boot.S", + "Arch/aarch64/kprintf.cpp", + "Arch/aarch64/vector_table.S", + ] + } +} + +source_set("lib_sources") { + deps = [ + ":kernel_debug_gen", + "//Userland/Libraries/LibC:install_libc_headers", + "//Userland/Libraries/LibVT:generate_vt_state_machine(//Meta/gn/build/toolchain:serenity)", + ] + + configs += [ ":Kernel_config" ] + sources = [ + "//AK/DOSPackedTime.cpp", + "//AK/Error.cpp", + "//AK/Format.cpp", + "//AK/GenericLexer.cpp", + "//AK/Hex.cpp", + "//AK/MemoryStream.cpp", + "//AK/Stream.cpp", + "//AK/StringBuilder.cpp", + "//AK/StringUtils.cpp", + "//AK/StringView.cpp", + "//AK/Time.cpp", + "//AK/UUID.cpp", + "//Userland/Libraries/LibCrypto/Cipher/AES.cpp", + "//Userland/Libraries/LibCrypto/Hash/SHA2.cpp", + "//Userland/Libraries/LibEDID/DMT.cpp", + "//Userland/Libraries/LibEDID/EDID.cpp", + "//Userland/Libraries/LibEDID/VIC.cpp", + "//Userland/Libraries/LibELF/Image.cpp", + "//Userland/Libraries/LibELF/Validation.cpp", + "//Userland/Libraries/LibPartition/DiskPartitionMetadata.cpp", + "//Userland/Libraries/LibPartition/EBRPartitionTable.cpp", + "//Userland/Libraries/LibPartition/GUIDPartitionTable.cpp", + "//Userland/Libraries/LibPartition/MBRPartitionTable.cpp", + "//Userland/Libraries/LibPartition/PartitionTable.cpp", + "//Userland/Libraries/LibPartition/PartitionableDevice.cpp", + "//Userland/Libraries/LibVT/EscapeSequenceParser.cpp", + "//Userland/Libraries/LibVT/Line.cpp", + "//Userland/Libraries/LibVT/Terminal.cpp", + ] +} + +action("generate_version_header") { + script = "//Meta/gn/secondary/Kernel/generate_version_header.py" + outputs = [ "$target_gen_dir/Version.h" ] + args = [ rebase_path(outputs[0], root_build_dir) ] +} + +if (current_cpu == "x86_64") { + action("preprocess_linker_script") { + script = "//Meta/gn/secondary/Ladybird/invoke_process_with_args.py" + inputs = [ "Arch/x86_64/linker.ld" ] + outputs = [ "$target_gen_dir/linker.ld" ] + args = [ + "$serenity_cxx", + "-E", + "-P", + "-x", + "c", + rebase_path(inputs[0], root_build_dir), + "-o", + rebase_path(outputs[0], root_build_dir), + ] + } +} + +executable("Kernel_bin") { + configs += [ ":Kernel_config" ] + deps = [ + ":arch_sources", + ":generate_version_header", + ":kernel_debug_gen", + ":kernel_heap", + ":lib_sources", + ":mini_stdlib_sources", + "//Userland/Libraries/LibC:install_libc_headers", + ] + ldflags = [ "-static-pie" ] + if (serenity_arch == "x86_64") { + deps += [ ":preprocess_linker_script" ] + ldflags += + [ "-Wl,-T," + rebase_path("$target_gen_dir/linker.ld", root_build_dir) ] + } else { + assert(serenity_arch == "aarch64") + ldflags += + [ "-Wl,-T," + rebase_path("Arch/aarch64/linker.ld", root_build_dir) ] + } + sources = [ + "Arch/DeferredCallPool.cpp", + "Arch/PageFault.cpp", + "Arch/init.cpp", + "Boot/CommandLine.cpp", + "Bus/PCI/API.cpp", + "Bus/PCI/Access.cpp", + "Bus/PCI/Controller/HostController.cpp", + "Bus/PCI/Controller/MemoryBackedHostBridge.cpp", + "Bus/PCI/Controller/VolumeManagementDevice.cpp", + "Bus/PCI/Device.cpp", + "Bus/PCI/DeviceIdentifier.cpp", + "Bus/USB/UHCI/UHCIController.cpp", + "Bus/USB/UHCI/UHCIRootHub.cpp", + "Bus/USB/USBConfiguration.cpp", + "Bus/USB/USBController.cpp", + "Bus/USB/USBDevice.cpp", + "Bus/USB/USBHub.cpp", + "Bus/USB/USBManagement.cpp", + "Bus/USB/USBPipe.cpp", + "Bus/USB/USBTransfer.cpp", + "Bus/VirtIO/Console.cpp", + "Bus/VirtIO/ConsolePort.cpp", + "Bus/VirtIO/Device.cpp", + "Bus/VirtIO/Queue.cpp", + "Bus/VirtIO/RNG.cpp", + "Devices/AsyncDeviceRequest.cpp", + "Devices/Audio/AC97/AC97.cpp", + "Devices/Audio/Channel.cpp", + "Devices/Audio/IntelHDA/Codec.cpp", + "Devices/Audio/IntelHDA/Controller.cpp", + "Devices/Audio/IntelHDA/Format.cpp", + "Devices/Audio/IntelHDA/InterruptHandler.cpp", + "Devices/Audio/IntelHDA/Stream.cpp", + "Devices/Audio/Management.cpp", + "Devices/BlockDevice.cpp", + "Devices/CharacterDevice.cpp", + "Devices/Device.cpp", + "Devices/DeviceManagement.cpp", + "Devices/GPU/Bochs/GraphicsAdapter.cpp", + "Devices/GPU/Bochs/QEMUDisplayConnector.cpp", + "Devices/GPU/Console/BootFramebufferConsole.cpp", + "Devices/GPU/Console/ContiguousFramebufferConsole.cpp", + "Devices/GPU/Console/GenericFramebufferConsole.cpp", + "Devices/GPU/Console/VGATextModeConsole.cpp", + "Devices/GPU/DisplayConnector.cpp", + "Devices/GPU/Generic/DisplayConnector.cpp", + "Devices/GPU/Intel/Auxiliary/GMBusConnector.cpp", + "Devices/GPU/Intel/DisplayConnectorGroup.cpp", + "Devices/GPU/Intel/NativeDisplayConnector.cpp", + "Devices/GPU/Intel/NativeGraphicsAdapter.cpp", + "Devices/GPU/Intel/Plane/DisplayPlane.cpp", + "Devices/GPU/Intel/Plane/G33DisplayPlane.cpp", + "Devices/GPU/Intel/Transcoder/AnalogDisplayTranscoder.cpp", + "Devices/GPU/Intel/Transcoder/DisplayTranscoder.cpp", + "Devices/GPU/Intel/Transcoder/PLL.cpp", + "Devices/GPU/Management.cpp", + "Devices/GPU/VMWare/Console.cpp", + "Devices/GPU/VMWare/DisplayConnector.cpp", + "Devices/GPU/VMWare/GraphicsAdapter.cpp", + "Devices/GPU/VirtIO/Console.cpp", + "Devices/GPU/VirtIO/DisplayConnector.cpp", + "Devices/GPU/VirtIO/GPU3DDevice.cpp", + "Devices/GPU/VirtIO/GraphicsAdapter.cpp", + "Devices/Generic/ConsoleDevice.cpp", + "Devices/Generic/DeviceControlDevice.cpp", + "Devices/Generic/FullDevice.cpp", + "Devices/Generic/MemoryDevice.cpp", + "Devices/Generic/NullDevice.cpp", + "Devices/Generic/RandomDevice.cpp", + "Devices/Generic/SelfTTYDevice.cpp", + "Devices/Generic/ZeroDevice.cpp", + "Devices/HID/KeyboardDevice.cpp", + "Devices/HID/Management.cpp", + "Devices/HID/MouseDevice.cpp", + "Devices/HID/PS2/KeyboardDevice.cpp", + "Devices/HID/PS2/MouseDevice.cpp", + "Devices/KCOVDevice.cpp", + "Devices/KCOVInstance.cpp", + "Devices/PCISerialDevice.cpp", + "Devices/SerialDevice.cpp", + "Devices/Storage/ATA/AHCI/Controller.cpp", + "Devices/Storage/ATA/AHCI/InterruptHandler.cpp", + "Devices/Storage/ATA/AHCI/Port.cpp", + "Devices/Storage/ATA/ATAController.cpp", + "Devices/Storage/ATA/ATADevice.cpp", + "Devices/Storage/ATA/ATADiskDevice.cpp", + "Devices/Storage/ATA/ATAPort.cpp", + "Devices/Storage/ATA/GenericIDE/Channel.cpp", + "Devices/Storage/ATA/GenericIDE/Controller.cpp", + "Devices/Storage/DiskPartition.cpp", + "Devices/Storage/NVMe/NVMeController.cpp", + "Devices/Storage/NVMe/NVMeInterruptQueue.cpp", + "Devices/Storage/NVMe/NVMeNameSpace.cpp", + "Devices/Storage/NVMe/NVMePollQueue.cpp", + "Devices/Storage/NVMe/NVMeQueue.cpp", + "Devices/Storage/SD/PCISDHostController.cpp", + "Devices/Storage/SD/SDHostController.cpp", + "Devices/Storage/SD/SDMemoryCard.cpp", + "Devices/Storage/StorageController.cpp", + "Devices/Storage/StorageDevice.cpp", + "Devices/Storage/StorageManagement.cpp", + "FileSystem/AnonymousFile.cpp", + "FileSystem/BlockBasedFileSystem.cpp", + "FileSystem/Custody.cpp", + "FileSystem/DevPtsFS/FileSystem.cpp", + "FileSystem/DevPtsFS/Inode.cpp", + "FileSystem/Ext2FS/FileSystem.cpp", + "FileSystem/Ext2FS/Inode.cpp", + "FileSystem/FATFS/FileSystem.cpp", + "FileSystem/FATFS/Inode.cpp", + "FileSystem/FIFO.cpp", + "FileSystem/File.cpp", + "FileSystem/FileBackedFileSystem.cpp", + "FileSystem/FileSystem.cpp", + "FileSystem/ISO9660FS/DirectoryIterator.cpp", + "FileSystem/ISO9660FS/FileSystem.cpp", + "FileSystem/ISO9660FS/Inode.cpp", + "FileSystem/Inode.cpp", + "FileSystem/InodeFile.cpp", + "FileSystem/InodeMetadata.cpp", + "FileSystem/InodeWatcher.cpp", + "FileSystem/Mount.cpp", + "FileSystem/MountFile.cpp", + "FileSystem/OpenFileDescription.cpp", + "FileSystem/Plan9FS/FileSystem.cpp", + "FileSystem/Plan9FS/Inode.cpp", + "FileSystem/Plan9FS/Message.cpp", + "FileSystem/ProcFS/FileSystem.cpp", + "FileSystem/ProcFS/Inode.cpp", + "FileSystem/ProcFS/ProcessExposed.cpp", + "FileSystem/RAMFS/FileSystem.cpp", + "FileSystem/RAMFS/Inode.cpp", + "FileSystem/SysFS/Component.cpp", + "FileSystem/SysFS/DirectoryInode.cpp", + "FileSystem/SysFS/FileSystem.cpp", + "FileSystem/SysFS/Inode.cpp", + "FileSystem/SysFS/LinkInode.cpp", + "FileSystem/SysFS/Registry.cpp", + "FileSystem/SysFS/RootDirectory.cpp", + "FileSystem/SysFS/Subsystems/Bus/Directory.cpp", + "FileSystem/SysFS/Subsystems/Bus/PCI/BusDirectory.cpp", + "FileSystem/SysFS/Subsystems/Bus/PCI/DeviceAttribute.cpp", + "FileSystem/SysFS/Subsystems/Bus/PCI/DeviceDirectory.cpp", + "FileSystem/SysFS/Subsystems/Bus/PCI/DeviceExpansionROM.cpp", + "FileSystem/SysFS/Subsystems/Bus/USB/BusDirectory.cpp", + "FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.cpp", + "FileSystem/SysFS/Subsystems/DeviceIdentifiers/BlockDevicesDirectory.cpp", + "FileSystem/SysFS/Subsystems/DeviceIdentifiers/CharacterDevicesDirectory.cpp", + "FileSystem/SysFS/Subsystems/DeviceIdentifiers/DeviceComponent.cpp", + "FileSystem/SysFS/Subsystems/DeviceIdentifiers/Directory.cpp", + "FileSystem/SysFS/Subsystems/DeviceIdentifiers/SymbolicLinkDeviceComponent.cpp", + "FileSystem/SysFS/Subsystems/Devices/Directory.cpp", + "FileSystem/SysFS/Subsystems/Devices/Graphics/Directory.cpp", + "FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/DeviceAttribute.cpp", + "FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/DeviceDirectory.cpp", + "FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/Directory.cpp", + "FileSystem/SysFS/Subsystems/Devices/Storage/DeviceAttribute.cpp", + "FileSystem/SysFS/Subsystems/Devices/Storage/DeviceDirectory.cpp", + "FileSystem/SysFS/Subsystems/Devices/Storage/Directory.cpp", + "FileSystem/SysFS/Subsystems/Firmware/Directory.cpp", + "FileSystem/SysFS/Subsystems/Kernel/CPUInfo.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Directory.cpp", + "FileSystem/SysFS/Subsystems/Kernel/DiskUsage.cpp", + "FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Interrupts.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Jails.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Keymap.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Log.cpp", + "FileSystem/SysFS/Subsystems/Kernel/MemoryStatus.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Network/ARP.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Network/Adapters.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Network/Directory.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Network/Local.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Network/Route.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Network/TCP.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Network/UDP.cpp", + "FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Processes.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Profile.cpp", + "FileSystem/SysFS/Subsystems/Kernel/SystemStatistics.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Uptime.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Variables/BooleanVariable.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Variables/CapsLockRemap.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Variables/CoredumpDirectory.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Variables/Directory.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Variables/DumpKmallocStack.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Variables/StringVariable.cpp", + "FileSystem/SysFS/Subsystems/Kernel/Variables/UBSANDeadly.cpp", + "FileSystem/VirtualFileSystem.cpp", + "Firmware/ACPI/Initialize.cpp", + "Firmware/ACPI/Parser.cpp", + "Firmware/ACPI/StaticParsing.cpp", + "Interrupts/GenericInterruptHandler.cpp", + "Interrupts/IRQHandler.cpp", + "Interrupts/PCIIRQHandler.cpp", + "Interrupts/SharedIRQHandler.cpp", + "Interrupts/UnhandledInterruptHandler.cpp", + "KSyms.cpp", + "Library/DoubleBuffer.cpp", + "Library/IOWindow.cpp", + "Library/KBufferBuilder.cpp", + "Library/KLexicalPath.cpp", + "Library/KString.cpp", + "Library/Panic.cpp", + "Library/ScopedCritical.cpp", + "Library/StdLib.cpp", + "Library/UserOrKernelBuffer.cpp", + "Locking/LockRank.cpp", + "Locking/Mutex.cpp", + "Memory/AddressSpace.cpp", + "Memory/AnonymousVMObject.cpp", + "Memory/InodeVMObject.cpp", + "Memory/MemoryManager.cpp", + "Memory/PhysicalPage.cpp", + "Memory/PhysicalRegion.cpp", + "Memory/PhysicalZone.cpp", + "Memory/PrivateInodeVMObject.cpp", + "Memory/Region.cpp", + "Memory/RegionTree.cpp", + "Memory/RingBuffer.cpp", + "Memory/ScatterGatherList.cpp", + "Memory/ScopedAddressSpaceSwitcher.cpp", + "Memory/SharedFramebufferVMObject.cpp", + "Memory/SharedInodeVMObject.cpp", + "Memory/VMObject.cpp", + "Memory/VirtualRange.cpp", + "Net/IPv4Socket.cpp", + "Net/Intel/E1000ENetworkAdapter.cpp", + "Net/Intel/E1000NetworkAdapter.cpp", + "Net/LocalSocket.cpp", + "Net/LoopbackAdapter.cpp", + "Net/NetworkAdapter.cpp", + "Net/NetworkTask.cpp", + "Net/NetworkingManagement.cpp", + "Net/Realtek/RTL8168NetworkAdapter.cpp", + "Net/Routing.cpp", + "Net/Socket.cpp", + "Net/TCPSocket.cpp", + "Net/UDPSocket.cpp", + "Net/VirtIO/VirtIONetworkAdapter.cpp", + "SanCov.cpp", + "Security/AddressSanitizer.cpp", + "Security/Credentials.cpp", + "Security/Jail.cpp", + "Security/Random.cpp", + "Security/UBSanitizer.cpp", + "Syscalls/SyscallHandler.cpp", + "Syscalls/alarm.cpp", + "Syscalls/anon_create.cpp", + "Syscalls/beep.cpp", + "Syscalls/chdir.cpp", + "Syscalls/chmod.cpp", + "Syscalls/chown.cpp", + "Syscalls/clock.cpp", + "Syscalls/debug.cpp", + "Syscalls/disown.cpp", + "Syscalls/dup2.cpp", + "Syscalls/emuctl.cpp", + "Syscalls/execve.cpp", + "Syscalls/exit.cpp", + "Syscalls/faccessat.cpp", + "Syscalls/fallocate.cpp", + "Syscalls/fcntl.cpp", + "Syscalls/fork.cpp", + "Syscalls/fsync.cpp", + "Syscalls/ftruncate.cpp", + "Syscalls/futex.cpp", + "Syscalls/get_dir_entries.cpp", + "Syscalls/get_stack_bounds.cpp", + "Syscalls/getrandom.cpp", + "Syscalls/getuid.cpp", + "Syscalls/hostname.cpp", + "Syscalls/inode_watcher.cpp", + "Syscalls/ioctl.cpp", + "Syscalls/jail.cpp", + "Syscalls/keymap.cpp", + "Syscalls/kill.cpp", + "Syscalls/link.cpp", + "Syscalls/lseek.cpp", + "Syscalls/mkdir.cpp", + "Syscalls/mknod.cpp", + "Syscalls/mmap.cpp", + "Syscalls/mount.cpp", + "Syscalls/open.cpp", + "Syscalls/perf_event.cpp", + "Syscalls/pipe.cpp", + "Syscalls/pledge.cpp", + "Syscalls/poll.cpp", + "Syscalls/prctl.cpp", + "Syscalls/process.cpp", + "Syscalls/profiling.cpp", + "Syscalls/ptrace.cpp", + "Syscalls/purge.cpp", + "Syscalls/read.cpp", + "Syscalls/readlink.cpp", + "Syscalls/realpath.cpp", + "Syscalls/rename.cpp", + "Syscalls/resource.cpp", + "Syscalls/rmdir.cpp", + "Syscalls/sched.cpp", + "Syscalls/sendfd.cpp", + "Syscalls/setpgid.cpp", + "Syscalls/setuid.cpp", + "Syscalls/sigaction.cpp", + "Syscalls/socket.cpp", + "Syscalls/stat.cpp", + "Syscalls/statvfs.cpp", + "Syscalls/sync.cpp", + "Syscalls/sysconf.cpp", + "Syscalls/thread.cpp", + "Syscalls/times.cpp", + "Syscalls/umask.cpp", + "Syscalls/uname.cpp", + "Syscalls/unlink.cpp", + "Syscalls/unveil.cpp", + "Syscalls/utime.cpp", + "Syscalls/utimensat.cpp", + "Syscalls/waitid.cpp", + "Syscalls/write.cpp", + "TTY/ConsoleManagement.cpp", + "TTY/MasterPTY.cpp", + "TTY/PTYMultiplexer.cpp", + "TTY/SlavePTY.cpp", + "TTY/TTY.cpp", + "TTY/VirtualConsole.cpp", + "Tasks/Coredump.cpp", + "Tasks/CrashHandler.cpp", + "Tasks/FinalizerTask.cpp", + "Tasks/FutexQueue.cpp", + "Tasks/PerformanceEventBuffer.cpp", + "Tasks/PowerStateSwitchTask.cpp", + "Tasks/Process.cpp", + "Tasks/ProcessGroup.cpp", + "Tasks/ProcessList.cpp", + "Tasks/Scheduler.cpp", + "Tasks/SyncTask.cpp", + "Tasks/Thread.cpp", + "Tasks/ThreadBlockers.cpp", + "Tasks/ThreadTracer.cpp", + "Tasks/WaitQueue.cpp", + "Tasks/WorkQueue.cpp", + "Time/TimeManagement.cpp", + "Time/TimerQueue.cpp", + ] + sources += get_target_outputs(":generate_version_header") +} + +action("postprocess_kernel") { + script = "//Meta/gn/secondary/Kernel/post_process_kernel.py" + deps = [ ":Kernel_bin" ] + inputs = [ "$target_out_dir/Kernel_bin" ] + outputs = [ + "$target_out_dir/Kernel", + "$target_out_dir/Kernel.debug", + "$target_out_dir/kernel.map", + ] + args = [ + "--nm", + serenity_nm, + "--objcopy", + serenity_objcopy, + rebase_path(inputs[0], root_build_dir), + ] +} + +group("install_kernel") { + deps = [ + ":install_kernel_binaries", + ":install_kernel_data", + ] + if (serenity_arch == "x86_64") { + deps += [ "Prekernel:install_prekernel" ] + } +} + +copy("install_kernel_binaries") { + deps = [ ":postprocess_kernel" ] + sources = [ + "$target_out_dir/Kernel", + "$target_out_dir/Kernel.debug", + ] + outputs = [ "$sysroot/boot/{{source_file_part}}" ] +} + +copy("install_kernel_data") { + deps = [ ":postprocess_kernel" ] + sources = [ "$target_out_dir/kernel.map" ] + outputs = [ "$sysroot/res/{{source_file_part}}" ] +} diff --git a/Meta/gn/secondary/Kernel/Prekernel/BUILD.gn b/Meta/gn/secondary/Kernel/Prekernel/BUILD.gn new file mode 100644 index 00000000000..b57e5a113e8 --- /dev/null +++ b/Meta/gn/secondary/Kernel/Prekernel/BUILD.gn @@ -0,0 +1,51 @@ +import("//Meta/gn/build/serenity_target.gni") +import("//Meta/gn/build/sysroot.gni") + +assert(current_os == "serenity") +assert(current_cpu == "x86_64") + +group("Prekernel") { + deps = [ ":install_prekernel" ] +} + +executable("Prekernel_bin") { + configs += [ "//Kernel:Kernel_config" ] + deps = [ "//Userland/Libraries/LibC:install_libc_headers" ] + cflags = [ + "-fno-pic", + "-fno-pie", + ] + ldflags = [ + "-static", + "-fno-pie", + "-Wl,-T" + rebase_path("linker.ld", root_build_dir), + ] + sources = [ + "//Kernel//Library/MiniStdLib.cpp", + "//Userland/Libraries/LibELF/Relocation.cpp", + "UBSanitizer.cpp", + "boot.S", + "init.cpp", + "multiboot.S", + ] +} + +action("postprocess_prekernel") { + script = "//Meta/gn/secondary/Ladybird/invoke_process_with_args.py" + inputs = [ "$target_out_dir/Prekernel_bin" ] + outputs = [ "$target_gen_dir/Prekernel" ] + deps = [ ":Prekernel_bin" ] + args = [ + "$serenity_objcopy", + "-O", + "elf32-i386", + rebase_path(inputs[0], root_build_dir), + rebase_path(outputs[0], root_build_dir), + ] +} + +copy("install_prekernel") { + deps = [ ":postprocess_prekernel" ] + sources = [ "$target_gen_dir/Prekernel" ] + outputs = [ "$sysroot/boot/{{source_file_part}}" ] +} diff --git a/Meta/gn/secondary/Kernel/generate_version_header.py b/Meta/gn/secondary/Kernel/generate_version_header.py new file mode 100755 index 00000000000..a7ff40f23a8 --- /dev/null +++ b/Meta/gn/secondary/Kernel/generate_version_header.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import subprocess +import sys + +short_hash = subprocess.check_output(['git', 'rev-parse', '--short=8', 'HEAD']).decode().strip() +if subprocess.check_output(['git', 'status', '--porcelain=v2']) and short_hash: + short_hash += "-modified" + +if not short_hash: + short_hash = "unknown" + +with open(sys.argv[1], 'w') as f: + f.write(fr'''/* + * Automatically generated by Kernel/generate_version_header.py + */ + +#pragma once +#include + +namespace Kernel {{ + +constexpr unsigned SERENITY_MAJOR_REVISION = 1; +constexpr unsigned SERENITY_MINOR_REVISION = 0; +constexpr StringView SERENITY_VERSION = "{short_hash}"sv; + +}} +''') diff --git a/Meta/gn/secondary/Kernel/post_process_kernel.py b/Meta/gn/secondary/Kernel/post_process_kernel.py new file mode 100644 index 00000000000..26eae91aa17 --- /dev/null +++ b/Meta/gn/secondary/Kernel/post_process_kernel.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 + +import argparse +import shutil +import subprocess +import sys +from functools import cmp_to_key +from pathlib import Path + + +def main(): + parser = argparse.ArgumentParser( + epilog=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument('kernel', help='kernel binary location') + parser.add_argument('-n', '--nm', required=True, help='path to nm') + parser.add_argument('-o', '--objcopy', required=True, help='path to objcopy') + args = parser.parse_args() + + kernel_path = Path(args.kernel) + binary_directory = kernel_path.parent + + # Write out kernel.map, which contains kernel symbols and their addresses + symbols = subprocess.check_output([args.nm, '-C', '-n', str(kernel_path)]) + if not symbols: + print(f"Unable to dump symbols from {kernel_path}", file=sys.stderr) + return 1 + + def filter_symbol(s): + return s and not (".Lubsan_data" in s or s.split()[1] == "a") + + symbols = filter(filter_symbol, symbols.decode().split('\n')) + symbols = list(set(symbols)) + + def sort_symbols(s1, s2): + return int(s1.split()[0], base=16) - int(s2.split()[0], base=16) + symbols = sorted(symbols, key=cmp_to_key(sort_symbols)) + + kernel_map = binary_directory / "kernel.map" + with open(kernel_map, 'w') as out: + out.write(f'{len(symbols):#x}\n') + out.write('\n'.join(symbols)) + out.write('\0') + + kernel_final = binary_directory / "Kernel" + + shutil.copyfile(kernel_path, kernel_final) + + kernel_final = str(kernel_final) + + subprocess.check_call([args.objcopy, "--update-section", f".ksyms={kernel_map}", kernel_final]) + subprocess.check_call([args.objcopy, "--only-keep-debug", kernel_final, kernel_final + ".debug"]) + subprocess.check_call([args.objcopy, "--strip-debug", kernel_final]) + subprocess.check_call([args.objcopy, f"--add-gnu-debuglink={kernel_final}.debug", kernel_final]) + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/Meta/gn/secondary/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/BUILD.gn b/Meta/gn/secondary/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/BUILD.gn new file mode 100644 index 00000000000..2d7ef9430ca --- /dev/null +++ b/Meta/gn/secondary/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/BUILD.gn @@ -0,0 +1,6 @@ +import("//Meta/Lagom/Tools/lagom_tool.gni") + +lagom_tool("StateMachineGenerator") { + sources = [ "main.cpp" ] + deps = [ "//Userland/Libraries/LibMain" ] +} diff --git a/Meta/gn/secondary/Userland/Libraries/LibC/BUILD.gn b/Meta/gn/secondary/Userland/Libraries/LibC/BUILD.gn new file mode 100644 index 00000000000..7f2e47f460e --- /dev/null +++ b/Meta/gn/secondary/Userland/Libraries/LibC/BUILD.gn @@ -0,0 +1,21 @@ +import("//Meta/gn/build/sysroot.gni") +import("libc_headers.gni") + +copy("install_libelf_sysroot_headers") { + sources = [ "../LibELF/ELFABI.h" ] + outputs = [ "$sysroot/usr/include/LibELF/{{source_file_part}}" ] +} + +copy("install_libregex_sysroot_headers") { + sources = [ "../LibRegex/RegexDefs.h" ] + outputs = [ "$sysroot/usr/include/LibRegex/{{source_file_part}}" ] +} + +copy("install_libc_headers") { + deps = [ + ":install_libelf_sysroot_headers", + ":install_libregex_sysroot_headers", + ] + sources = libc_headers + outputs = [ "$sysroot/usr/include/{{source_target_relative}}" ] +} diff --git a/Meta/gn/secondary/Userland/Libraries/LibC/libc_headers.gni b/Meta/gn/secondary/Userland/Libraries/LibC/libc_headers.gni new file mode 100644 index 00000000000..655ec51ac65 --- /dev/null +++ b/Meta/gn/secondary/Userland/Libraries/LibC/libc_headers.gni @@ -0,0 +1,118 @@ +libc_headers = [ + "time.h", + "semaphore.h", + "pwd.h", + "utime.h", + "termcap.h", + "pty.h", + "inttypes.h", + "resolv.h", + "stdlib.h", + "ulimit.h", + "net/route.h", + "net/if_arp.h", + "net/if.h", + "float.h", + "locale.h", + "langinfo.h", + "limits.h", + "fd_set.h", + "endian.h", + "unistd.h", + "wctype.h", + "fcntl.h", + "signal.h", + "dirent.h", + "stdio_ext.h", + "spawn.h", + "regex.h", + "arpa/inet.h", + "syslog.h", + "netinet/tcp.h", + "netinet/ip_icmp.h", + "netinet/if_ether.h", + "netinet/in.h", + "netinet/ip.h", + "netinet/in_systm.h", + "libgen.h", + "setjmp.h", + "elf.h", + "getopt.h", + "dlfcn.h", + "strings.h", + "fnmatch.h", + "errno_codes.h", + "serenity.h", + "byteswap.h", + "alloca.h", + "sys/time.h", + "sys/ioctl.h", + "sys/statvfs.h", + "sys/uio.h", + "sys/types.h", + "sys/times.h", + "sys/wait.h", + "sys/file.h", + "sys/stat.h", + "sys/internals.h", + "sys/mman.h", + "sys/un.h", + "sys/utsname.h", + "sys/auxv.h", + "sys/sysmacros.h", + "sys/param.h", + "sys/prctl.h", + "sys/ptrace.h", + "sys/arch/regs.h", + "sys/arch/aarch64/regs.h", + "sys/arch/x86_64/regs.h", + "sys/ttydefaults.h", + "sys/resource.h", + "sys/cdefs.h", + "sys/poll.h", + "sys/socket.h", + "sys/select.h", + "utmp.h", + "bits/stdio_file_implementation.h", + "bits/wchar_size.h", + "bits/pthread_cancel.h", + "bits/sighow.h", + "bits/FILE.h", + "bits/posix1_lim.h", + "bits/pthread_integration.h", + "bits/wchar.h", + "bits/mutex_locker.h", + "bits/utimens.h", + "bits/dlfcn_integration.h", + "bits/search.h", + "bits/stdint.h", + "fenv.h", + "grp.h", + "mallocdefs.h", + "ctype.h", + "nl_types.h", + "paths.h", + "wchar.h", + "mntent.h", + "sched.h", + "shadow.h", + "netdb.h", + "pthread.h", + "math.h", + "memory.h", + "errno.h", + "termios.h", + "poll.h", + "stdio.h", + "stdarg.h", + "link.h", + "search.h", + "assert.h", + "glob.h", + "ifaddrs.h", + "stdint.h", + "complex.h", + "ucontext.h", + "sysexits.h", + "string.h", +] diff --git a/Meta/gn/secondary/Userland/Libraries/LibVT/BUILD.gn b/Meta/gn/secondary/Userland/Libraries/LibVT/BUILD.gn new file mode 100644 index 00000000000..f6944db739f --- /dev/null +++ b/Meta/gn/secondary/Userland/Libraries/LibVT/BUILD.gn @@ -0,0 +1,12 @@ +import("//Meta/gn/build/compiled_action.gni") + +compiled_action("generate_vt_state_machine") { + tool = "//Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator" + inputs = [ "StateMachine.txt" ] + outputs = [ "$root_gen_dir/LibVT/EscapeSequenceStateMachine.h" ] + args = [ + "-o", + rebase_path(outputs[0], root_build_dir), + rebase_path(inputs[0], root_build_dir), + ] +}