On 26/11/2010, at 6:07am, sam new wrote: > Thanks all, I have a question , when we build the system, always use host > client to build the toolchain , then GCC Glibc ...kernel some unity ... from > source ,but where the frist system come from ,does it build using the > Assembly language or machine language? I mean just give you X86 hardware and > power , no OS, no livd cd . I am afraid it is out of this topic.but it > always puzzled me :-)
I think you want to know which came first - the chicken or the egg? For a few years, operating systems were indeed written in assembler. Then, c 1970, Unix was the first operating system written in a higher-level programming language, C. Likewise, I guess, the first compilers would be written in assembler, until one was written that could compile itself and become "self-hosting". Thus new compilers and operating systems can now be written in higher-level languages (although C isn't very high-level) and compiled using an existing compiler. That Unix was written in C is what has lead to its ubiquity - until then every different brand of computer had its own operating system, usually written by the manufacturer. Written in assembly, these were non-portable. Writing the operating system in C allowed it to be ported to different hardware architectures, and programs could be written that would run on all the different systems out there (as long as those ran Unix). Linux was written on a Minix system, Minix was written c 1987 and so might have been written on one of the BSDs that was around then; the BSDs were probably written on an AT&T Unix. When Intel produce a new chip - or gcc wants to support a new architecture - they rewrite the compiler (the "backend" part of it) to output machine code to suit the new chip's instruction set (which will be different from that of other chips - PPC vs ARM vs MIPS vs x86). The compiled code is then transferred to the new machine and fingers are crossed as everyone waits to see if it boots. http://en.wikipedia.org/wiki/History_of_Unix http://en.wikipedia.org/wiki/Compiler Stroller.