Ventoy installable - #196
Draft
y4my4my4m wants to merge 31 commits into
Draft
Conversation
This commit introduces a comprehensive USB stack, including support for USB mass storage devices and Human Interface Devices (HID) such as keyboards and mice. Key changes include: - New files for USB core functionality, xHCI host controller, and device enumeration. - Implementation of bulk-only transport for mass storage devices. - Integration of HID protocols for keyboard and mouse input. - Updates to existing block device handling to accommodate USB devices. This enhancement significantly expands the system's capabilities for handling USB peripherals.
This update modifies the USB stack to replace the function pointer auto_cb with an integer auto_kind for handling HID report callbacks. Changes include: - Updated endpoint descriptor structure to use auto_kind for specifying report handler types (USB_AUTO_NONE, USB_AUTO_KBD, USB_AUTO_MOUSE). - Adjusted relevant functions to accommodate this change, enhancing clarity and maintainability of the code. This refactor streamlines the dispatching of report handlers in the USB HID implementation.
This update modifies the CUsbEP class to store a pointer to CXhciRing instead of embedding it directly. This change addresses limitations in the ZealC JIT class parser regarding nested class structures. Additionally, new initialization functions for endpoint rings have been introduced, ensuring proper memory allocation and initialization on first use. The code has been updated accordingly to reflect these changes, enhancing the overall structure and maintainability of the USB endpoint handling.
This update modifies the USB device structure and related functions to replace the eps array with ep_list for managing USB endpoints. Changes include updating references in the parsing, attachment, and configuration functions to ensure consistency and improve code clarity. This refactor enhances maintainability and aligns with recent structural changes in the USB stack.
This commit enhances the USB stack by integrating USB boot functionality and mass storage support. Key changes include: - Inclusion of USB boot initialization and fallback mechanisms. - Implementation of USB mass storage device handling with SCSI commands. - Updates to the block device management to accommodate USB drives. - Refactoring of existing USB endpoint management to improve clarity and maintainability. These enhancements significantly expand the system's capabilities for handling USB peripherals and booting from USB media.
…e functions This commit introduces runtime-dispatched functions for raw block read and write operations, allowing compatibility with both USB-capable and pre-USB bootstrap kernels. Key changes include: - Added `DiskPartRawWrite` and `BootMHDRawRead` functions to facilitate whole-device operations. - Updated existing code to utilize these new functions for improved maintainability and clarity. - Enhanced USB and boot loader integration by ensuring proper handling of raw block operations. These modifications streamline the block device management process and improve the overall robustness of the system.
This commit updates the raw block read and write functions across multiple components to utilize a unified runtime dispatch mechanism. Key changes include: - Replaced direct function pointer retrieval with a more flexible approach using `CHash` to accommodate both public kernel functions and JIT-local functions. - Enhanced compatibility with USB-capable and pre-USB bootstrap kernels by ensuring proper resolution of function addresses at runtime. These modifications improve the maintainability and robustness of block device operations in the system.
This commit introduces a new markdown file, `usb-boot-guide.md`, providing detailed instructions for creating a bootable USB disk using QEMU. Key steps include: - Creating a disk image and partitioning it. - Formatting the partition with FAT32. - Using QEMU to boot from the USB image. - Copying necessary files and configuring the boot process. This guide enhances user accessibility for booting from USB media and complements recent USB support enhancements in the system.
This commit introduces a new markdown file, `ventoy-ram-iso-guide.md`, detailing the process for building a self-contained ZealOS RAM-distro ISO using Ventoy, Limine, or PXE. Key steps include: - Cloning the repository and checking out the appropriate branch. - Building base ISOs and creating a ZealOS VM. - Syncing source code into the VM and recompiling the kernel. - Packaging the RAM ISO and testing it in QEMU. Additionally, boot progress markers have been added to the kernel startup sequence to improve debugging visibility during the boot process. These enhancements improve user guidance for creating bootable RAM ISOs and facilitate better debugging during kernel initialization.
This commit modifies the RAM-distro build process in the `ventoy-ram-iso-guide.md` to reflect changes in output file names and steps. The section titles have been updated for clarity, and the output now specifies `RAMDistro.BIN` as the OS image, alongside the normal kernel. Additionally, the kernel has been updated to handle the RAM-distro image, with new variables introduced for its base address and size. The `MakeRAMDistro` function has been refactored to streamline the image creation process, ensuring the entire OS is copied to a RAM drive and properly snapshot as a single file. These changes enhance the usability and accuracy of the RAM-distro ISO creation process.
… and functionality This commit modifies the `ventoy-ram-iso-guide.md` to clarify the requirements for the CD and disk to be on the same AHCI controller, ensuring proper detection during installation. Additionally, it updates the QEMU command for disk configuration to use `if=ide` for better compatibility. In `DiskAddDev.ZC`, the error handling for the mount code is enhanced to prevent panic during boot if hardware is missing. The try/catch structure is refined to ensure a clean lexical scope while providing informative error messages. These changes improve the robustness and user experience during the boot process.
…sanity check This commit modifies the `MakeRAMDistro` function to change the default image size from 48MB to 96MB, ensuring it exceeds the entire OS tree to prevent file skipping during the copy process. Additionally, a sanity check is introduced to alert users if files are missing due to insufficient RAM drive size, improving the reliability of the RAM-distro image creation.
This commit updates the `BlkPoolsInit` function to improve memory allocation for the code heap, accommodating scenarios where the RAM-distro image module is placed within the code heap range. It introduces logic to split the code heap into two chunks around the RAM-distro image, preventing potential clobbering of the image during allocation. This change ensures more reliable memory management and enhances the overall stability of the system.
This commit introduces the `LapicTimerInit` function to replace the legacy 8254 PIT with the LAPIC timer for system heartbeat management. It includes logic to calibrate the LAPIC timer against the TSC and sets up periodic interrupts. Additionally, diagnostic checks are added in `KMain` to verify the functionality of the timer, ensuring that the system does not hang due to a non-functional timer. This change enhances the reliability of timekeeping in the kernel, particularly on modern UEFI hardware.
This commit introduces two new scripts: `build-ram-iso.sh` for creating a self-contained RAM-distro ISO from a specified OS image and kernel, and `extract-kernel.sh` for robustly extracting the kernel and optionally the RAM-distro image from a ZealOS virtual disk. The `build-ram-iso.sh` script automates the packaging process, ensuring compatibility with various boot methods, while `extract-kernel.sh` provides a reliable way to retrieve necessary files from the VM's disk image. These additions enhance the usability and functionality of the build process for ZealOS.
…back logic This commit enhances the `LapicTimerInit` function by introducing a new `PitCh2Read` function to accurately latch and read the 8254 channel-2 counter for LAPIC timer calibration. The calibration process is refined to ensure reliable timing even when the PIT is clock-gated, with a fallback mechanism to derive TSC frequency from CPUID if necessary. Additionally, the initialization count is clamped to a safe default to prevent excessive CPU load from erroneous measurements. These changes improve the accuracy and reliability of the LAPIC timer in the kernel.
This commit updates the `XhciInit` function to iterate through all available xHCI controllers, allowing the system to find and initialize the first usable controller. It improves error handling and logging for cases where controllers are unassigned or have unsupported memory configurations. These changes enhance the robustness of USB controller detection and initialization in the kernel.
This commit introduces improvements to the `XhciInit` function, including enhanced logging for controller scanning and better handling of 64-bit BARs in UEFI. A new `XhciMmioMap` function is added to manage memory mapping for xHCI controllers located above 4GB, ensuring proper access to their registers. Additionally, the `UsbRep` function is updated to include a re-probing mechanism for xHCI controllers, improving the robustness of USB device detection in the kernel.
This commit updates the build marker in the `UsbRep` function to reflect a new version and modifies the `XhciInit` function to include an optional starting index for scanning xHCI controllers. This change improves the logging output, making it clearer which controller index is being scanned, and enhances the flexibility of the initialization process for systems with multiple xHCI controllers.
This commit introduces the `XhciSwitch` function to allow dynamic switching between multiple xHCI controllers, improving support for systems with multiple USB interfaces. Additionally, the `UsbRep` function is updated to include enhanced logging for port scanning, and the `XhciInit` function is modified to power root ports during initialization, ensuring devices are correctly recognized. These changes enhance the flexibility and robustness of USB device management in the kernel.
This commit updates the `XhciInit` function to include an optional parameter for forcing initialization of any xHCI controller, improving flexibility in systems with multiple controllers. Additionally, the `XhciSwitch` function is refined to better handle controller switching, and the `UsbRep` function is updated to include a kernel extraction script reference in the documentation. These changes enhance the robustness and usability of USB device management in the kernel.
This commit introduces the CDC-ECM (Ethernet Networking Control Model) class driver, enabling USB Ethernet NICs to operate within the kernel. It includes functionality for frame transmission and reception over bulk endpoints, along with MAC address parsing. Additionally, a USB hub class driver is added to manage devices connected to downstream ports, enhancing support for multi-tier USB configurations. The USB subsystem is updated to accommodate these new features, improving overall device management and connectivity.
This commit introduces a new structure for managing multiple xHCI controllers, allowing the system to handle up to four controllers simultaneously. The `usb_xhci` variable is replaced with an array of `CXhciGlobals`, and related functions are updated to reference the active controller correctly. Additionally, logging improvements are made to enhance visibility during USB device enumeration and hub attachment processes. These changes enhance the flexibility and robustness of USB device management in the kernel.
…ficiency This commit refines the USB CDC-ECM driver by simplifying comments and enhancing code clarity. It updates the documentation to better reflect the functionality of the driver, including the handling of Ethernet frames and the interaction with the net stack. Additionally, improvements are made to the USB hub and xHCI controller management, ensuring better integration and performance across multiple controllers. These changes enhance the maintainability and readability of the USB subsystem.
This commit introduces a transmit queue for the USB CDC-ECM driver, allowing for non-blocking frame transmission from interrupt context. The `UsbEcmSend` function is updated to queue frames for transmission, while the new `UsbEcmTick` function processes the transmit queue, ensuring efficient handling of outgoing data. Additionally, the maximum frame size is increased to accommodate larger Ethernet frames, and the driver structure is refined for better clarity and maintainability.
This commit introduces the `InstallTargetSelect` function, which allows users to select between ATA and USB drives for installation. The function handles user input for drive selection, validates the chosen drive, and manages the installation partition letter. Additionally, the `OSUpgrade` and `RegularInstallWiz` functions are refactored to utilize this new selection mechanism, streamlining the installation process and improving user experience. The changes enhance the clarity and maintainability of the installation code.
This commit updates the `MakeRAMDistro` function to include the copying of the Boot directory, ensuring that the necessary boot files are present in the RAM image. Additionally, a new `InstallNeedsMBR` function is introduced to determine if a Master Boot Record (MBR) is required for non-UEFI installations, improving the installation process for various target drives. The changes enhance the reliability of the RAM distribution and installation mechanisms, ensuring a smoother user experience.
This commit modifies the FAT32 formatting logic to include USB drives alongside ATA drives. The changes ensure that the `Format` function correctly processes both drive types, enhancing compatibility and functionality for disk formatting operations. Comments are added for clarity regarding the handling of different drive types, improving code maintainability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.