Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bootstrapping Gentoo the hard way (fosslinux/live-bootstrap)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 428

PostPosted: Mon Dec 30, 2024 8:20 am    Post subject: Bootstrapping Gentoo the hard way (fosslinux/live-bootstrap) Reply with quote

This post may be more suitable for "other things gentoo" or maybe even "other things open source", but the end goal is having a working amd64 gentoo linux.

Recently I fell down somewhat of a rabbithole of compiler bootstrapping and found the fosslinux/live-bootstrap repository.
In short, the project provides a bootstrap path from hex0 to linux 4.14 and gcc 13.1.

That got me thinking what would it take to bootstrap the system I have now also starting with hex0.
Just to be clear, the idea is not to use a gentoo stage3 tarball, but build everything from source.

I see a few major differences between my amd64 and what:
  • Currently, live-bootstrap only supports x86 systems, while I am on amd64. The first 10 steps of live-bootstrap are very much architecture dependent.
  • live-bootstrap uses musl as its libc instead of gibc.
The libc can be solved by bootstrapping a gentoo prefix - going with the RAP option (USE=prefix).
However, that's still a prefix and not "the real thing".

Question 1: If a gentoo prefix is bootstrapped in a directory that is a separate partition, would it be bootable? I know the prefix does not come with its own kernel, but that's just one additional step and very solvable.

That would be a way to get x86 gentoo from hex0 running as the host OS. What about amd64?
I see two paths forward:
  • After finishing live-bootstrap, make a cross compiler for x86_64, then cross compile the world. crossdev from a previously mentioned prefix could be useful.
  • Implement the first 10 steps such that we end up on an amd64 path instead.
I feel like I am missing something, because live-bootstrap's M2-Planet has the ability to generate amd64 binaries.
I also feel like this is straying far from the purpose of this subforum.

Question 2: Has anyone here considered bootstrapping gentoo without a stage3 tarball?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54661
Location: 56N 3W

PostPosted: Mon Dec 30, 2024 11:57 am    Post subject: Reply with quote

bstaletic,

Building a cross compiles with crossdev, doing the usual setup then cross emerging @system mostly works.

The @system set does not have fully defined dependencies as ...
a) it avoids lots of difficult to break circular dependencies
b) it is assumed to always be present.

As a result, cross emerging @system into an 'empty' target root takes several goes as portage gets the dependency order wrong.

In the days before there was an arm64 stage3, I put arm64 onto a Pi3 like that.

Something similar should be possible with a native install by defining a different install path.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10686
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Dec 30, 2024 5:07 pm    Post subject: Reply with quote

bstaletic wrote:
Question 2: Has anyone here considered bootstrapping gentoo without a stage3 tarball?
Well, yes. Gentoo Release Engineering bootstraps Gentoo as part of making each and every stage3 release. You can use the same tool they use (dev-util/catalyst) if you want, but there are really only two reasons to go through the extra trouble of bootstrapping Gentoo on a fully supported architecture, both of which have the same less difficult alternative:
  1. You want the @system set built with your chosen CFLAGS Instead of the more generic set used by Gentoo Release Engineering, or
  2. You want to save the compile time of a redundant build of (some of) the @system set.
The reason that this isn't done much anymore is that computers are much faster these days so the redundant compile of @system isn't really that burdensome. All you need to do is, at the end of a standard handbook install, run
Code:
emerge -e @system
and you get 100% of the benefits of bootstrapping with a lot less trouble.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54661
Location: 56N 3W

PostPosted: Mon Dec 30, 2024 5:17 pm    Post subject: Reply with quote

John R. Graham,

Code:
/var/db/repos/gentoo/scripts/bootstrap.sh
is still with us too :)

Install a stage 1 tarball.
Run bootstrap.sh and go for a sleep :)

Those with long memories will remember the install guide from 2003 which describes the stage 1, stage2 and stage3 installs.

Readers with nothing better to do may want to try Historical Gentoo.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10686
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Dec 30, 2024 5:22 pm    Post subject: Reply with quote

Wow! I didn't realize that was still there.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 428

PostPosted: Mon Dec 30, 2024 7:39 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Building a cross compiles with crossdev, doing the usual setup then cross emerging @system mostly works.


I couldn't think of a reason why that wouldn't be the case, but cross-compiling has a way of finding bugs in build scripts that assume a bit too much.
Thanks for confirming that!

NeddySeagoon wrote:
The @system set does not have fully defined dependencies as ...
a) it avoids lots of difficult to break circular dependencies
b) it is assumed to always be present.

As a result, cross emerging @system into an 'empty' target root takes several goes as portage gets the dependency order wrong.


Fair enough. I've bumped into this back when I was using Arch while recompiling stuff to switch the init system. That's a different story for another day, though.

John R. Graham wrote:
Gentoo Release Engineering bootstraps Gentoo as part of making each and every stage3 release. You can use the same tool they use (dev-util/catalyst) if you want


I completely forgot catalyst was a thing. Gentoo Release Engineering bootstrapping Gentoo also makes sense.

Jogn R. Graham wrote:
but there are really only two reasons to go through the extra trouble of bootstrapping Gentoo on a fully supported architecture, both of which have the same less difficult alternative:


While I would normally agree with you, this whole idea of mine is mostly an exercise in not trusting binaries and seeing to what extreme can that be taken while still arriving at an up-to-date Gentoo.
That's why I'm talking about bootstrapping instead of emerge -e @system.

NeddySeagoon wrote:
Code:
/var/db/repos/gentoo/scripts/bootstrap.sh


Is that the same script as the one mentioned in bootstrapping gentoo prefix?
Checking...
No, that one is bootstrap-prefix.sh
I guess I have some (bash) reading to do! :D
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54661
Location: 56N 3W

PostPosted: Mon Dec 30, 2024 7:58 pm    Post subject: Reply with quote

bstaletic,

You really need to try Historical Gentoo, since you are set on doing it the hard way. :)

Code:
/var/db/repos/gentoo/scripts/bootstrap.sh
predates prefix by a long way.
I used it in 2003 but it was called /usr/portage/scripts/bootstrap.sh in those days.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1355
Location: Richmond Hill, Canada

PostPosted: Mon Dec 30, 2024 8:20 pm    Post subject: Reply with quote

Thank you for sharing about hex0 and the fosslinux/live-bootstrap.

This is very interesting topic for me.

I wonder if there is simulator project for ARM?
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 428

PostPosted: Mon Dec 30, 2024 8:33 pm    Post subject: Reply with quote

NeddySeagoon,

Well, that made me chuckle. You're not wrong about me doing things the hard way.
You probably don't remember, but you've helped me get static /dev working some 8 years ago.
Static /dev was annoying at time when I'd plug a brand new MCU dev board into a USB port and then figuring out if all /dev nodes are there.
I don't remember /sys/dev being a thing back then, so either the kernel got nicer or I got more experienced.

As for Historical Gentoo, I've read the wiki page before. I had fun reading it, too. The only intimidating part would be XFree86 config.
XFree86 had its final release about the same time I had installed my first linux distro. The licensing controversy was definitely during the period where all I knew about linux is "it is rumoured to be lighter than windows".
On the other hand, man 5 XF86Config suggests big overlap with xorg.conf. That brings two thoughts to my head:
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54661
Location: 56N 3W

PostPosted: Mon Dec 30, 2024 8:52 pm    Post subject: Reply with quote

bstaletic,

Only some names have changed :)
Otherwise, its the same.

The warning from the old days about CRT displays still applies.
Get the Horz line rate wrong and you can let the magic smoke out.
Do you still have a CRT display?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 428

PostPosted: Mon Dec 30, 2024 9:27 pm    Post subject: Reply with quote

@pingtoo I have not found a similar project for arm. Look at live-bootstrap forks, there might be some hidden gems there.

@NeddySeagoon
Wait, what warning about Hz and CRTs? Last CRT I had was back in elementary school, I think.

I do have a microwave oven. Maybe I could solder an HDMI cable to whatever generates the microwaves and configure XFree86 for that?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22909

PostPosted: Mon Dec 30, 2024 9:58 pm    Post subject: Reply with quote

Some CRT monitors (maybe all, I don't know) were reported to lack any sort of hardware/firmware safety on input validation, so a misconfigured PC could instruct the monitor to use impossible operational parameters, and rather than blank out or use the safest approximation, the monitor would do its best to comply with the invalid settings, even when that would destroy the hardware.

You may have seen reports that one of the recent Apple devices has a similar omission in its sound hardware. Playing the wrong type of sound will cause its speakers to heat themselves to death. Asahi Linux has been very cautious in introducing audio support on that platform because of the potential to destroy hardware if the software makes a mistake.

The same problem applies to old CRT monitors, except that on those, there is no software level safety to protect you if you make a major mistake. Hence, use caution unless you are sure your monitor will gracefully reject impossible requests.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54661
Location: 56N 3W

PostPosted: Tue Dec 31, 2024 12:24 pm    Post subject: Reply with quote

bstaletic,

CRT displays used to have the final anode (EHT) voltage derived from the line scan.
The line frequency is one of the knobs you define to configure X.

Too high a number could result in too high an EHT voltage.
As Hu says, there was no protection to start with.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 2056

PostPosted: Tue Dec 31, 2024 3:43 pm    Post subject: Reply with quote

I believe some of the people in #bootstrappable on libera.chat have used live-bootstrap to build a stage3 and have script(s) for it. See https://mid-kid.root.sx/git/mid-kid/bootstrap/src/branch/master/gentoo-2024.8

I have more thoughts on this overall but I'm a bit too tired to write them up today.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum