Posted by
timothy
on from the count-to-ten-very-slowly dept.
An anonymous reader writes "TCCBOOT is the first boot loader able to compile and boot a Linux kernel directly from its source code. It can compile and start booting a typical Linux kernel in less than 15 seconds on a 2.4 GHz Pentium 4. TCCBOOT uses the latest version of the TinyCC C compiler."
It takes a couple minutes to compile my kernel on a 3.06 P4, and of course, forever and a day to boot.
I guess 15 seconds is to compile without any device support other than the boot drive.
That said, linux boot time as it is sucks, especially if you want to use it on something like a router/firewall box like I do. The only button I ever press on that machine is reset. VPN not working? Reset.
That's how it should work IMO, but every time I do it the 'net is out for 10 mintues until it's back up.
Resetting the whole box should be faster than ssh'ing in and typing a "/etc/init.d/shorewall restart" and "/etc/init.d/openvpn restart".
--
I don't need no instructions to know how to rock!!!!
TCC is an incredibly tiny compiler with practically no dependencies on the environment. It's based on a cleaned up entry to the obfuscated C contest. So you can safely assume it's using every dirty trick in the book and then some. It still sounds incredible though.
Blatant Karma Whoring: In case of a slashdotting..
by
jimicus
·
· Score: 3, Informative
Introduction TCCBOOT is a boot loader able to compile and boot a Linux kernel directly from its source code.
TCCBOOT is only 138 KB big (uncompressed code) and it can compile and run a typical Linux kernel in less than 15 seconds on a 2.4 GHz Pentium 4.
TCCBOOT is based on the TinyCC compiler, assembler and linker. TinyCC is an experiment to produce a very small and simple C compiler compatible with the GNU C compiler and binary utilities. Screenshots Download ISO image demonstation: tccboot.iso (5.9 MB).
Create a CD from it and boot it to see TCCBOOT in action (PC with at least 64 MB of RAM required). You can also try it with the QEMU PC emulator.
TCCBOOT source code: tccboot-0.1.tar.gz, and README file.
Non-optimizing compilers can be very fast. Basically you just have to parse it and output pre-defined asm for each bit. According to this page, Turbo C 2.01 (a 1989 product) compiles over 16,000 lines per minute. Given that this number is also on the advertisement shown in that picture, which is actually from that time, it's 16,000 lines on the hardware of that time (i.e. 386). Now IIRC the 386 had at most 33MHz, so from the clock speed difference alone, on an 2.4GHz computer it should compile about 1.16 million lines per second; assuming a factor 4 in efficiency (i.e. modern processors can do 4 times as much per clock cycle as an 386), it should be possible to compile the same amount in 15 seconds. Now according to this page the Linux kernel has 1,526,722 lines of code, so if either my efficiency factor of 4 was too low, or TCC can compile about 1.5 times as fast as Turbo C 2.0 could (or maybe a combination of both), it's clearly not that far-fetched that a linux kernel could be compiled in 15 seconds.
-- The Tao of math: The numbers you can count are not the real numbers.
Re:TCC compiler
by
TheRaven64
·
· Score: 5, Informative
TCC has a few significant drawbacks.
It is not portable (well, technically it is portable, but currently only has an i386 back end).
It only supports C (not a drawback if you are just compiling C, but a lot of projects use C++/Objective-C/Whatever).
It produces fairly sub-optimal code. The register allocation done by TCC is not very clever, and it performs no serious optimisation steps.
On the other hand, TCC has two huge advantages:
It is not GCC. Compiling your code using two or more compilers and ideally for 2 or more CPU architectures is a good way of finding some more obscure bugs.
It is very fast. The less time you spend compiling, the more time you can spend testing / debugging.
Actually the TinyCC site lists a speedchart at http://fabrice.bellard.free.fr/tcc/#speed measurements are done on a 500 MHz K6. That should give you a better idea than just estimating based on Turbo C 2.0
The README says it needs some of the binaries and headers on the linux kernel, so you have to pre-compile these first.
I guess this could have some limited use somewhere, perhaps, but I can't really see how if you need some precompiled stuff.
- It's not the Macs I hate. It's Digg users. -
It takes a couple minutes to compile my kernel on a 3.06 P4, and of course, forever and a day to boot.
I guess 15 seconds is to compile without any device support other than the boot drive.
That said, linux boot time as it is sucks, especially if you want to use it on something like a router/firewall box like I do. The only button I ever press on that machine is reset. VPN not working? Reset.
That's how it should work IMO, but every time I do it the 'net is out for 10 mintues until it's back up.
Resetting the whole box should be faster than ssh'ing in and typing a "/etc/init.d/shorewall restart" and "/etc/init.d/openvpn restart".
I don't need no instructions to know how to rock!!!!
TCC is an incredibly tiny compiler with practically no dependencies on the environment. It's based on a cleaned up entry to the obfuscated C contest. So you can safely assume it's using every dirty trick in the book and then some. It still sounds incredible though.
Introduction
TCCBOOT is a boot loader able to compile and boot a Linux kernel directly from its source code.
TCCBOOT is only 138 KB big (uncompressed code) and it can compile and run a typical Linux kernel in less than 15 seconds on a 2.4 GHz Pentium 4.
TCCBOOT is based on the TinyCC compiler, assembler and linker. TinyCC is an experiment to produce a very small and simple C compiler compatible with the GNU C compiler and binary utilities.
Screenshots
Download
ISO image demonstation: tccboot.iso (5.9 MB).
Create a CD from it and boot it to see TCCBOOT in action (PC with at least 64 MB of RAM required). You can also try it with the QEMU PC emulator.
TCCBOOT source code: tccboot-0.1.tar.gz, and README file.
Non-optimizing compilers can be very fast. Basically you just have to parse it and output pre-defined asm for each bit. According to this page, Turbo C 2.01 (a 1989 product) compiles over 16,000 lines per minute. Given that this number is also on the advertisement shown in that picture, which is actually from that time, it's 16,000 lines on the hardware of that time (i.e. 386). Now IIRC the 386 had at most 33MHz, so from the clock speed difference alone, on an 2.4GHz computer it should compile about 1.16 million lines per second; assuming a factor 4 in efficiency (i.e. modern processors can do 4 times as much per clock cycle as an 386), it should be possible to compile the same amount in 15 seconds. Now according to this page the Linux kernel has 1,526,722 lines of code, so if either my efficiency factor of 4 was too low, or TCC can compile about 1.5 times as fast as Turbo C 2.0 could (or maybe a combination of both), it's clearly not that far-fetched that a linux kernel could be compiled in 15 seconds.
The Tao of math: The numbers you can count are not the real numbers.
- It is not portable (well, technically it is portable, but currently only has an i386 back end).
- It only supports C (not a drawback if you are just compiling C, but a lot of projects use C++/Objective-C/Whatever).
- It produces fairly sub-optimal code. The register allocation done by TCC is not very clever, and it performs no serious optimisation steps.
On the other hand, TCC has two huge advantages:I am TheRaven on Soylent News
Actually the TinyCC site lists a speedchart at http://fabrice.bellard.free.fr/tcc/#speed measurements are done on a 500 MHz K6. That should give you a better idea than just estimating based on Turbo C 2.0