public inbox for outreachy@lists.linux.dev
 help / color / mirror / Atom feed
From: Richard Akintola <princerichard17a@gmail.com>
To: outreachy@lists.linux.dev
Cc: julia.lawall@inria.fr, princerichard17a@gmail.com
Subject: Help on Modifying a Driver on Native Linux
Date: Tue, 1 Apr 2025 23:36:26 +0100	[thread overview]
Message-ID: <67ec6a6e.050a0220.2a613c.09a3@mx.google.com> (raw)

I learnt that e1000 didn't work because the driver is included in VM
images and not on Linux native, and a variant of e1000 on Linux native
is the e1000e driver.

Below are some of the drivers that one could modify on Linux native
in order have the "I can modify Linux kernel\n" effect.

Using the e1000e driver

1. vim drivers/net/ethernet/intel/e1000e/netdev.c

2. Find the probe function

static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
        struct net_device *netdev;
        struct e1000_adapter *adapter;
        struct e1000_hw *hw;
        const struct e1000_info *ei = e1000_info_tbl[ent->driver_data];
        resource_size_t mmio_start, mmio_len;
        resource_size_t flash_start, flash_len;
        static int cards_found;
        u16 aspm_disable_flag = 0;
        u16 eeprom_data = 0;
        u16 eeprom_apme_mask = E1000_EEPROM_APME;
        int bars, i, err;
        s32 ret_val = 0;

        printk(KERN_DEBUG "I can modify the Linux kernel\n");

3. Save the file and recompile the kernel, you should see the text
printed when you run the "dmesg | less" command after rebooting.

Or you could use the bluetooth driver

1. vim drivers/bluetooth/btusb.c

2. Find the probe function

static int btusb_probe(struct usb_interface *intf,
                       const struct usb_device_id *id)
{
        struct usb_endpoint_descriptor *ep_desc;
        struct gpio_desc *reset_gpio;
        struct btusb_data *data;
        struct hci_dev *hdev;
        unsigned ifnum_base;
        int i, err, priv_size;

        printk(KERN_DEBUG "I can modify the Linux Kernel\n");


3. Save the file and recompile the kernel, you should see the text
printed when you run the "dmesg | less" command after rebooting.

I hope this helps.


             reply	other threads:[~2025-04-01 22:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01 22:36 Richard Akintola [this message]
2025-04-02  5:05 ` Help on Modifying a Driver on Native Linux Julia Lawall
2025-04-02  6:13 ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67ec6a6e.050a0220.2a613c.09a3@mx.google.com \
    --to=princerichard17a@gmail.com \
    --cc=julia.lawall@inria.fr \
    --cc=outreachy@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox