LinuxDevices.com Archive Index (1999-2012) | 2013-current at LinuxGizmos.com | About  
Follow LinuxGizmos:
Twitter Google+ Facebook RSS feed

Open source compiler demos speed, compactness with boottime compile trick

Oct 28, 2004 — by Henry Kingman — from the LinuxDevices Archive
Share this: Tweet about this on TwitterGoogle+Share on FacebookShare on LinkedInShare on RedditPin on Pinterest

A project to build a C compiler small enough to enable C to be used as a scripting language has released an impressive technology demonstration: a bootloader that uses the Tiny C Compiler (TCC) to compile a Linux kernel from source at boot-time in as little as 15 seconds.

TCCBoot is framed on creator Fabrice Bellard's website as a demonstration application for Bellard's Tiny C Compiler (TCC), described as “a tiny but complete ISOC99 C compiler which enables you to use C as scripting language.” According to Bellard, TCC is several times faster than gcc, produces optimized code, and is small enough “(about 100KB for x86 TCC executable, including C preprocessor, C compiler, assembler and linker)” to be used on rescue disks, among other features.

TCCBoot is distributed as an ISO image, as well as source code. The ISO image can be burned onto a CD and used to boot x86 PCs. The CD first loads an initrd filesystem on which kernel C and assembly code have been stashed in a gzipped ROMFS. It then reads a TCC config file before compiling a binary kernel image. the image is then booted, leaving the user in a rudimentary Linux environment featuring a very basic shell with benchmarking software.

We couldn't resist trying it. The whole boot process took about 45 seconds, including 33 seconds of compile time, on a 1.6GHz Pentium M.

Project creator Fabrice Bellard writes, “It is sure that there are still many bugs in the kernel generated by TinyCC/TCCBOOT, but at least it can boot and launch a shell.”

Among Bellard's other accomplishments are a victory in a 1997 “obfuscated C” programming contest, and the creation of the “most efficient formula to date to compute the nth binary digits of Pi.” Bellard also made significant contributions to a project to create GPL support for Memory Technology Devices (MTD) DiskOnChip technology.

More details about TCC, TCCBoot and Bellard's other interesting projects are available on his website.


 
This article was originally published on LinuxDevices and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.

(advertise here)


Comments are closed.