You are not logged in.

#1 2025-08-19 18:39:35

mu40u_n1k4
Member
Registered: 2025-07-24
Posts: 8

[SOLVED] Learning kernel development - Where to get linux/init.h ?

I'm going through Linux Device Drivers 3rd edition to start learn about the kernel and drivers. I know it's outdated, but from my understanding the "high level" of it still applies. Also, I found this repository that has more up-to-date examples from the book. My current issue is that I'm missing linux/init.h which I think I'm supposed to get from the linux-headers package.

From some posts I've seen around the web, installing this should be done with something like

linux-headers-$(uname -r)

but I don't see anything in the Arch repo that differs on that the kernel, only linux-headers. My current version (from uname -r) is 6.16.0-arch2-1 but what's out in the Arch repos is 6.16.1.arch1-1. I'm not sure if the versioning difference matters in this scenario. I figured I would try to install it and see if it works/breaks. When doing so though I get;

sudo pacman -S linux-headers   
resolving dependencies...
looking for conflicting packages...

Packages (2) pahole-1:1.30-2  linux-headers-6.16.arch2-1

Total Download Size:    52.45 MiB
Total Installed Size:  245.65 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
 linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst failed to download
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from america.mirror.pkgbuild.com : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from losangeles.mirror.pkgbuild.com : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from nl.arch.niranjan.co : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from us.arch.niranjan.co : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from berlin.mirror.pkgbuild.com : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from at.arch.niranjan.co : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from mirror.theo546.fr : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from mirror.moson.org : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from london.mirror.pkgbuild.com : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from mirror.sunred.org : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from mirror.ubrco.de : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from repo.jing.rocks : SSL: no alternative certificate subject name matches target hostname 'repo.jing.rocks'
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from singapore.mirror.pkgbuild.com : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from taipei.mirror.pkgbuild.com : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from johannesburg.mirror.pkgbuild.com : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from de.arch.niranjan.co : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from mirror.cyberbits.asia : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from nz.arch.niranjan.co : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from mirror.lcarilla.de : The requested URL returned error: 404
error: failed retrieving file 'linux-headers-6.16.arch2-1-x86_64.pkg.tar.zst' from in.arch.niranjan.co : The requested URL returned error: 404
warning: failed to retrieve some files
error: failed to commit transaction (failed to retrieve some files)
Errors occurred, no packages were upgraded.

Which would make sense, since the repo has a different version than my local system. Using pacman -S linux-headers-$(uname -r) gives me a "target not found", as expected. So, my questions are...

- Am I looking in the right place for these headers or is there a better way I should acquire these?
- If the arch repo isn't the best place for me to get them, where should I look?
- If it is the correct place, what package should I be looking for?

Last edited by mu40u_n1k4 (2025-08-19 19:01:41)

Offline

#2 2025-08-19 18:53:02

iwuvkittens
Member
Registered: 2025-05-30
Posts: 87

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

it's in /usr/lib/modules/$(uname -r)/build/include/linux/init.h

you got 404 errors because the previous version has been removed from the repos, refresh your databases via upgrading often to prevent that

Last edited by iwuvkittens (2025-08-19 18:57:33)


gnu/linux/tux

Offline

#3 2025-08-19 19:01:19

mu40u_n1k4
Member
Registered: 2025-07-24
Posts: 8

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

Ah, just updating my system with a good ol' pacman -Syu worked. Silly me.

Offline

#4 2025-12-07 03:10:01

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 157

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

mu40u_n1k4 wrote:

Ah, just updating my system with a good ol' pacman -Syu worked. Silly me.

Yeah, that will do the trick :-)

Packman downloads URLs which it accesses to grab packages when you try to do so.

If the packages are updated, the URL cache becomes stale and access to it will give 404, maybe some other error.

At this point you have to download some fresh cache :-)

Offline

#5 2025-12-07 12:25:22

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 439

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

/usr/src/linux symlink points to currently installed kernel headers.

Last edited by dimich (2025-12-07 12:25:46)

Offline

#6 2025-12-07 19:20:39

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 157

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

dimich wrote:

/usr/src/linux symlink points to currently installed kernel headers.

Troll effort halfway appreciated.

Offline

#7 2025-12-07 20:17:48

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 439

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

ReDress wrote:

Troll effort halfway appreciated.

What? I wasn't mean to troll. Maybe I misunderstood the issue from OP, sorry.

linux-headers package installs /usr/src/linux symlink, you can pass it to make command directly to compile a module. You don't need to use $(uname -r).

Last edited by dimich (2025-12-07 20:18:14)

Offline

#8 Today 05:15:47

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 157

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

But,  why does your messages/replies suddenly show up in my inbox

Offline

#9 Today 07:09:33

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,461
Website

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

ReDress wrote:

But,  why does your messages/replies suddenly show up in my inbox

Mod note: Probably because you subscribed to this topic.


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#10 Today 07:17:41

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 157

Re: [SOLVED] Learning kernel development - Where to get linux/init.h ?

Maybe I subscribed by mistake.


Yet I am sure I never did

Offline

Board footer

Powered by FluxBB