Funtoo:Metro/Evolved Bootstrap

From Funtoo
< Funtoo:Metro
Revision as of 03:25, October 18, 2022 by Drobbins (talk | contribs) (→‎Evolved Bootstrap)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page documents how to use Funtoo from Scratch, aka Evolved Boostrap to create a stage1 that is then fed to metro to build a stage3. This is an advanced functionality that ties together our Funtoo from Scratch effort under Evolved Bootstrap with our official Metro stage builder, allowing a Funtoo stage3 to be built that is not based on a pre-existing Funtoo system.

Evolved Bootstrap

The Evolved Bootstrap project allows for the creation of a stage1 Funtoo tarball completely from a non-Funtoo/non-Gentoo environment, fully cross-compiled and from scratch. Once the stage1 is created, it can be fed to Metro which will turn it into a stage3. But first, we need the bootstrapped stage1.

In order to create a stage1 tarball using Evolved Bootstrap, you will want to follow the instructions located at Use the LXD setup instructions to successfully complete a GNU build, as follows:

user $ cd ~/ffs
user $ ci/lxd-baremetal/bin/ffs gnu x86-64bit

Once the build completes successfully, a stage1 will have been built, but is not (yet) automatically captured into a tarball. To do this, you will need to enter the container to grab it:

user $ lxc exec ffs-drobbins-x86-64bit-gnu-test -- /bin/bash --login
container # cd /root/ffs-repo/tmp/stage1root
container # tar cvf /var/tmp/stage1.tar --xattrs --acls .
container # exit
user $ lxc file pull ffs-drobbins-x86-64bit-gnu-test/var/tmp/stage1.tar .
user $ scp -C /var/tmp/stage1.tar root@metro-host:/var/tmp/

You now have a stage1.tar next-release tarball outside of the container, which can then be copied to a system set up with Metro, and used to seed a Metro build, which we will cover next.

Seeding Metro

You will need a system set up to run Metro. The typical way you want to use this is to follow the Initial Setup instructions, and initialize Metro to build a generic_64 next-release build for x86-64bit. Assuming you have this set up in /home/mirror/funtoo/next/x86-64bit/generic_64, which is the default location, here is how you will set up Metro to use your stage1. Replace 2022-10-10 with the current date on your Linux system:

root # cd /home/mirror/funtoo/next/x86-64bit/generic_64
root # mkdir 2022-10-10 
root # mv /var/tmp/stage1.tar stage1-generic_64-next-2022-10-10.tar

For this to work, the name of the stage1 must match the specific expected name above, which is in the format stage1-subarch-release-date.tar. That's it! What we have done is set up Metro so that it thinks it has already built a valid stage1, so if we run the build script, this artifact will not be rebuilt -- and it will proceed to use the stage1 to build a stage2, and use the stage2 to build a stage3. Perform this build by running the following command:

root # cd /root/metro/scripts
root # ./ next x86-64bit generic_64 full

Metro will proceed to build the stage2 and stage3, and you can follow the logs at /home/mirror/funtoo/next/x86-64bit/generic_64/2022-10-10/log/stage2.log.