TCCBoot , How-To

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
Cdev
Posts: 8
Joined: Wed Mar 10, 2021 5:03 am

TCCBoot , How-To

Post by Cdev »

Is there detailed documentation for how to compile and use TCCBoot ?

I wish to write an x86/x86_64 kerne in C source and have the compiler compile it and run it at bootup. How practical is this goal ?
Is the project still maintained ?
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: TCCBoot , How-To

Post by Schol-R-LEA »

Just to be clear, I assume you mean this project? I don't know if it is maintained anywhere, though there are at least two GitHub here and here, both of which are over five years old. The main project itself dates to 2004, which makes it unlikely that Bellard ever added support for x86-64 to TinyCC.

Perhaps someone else here is more familiar with TinyCC and TCCBoot.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
Wukl
Posts: 8
Joined: Tue Jul 05, 2011 5:17 am
Location: Delft, Netherlands
Contact:

Re: TCCBoot , How-To

Post by Wukl »

Schol-R-LEA wrote:The main project itself dates to 2004, which makes it unlikely that Bellard ever added support for x86-64 to TinyCC.
Tinycc development is still active here: https://repo.or.cz/w/tinycc.git

It's probably doable for your own OS, as long as you target C89 or tcc specifically from the beginning. You'll need a bootstrap C library and some form of initramfs for the compiler to find its libraries and headers, or patch it so that the files are supplied from memory. Doing this from UEFI may be an interesting project...

I wouldn't recommend updating TCCBoot to a modern (x86-64) kernel. You'll need to re-do most of the patches of the kernel and have a good grasp of both C and the Linux kernel to make it work.
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: TCCBoot , How-To

Post by klange »

Schol-R-LEA wrote:Perhaps someone else here is more familiar with TinyCC and TCCBoot.
While tccboot itself isn't really maintained, tcc has seen very active development since then and has backends for x86-64, arm (32 and 64), and riscv64.
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: TCCBoot , How-To

Post by iansjack »

I may be missing something, but can anyone explain to me what the point of this project is?

I think I understand what it does, but I don't understand why.
thewrongchristian
Member
Member
Posts: 425
Joined: Tue Apr 03, 2018 2:44 am

Re: TCCBoot , How-To

Post by thewrongchristian »

iansjack wrote:I may be missing something, but can anyone explain to me what the point of this project is?

I think I understand what it does, but I don't understand why.
Just because?

I think the original point was to demonstrate how fast TCC is at compiling. What better demonstration than compiling and running a linux kernel at boot?
User avatar
Wukl
Posts: 8
Joined: Tue Jul 05, 2011 5:17 am
Location: Delft, Netherlands
Contact:

Re: TCCBoot , How-To

Post by Wukl »

iansjack wrote:I may be missing something, but can anyone explain to me what the point of this project is?

I think I understand what it does, but I don't understand why.
TCCBoot was mostly to show off Tinycc. It's tiny, fast, versatile and complete enough to compile Linux in a very restricted environment. (I once used tcc inside a Java process to create very specific Linux ELF executables on a variety of platforms. Yes, it's a strange application of both Java and tcc, but it beats shipping Docker-like containers or a bunch of Binutils+GCC builds for the same set of platforms.)

It's also just a neat project. You effectively turn the kernel into a boot-time script. I think a lot of the projects on this site don't really have a point (mine at least doesn't) and that the question should rather be "why not".

Edit: clarify "shipping containers"
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: TCCBoot , How-To

Post by iansjack »

thewrongchristian wrote:Just because?
Ah. I understand that, and I guess it's the same reasoning that makes many want to write their own boot loader rather than using one of the tried and tested ones.

I'd rather hoped their might be more to it than that. But it probably explains why it hasn't been developed further.

I'd say this was a General Programming question rather than OS Design & Theory.
Post Reply