Top
Best
New

Posted by dmitrybrant 5 days ago

Using Claude Code to modernize a 25-year-old kernel driver(dmitrybrant.com)
916 points | 319 commentspage 3
AdieuToLogic 5 days ago|
Something not yet mentioned by other commenters is the "giant caveat":

  As a giant caveat, I should note that I have a small bit of 
  prior experience working with kernel modules, and a good 
  amount of experience with C in general, so I don’t want to 
  overstate Claude’s success in this scenario. As in, it 
  wasn’t literally three prompts to get Claude to poop out a 
  working kernel module, but rather several back-and-forth 
  conversations and, yes, several manual fixups of the code. 
  It would absolutely not be possible to perform this 
  modernization without a baseline knowledge of the internals 
  of a kernel module.
Of note is the last sentence:

  It would absolutely not be possible to perform this 
  modernization without a baseline knowledge of the internals 
  of a kernel module.
This is critical context when using a code generation tool, no matter which one chosen.

Then the author states in the next section:

  Interacting with Claude Code felt like an actual 
  collaboration with a fellow engineer. People like to 
  compare it to working with a “junior” engineer, and I think 
  that’s broadly accurate: it will do whatever you tell it to 
  do, it’s eager to please, it’s overconfident, it’s quick to 
  apologize and praise you for being “absolutely right” when 
  you point out a mistake it made, and so on.
I don't know what "fellow engineers" the author is accustomed to collaborating with, junior or otherwise, but the attributes enumerated above are those of a sycophant and not any engineer I have worked with.

Finally, the author asserts:

  I’m sure that if I really wanted to, I could have done this 
  modernization effort on my own. But that would have 
  required me to learn kernel development as it was done 25 
  years ago.
This could also be described as "understanding the legacy solution and what needs to be done" when the expressed goal identified in the article title is:

  ... modernize a 25-year-old kernel driver
Another key activity identified as a benefit to avoid in the above quote is:

  ... required me to learn ...
rmoriz 5 days ago||
Gatekeeping is toxic. I love agents explaining me projects I don‘t know. Recently I cloned sources of Firefox and asked qwen-code (tool not significant) about the AI features of Firefox and how it‘s implemented. Learning has become awesome.
AdieuToLogic 5 days ago|||
> Gatekeeping is toxic.

Learning what must be done to implement a device driver in order for it to operate properly is not "gatekeeping." It is a prerequisite.

> I love agents explaining me projects I don‘t know.

Awesome. This is one way to learn about implementations and I applaud you for benefiting from same.

> Recently I cloned sources of Firefox and asked qwen-code (tool not significant) about the AI features of Firefox and how it‘s implemented. Learning has become awesome.

Again, this is not the same as implementing an OS device driver. Even though one could justify saying Firefox is way more complicated than a Linux device driver (and I would agree), the fact is that a defective device driver can lock-up the machine[0], corrupt internal data structures resulting in arbitrary data corruption, and/or cause damage to peripheral devices.

0 - https://en.wikipedia.org/wiki/Kernel_panic

kelnos 5 days ago|||
> Learning what must be done to implement a device driver in order for it to operate properly is not "gatekeeping." It is a prerequisite.

Apparently it's not, though. The author here had some baseline knowledge of how Linux kernel modules work, but the impression I got is that they would not have been able to do this on their own without a lot of learning.

> the fact is that a defective device driver can lock-up the machine[0], corrupt internal data structures resulting in arbitrary data corruption, and/or cause damage to peripheral devices.

Now that's some gatekeeping right there. "Only experts can write kernel modules" is a pretty toxic attitude to have.

skydhash 5 days ago||
Anyone can write kernel module.

On their computers.

Not mine.

BestHackerOnHN 5 days ago|||
[dead]
rgoulter 5 days ago|||
> I don't know what "fellow engineers" the author is accustomed to collaborating with, junior or otherwise, but the attributes enumerated above are those of a sycophant and not any engineer I have worked with.

I read "junior" as 'subordinate' and 'lacking in discernment'.. -- Sycophancy is a good description. I also like "bullshit" (as in 'for the purpose of convincing'). https://en.wikipedia.org/wiki/Bullshit#In_the_philosophy_of_...

The point being, there's nuance to "it felt like a collaboration with another developer (some caveats apply)". -- It's not a straightforward hype of "LLM is perfect for everything", nor is it so simple as "LLM has imperfections, it's not worth using".

> Another key activity identified as a benefit to avoid in the above quote is: > > ... required me to learn ...

It would be bad to avoid learning fundamentals, or things which will be useful later.

But, it's not bad to say "there are things I didn't need to know to solve a problem".

badsectoracula 5 days ago|||
> Another key activity identified as a benefit to avoid in the above quote is: ... required me to learn ...

"...kernel development as it was done 25 years ago."

Not "...kernel development as it is done today".

That "25 years ago" is important and one might be interested in the latter but not in the former.

kelnos 5 days ago||
To be fair, a "baseline knowledge of the internals of a kernel module" is not that difficult to acquire.

I think a moderately-skilled developer with experience in C could have done this, with Claude's help, even if they had little or no experience with the Linux kernel. It would probably take longer to do, and debugging would be harder, but it would still be doable.

rob_c 5 days ago||
Qudos to the author.

I keep beating on the drum that they correctly point out. It's not perfect. But it saves hours and hours of work in generating compared to small conceptual debugging.

The era of _needing_ teams of people to spit out boilerplate is coming to an end. I'm not saying doing learn to write it, learning demands doing, making mistakes and personal growth. But after you've mastered this there's no need to waste time writing booklet plate on the clock unless you truly enjoy it.

This is a perfect example of time taken to debug small mistakes << time to start from scratch as a human.

Time, equivalent money, energy saved all a testament to what is possible with huge context windows and generic modern LLMs :) :) :)

miki123211 4 days ago||
IMO, the most under-appreciated trick when working with these coding agents is to give them an automatic way to check their work.
MrContent04 4 days ago||
It’s fascinating to see LLMs breathe new life into legacy code. But I wonder — if AI rewrites outpace human review, are we just creating a new layer of technical debt? Maybe the real challenge is balancing modernization with long-term maintainability.
fourthark 5 days ago||
Upgrades and “collateral evolution” are very strong use cases for Claude.

I think the training data is especially good, and ideally no logic needs to change.

DrNosferatu 5 days ago||
Uses like this will only get more pervasive.
fruitworks 5 days ago|
If we allow it
DrNosferatu 5 days ago|||
If it delivers what we need, isn't it a net positive?

And clearly define what we need with specs and thorough tests.

fruitworks 5 days ago||
Do we need code generated from a stochastic model of previous code? I think we need actual people who are familiar with the kernel and hardware and are capable of reasoning about it.

We are constantly reminded that LLMs are the future despite the real world evidence to the contrary. Look at what happens when LLMs are trained on the output of other LLMs, such as the low quality code flooding the internet. It is all a self-solving problem set in motion.

jason-johnson 5 days ago||
As sad as it makes some version of me to say, the majority of code that gets written every day doesn't need to be good code. I am doing a pet side project right now, completely with copilot. I haven't written a line of code, documentation or anything else. The code is pretty poor but I don't care because I just need it to take a specific input and produce a specific output and I only need this to happen once and then I'll throw the whole thing away. As I mentioned elsewhere: this didn't get me the result faster than I could have done by hand, but it did let me not spend the entire time in deep focus trying to write all this.
rob_c 5 days ago||||
The alternative is to go back to stone tablet in the cave with Plato.
DrNosferatu 5 days ago|||
Compilers also came a long way.
fruitworks 4 days ago||
compilers are deterministic
DrNosferatu 4 days ago||
barely so - in practice they display (local) chaotic behaviour.

And LLMs are deterministic too if you freeze the seed.

yieldcrv 5 days ago||
I’ve been doing assembly subroutines in Solidity for years with LLMs, I wouldn't even have tried beforehand
unethical_ban 5 days ago||
Neat stuff. I just got Claude code and am training myself on Rails, I'm excited to have assistance working through some ideas I have and seeing it handle this kind of iterative testing is great.

One note: I think the author could have modified sudoers file to allow loading and unloading the module* without password prompt.

frumplestlatz 5 days ago||
> One note: I think the author could have modified sudoers file to allow loading and unloading the module* without password prompt.

Even a minor typo in kernel code can cause a panic; that’s not a reasonable level of power to hand directly to Claude Code unless you’re targeting a separate development system where you can afford repeated crashes.

nico 5 days ago|||
Claude is really good with frameworks like Rails. Both because it’s probably seen a lot of code in its training set, and because it works way better when there is a very well defined structure
anyfoo 5 days ago||
... which would allow you to load arbitrary code into the kernel, pretty much bypassing any and all security. You might as well not have a password at all. Which, incidentally, can be a valid strategy for isolated external dev boards, or QEMU VMs. But on a machine with stuff you care about? You're basically ripping it open.
unethical_ban 5 days ago||||
He was already loading "arbitrary" Claude code, no? I'm suggesting there was a way to skip password entry by narrowly tailoring an exception.

Another thought, IIRC in the plugins for Claude code in my IDE, you can "authorize" actions and have manual intervention without having to leave the tool.

My point is there were ways I think they could have avoided copy/paste.

anyfoo 5 days ago||
While I personally would have used a dedicated development target, the workflow he had at least allowed him to have a good look at any and all code changes, before approving with the root password.

That is a bit different than allowing unconfirmed loading of arbitrary kernel code without proper authentication.

anonymousiam 5 days ago||
I hope Dmitry did a good job. I've got a box of 2120 tapes with old backups from > 20 years ago, and I'm in the process of resurrecting the old (486) computer with both of my tape drives (floppy T-1000 and SCSI DDS-4). It would be nice to run a modern kernel on it.
More comments...