OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Sep 21, 2021 9:37 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: TCCBoot , How-To
PostPosted: Thu Aug 05, 2021 12:57 am 
Offline

Joined: Wed Mar 10, 2021 5:03 am
Posts: 8
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 ?


Top
 Profile  
 
 Post subject: Re: TCCBoot , How-To
PostPosted: Sat Aug 07, 2021 10:50 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1791
Location: Athens, GA, USA
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
μή εἶναι βασιλικήν ἀτραπόν ἐπί γεωμετρίαν
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.


Top
 Profile  
 
 Post subject: Re: TCCBoot , How-To
PostPosted: Tue Aug 10, 2021 3:59 am 
Offline
User avatar

Joined: Tue Jul 05, 2011 5:17 am
Posts: 8
Location: Delft, Netherlands
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.


Top
 Profile  
 
 Post subject: Re: TCCBoot , How-To
PostPosted: Tue Aug 10, 2021 4:18 am 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 492
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.

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
 Post subject: Re: TCCBoot , How-To
PostPosted: Tue Aug 10, 2021 5:28 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4237
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: TCCBoot , How-To
PostPosted: Tue Aug 10, 2021 6:16 am 
Online
Member
Member

Joined: Tue Apr 03, 2018 2:44 am
Posts: 238
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?


Top
 Profile  
 
 Post subject: Re: TCCBoot , How-To
PostPosted: Tue Aug 10, 2021 6:22 am 
Offline
User avatar

Joined: Tue Jul 05, 2011 5:17 am
Posts: 8
Location: Delft, Netherlands
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"


Top
 Profile  
 
 Post subject: Re: TCCBoot , How-To
PostPosted: Tue Aug 10, 2021 8:21 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4237
Location: Chichester, UK
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group