Difference between revisions of "User:Pnoecker/clfs"

From Funtoo
Jump to navigation Jump to search
(→‎amalgam: python 3.7.10)
(→‎amalgam 2.0: openssl instead of tls)
 
(21 intermediate revisions by the same user not shown)
Line 625: Line 625:
$##i## CONFIG_SITE=config.site ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools --disable-ipv6  && make && make install
$##i## CONFIG_SITE=config.site ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools --disable-ipv6  && make && make install
$##i## cd .. && rm -rf Python-3.7.10
$##i## cd .. && rm -rf Python-3.7.10
}}
*git-2.9.5
{{console|body=
$##i## tar -xf git-2.9.5.tar.xz && cd git-2.9.5
$##i## ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools NO_ICONV=true ac_cv_fread_reads_directories=true ac_cv_snprintf_returns_bogus=false && make && make install
$##i## cd .. && rm -rf git-2.9.5
}}
for portage we should probably use fchroot on the tools directory, and build and install ppc64 to ppc64.  or perhaps we use https://pypi.org/project/crossenv/ to install portage?
*portage
{{console|body=
$##i## tar -xf portage.tar.xz && cd portage-master
$##i## ./setup.py --help
$##i## python3 setup.py build && python3 setup.py install
}}
*check emerge is working and sinking in tools path and exit fchroot.
we go back into fchroot but this time the /usr path.
{{console|body=
$##i## fchroot -options-to-load-tools .
###i## emerge sync && emerge --emptytree @installed -1
}}
==amalgam 2.0==
ok this is stab 2 at this.  were going to link sources build directory to tools so we can build within the newly generated build.
{{console|body=
$##i## pwd
/home/pnoecker/sexybeast/tools
$##i## mkdir sources
$##i## sudo mount --rbind ../sources ./sources
$##i## sudo fchroot .
}}
now we should be able to access the sources build directory within our fchroot environment
bin/sh symlink needs to be created under fchroot as many scripts call bin sh
{{console|body=
###i## ln -s /bin/bash /bin/sh
}}
https://www.linuxfromscratch.org/lfs/view/stable/chapter07/creatingdirs.html
https://www.linuxfromscratch.org/lfs/view/9.1-systemd/chapter06/pkg-config.html
fchroot acts like it cant access m4.  m4-1.4.13 builds
http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/final-system/temp-perl.html
*gettext-0.19.1
./configure --prefix=/tools && make && make install
*git 2.9.5
./configure --prefix=/tools && make && make install
*python 3.7.10
./configure --prefix=/tools && make && make install
*m4-1.4.13
./configure --prefix=/tools && make && make install
*nettle-3.7.3
./configure --prefix=/tools && make && make install
*export pkgconfig path so gnutls' configure script can find nettle
{{console|body=
$##i## export PKG_CONFIG_PATH=/lib/pkgconfig:$PKG_CONFIG_PATH
}}
*openssl-3.0.2
./config --prefix=/tools --openssldir=/etc/ssl --libdir=lib shared zlib-dynamic linux-ppc64 && make && make install
*gnutls-3.7.3
./configure --prefix=/tools --with-included-libtasn1 --with-included-unistring --without-p11-kit && make && make install
*wget-1.21.2 requires the env binary to be in the right location.
{{console|body=
$##i## ln -s /bin/env /usr/bin/env
$##i## ./configure --prefix=/tools && make && make install
}}
*curl-7.81.0
./configure --prefix=/tools --with-gnutls && make && make install
we now need to download portage & it's patches https://github.com/zmedico/portage/tarball/261f0f763888d9392927a6cae2af50292fc694a1
https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files
*in the sources directory
{{console|body=
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.14-aliases-name-check.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.14-track-and-deny-keywords-r1.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.14-allow-matches-in-package-updates.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.9-add-repodir-variable.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.78-module-rebuild.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.78-static-libs-belong-where-I-put-them.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.9-enhanced-metadata.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.68-set-backtracking-to-6.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.41-ebuild-nodie.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.68-change-global-paths.patch
$##i## wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.4.3-remove-gentoo-repos-conf.patch
}}
{{console|body=
$##i## cd zmedico-portage-261f0f7
$##i## patch -Np1 -i ../portage-2.4.3-remove-gentoo-repos-conf.patch
$##i## patch -Np1 -i ../portage-2.3.68-change-global-paths.patch
$##i## patch -Np1 -i ../portage-2.3.41-ebuild-nodie.patch
$##i## patch -Np1 -i ../portage-2.3.68-set-backtracking-to-6.patch
$##i## patch -Np1 -i ../portage-3.0.9-enhanced-metadata.patch
$##i## patch -Np1 -i ../portage-2.3.78-static-libs-belong-where-I-put-them.patch
$##i## patch -Np1 -i ../portage-2.3.78-module-rebuild.patch
$##i## patch -Np1 -i ../portage-3.0.9-add-repodir-variable.patch
$##i## patch -Np1 -i ../portage-3.0.14-allow-matches-in-package-updates.patch
$##i## patch -Np1 -i ../portage-3.0.14-track-and-deny-keywords-r1.patch
$##i## patch -Np1 -i ../portage-3.0.14-aliases-name-check.patch
}}
}}

Latest revision as of 23:45, April 9, 2022

this will overview my powerpc64 clfs progress on this page. http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/index.html

first export the clfs variable. this is my ~/sexybeast.


user $ pwd
/home/pnoecker
user $ mkdir sexybeast
user $ export CLFS=/home/pnoecker/sexybeast
user $ sudo su
root # export CLFS=/home/pnoecker/sexybeast

follow from http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/materials/introduction.html

user $ mkdir -v ${CLFS}/sources
user $ chmod -v a+wt ${CLFS}/sources
user $ wget http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/dl.list

dl.list has a broken isl link. use nano ctl + w : isl to find the link. replace it with this live link. http://ftp.osuosl.org/pub/clfs/conglomeration/isl/isl-0.12.2.tar.lzma then write the file and exit out of nano.

  • download sources
user $ wget -i dl.list -P ${CLFS}/sources

follow on from http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/final-preps/creatingtoolsdir.html

igore root, were doing this cash money $$$$ on the first command. second command requires root.

user $ install -dv ${CLFS}/tools
user $ sudo ln -sv ${CLFS}/tools /

create cross tool directory.

user $ install -dv ${CLFS}/cross-tools
user $ sudo ln -sv ${CLFS}/cross-tools /

http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/final-preps/addinguser.html

user $ sudo groupadd clfs
user $ sudo useradd -s /bin/bash -g clfs -d /home/clfs clfs
user $ sudo mkdir -pv /home/clfs
user $ sudo chown -v clfs:clfs /home/clfs
user $ sudo chown -v clfs ${CLFS}/tools
user $ sudo chown -v clfs ${CLFS}/cross-tools
user $ sudo chown -v clfs ${CLFS}/sources
user $ sudo su - clfs

setup environment:

user $ cat > ~/.bash_profile << "EOF"
exec env -i HOME=${HOME} TERM=${TERM} PS1='\u:\w\$ ' /bin/bash
EOF
user $ cat > ~/.bashrc << "EOF"
set +h
umask 022
CLFS=/home/pnoecker/sexybeast
LC_ALL=POSIX
PATH=/cross-tools/bin:/bin:/usr/bin
export CLFS LC_ALL PATH
unset CFLAGS CXXFLAGS
EOF
user $source ~/.bash_profile

setup host and target variables.

http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/final-preps/variables.html

user $ export CLFS_HOST=$(echo ${MACHTYPE} | sed -e 's/-[^-]*/-cross/')
user $ export CLFS_TARGET="powerpc64-unknown-linux-gnu"
user $ export BUILD64="-m64"
user $ cat >> ~/.bashrc << EOF
export CLFS_HOST="${CLFS_HOST}"
export CLFS_TARGET="${CLFS_TARGET}"
export BUILD64="${BUILD64}"
EOF

link the sources directory to your clfs ~ home work space:

user $ ln -sv ${CLFS}/sources .

http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/cross-tools/introduction.html

user $ tar -xf file-5.19.tar.gz && cd file-5.19

compile according to the page. http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/cross-tools/file.html

user $ ./configure --prefix=/cross-tools --disable-static && make && make install

once finished compiling, go back down a level and remove the source directory:

user $ cd .. && rm -rf file-5.19

install the linux headers. ch 5.3

user $ wget https://trac.clfs.org/export/a4a0c7f1cd78df350da9e28b1d8f496702356e0f/patches/patch-3.14.21.xz
user $ tar -xf linux-3.14.tar.xz && cd linux-3.14
user $ xzcat ../patch-3.14.21.xz | patch -Np1 -i -
user $ make mrproper
user $ make ARCH=powerpc headers_check
user $ make ARCH=powerpc INSTALL_HDR_PATH=/tools headers_install

ch 5.4

user $ wget https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz
user $ tar -xf m4-1.4.19.tar.xz && cd m4-1.4.19
user $ ./configure --prefix=/cross-tools && make && make install

ch 5.5

user $ wget https://ftp.gnu.org/gnu/ncurses/ncurses-6.3.tar.gz
user $ tar -xf ncurses-6.3.tar.gz && cd ncurses-6.3
user $ ./configure --prefix=/cross-tools --without-debug --without-shared && make -C include && make -C progs tic && install -v -m755 progs/tic /cross-tools/bin

ch 5.6

user $ tar -xf pkg-config-lite-0.28-1.tar.gz && cd pkg-config-lite-0.28-1
user $ ./configure --prefix=/cross-tools --host=${CLFS_TARGET} --with-pc-path=/tools/lib/pkgconfig:/tools/share/pkgconfig && make && make install
user $ cd .. && rm -rf pkg-config-lite-0.28-1

ch 5.7 this package suggests using make check, it's optional but it's good practice to ensure it's working.

user $ wget https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz
user $ tar -xf gmp-6.2.1.tar.xz && cd gmp-6.2.1
user $ ./configure --prefix=/cross-tools --enable-cxx --disable-static && make && make install
user $ make check
user $ cd .. && rm -rf gmp-6.2.1

ch 5.8

user $ tar -xf mpfr-3.1.2.tar.xz && cd mpfr-3.1.2
user $ patch -Np1 -i ../mpfr-3.1.2-fixes-4.patch
user $ LDFLAGS="-Wl,-rpath,/cross-tools/lib" ./configure --prefix=/cross-tools --disable-static --with-gmp=/cross-tools && make && make install
user $ cd .. && rm -rf mpfr-3.1.2

ch 5.9

user $ wget https://ftp.gnu.org/gnu/mpc/mpc-1.0.2.tar.gz
user $ tar -xf mpc-1.0.2.tar.gz && cd mpc-1.0.2
user $ LDFLAGS="-Wl,-rpath,/cross-tools/lib" ./configure --prefix=/cross-tools --disable-static --with-gmp=/cross-tools --with-mpfr=/cross-tools && make && make install
user $ cd .. && rm -rf mpc-1.0.2

ch 5.10

this needs to be updated to isl 0.15 or 16 for gcc 8 series later on.

user $ tar -xf isl-0.12.2.tar.lzma && cd isl-0.12.2
user $ LDFLAGS="-Wl,-rpath,/cross-tools/lib" ./configure --prefix=/cross-tools --disable-static     --with-gmp-prefix=/cross-tools && make && make install
user $ cd .. && rm -rf isl-0.12.2

ch 5.11

user $ wget http://www.bastoul.net/cloog/pages/download/cloog-0.18.4.tar.gz
user $ tar -xf cloog-0.18.4.tar.gz && cd cloog-0.18.4
user $ LDFLAGS="-Wl,-rpath,/cross-tools/lib" ./configure --prefix=/cross-tools --disable-static --with-gmp-prefix=/cross-tools --with-isl-prefix=/cross-tools
user $ cp -v Makefile{,.orig} && sed '/cmake/d' Makefile.orig > Makefile && make && make install
user $ cd .. && rm -rf cloog-0.18.2

ch 5.12

bin utils needs to be built in an external directory.

user $ wget https://mirrors.sarata.com/gnu/binutils/binutils-2.36.tar.xz
user $ tar -xf binutils-2.36.tar.xz && cd binutils-2.36
user $ mkdir -v ../binutils-build && cd ../binutils-build
user $ AR=ar AS=as ../binutils-2.36/configure     --prefix=/cross-tools --host=${CLFS_HOST} --target=${CLFS_TARGET}     --with-sysroot=${CLFS} --with-lib-path=/tools/lib --disable-nls     --disable-static --enable-64-bit-bfd --disable-multilib --disable-werror && make && make install
user $ cd .. && rm -rf binutils-build && rm -rf binutils-2.36

ch 5.13

gcc static:

user $ tar -xf gcc-8.1.0.tar.bz2 && cd gcc-8.1.0
user $ echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/rs6000/sysv4.h && echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/rs6000/sysv4.h
user $ touch /tools/include/limits.h && mkdir -v ../gcc-build && cd ../gcc-build
user $ AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
    ../gcc-8.1.0/configure --prefix=/cross-tools \
    --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \
    --with-sysroot=${CLFS} --with-local-prefix=/tools \
    --with-native-system-header-dir=/tools/include --disable-nls \
    --disable-shared --with-mpfr=/cross-tools --with-gmp=/cross-tools \
    --with-isl=/cross-tools --with-cloog=/cross-tools --with-mpc=/cross-tools \
    --without-headers --with-newlib --disable-decimal-float --disable-libgomp \
    --disable-libmudflap --disable-libssp --disable-libatomic --disable-libitm \
    --disable-libsanitizer --disable-libquadmath --disable-threads \
    --disable-multilib --disable-target-zlib --with-system-zlib \
    --enable-languages=c --enable-checking=release
user $ make all-gcc all-target-libgcc && make install-gcc install-target-libgcc
user $ cd .. && rm -rf gcc-8.1.0 && rm -rf gcc-build

ch 5.14

glib c

user $ tar -xf glibc-2.19.tar.xz && cd glibc-2.19
user $ cp -v timezone/Makefile{,.orig} && sed 's/\\$$(pwd)/`pwd`/' timezone/Makefile.orig > timezone/Makefile
user $ mkdir -v ../glibc-build && cd ../glibc-build
user $ echo "libc_cv_ssp=no" > config.cache
user $ BUILD_CC="gcc" CC="${CLFS_TARGET}-gcc ${BUILD64}" \
      AR="${CLFS_TARGET}-ar" RANLIB="${CLFS_TARGET}-ranlib" \
      ../glibc-2.19/configure --prefix=/tools \
      --host=${CLFS_TARGET} --build=${CLFS_HOST} \
      --disable-profile --enable-kernel=2.6.32 \
      --with-binutils=/cross-tools/bin --with-headers=/tools/include \
      --enable-obsolete-rpc --cache-file=config.cache && make && make install
user $ cd .. && rm -rf glibc-build && rm -rf glibc-2.19

ch 5.15

gcc final pass

user $ tar -xf gcc-8.1.0.tar.xz && cd gcc-8.1.0
user $ echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/rs6000/sysv4.h && echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/rs6000/sysv4.h
user $ mkdir -v ../gcc-build && cd ../gcc-build
user $ AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
    ../gcc-8.1.0/configure --prefix=/cross-tools \
    --build=${CLFS_HOST} --target=${CLFS_TARGET} --host=${CLFS_HOST} \
    --with-sysroot=${CLFS} --with-local-prefix=/tools \
    --with-native-system-header-dir=/tools/include --disable-nls \
    --disable-static --enable-languages=c,c++ --enable-__cxa_atexit \
    --enable-threads=posix --disable-multilib \
    --with-mpc=/cross-tools --with-mpfr=/cross-tools --with-gmp=/cross-tools \
    --with-cloog=/cross-tools --with-isl=/cross-tools --with-system-zlib \
    --enable-checking=release --enable-libstdcxx-time
user $ make AS_FOR_TARGET="${CLFS_TARGET}-as" LD_FOR_TARGET="${CLFS_TARGET}-ld" && make install
user $ cd .. && rm -rf gcc-build && rm -rf gcc-8.1.0

ch 6

ch 6.2

export CC="${CLFS_TARGET}-gcc ${BUILD64}"
export CXX="${CLFS_TARGET}-g++ ${BUILD64}"
export AR="${CLFS_TARGET}-ar"
export AS="${CLFS_TARGET}-as"
export RANLIB="${CLFS_TARGET}-ranlib"
export LD="${CLFS_TARGET}-ld"
export STRIP="${CLFS_TARGET}-strip"
echo export CC=\""${CC}\"" >> ~/.bashrc
echo export CXX=\""${CXX}\"" >> ~/.bashrc
echo export AR=\""${AR}\"" >> ~/.bashrc
echo export AS=\""${AS}\"" >> ~/.bashrc
echo export RANLIB=\""${RANLIB}\"" >> ~/.bashrc
echo export LD=\""${LD}\"" >> ~/.bashrc
echo export STRIP=\""${STRIP}\"" >> ~/.bashrc

ch 6.3

user $ tar -xf gmp-6.2.1.tar.xz && cd gmp-6.2.1
user $ CC_FOR_BUILD=gcc ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --enable-cxx && make && make install
user $ cd .. && rm -rf gmp-6.2.1

ch 6.4

user $ tar -xf mpfr-3.1.2.tar.xz && cd mpfr-3.1.2
user $ patch -Np1 -i ../mpfr-3.1.2-fixes-4.patch
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf mpfr-3.1.2

ch 6.5

user $ tar -xf mpc-1.0.2.tar.gz && cd mpc-1.0.2
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf mpc-1.0.2

ch 6.6

user $ tar -xf isl-0.16.1.tar.bz2 && cd isl-0.16.1
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf isl-0.16.1

ch 6.7

user $ tar -xf cloog-0.18.4.tar.gz && cd cloog-0.18.4
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --with-isl=system && cp -v Makefile{,.orig} && sed '/cmake/d' Makefile.orig > Makefile && make && make install
user $ cd .. && rm -rf cloog-0.18.4

ch 6.8

user $ wget https://zlib.net/zlib-1.2.11.tar.xz
user $ tar -xf zlib-1.2.11.tar.xz && cd zlib-1.2.11
user $ CHOST=ppc64 ./configure --prefix=/tools && make && make install
user $ cd .. && rm -rf zlib-1.2.11

ch 6.9

user $ wget https://mirrors.sarata.com/gnu/binutils/binutils-2.36.tar.xz
user $ tar -xf binutils-2.36.tar.bz2 && cd binutils-2.36
user $ mkdir -v ../binutils-build && cd ../binutils-build
user $ ../binutils-2.36/configure \
    --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} \
    --target=${CLFS_TARGET} --with-lib-path=/tools/lib --disable-nls \
    --enable-shared --enable-64-bit-bfd --disable-multilib && make && make install
user $ cd .. && rm -rf binutils-build && rm -rf binutils-2.36

ch 6.10

user $ tar -xf gcc-8.1.0.tar.xz && cd gcc-8.1.0
user $ echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/rs6000/sysv4.h && echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/rs6000/sysv4.h
user $ cp -v gcc/Makefile.in{,.orig} && sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in
user $ mkdir -v ../gcc-build && cd ../gcc-build
user $ ../gcc-8.1.0/configure --prefix=/tools --disable-multilib \
    --build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET} \
    --with-local-prefix=/tools --disable-nls --enable-languages=c,c++ \
    --disable-libstdcxx-pch --with-system-zlib \
    --with-native-system-header-dir=/tools/include --enable-checking=release \
    --enable-libstdcxx-time
user $ cp -v Makefile{,.orig} && sed "/^HOST_\(GMP\|ISL\|CLOOG\)\(LIBS\|INC\)/s:/tools:/cross-tools:g" \
    Makefile.orig > Makefile
user $ make AS_FOR_TARGET="${AS}" LD_FOR_TARGET="${LD}"
user $ make install && cp -v ../gcc-8.1.0/include/libiberty.h /tools/include
user $ cd .. && rm -rf gcc-build && rm -rf gcc-8.1.0

ch 6.11

user $ tar -xf ncurses-6.3.tar.gz && cd ncurses-6.3
user $ ./configure --prefix=/tools --with-shared --build=${CLFS_HOST} --host=${CLFS_TARGET}     --without-debug --without-ada --enable-overwrite --with-build-cc=gcc --disable-stripping && make && make install
user $ cd .. && rm -rf ncurses-6.3

ch 6.12

user $ tar -xf bash-4.3.tar.gz && cd bash-4.3
user $ patch -Np1 -i ../bash-4.3-branch_update-5.patch
user $ cat > config.cache << "EOF"
ac_cv_func_mmap_fixed_mapped=yes
ac_cv_func_strcoll_works=yes
ac_cv_func_working_mktime=yes
bash_cv_func_sigsetjmp=present
bash_cv_getcwd_malloc=yes
bash_cv_job_control_missing=present
bash_cv_printf_a_format=yes
bash_cv_sys_named_pipes=present
bash_cv_ulimit_maxfds=yes
bash_cv_under_sys_siglist=yes
bash_cv_unusable_rtsigs=no
gt_cv_int_divbyzero_sigfpe=yes
EOF
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --without-bash-malloc --cache-file=config.cache && make && make install
user $ cd .. && rm -rf bash-4.3

ch 6.13

user $ tar -xf bzip2-1.0.6.tar.gz && cd bzip2-1.0.6
user $ cp -v Makefile{,.orig} && sed -e 's@^\(all:.*\) test@\1@g' Makefile.orig > Makefile
user $ make CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" && make PREFIX=/tools install
user $ cd .. && rm -rf bzip2-1.0.6

ch 6.14

user $ tar -xf check-0.9.13.tar.gz && cd check-0.9.13
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf check-0.9.13

ch 6.15

user $ tar -xf coreutils-8.22.tar.xz && cd coreutils-8.22
user $ cat > config.cache << EOF
fu_cv_sys_stat_statfs2_bsize=yes
gl_cv_func_working_mkstemp=yes
EOF
user $ patch -Np1 -i ../coreutils-8.22-noman-1.patch
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --enable-install-program=hostname --cache-file=config.cache && make && make install
user $ cd .. && rm -rf coreutils-8.22

ch 6.16

user $ tar -xf diffutils-3.3.tar.xz && cd diffutils-3.3
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf diffutils-3.3

ch 6.17

user $ tar -xf file-5.19.tar.gz && cd file-5.19
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf file-5.19

ch 6.18

user $ tar -xf findutils-4.4.2.tar.gz && cd findutils-4.4.2
user $ echo "gl_cv_func_wcwidth_works=yes" > config.cache && echo "ac_cv_func_fnmatch_gnu=yes" >> config.cache
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --cache-file=config.cache && make && make install
user $ cd .. && rm -rf findutils-4.4.2

ch 6.19

user $ tar -xf gawk-4.1.1.tar.xz && cd gawk-4.1.1
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf gawk-4.1.1

ch 6.20

user $ tar -xf gettext-0.19.1.tar.gz && cd gettext-0.19.1
user $ cd gettext-tools && echo "gl_cv_func_wcwidth_works=yes" > config.cache
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --disable-shared --cache-file=config.cache && make -C gnulib-lib && make -C src msgfmt && cp -v src/msgfmt /tools/bin
user $ cd ../.. && rm -rf gettext-0.19.1

ch 6.21

user $ tar -xf grep-2.19.tar.xz && cd grep-2.19
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --without-included-regex && make && make install
user $ cd .. && rm -rf grep-2.19

ch 6.22

user $ tar -xf gzip-1.6.tar.xz && cd gzip-1.6
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf gzip-1.6

ch 6.23

user $ tar -xf make-4.0.tar.bz2 && cd make-4.0
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf make-4.0

ch 6.24

user $ tar -xf patch-2.7.1.tar.xz && cd patch-2.7.1
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf patch-2.7.1

ch 6.25

user $ tar -xf sed-4.2.2.tar.bz2 && cd sed-4.2.2
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf sed-4.2.2

ch 6.26

user $ tar -xf tar-1.27.1.tar.xz && cd tar-1.27.1
user $ cat > config.cache << EOF
gl_cv_func_wcwidth_works=yes
gl_cv_func_btowc_eof=yes
ac_cv_func_malloc_0_nonnull=yes
gl_cv_func_mbrtowc_incomplete_state=yes
gl_cv_func_mbrtowc_nul_retval=yes
gl_cv_func_mbrtowc_null_arg1=yes
gl_cv_func_mbrtowc_null_arg2=yes
gl_cv_func_mbrtowc_retval=yes
gl_cv_func_wcrtomb_retval=yes
EOF
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --cache-file=config.cache && make && make install
user $ cd .. && rm -rf tar-1.27.1

ch 6.27

user $ tar -xf texinfo-5.2.tar.xz && cd texinfo-5.2
user $ PERL=/usr/bin/perl ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} && make && make install
user $ cd .. && rm -rf texinfo-5.2

ch 6.28

user $ tar -xf util-linux-2.24.2.tar.xz && cd util-linux-2.24.2
user $ ./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} --disable-makeinstall-chown --disable-makeinstall-setuid && make && make install
user $ cd .. && rm -rf util-linux-2.24.2

ch 6.29

were doing nano because vim is hot garbage.

user $ wget https://www.nano-editor.org/dist/v6/nano-6.1.tar.xz
user $ tar -xf nano-6.1.tar.xz && cd nano-6.1.tar.xz
user $ ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools && make && make install
user $ cd .. && rm -rf nano-6.1

ch 6.30

user $ tar -xf xz-5.0.5.tar.xz && cd xz-5.0.5
user $ ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools && make && make install
user $ cd .. && rm -rf xz-5.0.5

ch 6.31

boot or chroot? we want to go down the path of chroot, but require fchroot to chroot to our tools which are cross compiled for non native hardware. load the tools directory and symlink lib64 to lib.

user $ cd /home/pnoecker/sexybeast/tools
user $ cp lib/ld64.so.1 lib64

amalgam

at this point we probably want to populate the /tools directory with a cross compiled portage, and dependencies. we will need to adapt from ch10 & BLFS to include cross compiling configure make & make install and use prefix=/tools instead of /usr to further develop our chroot that deploys the final operating system.

i install ping to ensure we have network connectivity in our new power pc 64 chroot.

http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/final-system/iputils.html

user $ tar -xf iputils-s20121221.tar.bz2 && cd iputils-s20121221
user $ make CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" USE_CAP=no IPV4_TARGETS="ping" && install -v -m755 ping /tools/bin
user $ cd .. && rm -rf iputils-s20121221

i updated to bash 5 because i don't know if our portage requires it like gentoo's does. im pulling in more sources to compile our tool chain. at minimum our cross tools probably require curl, wget, git, python, and ultimately portage.

user $ wget https://curl.se/download/curl-7.81.0.tar.gz
user $ wget https://ftp.gnu.org/gnu/wget/wget-1.21.2.tar.gz
user $ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz
user $ wget https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tar.xz

wget requires tls or openssl. so im building nettle and gnutls to satisfy dependencies.

user $ wget ftp://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz
user $ tar -xf nettle-3.7.3.tar.gz && cd nettle-3.7.3
user $ ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools --disable-static  && make && make install
user $ chmod -v 755 /tools/lib/lib{hogweed,nettle}.so
user $ cd .. && rm -rf nettle-3.7.3
  • gnuTLS
user $ wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.3.tar.xz
user $ tar -xf gnutls-3.7.3.tar.xz && cd gnutls-3.7.3
user $ ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools --disable-guile --disable-rpath --with-included-libtasn1 --with-included-unistring --without-p11-kit && make && make install
user $ cd .. && rm -rf gnutls-3.7.3
  • wget
user $ tar -xf wget-1.21.2.tar.gz && cd wget-1.21.2
user $ ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools  && make && make install
user $ cd .. && rm -rf wget-1.21.2
  • curl
user $ tar -xf curl-7.81.0.tar.gz && cd curl-7.81.0
user $ ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools --with-gnutls && make && make install
user $ cd .. && rm -rf curl-7.81.0
  • python 3.7.10
user $ tar -xf Python-3.7.10.tar.xz && cd Python-3.7.10
user $ echo ac_cv_file__dev_ptmx=no/yes >> config.site
user $ echo ac_cv_file__dev_ptc=no/yes >> config.site
user $ CONFIG_SITE=config.site ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools --disable-ipv6  && make && make install
user $ cd .. && rm -rf Python-3.7.10
  • git-2.9.5
user $ tar -xf git-2.9.5.tar.xz && cd git-2.9.5
user $ ./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} --prefix=/tools NO_ICONV=true ac_cv_fread_reads_directories=true ac_cv_snprintf_returns_bogus=false && make && make install
user $ cd .. && rm -rf git-2.9.5

for portage we should probably use fchroot on the tools directory, and build and install ppc64 to ppc64. or perhaps we use https://pypi.org/project/crossenv/ to install portage?

  • portage
user $ tar -xf portage.tar.xz && cd portage-master
user $ ./setup.py --help
user $ python3 setup.py build && python3 setup.py install
  • check emerge is working and sinking in tools path and exit fchroot.

we go back into fchroot but this time the /usr path.

user $ fchroot -options-to-load-tools .
root # emerge sync && emerge --emptytree @installed -1

amalgam 2.0

ok this is stab 2 at this. were going to link sources build directory to tools so we can build within the newly generated build.

user $ pwd 
/home/pnoecker/sexybeast/tools
user $ mkdir sources
user $ sudo mount --rbind ../sources ./sources
user $ sudo fchroot .

now we should be able to access the sources build directory within our fchroot environment

bin/sh symlink needs to be created under fchroot as many scripts call bin sh

root # ln -s /bin/bash /bin/sh

https://www.linuxfromscratch.org/lfs/view/stable/chapter07/creatingdirs.html

https://www.linuxfromscratch.org/lfs/view/9.1-systemd/chapter06/pkg-config.html

fchroot acts like it cant access m4. m4-1.4.13 builds

http://www.clfs.org/view/CLFS-3.0.0-SYSVINIT/ppc64-64/final-system/temp-perl.html

  • gettext-0.19.1

./configure --prefix=/tools && make && make install

  • git 2.9.5

./configure --prefix=/tools && make && make install

  • python 3.7.10

./configure --prefix=/tools && make && make install

  • m4-1.4.13

./configure --prefix=/tools && make && make install

  • nettle-3.7.3

./configure --prefix=/tools && make && make install

  • export pkgconfig path so gnutls' configure script can find nettle
user $ export PKG_CONFIG_PATH=/lib/pkgconfig:$PKG_CONFIG_PATH
  • openssl-3.0.2

./config --prefix=/tools --openssldir=/etc/ssl --libdir=lib shared zlib-dynamic linux-ppc64 && make && make install

  • gnutls-3.7.3

./configure --prefix=/tools --with-included-libtasn1 --with-included-unistring --without-p11-kit && make && make install

  • wget-1.21.2 requires the env binary to be in the right location.
user $ ln -s /bin/env /usr/bin/env
user $ ./configure --prefix=/tools && make && make install
  • curl-7.81.0

./configure --prefix=/tools --with-gnutls && make && make install

we now need to download portage & it's patches https://github.com/zmedico/portage/tarball/261f0f763888d9392927a6cae2af50292fc694a1 https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files

  • in the sources directory
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.14-aliases-name-check.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.14-track-and-deny-keywords-r1.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.14-allow-matches-in-package-updates.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.9-add-repodir-variable.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.78-module-rebuild.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.78-static-libs-belong-where-I-put-them.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-3.0.9-enhanced-metadata.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.68-set-backtracking-to-6.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.41-ebuild-nodie.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.3.68-change-global-paths.patch
user $ wget https://code.funtoo.org/bitbucket/projects/CORE/repos/kit-fixups/browse/core-kit/curated/sys-apps/portage/files/portage-2.4.3-remove-gentoo-repos-conf.patch
user $ cd zmedico-portage-261f0f7
user $ patch -Np1 -i ../portage-2.4.3-remove-gentoo-repos-conf.patch
user $ patch -Np1 -i ../portage-2.3.68-change-global-paths.patch
user $ patch -Np1 -i ../portage-2.3.41-ebuild-nodie.patch
user $ patch -Np1 -i ../portage-2.3.68-set-backtracking-to-6.patch
user $ patch -Np1 -i ../portage-3.0.9-enhanced-metadata.patch
user $ patch -Np1 -i ../portage-2.3.78-static-libs-belong-where-I-put-them.patch
user $ patch -Np1 -i ../portage-2.3.78-module-rebuild.patch
user $ patch -Np1 -i ../portage-3.0.9-add-repodir-variable.patch
user $ patch -Np1 -i ../portage-3.0.14-allow-matches-in-package-updates.patch
user $ patch -Np1 -i ../portage-3.0.14-track-and-deny-keywords-r1.patch
user $ patch -Np1 -i ../portage-3.0.14-aliases-name-check.patch