OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 5:37 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Creating sysroot and Meaty Skeleton
PostPosted: Sun Jan 09, 2022 2:34 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 291
I've completed Bare Bones and now I'm getting to Meaty Skeleton.
I have read the article several times and would like to make sure that I understood everything correctly.

As far as I understand, now my task is to create a properly organized sysroot folder, which will later be used by "Hosted GCC" to compile user space programs for my OS.

My sysroot should contain the files necessary for "Hosted GCC", and have this structure:
/sysroot/usr/include - contains header files with declarations of functions in user space to be used Hosted by GCC when generating programs(for example stdio.h or stdlib.h)
/sysroot/usr/lib - contains the object file libc.a code containing functions to user space(for example, malloc()), which, when you create a user-space programs will be linked to the program

The subsequent work boils down to implementing the user space functions and combining them into libc.a

Right?


Top
 Profile  
 
 Post subject: Re: Creating sysroot and Meaty Skeleton
PostPosted: Sun Jan 09, 2022 7:21 pm 
Offline
Member
Member

Joined: Mon Dec 07, 2020 8:09 am
Posts: 212
I think your understandings are right.

As per my understanding, besides the kernel, there are a few large pieces in the puzzle of beginning to port/write user space programs "properly".

1. libc

Shared by the build machine and host (yourOS) "boils down to implementing the user space functions" summarizes it perfectly.

2. hosted toolchain

This toolchain can only run in the host (yourOS) unless yourOS happen to have the exact same interfaces and environments as the build machine.

3. cross compile toolchain

This toolchain can only run in the build machine unless yourOS happen to have the exact same interfaces and environments as the build machine.


Note that 2 is a strange beast, since 3 is needed to build it so you'd have 3 already at the point of having 2.

Although, 3 is going to be better featured, more correct, more stable, likely easier to use, and possibly faster than 2 for a long time (until your kernel has similar levels of capabilities as a *nix kernel in all areas that a build toolchain would care about).


Top
 Profile  
 
 Post subject: Re: Creating sysroot and Meaty Skeleton
PostPosted: Mon Jan 10, 2022 4:09 am 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 291
xeyes wrote:
I think your understandings are right.

Thank you for the detailed answer!


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 8 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