Skip to content

Auto-generate linux drivers with alternative kernel interfaces#414

Merged
jjts merged 12 commits intoIObundle:mainfrom
arturum1:alternative_kernel_interfaces
Dec 10, 2025
Merged

Auto-generate linux drivers with alternative kernel interfaces#414
jjts merged 12 commits intoIObundle:mainfrom
arturum1:alternative_kernel_interfaces

Conversation

@arturum1
Copy link
Contributor

@arturum1 arturum1 commented Dec 9, 2025

This is a dependency of PR IObundle/soc-linux#6

  • Add missing verilog sources for quartus modules.

  • Update iob_linux_device_drivers software module.
    The new version auto-generates the peripheral's Linux kernel module with support for three alternative interfaces: /dev, sysfs, and ioctl.
    It also generates the corresponding user-space sources for each of those interfaces.

    To test this new module, setup the iob_timer core and list the generated sources with:

    make sim-run CORE=iob_timer
    tree ../../../iob_timer_V0.81/software/linux
    
  • Update iob_system_linux rootfs to include a pre-compiled version of the new auto-generated iob_timer kernel module driver and associated user-space functions. It also includes three pre-compiled user-space programs to test the iob_timer driver with each interface.

@jjts jjts requested review from P-Miranda and Copilot December 9, 2025 17:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for auto-generating Linux device drivers with three alternative kernel-userspace interfaces: /dev, sysfs, and ioctl. The implementation extends the iob_linux_device_drivers module to generate appropriate driver and user-space code for each interface, and updates the iob_system_linux rootfs to include pre-compiled test programs for the iob_timer peripheral.

Key Changes:

  • Auto-generation of Linux kernel drivers supporting /dev, sysfs, and ioctl interfaces
  • Generation of interface-specific user-space sources for each kernel interface
  • Addition of missing Verilog sources for Altera/Quartus FPGA modules

Reviewed changes

Copilot reviewed 6 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
create_peripheral_device_drivers.py Core implementation adding support for three kernel-userspace interfaces with auto-generation of driver and user-space code
iob_eth Submodule reference update
minicom_linux_script.txt Test script updated to test all three driver interfaces for iob_timer
device_driver_tutorial.md Documentation updated to reference the new auto-generation capabilities
ddio_out_clkbuf.v Added missing Verilog source for Altera DDIO output module
clk_buf_altclkctrl_0.v Added missing Verilog source for Altera clock buffer module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@P-Miranda P-Miranda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the commands:

cd py2hwsw/lib
make sim-run CORE=iob_timer
tree ../../../iob_timer_V0.81/software/linux

the ../../../iob_timer_V0.81/software/linux/user/Makefile
uses: riscv64-unknown-linux-gnu-gcc compiler, which is not available from py2hwsw nix-shell environment.
Not sure if this is a problem or not.

@arturum1
Copy link
Contributor Author

the ../../../iob_timer_V0.81/software/linux/user/Makefile uses: riscv64-unknown-linux-gnu-gcc compiler, which is not available from py2hwsw nix-shell environment. Not sure if this is a problem or not.

I have been using the nix-shell environment from the iob_linux repository to compile all software related to linux, including those user-space functions.
This nix environment is also available under the iob_linux submodule at: py2hwsw/lib/iob_system/iob_system_linux/submodules/iob_linux

Running the ../../../iob_timer_V0.81/software/linux/user/Makefile from within the iob_linux's nix environment, should build the software correctly.

@jjts jjts merged commit 58f5c1c into IObundle:main Dec 10, 2025
2 checks passed
@arturum1 arturum1 deleted the alternative_kernel_interfaces branch December 29, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants