Advice on Tools, methodologies, and introductions :)
Advice on Tools, methodologies, and introductions :)
Hey everyone Just thought I'd introduce myself to the board and perhaps ask a few questions to fill in a few gaps in my knowledge.
First some background on myself.
I have about 10 years of experience in C++ and am passingly familiar with C. I'm familiar with the C standard library and even some of the idioms, but I would not call myself experienced in pure ANSI C. Over the last 1.5 years I've found myself using mostly C# professionally (3.5) and, while it pays well, it doesn't really scratch the itch that caused me to fall in love with development in the first place. So here I am. I'm thinking a superhero archetype would describe me best. Plain C# hacker during the day, tight wearing, OS dev'ing wild eyed caffeine fueled leaper of tall buildings lover of beautiful women hacker dude in the evenings
So with that out of the way, here are the tools I've settled on.
Gentoo Linux
ANSI C
gcc (make, ld, etc).
nasm
bochs
bash (for automation and the like) Note: unless you guys recommend against this approach for some reason.
Now for the questions. Also, if I need to RTFM, please at least link TFM that I need to R
1. I see 2 book recommendations for hardware, which do you guys feel is better for someone who is just starting? The books are "The Indispensable PC Hardware Book" and "The Undocumented PC".
2. Are there any recommended resources for assembly/nasm?
3. This is probably just a gap in my knowledge, but I was following the loopback device article on the wiki, and it talks about creating floppies, and hd images. It also talks about formatting the disk and putting files on it manually. Is formatting even necessary at this point? How do you guys normally go about pushing your bootloader and/or kernel onto an image?
4. automation wise, what do you guys recommend I do first, and if you don't mind, perhaps a little of the how or links? What I mean is, instead of telling me to automate pushing my images onto a disk, perhaps a little insight into how I do this please?
Ok, that's all I have for now. Since this is a part time pasttime for me it's probably going to go a little slow, but hopefully I'll soon be answering questions for others
Also, I believe my weak spots are knowledge of hardware and assembly so any extra recommendations in this area are not going to be ignored.
First some background on myself.
I have about 10 years of experience in C++ and am passingly familiar with C. I'm familiar with the C standard library and even some of the idioms, but I would not call myself experienced in pure ANSI C. Over the last 1.5 years I've found myself using mostly C# professionally (3.5) and, while it pays well, it doesn't really scratch the itch that caused me to fall in love with development in the first place. So here I am. I'm thinking a superhero archetype would describe me best. Plain C# hacker during the day, tight wearing, OS dev'ing wild eyed caffeine fueled leaper of tall buildings lover of beautiful women hacker dude in the evenings
So with that out of the way, here are the tools I've settled on.
Gentoo Linux
ANSI C
gcc (make, ld, etc).
nasm
bochs
bash (for automation and the like) Note: unless you guys recommend against this approach for some reason.
Now for the questions. Also, if I need to RTFM, please at least link TFM that I need to R
1. I see 2 book recommendations for hardware, which do you guys feel is better for someone who is just starting? The books are "The Indispensable PC Hardware Book" and "The Undocumented PC".
2. Are there any recommended resources for assembly/nasm?
3. This is probably just a gap in my knowledge, but I was following the loopback device article on the wiki, and it talks about creating floppies, and hd images. It also talks about formatting the disk and putting files on it manually. Is formatting even necessary at this point? How do you guys normally go about pushing your bootloader and/or kernel onto an image?
4. automation wise, what do you guys recommend I do first, and if you don't mind, perhaps a little of the how or links? What I mean is, instead of telling me to automate pushing my images onto a disk, perhaps a little insight into how I do this please?
Ok, that's all I have for now. Since this is a part time pasttime for me it's probably going to go a little slow, but hopefully I'll soon be answering questions for others
Also, I believe my weak spots are knowledge of hardware and assembly so any extra recommendations in this area are not going to be ignored.
Last edited by me on Tue Jan 27, 2009 3:53 pm, edited 1 time in total.
Re: Advice on Tools, methodologies, and introductions :)
Welcome to the board.
1&2. Personally I use YASM rather than NASM (you may want to take a look at it). In the General Programming and OS Development stickies of this board (not to mention old threads) there are tons of links to tutorials and discussions about books (you are getting a pointer to a pointer here). Re-hashing the discussions here is of little value. I'd recommend you spend a little time learning about assembly in user space before starting OS development.
3. "Is formatting at this point?" Could you restate the question?
4. If you are using Bochs then you don't have to worry about this. Using a file as a disk is an option away (read the bochs man pages).
5. Are you using the word "automation" to describe the functions make performs?
1&2. Personally I use YASM rather than NASM (you may want to take a look at it). In the General Programming and OS Development stickies of this board (not to mention old threads) there are tons of links to tutorials and discussions about books (you are getting a pointer to a pointer here). Re-hashing the discussions here is of little value. I'd recommend you spend a little time learning about assembly in user space before starting OS development.
3. "Is formatting at this point?" Could you restate the question?
4. If you are using Bochs then you don't have to worry about this. Using a file as a disk is an option away (read the bochs man pages).
5. Are you using the word "automation" to describe the functions make performs?
Re: Advice on Tools, methodologies, and introductions :)
I would also suggest you use Ubuntu rather than Gentoo. It should install quickly, and easily, and get you osdeving almost immediately.
As for the reading material, the Intel manuals should be your first read. After reading those, assembly should come almost naturally. (ie. Doing some online research should suffice.)
As for the reading material, the Intel manuals should be your first read. After reading those, assembly should come almost naturally. (ie. Doing some online research should suffice.)
C8H10N4O2 | #446691 | Trust the nodes.
-
- Member
- Posts: 566
- Joined: Tue Jun 20, 2006 9:17 am
Re: Advice on Tools, methodologies, and introductions :)
I would suggest Slackware , all others are simply not on par with Slackware . You can probly look at advanced 386 programming techniques , a book i found in libarary , this book is of great help and do not forget the wiki .
For automation purpose i would prefer a scripting language like python
Regards
Shrek
For automation purpose i would prefer a scripting language like python
Regards
Shrek
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Advice on Tools, methodologies, and introductions :)
I never felt the need for any such books. All the information you need is available off the web and IMO you can better get yourself an old computer for that priceme wrote:1. I see 2 book recommendations for hardware, which do you guys feel is better for someone who is just starting? The books are "The Indispensable PC Hardware Book" and "The Undocumented PC".
The idea of a loopback device is to pretend that there is an extra floppy or harddisk, which is actually a image. You can then do with that virtual piece of hardware whatever you would do with other pieces of hardware.3. This is probably just a gap in my knowledge, but I was following the loopback device article on the wiki, and it talks about creating floppies, and hd images. It also talks about formatting the disk and putting files on it manually. Is formatting at this point? How do you guys normally go about pushing your bootloader and/or kernel onto an image?
Since using the loopback requires some root privileges I personally prefer a tool that works on images directly. In my case, MTools. It also happens to be fairly platform independent.
If you know make, use it. If you can do shell scripting, use it. You can try the Makefile tutorial otherwise.4. automation wise, what do you guys recommend I do first, and if you don't mind, perhaps a little of the how or links? What I mean is, instead of telling me to automate pushing my images onto a disk, perhaps a little insight into how I do this please?
As for those distro recommendations, use what you feel comfortable with. You can do OSDev under windows. No need to install linux for that. If you already have linux installed, don't bother with getting a different distro just for OS development as they all should work equally well.
In other words: no need to install any form of linux specifically for OS development
And hence, no reason to start a distro war, Shrek, Alboin
Re: Advice on Tools, methodologies, and introductions :)
He seems to want to use Linux and in his post he makes himself seem to have more experience with Windows. If this is true, and he has little Linux experience, then he may have seen the various topics on this board suggesting Gentoo and decided to use that. This, however, would be a mistake, because learning how to use Linux in general is difficult enough without having to manually install the smallest piece of software. I thus suggested Ubuntu, following these assumptions. My point is still valid.Combuster wrote:As for those distro recommendations, use what you feel comfortable with. You can do OSDev under windows. No need to install linux for that. If you already have linux installed, don't bother with getting a different distro just for OS development as they all should work equally well.
In other words: no need to install any form of linux specifically for OS development
And hence, no reason to start a distro war, Shrek, Alboin
C8H10N4O2 | #446691 | Trust the nodes.
Re: Advice on Tools, methodologies, and introductions :)
My apologies, I should have specified. I've been a Linux user for close to 10 years. All of my personal work is done in linux (I know Linux better than windows truthfully), and I run Linux as my desktop at home, so unless there's a specific reason for switching to another distro I'm going to stay with Gentoo.
I'm an old slacker, and agree that it's a superb OS, but the lack of a package manager eventually caused me to move over to Gentoo. For whatever reason I like emerge better than apt-get (no rational reason, just preference), and the build times don't bother me, so there you have it I've also played with Ubuntu, and if I were recommending a distro to a "noob" Ubuntu would be it, but for me I don't need the shiny packaging (that's just me though).
stephenj
Things of that nature. Just wanted to see how the experienced OS dev'ers saved themselves time.
So here I am in all of my noob glory
I'm an old slacker, and agree that it's a superb OS, but the lack of a package manager eventually caused me to move over to Gentoo. For whatever reason I like emerge better than apt-get (no rational reason, just preference), and the build times don't bother me, so there you have it I've also played with Ubuntu, and if I were recommending a distro to a "noob" Ubuntu would be it, but for me I don't need the shiny packaging (that's just me though).
stephenj
That should have read :"Is formatting even necessary at this point?" By "this point" I really mean someone just trying to get a bootloader to load up a rudimentary kernel. Is there a reason why I'd want to do this?3. "Is formatting at this point?" Could you restate the question?
partially. Perhaps an example would help. I can foresee kicking off a build and at the end of it launching bochs with a debugger attached, or pushing it to another machine, updating a bootloader and rebooting said machine. "automation" in this case would be a set of scripts written so all I have to do is kick off the process and then go grab another cup of coffee5. Are you using the word "automation" to describe the functions make performs?
Things of that nature. Just wanted to see how the experienced OS dev'ers saved themselves time.
I think I asked that question badly. I've never had to push 512 bytes to the first sector of a HD before. I haven't come across anything on the wiki yet and I'm not even sure what keywords I would google on to find the information (in other words I'm very ignorant in this respect). A nudge in the right direction would be invaluable to me.The idea of a loopback device is to pretend that there is an extra floppy or harddisk, which is actually a image. You can then do with that virtual piece of hardware whatever you would do with other pieces of hardware.
I mentioned the Windows only to offer a reason why I'm jumping into OS dev. To make a long story short, I've always been interested in it. I recently took a fulltime position at one of the companies I contract with (to lessen the effects of the current economy) and I'm finding the development there to be mostly web stuff in C#. It's enjoyable enough, but not what I really enjoy about developing, so I decided to scratch that itch outside of work.He seems to want to use Linux and in his post he makes himself seem to have more experience with Windows. If this is true, and he has little Linux experience
So here I am in all of my noob glory
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Advice on Tools, methodologies, and introductions :)
If you have a floppy with a filesystem, and the bootloader has already been installed, then the only thing you need to do is to replace the kernel file. To get started that way, you can get precompiled floppy images with GRUB off the wiki.That should have read :"Is formatting even necessary at this point?" By "this point" I really mean someone just trying to get a bootloader to load up a rudimentary kernel. Is there a reason why I'd want to do this?
If the bootloader isn't fixed, you need to rebuild the floppy on each iteration.
Maybe you should try the Bare Bones tutorial and see where you get stuck, that also makes it easier for us to answer questions when they're more specific.
In my case, makefiles. With lots of phony targets doing useful stuff so that all I ever need to do is type "make (...)" at the console. (You can use my source browser to get ideas)Just wanted to see how the experienced OS dev'ers saved themselves time.
Re: Advice on Tools, methodologies, and introductions :)
Fair enough. I was planning on starting with Hello World Bootloader, but I'll start with the bare bones and work backwards. I know the bootloader isn't technically kernel hacking, but I'm here for the fun and it'll let me dive into assembly a bitMaybe you should try the Bare Bones tutorial and see where you get stuck, that also makes it easier for us to answer questions when they're more specific.
and thanks for the link, I'll definitely check it out.
Re: Advice on Tools, methodologies, and introductions :)
I've successfully worked through the bare bones tutorial. There isn't a note in the tutorial about this, but bochs insisted on a floppy with an expected size (I padded it out to 1474560 bytes) before it would work as expected. I've updated the wiki accordingly.
Re: Advice on Tools, methodologies, and introductions :)
Hi,
As an example, I use both methods. For my bootable GRUB floppy image I've got a pre-formatted (FAT) floppy image with GRUB already installed, and I use mtools to add my OS's files to a copy of this floppy image to create the final floppy image. Alternatively it's possible to use "dd" to create images in some cases, or you could use NASM for more complex cases (see this web page for an example of using NASM to create a bootable ISO9660/El Torito CD image).
Note: I think Bochs uses the floppy image's size to determine the disk type. For e.g. a 1440 KiB file would be emulated as a floppy disk with 80 cylinders, 18 sectors per track and 2 heads; while a 160 KiB file would be emulated as a single-sided floppy disk with 40 tracks and 8 sectors per track.
Cheers,
Brendan
If your floppy image uses a common file system (e.g. FAT), then you'd need to create the blank image, format it, then copy files to it (where formatting and copying files can be done with a loopback device). If your floppy image doesn't use a common file system then there's no point mounting it as a loopback device.me wrote:3. This is probably just a gap in my knowledge, but I was following the loopback device article on the wiki, and it talks about creating floppies, and hd images. It also talks about formatting the disk and putting files on it manually. Is formatting even necessary at this point? How do you guys normally go about pushing your bootloader and/or kernel onto an image?
As an example, I use both methods. For my bootable GRUB floppy image I've got a pre-formatted (FAT) floppy image with GRUB already installed, and I use mtools to add my OS's files to a copy of this floppy image to create the final floppy image. Alternatively it's possible to use "dd" to create images in some cases, or you could use NASM for more complex cases (see this web page for an example of using NASM to create a bootable ISO9660/El Torito CD image).
Note: I think Bochs uses the floppy image's size to determine the disk type. For e.g. a 1440 KiB file would be emulated as a floppy disk with 80 cylinders, 18 sectors per track and 2 heads; while a 160 KiB file would be emulated as a single-sided floppy disk with 40 tracks and 8 sectors per track.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.