I know there are a lot of questions like this, but I certain this one is rare. I am a computer programmer who wants to take on the challenge of building an operating system. I want to base it on Unix because I know that what I make could never compare. Where can I find Unix? I don't mean things like Mint (that's Linux, I know). I mean the thing they are all based on. Where can I get the main files, like the boot loader and the kernel?
linux – Where Is the Core of Unix?
developmentlinux
Related Solutions
AFAIK the only way to be completely sure of security would be to write a compiler in assembly language (or modifying the disk directly yourself). Only then can you ensure that your compiler isn't inserting a backdoor - this works because you're actually eliminating the compiler completely.
From there, you may use your from-scratch compiler to bootstrap e.g. the GNU toolchain. Then you could use your custom toolchain to compile a Linux From Scratch system.
Note that to make things easier on yourself, you could have a second intermediary compiler, written in C (or whatever other language). So you would write compiler A in assembly, then rewrite that compiler in C/C++/Python/Brainfuck/whatever to get compiler B, which you would compile using compiler A. Then you would use compiler B to compile gcc and friends.
Any kernel is pretty much the complete opposite of a "normal program". Even though microkernel folks might like the idea of OS services running as processes in the same level as user application, the kernel is always going to have to include some part that's not. If nothing else, there must be some part of the OS that handles scheduling of and switching between the processes, and communication between them.
Particularly, on Linux, the kernel is mapped to the address space of all processes, in the upper part of the address space. In a sense, it's part of each process, in that some processes might be running kernel code while at the same time some other process might be running user-space code.
I wouldn't say the kernel runs as a normal program, but it also doesn't run "only" on interrupts, as user-space code can also call into kernel routines: that's what system calls are. Quotes around "only", since interrupts aren't at all exceptional, some sort of a regular timer tick is quite common to have.
Best Answer
Maybe you're interested into xv6; Xv6 is a teaching operating system developed in the summer of 2006 for MIT's operating systems course. There are also many resources on UNIX OS.
If you want to know more about bootloaders, Operating System Development Series is a nice place to start.