Page 1 of 1
TCCBoot , How-To
Posted: Thu Aug 05, 2021 12:57 am
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 ?
Re: TCCBoot , How-To
Posted: Sat Aug 07, 2021 10:50 am
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.
Re: TCCBoot , How-To
Posted: Tue Aug 10, 2021 3:59 am
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.
Re: TCCBoot , How-To
Posted: Tue Aug 10, 2021 4:18 am
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.
Re: TCCBoot , How-To
Posted: Tue Aug 10, 2021 5:28 am
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.
Re: TCCBoot , How-To
Posted: Tue Aug 10, 2021 6:16 am
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?
Re: TCCBoot , How-To
Posted: Tue Aug 10, 2021 6:22 am
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"
Re: TCCBoot , How-To
Posted: Tue Aug 10, 2021 8:21 am
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.