Hi all.
i'm sure this is a very basic question, but I've been working on my bootloader, and I wondered if there's a way to locate which inode belongs to the kernel binary (in the ext family), other than just going through all the inodes and checking if they're the kernel. I've done some searching, and the closest I can find is a reserved inode for the bootloader, but that's not what I'm after.
Thanks!
Finding the kenrel (ext*)
- PavelChekov
- Member
- Posts: 113
- Joined: Mon Sep 21, 2020 9:51 am
- Location: Aboard the Enterprise
Finding the kenrel (ext*)
USS Enterprise NCC-1701,
The Final Frontier,
Space,
The Universe
Live Long And Prosper
Slava Ukraini!
Слава Україні!
The Final Frontier,
Space,
The Universe
Live Long And Prosper
Slava Ukraini!
Слава Україні!
Re: Finding the kenrel (ext*)
If you have a path name, you can just look it up. I-Node 2 is the root directory, so open it, then iterate through the directory, find the first path name, open its i-node, find the second one, etc. until you have iterated through the entire path. That's actually how most people find a file in a file system.
Carpe diem!
- PavelChekov
- Member
- Posts: 113
- Joined: Mon Sep 21, 2020 9:51 am
- Location: Aboard the Enterprise
Re: Finding the kenrel (ext*)
That's what I figured. I was afraid I might have been missing some sort of lookup table by filename or something. Thanks.nullplan wrote:If you have a path name, you can just look it up. I-Node 2 is the root directory, so open it, then iterate through the directory, find the first path name, open its i-node, find the second one, etc. until you have iterated through the entire path. That's actually how most people find a file in a file system.
USS Enterprise NCC-1701,
The Final Frontier,
Space,
The Universe
Live Long And Prosper
Slava Ukraini!
Слава Україні!
The Final Frontier,
Space,
The Universe
Live Long And Prosper
Slava Ukraini!
Слава Україні!
Re: Finding the kenrel (ext*)
Apparently, there is some sort of look-up table on large directories, but it is only optional, only on large directories, and only tells you which filesystem block contains the directory entry you are looking for. Way overkill for a bootloader. So I'd just stick to reading the directories normally.
Carpe diem!