Browse Source

Fix gentoo notes as per my latest install

master
mid-kid 4 years ago
parent
commit
52f574d5b7
  1. 1
      gcc/notes/gentoo/gentoo.sha1
  2. 1
      gcc/notes/gentoo/gentoo.wget-list
  3. 1
      gcc/notes/gentoo/gentoo_gen.sh
  4. 96
      gcc/notes/gentoo/gentoo_notes.txt
  5. 116
      gcc/notes/gentoo/gentoo_notes_lfs.txt
  6. 182
      gcc/notes/gentoo/gentoo_notes_nogcc.txt

1
gcc/notes/gentoo/gentoo.sha1

@ -1,3 +1,4 @@
9a923237a1a1d3d4005d5676e25072a2d1f66af1 baselayout-2.7.tar.bz2
534c7ee46331ff1f1fc96a378fd6a9f6b322a242 bison-3.7.1.tar.xz 534c7ee46331ff1f1fc96a378fd6a9f6b322a242 bison-3.7.1.tar.xz
f17235bc9c3aec538065a655681815c242a6d7d5 ca-certificates_20200601.tar.xz f17235bc9c3aec538065a655681815c242a6d7d5 ca-certificates_20200601.tar.xz
8df6cb570c8d6596a67d1c0773bf00650154f7aa libffi-3.3.tar.gz 8df6cb570c8d6596a67d1c0773bf00650154f7aa libffi-3.3.tar.gz

1
gcc/notes/gentoo/gentoo.wget-list

@ -1,3 +1,4 @@
https://gitweb.gentoo.org/proj/baselayout.git/snapshot/baselayout-2.7.tar.bz2
https://tukaani.org/xz/xz-5.2.5.tar.gz https://tukaani.org/xz/xz-5.2.5.tar.gz
https://zlib.net/zlib-1.2.11.tar.gz https://zlib.net/zlib-1.2.11.tar.gz
https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz

1
gcc/notes/gentoo/gentoo_gen.sh

@ -6,6 +6,7 @@ set -e
root="${1:-/}" root="${1:-/}"
pkgs=" pkgs="
sys-apps/baselayout
app-arch/xz-utils app-arch/xz-utils
sys-libs/zlib sys-libs/zlib
dev-libs/libffi dev-libs/libffi

96
gcc/notes/gentoo/gentoo_notes.txt

@ -1,4 +1,4 @@
Based on portage-3.0.8 and gentoo-20201031 snapshot Based on portage-3.0.8 and gentoo-20201101 snapshot
The specifics of this document (software versions and whatnot) are subject to The specifics of this document (software versions and whatnot) are subject to
change as gentoo evolves, but I hope the big lines of it won't change too change as gentoo evolves, but I hope the big lines of it won't change too
@ -12,15 +12,18 @@ architectures, but this guide won't go into detail.
You should be running a system with a x86_64 kernel (with i686 support). You should be running a system with a x86_64 kernel (with i686 support).
Install the required sources (listed in gentoo.wget-list) into /sources. Install the required sources (listed in gentoo.wget-list) into /sources.
Before entering the system, create the basic directory layout by unpacking
the baselayout tarball, and running:
make layout OS=Linux DESTDIR=<ROOT>
NOTE: In the future this might have to become `layout-usrmerge`
To enter the bootstrap system as a chroot, use the following commands to set To enter the bootstrap system as a chroot, use the following commands to set
up the filesystems and entering: up the filesystems and entering:
mkdir -p proc sys dev tmp
mount -t proc proc proc mount -t proc proc proc
mount -t sysfs sysfs sys mount -t sysfs sysfs sys
mount -t devtmpfs devtmpfs dev mount -t devtmpfs devtmpfs dev
mount -t devpts devpts dev/pts mount -t devpts devpts dev/pts
mount -t tmpfs tmpfs dev/shm mount -t tmpfs tmpfs dev/shm
mkdir -p etc
touch etc/resolv.conf touch etc/resolv.conf
mount --bind /etc/resolv.conf etc/resolv.conf mount --bind /etc/resolv.conf etc/resolv.conf
./bootstrap/bin/chroot . /bootstrap/bin/env -i PATH=/bin:/sbin:/usr/bin:/usr/sbin:/bootstrap/bin:/bootstrap/sbin HOME=/root /bootstrap/bin/sh -l ./bootstrap/bin/chroot . /bootstrap/bin/env -i PATH=/bin:/sbin:/usr/bin:/usr/sbin:/bootstrap/bin:/bootstrap/sbin HOME=/root /bootstrap/bin/sh -l
@ -29,23 +32,24 @@ To install all the prerequisite tools, place the sources (listed in
gentoo.wget-list) under /sources, then run the gentoo_tools.sh script. gentoo.wget-list) under /sources, then run the gentoo_tools.sh script.
Configure portage: Configure portage:
echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd echo "portage:x:250:250:portage:/var/tmp/portage:/bin/false" > /etc/passwd
echo "root:x:0:root" > /etc/group echo "portage::250:portage" > /etc/group
echo "portage:x:250:250:portage:/var/tmp/portage:/bin/false" >> /etc/passwd
echo "portage::250:portage" >> /etc/group
echo "C UTF-8" > /etc/locale.gen echo "C UTF-8" > /etc/locale.gen
mkdir -p /tmp /root
chown root.root /tmp /root
chmod 1777 /tmp
chmod 0700 /root
cat > /etc/portage/make.conf << 'EOF' cat > /etc/portage/make.conf << 'EOF'
FEATURES='-pid-sandbox -news' FEATURES='-pid-sandbox -news'
ROOTPATH=/bootstrap/bin:/bootstrap/sbin ROOTPATH=/bootstrap/bin:/bootstrap/sbin
EOF EOF
ln -sf ../../var/db/repos/gentoo/profiles/default/linux/amd64/17.1/ /etc/portage/make.profile ln -sf ../../var/db/repos/gentoo/profiles/default/linux/amd64/17.1/ /etc/portage/make.profile
NOTE: You can copy the ebuild repository archive, gpgsig and md5sum to
/var/cache/distfiles to avoid downloading.
Install ebuild repository (pick appropriate date, see distfiles.gentoo.org/snapshots): Install ebuild repository (pick appropriate date, see distfiles.gentoo.org/snapshots):
emerge-webrsync -v --revert=20201031 emerge-webrsync -k -v --revert=20201101
Install baselayout:
emerge -O1 sys-apps/baselayout
cp /usr/share/baselayout/{passwd,group} /etc/
Install some ebuild prerequisites: Install some ebuild prerequisites:
emerge -O1 sys-apps/gentoo-functions # Used by elt-patches and a ton of other things emerge -O1 sys-apps/gentoo-functions # Used by elt-patches and a ton of other things
@ -66,24 +70,22 @@ the change from /bootstrap to /usr, as well as the multilib libdir changes, so
for simplicity's sake, I won't bother. This just works™. for simplicity's sake, I won't bother. This just works™.
Install temporary libc files for target compiler: Install temporary libc files for target compiler:
mkdir -p /lib64 /lib
ln -sf /bootstrap/lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 ln -sf /bootstrap/lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
ln -sf /bootstrap/lib32/ld-linux.so.2 /lib/ld-linux.so.2 ln -sf /bootstrap/lib32/ld-linux.so.2 /lib/ld-linux.so.2
mkdir -p /usr/include
ln -sf /bootstrap/include/limits.h /usr/include/limits.h
mkdir -p /usr/lib64 /usr/lib
ln -sf /bootstrap/lib/{crti,crtn,Scrt1}.o \ ln -sf /bootstrap/lib/{crti,crtn,Scrt1}.o \
/bootstrap/lib/{libc,libm,libpthread}.so /usr/lib64/ /bootstrap/lib/{libc,libm,libpthread}.so /usr/lib64/
ln -sf /bootstrap/lib32/{crti,crtn,Scrt1}.o \ ln -sf /bootstrap/lib32/{crti,crtn,Scrt1}.o \
/bootstrap/lib32/{libc,libm,libpthread}.so /usr/lib/ /bootstrap/lib32/{libc,libm,libpthread}.so /usr/lib/
mkdir -p /usr/include
ln -sf /bootstrap/include/limits.h /usr/include/limits.h
Install binutils+GCC (linked against /bootstrap): Install binutils+GCC (linked against /bootstrap):
USE='-*' emerge -O1 sys-devel/binutils USE='-*' emerge -O1 sys-devel/binutils
USE='-* static-libs' EXTRA_ECONF=--disable-shared \ USE='-* static-libs' EXTRA_ECONF=--disable-shared \
CPPFLAGS='-isystem/usr/include' LDFLAGS='-L/usr/lib64 -L/usr/lib' \ CPPFLAGS='-I/usr/include' LDFLAGS='-L/usr/lib64 -L/usr/lib' \
emerge -O1 dev-libs/gmp dev-libs/mpfr dev-libs/mpc emerge -O1 dev-libs/gmp dev-libs/mpfr dev-libs/mpc
USE='-*' EXTRA_ECONF=--disable-bootstrap GCC_MAKE_TARGET=all \ USE='-*' EXTRA_ECONF=--disable-bootstrap GCC_MAKE_TARGET=all \
CPPFLAGS='-isystem/usr/include' LDFLAGS='-L/usr/lib64 -L/usr/lib' \ CPPFLAGS='-I/usr/include' LDFLAGS='-L/usr/lib64 -L/usr/lib' \
CPATH=/bootstrap/include \ CPATH=/bootstrap/include \
emerge -O1 sys-devel/gcc emerge -O1 sys-devel/gcc
emerge --rage-clean dev-libs/gmp dev-libs/mpfr dev-libs/mpc emerge --rage-clean dev-libs/gmp dev-libs/mpfr dev-libs/mpc
@ -133,22 +135,16 @@ gzip, grep, and other tools, they're still required for some reason.
From this point onward, you're pretty much on your own to beat portage into From this point onward, you're pretty much on your own to beat portage into
performing an `emerge -e @system` and fixing any unspecified dependencies you performing an `emerge -e @system` and fixing any unspecified dependencies you
encounter along the way. This can be done in a whole number of ways, and will encounter along the way. This can be done in a whole number of ways, and will
differ on any given day, since this is painfully unsupported by gentoo devs. differ on any given day, since this method of bootstrapping is painfully
Because the order in which you install everything can differ wildly, and unsupported by gentoo devs. Below I detail my most recent procedure, which, I
consequently affect the output of your build, it is advised to do a second can't stress enough, may or may not work at the time you're reading this.
`emerge -e @system` afterwards, for sanity. Below I detail my most recent
procedure, which, I can't stress enough, may or may not work at the time
you're reading this.
Fix circular dependencies: Fix circular dependencies:
USE=-filecaps emerge -O1 sys-libs/pam USE=-filecaps emerge -O1 sys-libs/pam
USE='-acl -xattr' emerge -O1 sys-apps/shadow # required by acct-group/acct-user USE='-acl -xattr' emerge -O1 sys-apps/shadow # required by acct-group/acct-user
Verify there's no circular deps left, for sanity:
emerge -fe @system
Build everything: Build everything:
emerge -e @system emerge -be @system
Clean up bootstrap tools/configs: Clean up bootstrap tools/configs:
rm -rf /bootstrap /sources rm -rf /bootstrap /sources
@ -158,30 +154,44 @@ Reinitialize environment:
env-update env-update
exec bash -l exec bash -l
Consider rebuilding everything again without /bootstrap, since a lot of NOTE: Re-entering chroot after this point:
packages couldn't be properly stripped, and a bunch of other tools have been chroot . /usr/bin/env -i /bin/su -l
upgraded, during the first emerge -e @system: NOTE: Cleaning up the chroot:
umount -R proc sys dev etc/resolv.conf
(optional) consider rebuilding everything again without /bootstrap, to ensure sanity:
emerge -be @system emerge -be @system
To install everything into a clean root: To install everything into a clean root:
ROOT=/final emerge -K @system USE=build emerge --root /final sys-apps/baselayout
emerge --root /final -K -j$(nproc) @system
#emerge --root /final --sysroot /final -K --with-bdeps=y --root-deps -j$(nproc) @system
TODO: How to forcefully install _everything_
Now you're essentially done. You can move /final (as well as /var/db/repos,
/var/cache/distfiles and /var/cache/binpkgs) to a proper disk and start using
it, or copy the built binpkgs to an existing install and install them. This
guide will further go over how to make a stage3 and install CD, in case you're
installing a new machine, or just want to know how that's done.
Prepare files for catalyst: Prepare files for catalyst:
mkdir -p /var/tmp/catalyst/snapshots
wget -O gentoo-latest.tar.xz http://distfiles.gentoo.org/snapshots/gentoo-latest.tar.xz
mkdir -p /var/tmp/catalyst/builds/default mkdir -p /var/tmp/catalyst/builds/default
cd /var/tmp/catalyst/builds/default cd /var/tmp/catalyst/builds/default
tar -C /final -cf stage3-amd64-latest.tar . tar -C /final -cf stage3-amd64-latest.tar .
xz -9v stage3-amd64-latest.tar
rm -rf /final rm -rf /final
wget -O stage1.spec "https://gitweb.gentoo.org/proj/releng.git/plain/releases/specs/amd64/stage1.spec"
wget -O stage2.spec "https://gitweb.gentoo.org/proj/releng.git/plain/releases/specs/amd64/stage2.spec" # Adjust to hash relevant for portage tree date, see https://gitweb.gentoo.org/proj/releng.git/log/
wget -O stage3.spec "https://gitweb.gentoo.org/proj/releng.git/plain/releases/specs/amd64/stage3.spec" wget https://gitweb.gentoo.org/proj/releng.git/snapshot/releng-0430f1f0ced5a3137f284ec426b7431be7d53085.tar.bz2
sed -i -e 's/@TIMESTAMP@/latest/' -e '/^portage_confdir: /d' *.spec tar xf releng-*.tar.bz2
cd releng-*/
sed -i -e 's:@TIMESTAMP@:now:g' -e "s:@REPO_DIR@:$PWD:g" releases/specs/amd64/*.spec
cd releases/specs/amd64
Build the stage3: Build the stage3:
emerge catalyst emerge dev-util/catalyst app-arch/pixz
catalyst -f stage1.spec catalyst -s now
catalyst -f stage1.spec && catalyst -f stage2.spec && catalyst -f stage3.spec
rm -f /var/tmp/catalyst/builds/default/stage3-amd64-latest.tar
Clean up chroot: Build the install CD (failed at time of writing, see https://bugs.gentoo.org/713946):
umount -R proc sys dev etc/resolv.conf catalyst -f installcd-stage1.spec && catalyst -f installcd-stage2-minimal.spec

116
gcc/notes/gentoo/gentoo_notes_lfs.txt

@ -1,116 +0,0 @@
This is done in a chroot, from a 10.0 chapter 7 system. To do this on a live
system, you'll need a kernel, initscripts, and some way to connect to the
internet, such as iproute+dhcpcd.
Make sure you bind-mount your host's /etc/resolv.conf to the chroot, such as:
touch $LFS/etc/resolv.conf
mount -v --bind /etc/resolv.conf $LFS/etc/resolv.conf
This will allow programs to resolve DNS names, which is necessary to download things.
Also mount /dev/shm, in addition to the mounts in chapter 7.3:
mount -t tmpfs tmpfs $LFS/dev/shm
Run the following chapters (avoid tests and docs):
- 8.9. Zlib-1.2.11
- 8.10. Bzip2-1.0.8
- 8.34. Bash-5.0
- 8.47. Libffi-3.3
- 8.48. OpenSSL-1.1.1g
- 8.49. Python-3.8.5 (!--with-system-expat --without-ensurepip)
Symlink python3:
ln -sf python3 /usr/bin/python
Install ca-certificates:
make
mkdir -p /usr/share/ca-certificates
make install
( cd /usr/share/ca-certificates
find . -name '*.crt' | LC_ALL=C sort | cut -b3-
) > /etc/ca-certificates.conf
mkdir -p /etc/ssl/certs
update-ca-certificates
Install wget:
./configure --prefix=/usr --sysconfdir=/etc --with-ssl=openssl --with-libssl-prefix=/usr
make
make install
Install portage (https://wiki.gentoo.org/wiki/Portage#Tarball):
python setup.py install
echo "portage:x:250:250:portage:/var/tmp/portage:/bin/false" >> /etc/passwd
echo "portage::250:portage" >> /etc/group
Install repository (https://bouncer.gentoo.org/fetch/root/all/snapshots/, grab gentoo-*.tar.xz):
rm -rf /var/db/repos
mkdir -p /var/db/repos
mv gentoo-*/ /var/db/repos/gentoo
Configure portage:
mkdir -p /etc/portage
ln -sf ../../var/db/repos/gentoo/profiles/default/linux/amd64/17.1/ /etc/portage/make.profile
emerge -O1 sys-apps/baselayout
. /etc/profile
cat /var/lib/gentoo/news/news-gentoo.unread >> /var/lib/gentoo/news/news-gentoo.read
rm /var/lib/gentoo/news/news-gentoo.unread
touch /var/lib/gentoo/news/news-gentoo.unread
dispatch-conf
Bootstrap multilib compiler:
emerge -O1 sys-apps/gentoo-functions sys-devel/binutils-config sys-devel/gcc-config app-portage/elt-patches sys-devel/binutils dev-libs/gmp dev-libs/mpfr dev-libs/mpc
emerge -Of sys-devel/gcc
tar xf /var/cache/distfiles/gcc-*.tar.* && cd gcc-*/ && mkdir build && cd build
mkdir -p /tmp/gcc/include
touch /tmp/gcc/include/limits.h
../configure --prefix=/usr --with-local-prefix=/tmp/gcc --with-newlib --without-headers --disable-shared --disable-threads --disable-bootstrap --enable-multilib --enable-languages=c,c++
make all-gcc all-target-libgcc
make install-gcc install-target-libgcc
rm -rf /tmp/gcc
cd ../.. && rm -rf gcc-*/
Remove use of gcc-multilib-bootstrap, since that defeats the point of building
everything from source, and we don't need it with this hack:
cd /var/db/repos/gentoo/sys-libs/glibc
cp -u glibc-2.31-r6.ebuild{,.orig}
sed -e '/gcc-multilib-bootstrap/d' glibc-2.31-r6.ebuild.orig > glibc-2.31-r6.ebuild
ebuild glibc-2.31-r6.ebuild manifest
PYTHON_COMPAT_OVERRIDE=python3 emerge -O1 sys-libs/glibc
...in case of downgrade, reinstall any LFS programs that broke (using the
/tools toolchain?) until portage works again, and reinstall glibc, run
ldconfig and fix all warnings.
Alternatively, build LFS with an older glibc or unmask the same glibc version
that LFS has...
Clean up glibc modifications:
cd /var/db/repos/gentoo/sys-libs/glibc
mv glibc-2.31-r6.ebuild.orig glibc-2.31-r6.ebuild
ebuild glibc-2.31-r6.ebuild manifest
Not sure if this is necessary if not downgrading, but for good measure:
tar xf /var/cache/distfiles/gcc-*.tar.* && cd gcc-*/ && mkdir build && cd build
../libstdc++-v3/configure --prefix=/usr --enable-multilib
make
make install
cd ../.. && rm -rf gcc-*/
emerge -O1 sys-devel/gcc
PYTHON_COMPAT_OVERRIDE=python3 emerge -O1 sys-libs/glibc # might be necessary to merge _after_ pax-utils?
Bootstrap rest of system:
emerge -O1 sys-libs/libseccomp app-misc/pax-utils # required by at least ncurses and sandbox
emerge -O1 sys-apps/sandbox
USE=-acl emerge -O1 sys-devel/gettext # circular dep, bundles libxml2, abusing this fact...
USE=-acl emerge -O1 net-misc/rsync # required by linux-headers
emerge -O1 dev-util/pkgconf # required by pax-utils
cd /var/db/repos/gentoo/scripts
./bootstrap.sh
USE=-pam emerge -O1 sys-libs/libcap # circular dep
USE='-acl -xattr -pam' emerge -O1 sys-apps/shadow # required by acct-group
emerge -abe @system
Unpollute the system by installing it somewhere else:
ROOT=/final emerge -K @system

182
gcc/notes/gentoo/gentoo_notes_nogcc.txt

@ -1,182 +0,0 @@
Based on portage-3.0.8 and gentoo-20201029
The specifics of this document (software versions and whatnot) are subject to
change as gentoo evolves, but I hope the big lines of it won't change too
much.
This guide starts off with a system built from build_cross.sh, built for
x86_64 with i686 multilib.
It might be possible to adapt both that script, and this guide for other
architectures, but this guide won't go into detail.
You should be running a system with a x86_64 kernel (with i686 support).
Install the required sources (outlined in gentoo.wget-list) into /sources.
To enter the bootstrap system as a chroot, use the following commands to set
up the filesystems and entering:
mkdir -p proc sys dev tmp
mount -t proc proc proc
mount -t sysfs sysfs sys
mount -t devtmpfs devtmpfs dev
mount -t devpts devpts dev/pts
mount -t tmpfs tmpfs dev/shm
mkdir -p etc
touch etc/resolv.conf
mount --bind /etc/resolv.conf etc/resolv.conf
./bootstrap/bin/chroot . /bootstrap/bin/env -i PATH=/bin:/sbin:/usr/bin:/usr/sbin:/bootstrap/bin:/bootstrap/sbin HOME=/root /bootstrap/bin/sh -l
To install all the prerequisite tools, place the sources (listed in
gentoo.wget-list) under /sources, then run the gentoo_tools.sh script.
Install ebuild repository:
tar xf gentoo-*.tar.xz
mkdir -p /var/db/repos/
mv gentoo-*/ /var/db/repos/gentoo
Configure portage:
echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd
echo "root:x:0:root" > /etc/group
echo "portage:x:250:250:portage:/var/tmp/portage:/bin/false" >> /etc/passwd
echo "portage::250:portage" >> /etc/group
mkdir -p /tmp /root
chown root.root /tmp /root
chmod 1777 /tmp
chmod 0700 /root
ln -sf ../../var/db/repos/gentoo/profiles/default/linux/amd64/17.1/ /etc/portage/make.profile
cat > /etc/portage/make.conf << 'EOF'
FEATURES=-pid-sandbox
ROOTPATH=/bootstrap/bin:/bootstrap/sbin
EOF
Install some prerequisites:
emerge -O1 sys-apps/gentoo-functions # Used by elt-patches and a ton of other things
emerge -O1 app-portage/elt-patches # required by elibtoolize(libtool.eclass), used to install any library
TODO: Doing this is *BAAAAD*, since we're linking the compiler and libraries
with a potentially incompatible version of glibc in /tools, and upgrading it
afterwards. Glibc should always be installed first into a new prefix!
I just can't be assed to discuss the manual upgrade of binutils+gcc and their
dependency tools.
TODO: Consider installing sys-devel/gnuconfig for the config.sub and
config.guess scripts.
Bootstrap GCC:
# Install linker at final location,
# so programs built with the new compiler can run...
mkdir -p /lib64 /lib
ln -sf /bootstrap/lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
ln -sf /bootstrap/lib32/ld-linux.so.2 /lib/ld-linux.so.2
# Target compiler expects target limits.h to be available in target prefix...
mkdir -p /usr/include
ln -sf /bootstrap/include/limits.h /usr/include/limits.h
# GCC errors out at the first incompatible startfile in LIBRARY_PATH,
# so multilib paths need to be fixed to match the final compiler...
mkdir -p /usr/lib64 /usr/lib
ln -sf /bootstrap/lib/crti.o /bootstrap/lib/crtn.o /bootstrap/lib/Scrt1.o /usr/lib64/
ln -sf /bootstrap/lib32/crti.o /bootstrap/lib32/crtn.o /bootstrap/lib32/Scrt1.o /usr/lib/
# Reconfigure GCC to match the config of the final compiler as much as possible.
cat > /etc/portage/gcc.specs << 'EOF'
*multilib:
. !m64 !m32;64:../lib64 m64 !m32;32:../lib !m64 m32;
*startfile_prefix_spec:
/usr/lib/
*link:
+ %{!shared:%{!static:-dynamic-linker %{m32:/lib/ld-linux.so.2;:/lib64/ld-linux-x86-64.so.2}}}
*cpp:
+ -isystem /usr/include
EOF
cat > /etc/portage/bashrc << 'EOF'
export C_INCLUDE_PATH=/usr/include:/bootstrap/include
export CPLUS_INCLUDE_PATH=/usr/include:/bootstrap/include
export LIBRARY_PATH=/usr/lib64:/usr/lib:/bootstrap/lib:/bootstrap/lib32
export LD_LIBRARY_PATH=/usr/lib64:/usr/lib:/bootstrap/lib:/bootstrap/lib32
export CC='gcc -specs=/etc/portage/gcc.specs'
export CXX='g++ -specs=/etc/portage/gcc.specs'
EOF
emerge -O1 sys-libs/zlib dev-libs/gmp dev-libs/mpfr dev-libs/mpc
emerge -O1 sys-devel/binutils-config sys-devel/binutils
emerge -O1 sys-devel/gcc-config sys-devel/gcc
/usr/bin/gcc-config 1 # Not automatic unlike binutils-config
Make portage forget about everything it's just installed, so it's all rebuilt
first thing when running bootstrap.sh/emerge later:
rm -rf /var/db/pkg
Install initial glibc:
CC=gcc emerge -O1 sys-kernel/linux-headers
mkdir -p /usr/bin/
ln -sf /bootstrap/bin/python3 /usr/bin/python3tmp
PYTHON_COMPAT_OVERRIDE=python3tmp emerge -O1 sys-libs/glibc
rm -f /usr/bin/python3tmp
This compiler and dynamic linker will now pick up everything correctly under
/usr instead of /bootstrap:
rm -f /etc/portage/bashrc /etc/portage/gcc.specs
Build the remainder of bootstrap utilities:
cd /var/db/repos/gentoo/scripts
rm -f /etc/profile.env
mkdir -p /var/run
USE=-nls ./bootstrap.sh
You'll get tons of LD_PRELOAD libsandbox.so errors from programs still linked
against /bootstrap. This is fine to ignore, and will gradually disappear as
programs are rebuilt.
It'd be nice to remove the bootstrap tools now, but among wget/openssl, gawk,
gzip, grep, and other tools, they're still required for some reason.
From this point onward, you're pretty much on your own to beat portage into
performing an `emerge -e @system` and fixing any unspecified dependencies you
encounter along the way. This can be done in a whole number of ways, and will
differ on any given day, since this is painfully unsupported by gentoo devs.
Because the order in which you install everything can differ wildly, and
consequently affect the output of your build, it is advised to do a second
`emerge -e @system` afterwards, for sanity. Below I detail my most recent
procedure, which, I can't stress enough, may or may not work at the time
you're reading this.
Fix circular dependencies:
USE=-filecaps emerge -O1 sys-libs/pam
USE='-acl -xattr' emerge -O1 sys-apps/shadow # required by acct-group/acct-user
Verify there's no circular deps left, for sanity:
emerge -fe @system
Build everything:
emerge -be @system
Clean up bootstrap tools/configs:
rm -rf /bootstrap /sources
rm -f /etc/portage/make.conf
Reinitialize environment:
env-update
exec bash -l
Consider rebuilding everything again without /bootstrap, as surely a lot
errors popped up during the first emerge -be @system, can't be sure enough.
To install everything into a clean root:
ROOT=/final emerge -K @system
Prepare files for catalyst:
mkdir -p /var/tmp/catalyst/snapshots
wget -O gentoo-latest.tar.xz http://distfiles.gentoo.org/snapshots/gentoo-latest.tar.xz
mkdir -p /var/tmp/catalyst/builds/default
cd /var/tmp/catalyst/builds/default
tar -C /final -cf stage3-amd64-latest.tar .
xz -9v stage3-amd64-latest.tar
rm -rf /final
wget -O stage1.spec "https://gitweb.gentoo.org/proj/releng.git/plain/releases/specs/amd64/stage1.spec"
wget -O stage2.spec "https://gitweb.gentoo.org/proj/releng.git/plain/releases/specs/amd64/stage2.spec"
wget -O stage3.spec "https://gitweb.gentoo.org/proj/releng.git/plain/releases/specs/amd64/stage3.spec"
sed -i -e 's/@TIMESTAMP@/latest/' -e '/^portage_confdir: /d' *.spec
Build the stage3:
emerge catalyst
catalyst -f stage1.spec
Loading…
Cancel
Save