Page 6 of 8
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 8:21 am
by natiiix
Korona wrote:What in particular is so bad about the Linux kernel if you just want to build a user-space? What features does it lack? It only seems overcomplicated if you refuse to study it.
It's probably the most complicated open source code on the Internet, how is it not overcomplicated for someone making a very basic OS? So yeah, that's bad about it. It's completely unusable for what I want. It would be more than a gigabyte of redundant code.
iansjack wrote:This thread sure makes me chuckle every time it gets sillier and sillier.
It won't get smarter unless the replies become more helpful.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 8:36 am
by iansjack
natiiix wrote:Korona wrote:What in particular is so bad about the Linux kernel if you just want to build a user-space? What features does it lack? It only seems overcomplicated if you refuse to study it.
It's probably the most complicated open source code on the Internet, how is it not overcomplicated for someone making a very basic OS?
How complicated the source code is shouldn't matter to you. You just want to use the kernel, not write drivers for it or anything like that. It provides a straightforward, easily used set of system calls.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 8:39 am
by natiiix
iansjack wrote:How complicated the source code is shouldn't matter to you. You just want to use the kernel, not write drivers for it or anything like that. It provides a straightforward, easily used set of system calls.
I guess that's why Linux From Scratch book has
only 359 pages, right?
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 9:02 am
by iansjack
You expect a book describing in detail how to build an operating system to have less than 359 pages? Once again an example of your naively inflated expectations I'm afraid.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 9:04 am
by natiiix
iansjack wrote:You expect a book describing in detail how to build an operating system to have less than 359 pages? Once again an example of your naively inflated expectations I'm afraid.
I don't remember mentioning anything about a detailed book. It's just the best known book regarding that topic.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 9:32 am
by iansjack
Certainly most books describing an operating system are considerably longer than that. The reason for that, as you are discovering (but refuse to accept) is that a useful operating system is a moderately complicated project.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 9:34 am
by natiiix
iansjack wrote:Certainly most books describing an operating system are considerably longer than that. The reason for that, as you are discovering (but refuse to accept) is that a useful operating system is a moderately complicated project.
You've just made a very good counter-argument to your statement about Linux kernel having easy to use system calls, because that would certainly make OS development pretty easy. Obviously that assume you don't necessarily want to start from an absolute scratch.
If it were as easy as you said I would have found a guide on how to build an OS on top of it and never started making my own kernel to begin with.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 9:52 am
by SpyderTL
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 10:07 am
by Schol-R-LEA
Actually, SpyderTL, the Linux From Scratch project was mentioned already, and was in fact what Natilix was talking about. And the point is a valid one, it really isn't a very approachable text; the problem is in expecting that an approachable text on this topic exists, or can exist.
I will also admit that I hadn't used the AHCI page as anything other than reference until now, and now that I have read it, I have to agree that it is severely lacking in detailed explanations and usable information - the information is there, but it will only make sense to someone who already knows enough about AHCI to implement it on their own. The fact that the code exists at all is extremely misleading, because, well, as people keep telling Natilix, it doesn't actually work and a working example can't be given without relying on knowledge of the OS it is being written for. We really have been falling down on the job, though part of it is that we still aren't being clear enough on just how high the bar is. Even with all the warnings we've got in the Beginner's pages, we haven't been getting through to people about what the limitations of our information, and the requirements of a working OS project, really are.
In the case of AHCI, part of the problem is copyright - we're already pushing Fair Use as far as it will go by including diagrams and direct quotes from the specification, and we'd need a lot more specialized knowledge than anyone here actually has in order to do a better job of explaining it without infringing on the spec IP.
You have to recall, too, that were are doing this as volunteers, most of us as a hobby; there aren't many actual professional OS devs in the world, and only maybe four are on this forum. Those who are, generally have focused on other parts of the wiki. There are simply too many different variables, too many options and approaches, to give a walkthrough for OS design beyond the very basic material already there.
Finally, while people such as Lee Felsenstein, Steve Wozniak, and Tim Pittman may have written their own operating systems in relatively short time spans, you have to keep in mind that they were working on hardware they designed themselves and knew intimately, hardware much simpler than what is used today, and they had no standards to try and implement or legacy cruft to remain compatible with. They only managed it because things like AHCI didn't exist to get in their way.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 10:21 am
by natiiix
Seen that page, seemed and still seems completely useless to me.
Mentions LFS, which is quite complicatedm, and simply modifying which packages to install in an already existing distro, which is ridiculous and is nothing like OS development.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 10:23 am
by iansjack
natiiix wrote:iansjack wrote:Certainly most books describing an operating system are considerably longer than that. The reason for that, as you are discovering (but refuse to accept) is that a useful operating system is a moderately complicated project.
You've just made a very good counter-argument to your statement about Linux kernel having easy to use system calls, because that would certainly make OS development pretty easy. Obviously that assume you don't necessarily want to start from an absolute scratch.
If it were as easy as you said I would have found a guide on how to build an OS on top of it and never started making my own kernel to begin with.
You really don't understand what an operating system is, do you. Which explains this train-wreck of a thread.
There is a big difference between a kernel that provides system calls and user programs that make use of those system calls. The former is a complicated business; the latter, if you did your work right with the former, is much simpler.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 10:54 am
by IanSeyler
@natiiix Here is the AHCI driver I wrote for my OS:
https://github.com/ReturnInfinity/BareM ... e/ahci.asm
It shows how to initialize the hardware and command slots as well as reading/writing sectors. It's written in x86-64 assembly (but is fairly well commented) so you can't get much lower level than that.
-Ian
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 11:00 am
by natiiix
iansjack wrote:There is a big difference between a kernel that provides system calls and user programs that make use of those system calls. The former is a complicated business; the latter, if you did your work right with the former, is much simpler.
You don't really understand what I'm talking about. I've never said anything about user programs.
IanSeyler wrote:@natiiix Here is the AHCI driver I wrote for my OS:
https://github.com/ReturnInfinity/BareM ... e/ahci.asm
It shows how to initialize the hardware and command slots as well as reading/writing sectors. It's written in x86-64 assembly (but is fairly well commented) so you can't get much lower level than that.
-Ian
I've seen it quite some time ago, but it doesn't appear anywhere near possible to me to get a C code out of that.
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 12:16 pm
by MollenOS
I've seen it quite some time ago, but it doesn't appear anywhere near possible to me to get a C code out of that.
It's a good thing it's not that hard to convert assembly to C code.
Otherwise, just as a mind-experiment, my AHCI driver is here:
https://github.com/Fadekraft/MollenOS/t ... orage/ahci
Re: How to read from SATA HDD (AHCI) on low level?
Posted: Wed Mar 29, 2017 1:22 pm
by IanSeyler
MollenOS wrote:It's a good thing it's not that hard to convert assembly to C code.
Even with the Assembly driver I linked you should be able to follow along with what is happening (along with the official documentation). For the most part its just moving/setting values in memory.