Browse Source

Another success!

master
mid-kid 3 months ago
parent
commit
094cbaa681
  1. 119
      gentoo-2024.8/gentoo.txt

119
gentoo-2024.8/gentoo.txt

@ -9,6 +9,8 @@ umount target/dev/shm target/sys target/proc target/tmp
# Optional: back up the system # Optional: back up the system
env -i chroot target tar --exclude='/external' --sort=name -cf /target.tar / env -i chroot target tar --exclude='/external' --sort=name -cf /target.tar /
env -i chroot target bzip2 -9v /target.tar env -i chroot target bzip2 -9v /target.tar
mv target/external/repo .
mv target/target.tar.bz2 .
# Goal: # Goal:
# install cross compiler in /cross # install cross compiler in /cross
@ -19,8 +21,13 @@ 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
env -i TERM="$TERM" chroot . env -i TERM="$TERM" chroot . /bin/bash -l
source /steps/env source /steps/env
mkdir -p /var/cache/distfiles; cd /var/cache/distfiles
curl -LO http://gitweb.gentoo.org/proj/portage.git/snapshot/portage-3.0.65.tar.bz2
curl -LO http://distfiles.gentoo.org/snapshots/squashfs/gentoo-20240801.xz.sqfs
curl -LO https://github.com/plougher/squashfs-tools/archive/refs/tags/4.6.1/squashfs-tools-4.6.1.tar.gz
cd /tmp cd /tmp
cat > portage.patch << 'EOF' cat > portage.patch << 'EOF'
@ -51,11 +58,7 @@ cat > portage.patch << 'EOF'
} }
EOF EOF
curl -LO http://gitweb.gentoo.org/proj/portage.git/snapshot/portage-3.0.65.tar.bz2 tar xf /var/cache/distfiles/squashfs-tools-4.6.1.tar.gz
curl -LO https://github.com/plougher/squashfs-tools/archive/refs/tags/4.6.1/squashfs-tools-4.6.1.tar.gz
curl -LO http://distfiles.gentoo.org/snapshots/squashfs/gentoo-20240801.xz.sqfs
tar xf squashfs-tools-4.6.1.tar.gz
cd squashfs-tools-4.6.1 cd squashfs-tools-4.6.1
make -C squashfs-tools install \ make -C squashfs-tools install \
INSTALL_PREFIX=/usr \ INSTALL_PREFIX=/usr \
@ -63,12 +66,15 @@ make -C squashfs-tools install \
cd .. cd ..
rm -rf squashfs-tools-4.6.1 rm -rf squashfs-tools-4.6.1
unsquashfs gentoo-20240801.xz.sqfs unsquashfs /var/cache/distfiles/gentoo-20240801.xz.sqfs
mkdir -p /var/db/repos mkdir -p /var/db/repos
rm -rf /var/db/repos/gentoo rm -rf /var/db/repos/gentoo
mv squashfs-root /var/db/repos/gentoo mv squashfs-root /var/db/repos/gentoo
tar xf portage-3.0.65.tar.bz2 tar xf /var/cache/distfiles/portage-3.0.65.tar.bz2
cd portage-3.0.65
patch -p1 -i ../portage.patch
cd ..
ln -sf portage-3.0.65 portage ln -sf portage-3.0.65 portage
# Configure portage # Configure portage
@ -100,10 +106,10 @@ FETCHCOMMAND="$FETCHCOMMAND" MAKEOPTS=-j1 ./portage/bin/emerge -O1 dev-build/mak
FETCHCOMMAND="$FETCHCOMMAND" ./portage/bin/emerge -O1 net-misc/wget FETCHCOMMAND="$FETCHCOMMAND" ./portage/bin/emerge -O1 net-misc/wget
# Upgrade python so we can use it to cross-compile later on # Upgrade python so we can use it to cross-compile later on
./portage/bin/emerge -O1 dev-build/autoconf
./portage/bin/emerge -O1 dev-build/autoconf-wrapper ./portage/bin/emerge -O1 dev-build/autoconf-wrapper
./portage/bin/emerge -O1 dev-build/automake ./portage/bin/emerge -O1 dev-build/autoconf
./portage/bin/emerge -O1 dev-build/automake-wrapper ./portage/bin/emerge -O1 dev-build/automake-wrapper
./portage/bin/emerge -O1 dev-build/automake
./portage/bin/emerge -O1 sys-apps/gentoo-functions ./portage/bin/emerge -O1 sys-apps/gentoo-functions
./portage/bin/emerge -O1 app-portage/elt-patches ./portage/bin/emerge -O1 app-portage/elt-patches
./portage/bin/emerge -O1 dev-libs/mpdecimal ./portage/bin/emerge -O1 dev-libs/mpdecimal
@ -128,13 +134,13 @@ ln -s bzip2-reference /bin/bzip2
./portage/bin/emerge -O1 dev-python/wheel ./portage/bin/emerge -O1 dev-python/wheel
./portage/bin/emerge -O1 dev-python/setuptools ./portage/bin/emerge -O1 dev-python/setuptools
./portage/bin/emerge -O1 dev-build/meson ./portage/bin/emerge -O1 dev-build/meson
./portage/bin/emerge -O1 dev-build/meson-format-array
./portage/bin/emerge -O1 dev-build/ninja ./portage/bin/emerge -O1 dev-build/ninja
# Finally install portage itself # Finally install portage itself
./portage/bin/emerge -O1 sys-apps/portage ./portage/bin/emerge -O1 sys-apps/portage
# Install pax-utils to allow stripping binaries # Install pax-utils to allow stripping binaries (requires meson...)
emerge -O1 dev-build/meson-format-array
emerge -O1 app-misc/pax-utils emerge -O1 app-misc/pax-utils
# Fix "find" warnings in emerge # Fix "find" warnings in emerge
@ -168,14 +174,14 @@ sys-devel/gcc -sanitize -fortran
EOF EOF
mkdir -p /cross/etc/portage/env/sys-devel mkdir -p /cross/etc/portage/env/sys-devel
cat > /cross/etc/portage/env/sys-devel/gcc << 'EOF' cat > /cross/etc/portage/env/sys-devel/gcc << 'EOF'
EXTRA_ECONF='--with-sysroot=$EPREFIX/usr/$CTARGET' EXTRA_ECONF='--with-sysroot=$EPREFIX/usr/$CTARGET --enable-threads'
EOF EOF
# TODO: Build sys-libs/glibc in /gentoo instead, to avoid extra rebuilding # TODO: Build sys-libs/glibc in /gentoo instead, to avoid extra rebuilding
PORTAGE_CONFIGROOT=/cross EPREFIX=/cross emerge -O1 sys-devel/binutils PORTAGE_CONFIGROOT=/cross EPREFIX=/cross emerge -O1 sys-devel/binutils
PORTAGE_CONFIGROOT=/cross EPREFIX=/cross USE='headers-only' emerge -O1 sys-kernel/linux-headers PORTAGE_CONFIGROOT=/cross EPREFIX=/cross USE='headers-only' emerge -O1 sys-kernel/linux-headers
PORTAGE_CONFIGROOT=/cross EPREFIX=/cross USE='headers-only -multilib' emerge -O1 sys-libs/glibc PORTAGE_CONFIGROOT=/cross EPREFIX=/cross USE='headers-only -multilib' emerge -O1 sys-libs/glibc
PORTAGE_CONFIGROOT=/cross EPREFIX=/cross USE='-cxx -openmp' emerge -O1 sys-devel/gcc PORTAGE_CONFIGROOT=/cross EPREFIX=/cross USE='-cxx' emerge -O1 sys-devel/gcc
PORTAGE_CONFIGROOT=/cross EPREFIX=/cross emerge -O1 sys-kernel/linux-headers PORTAGE_CONFIGROOT=/cross EPREFIX=/cross emerge -O1 sys-kernel/linux-headers
PORTAGE_CONFIGROOT=/cross EPREFIX=/cross emerge -O1 sys-libs/glibc PORTAGE_CONFIGROOT=/cross EPREFIX=/cross emerge -O1 sys-libs/glibc
PORTAGE_CONFIGROOT=/cross EPREFIX=/cross emerge -O1 sys-devel/gcc PORTAGE_CONFIGROOT=/cross EPREFIX=/cross emerge -O1 sys-devel/gcc
@ -213,7 +219,7 @@ BINPKG_COMPRESS="bzip2"
CBUILD="i386-unknown-linux-musl" CBUILD="i386-unknown-linux-musl"
CHOST="x86_64-bootstrap-linux-gnu" CHOST="x86_64-bootstrap-linux-gnu"
CFLAGS_x86="$CFLAGS_x86 -msse" # bug 937637 CFLAGS_x86="$CFLAGS_x86 -msse" # bug 937637
USE="-* build openmp python_targets_python3_12" USE="-* build $BOOTSTRAP_USE -zstd"
CONFIG_SITE="$PORTAGE_CONFIGROOT/etc/portage/config.site" CONFIG_SITE="$PORTAGE_CONFIGROOT/etc/portage/config.site"
EOF EOF
cat > /gentoo.cfg/etc/portage/config.site << 'EOF' cat > /gentoo.cfg/etc/portage/config.site << 'EOF'
@ -224,6 +230,7 @@ ac_cv_file__dev_ptc=no
fi fi
EOF EOF
py=$(PORTAGE_CONFIGROOT=/gentoo.cfg portageq envvar PYTHON_SINGLE_TARGET | sed 's/^python//;s/_/./g')
PORTAGE_CONFIGROOT=/gentoo.cfg ROOT=/gentoo SYSROOT=/gentoo emerge -O1n \ PORTAGE_CONFIGROOT=/gentoo.cfg ROOT=/gentoo SYSROOT=/gentoo emerge -O1n \
sys-apps/baselayout \ sys-apps/baselayout \
sys-kernel/linux-headers \ sys-kernel/linux-headers \
@ -242,7 +249,7 @@ PORTAGE_CONFIGROOT=/gentoo.cfg ROOT=/gentoo SYSROOT=/gentoo emerge -O1n \
dev-libs/mpdecimal \ dev-libs/mpdecimal \
sys-apps/util-linux \ sys-apps/util-linux \
sys-libs/libxcrypt \ sys-libs/libxcrypt \
dev-lang/python:3.12 \ dev-lang/python:$py \
\ \
dev-lang/python-exec \ dev-lang/python-exec \
sys-apps/portage \ sys-apps/portage \
@ -259,53 +266,53 @@ PORTAGE_CONFIGROOT=/gentoo.cfg ROOT=/gentoo SYSROOT=/gentoo emerge -O1n \
sys-devel/patch \ sys-devel/patch \
app-arch/tar \ app-arch/tar \
app-arch/gzip \ app-arch/gzip \
dev-build/make dev-build/make \
\
# TODO: Un-hardcode python 3.12 dev-libs/openssl \
# TODO: Avoid gzip? net-misc/wget \
app-misc/ca-certificates
# Set up final system # Set up final system
mkdir -p /gentoo/etc/portage mkdir -p /gentoo/etc/portage
ln -sf ../../var/db/repos/gentoo/profiles/default/linux/amd64/23.0 /gentoo/etc/portage/make.profile ln -sf ../../var/db/repos/gentoo/profiles/default/linux/amd64/23.0 /gentoo/etc/portage/make.profile
rsync -aP /var/db/repos/ /gentoo/var/db/repos
echo 'nameserver 1.1.1.1' > /gentoo/etc/resolv.conf echo 'nameserver 1.1.1.1' > /gentoo/etc/resolv.conf
echo 'C.UTF8 UTF-8' > /gentoo/etc/locale.gen echo 'C.UTF8 UTF-8' > /gentoo/etc/locale.gen
# Fetch some extra source code # Copy repo
DISTDIR=/gentoo/var/cache/distfiles \ rsync -aP /var/db/repos/ /gentoo/var/db/repos
PORTAGE_CONFIGROOT=/gentoo ROOT=/gentoo SYSROOT=/gentoo emerge -O1f \
dev-util/pkgconf \
dev-lang/perl \
dev-libs/openssl \
net-misc/wget \
app-misc/ca-certificates
# From here you just chroot into /gentoo, clean /etc/portage (leaving only make.profile), install wget, and run "emerge -DN @world", untangling dependencies until it works # From here you just chroot into /gentoo, and run "emerge -e @world", untangling dependencies until it works
# This is an example: # This is an example:
# TODO: Avoid weird gcc rebuild...
# This part can be improved a lot by cross-compiling more stuff # TODO: How does catalyst stage1 resolve these?
emerge -O1 dev-util/pkgconf emerge -O1n \
USE=-gdbm emerge -O1 dev-lang/perl app-alternatives/awk \
emerge -O1 dev-libs/openssl app-alternatives/bzip2 \
MAKEINFO=true emerge -O1 net-misc/wget app-alternatives/gzip \
emerge -O1 app-misc/ca-certificates app-alternatives/lex \
emerge -O1 dev-build/ninja app-alternatives/ninja \
emerge -O1 app-alternatives/ninja app-alternatives/tar \
emerge -O1 sys-apps/gentoo-functions app-alternatives/yacc
emerge -O1 app-portage/elt-patches
emerge -O1 sys-devel/m4 USE="-* build $(portageq envvar BOOTSTRAP_USE)" emerge -O1n \
MAKEINFO=true emerge -O1 sys-devel/flex sys-apps/gentoo-functions \
emerge -O1 sys-apps/diffutils app-portage/elt-patches \
emerge -O1 sys-devel/gcc-config app-crypt/libmd \
USE='-* openmp' EXTRA_ECONF=--disable-bootstrap emerge -O1 sys-devel/gcc dev-libs/libbsd \
emerge -O1 dev-build/ninja # avoid segfault dev-util/pkgconf \
emerge -O1 sys-devel/bison sys-apps/shadow
USE='-* cet' emerge -O1 sys-libs/glibc
emerge -O1 app-alternatives/yacc # Finish installing stage1 dependencies
emerge -O1 app-alternatives/lex pkgs_build="$(python3 -c 'import portage
rm -f /var/run/bootstrap-progress && USE=-nls /var/db/repos/gentoo/scripts/bootstrap.sh print(*portage.util.stack_lists([portage.util.grabfile_package("%s/packages.build" % x) for x in portage.settings.profiles], incremental=1))')"
USE='-* openmp' EXTRA_ECONF=--disable-bootstrap emerge -O1 sys-devel/gcc # enable openmp again... USE="-* build $(portageq envvar BOOTSTRAP_USE)" CHOST="$(gcc -dumpmachine)" \
USE='-nls -pam -su -http2' emerge -1 net-misc/rsync emerge -1Dn --with-bdeps=n $pkgs_build
USE='-nls -pam -su -http2' emerge -e @system
emerge -DN @system # Change CHOST and build OpenMP support
emerge -O1 sys-devel/binutils
EXTRA_ECONF=--disable-bootstrap emerge -O1 sys-devel/gcc
emerge -O1 $(portageq expand_virtual / virtual/libc)
# Rebuild everything
USE='-filecaps -http2' emerge -e @system
emerge -c emerge -c

Loading…
Cancel
Save