OSDev.org
https://forum.osdev.org/

Creating sysroot and Meaty Skeleton
https://forum.osdev.org/viewtopic.php?f=13&t=56085
Page 1 of 1

Author:  mrjbom [ Sun Jan 09, 2022 2:34 pm ]
Post subject:  Creating sysroot and Meaty Skeleton

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?

Author:  xeyes [ Sun Jan 09, 2022 7:21 pm ]
Post subject:  Re: Creating sysroot and Meaty Skeleton

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).

Author:  mrjbom [ Mon Jan 10, 2022 4:09 am ]
Post subject:  Re: Creating sysroot and Meaty Skeleton

xeyes wrote:
I think your understandings are right.

Thank you for the detailed answer!

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/