Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README164
-rw-r--r--create_ca-certificates-utils_shim.sh45
-rw-r--r--create_gcc-lib_shim.sh51
-rw-r--r--create_glibc_shim.sh82
-rw-r--r--default.conf12
-rwxr-xr-xprepare_stage1_repo.sh2
6 files changed, 199 insertions, 157 deletions
diff --git a/README b/README
index 0b8c205..5d34781 100644
--- a/README
+++ b/README
@@ -123,17 +123,11 @@ su cross ./prepare_stage1_repo.sh
# PHASE 1
#########
-Build stage1 with the cross-compiler and modified PKGBUILDs and patches
-into $STAGE1_CHROOT
+# Build stage1 in $STAGE1_BUILD with the cross-compiler and modified
+# PKGBUILDs and patches into $STAGE1_CHROOT.
-# TODO FROM HERE:
-
-
-# package shims
-################
-
-# we cannot build the glibc or the compilers, we create phantom packages by hand without
-# makepkg with files from the toolchain's sysroot
+# we cannot build the glibc or the compilers, we create phantom packages
+# by hand without makepkg with files from the toolchain's sysroot
# so we build gcc-libs for compiler libraries (C and C++) and the glibc
# we will NOT build them using the cross-compiler as packages but later
@@ -141,155 +135,17 @@ into $STAGE1_CHROOT
# dependency for makepkg all the time, if not the original one, so close
# ones fitting to the crosstoolchain.
-# the gcc-lib shim
-##################
-
-cd $HOME/build
-mkdir gcc-libs
-cd gcc-libs
-mkdir -p pkg/gcc-libs/usr/lib
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libgcc_s.so pkg/gcc-libs/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libgcc_s.so.1 pkg/gcc-libs/usr/lib/.
-cp -L $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/lib/libatomic.so.1.2.0 pkg/gcc-libs/usr/lib/.
-ln -s libatomic.so.1.2.0 pkg/gcc-libs/usr/lib/libatomic.so.1
-ln -s libatomic.so.1.2.0 pkg/gcc-libs/usr/lib/libatomic.so
-cp -L $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/lib/libatomic.a pkg/gcc-libs/usr/lib/.
-cp -L $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/lib/libstdc++.so.6.0.24 pkg/gcc-libs/usr/lib/.
-ln -s libstdc++.so.6.0.24 pkg/gcc-libs/usr/lib/libstdc++.so.6
-ln -s libstdc++.so.6.0.24 pkg/gcc-libs/usr/lib/libstdc++.so
-
-BUILDDATE=`date '+%s'`
-size=`du -sk --apparent-size pkg/`
-size="$(( ${size%%[^0-9]*} * 1024 ))"
-cat > pkg/gcc-libs/.PKGINFO <<EOF
-pkgname = gcc-libs
-pkgver = 4.9.4-1
-pkgdesc = Runtime libraries shipped by GCC (from crosstool-ng sysroot)
-url = http://gcc.gnu.org
-builddate = $BUILDDATE
-size = $size
-arch = i486
-EOF
-
-cd pkg/gcc-libs
-tar cJvf - .PKGINFO * | xz > ../../gcc-libs-7.2.0-1-i486.pkg.tar.xz
-cd ../..
-
-cp -v *.pkg.tar.xz $STAGE1_CHROOT/packages/i486/.
-rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
-rm -rf $STAGE1_CHROOT/packages/i486/temp.db*
-rm -rf $STAGE1_CHROOT/packages/i486/temp.files*
-repo-add -R $STAGE1_CHROOT/packages/i486/temp.db.tar.gz $STAGE1_CHROOT/packages/i486/*pkg.tar.xz
-sudo pacman --noconfirm --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Syy gcc-libs
-cd ..
-
-# the glibc shim
-################
-
-cd $HOME/build
-mkdir glibc
-cd glibc
-mkdir -p pkg/glibc/usr/include
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/include/* pkg/glibc/usr/include
-sudo rm -rf pkg/glibc/usr/include/{linux,misc,mtd,rdma,scsi,sound,video,xen,asm,asm-generic}
-mkdir -p pkg/glibc/etc
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/etc/rpc pkg/glibc/etc/.
-mkdir -p pkg/glibc/usr/bin
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/bin/* pkg/glibc/usr/bin/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/sbin/* pkg/glibc/usr/bin/.
-mkdir -p pkg/glibc/usr/lib
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/lib/*.o pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/lib/*.a pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/lib/*.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/ld-linux.so.2 pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/ld-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libc.so.6 pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libc-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libpthread.so.0 pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libpthread-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/lib/gconv pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libutil.so* pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libutil-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libanl.so.1 pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libanl-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libBrokenLocale.so.1 pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libBrokenLocale-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libcrypt.so.1 pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libcrypt-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libdl.so.2 pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libdl-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libm.so.6 pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libm-2.26.so pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libnsl* pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libnss* pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libresolv* pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/librt* pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/lib/libthread_db* pkg/glibc/usr/lib/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/lib/audit pkg/glibc/usr/lib/.
-mkdir -p pkg/glibc/usr/share
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/share/i18n pkg/glibc/usr/share/.
-cp -a $HOME/x-tools/i486-unknown-linux-gnu/i486-unknown-linux-gnu/sysroot/usr/share/locale pkg/glibc/usr/share/.
-
-BUILDDATE=`date '+%s'`
-size=`du -sk --apparent-size pkg/`
-size="$(( ${size%%[^0-9]*} * 1024 ))"
-cat > pkg/glibc/.PKGINFO <<EOF
-pkgname = glibc
-pkgver = 2.26-1
-pkgdesc = GNU C Library (from crosstool-ng sysroot)
-url = http://www.gnu.org/software/libc
-builddate = $BUILDDATE
-size = $size
-arch = i486
-EOF
-
-cd pkg/glibc
-tar cJvf - .PKGINFO * | xz > ../../glibc-2.26-1-i486.pkg.tar.xz
-cd ../..
+su cross ./create_gcc-lib_shim.sh
-cp -v *.pkg.tar.xz $STAGE1_CHROOT/packages/i486/.
-rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
-rm -rf $STAGE1_CHROOT/packages/i486/temp.db*
-rm -rf $STAGE1_CHROOT/packages/i486/temp.files*
-repo-add $STAGE1_CHROOT/packages/i486/temp.db.tar.gz $STAGE1_CHROOT/packages/i486/*pkg.tar.xz
-sudo pacman --force --noconfirm --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Syy glibc
+su cross ./create_glibc_shim.sh
-# the ca-certificates-utils shim
-################################
+# take pre-computed cert stores from an existing machine as the
+# dependencies to build the package are just too many
-# take pre-computed cert stores from an existing machine
+su cross ./create_ca-certificates-utils_shim.sh
-cd $HOME/build
-mkdir ca-certificates-utils
-cd ca-certificates-utils
-mkdir -p pkg/ca-certificates-utils/etc/ssl/certs/
-cp /etc/ssl/certs/ca-certificates.crt pkg/ca-certificates-utils/etc/ssl/certs/.
-
-BUILDDATE=`date '+%s'`
-size=`du -sk --apparent-size pkg/`
-size="$(( ${size%%[^0-9]*} * 1024 ))"
-cat > pkg/ca-certificates-utils/.PKGINFO <<EOF
-pkgname = ca-certificates-utils
-pkgver = 20170307-1
-pkgdesc = Common CA certificates (utilities)
-url = http://pkgs.fedoraproject.org/cgit/rpms/ca-certificates.git
-builddate = $BUILDDATE
-size = $size
-arch = any
-EOF
-
-cd pkg/ca-certificates-utils
-tar cJvf - .PKGINFO * | xz > ../../ca-certificates-utils-20170307-1-any.pkg.tar.xz
-cd ../..
-
-cp -v *.pkg.tar.xz $STAGE1_CHROOT/packages/i486/.
-rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
-rm -rf $STAGE1_CHROOT/packages/i486/temp.db*
-rm -rf $STAGE1_CHROOT/packages/i486/temp.files*
-repo-add $STAGE1_CHROOT/packages/i486/temp.db.tar.gz $STAGE1_CHROOT/packages/i486/*pkg.tar.xz
-sudo pacman --force --noconfirm --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Syy ca-certificates-utils
+# TODO FROM HERE:
-cd ..
# build packages for the i486-chroot
####################################
diff --git a/create_ca-certificates-utils_shim.sh b/create_ca-certificates-utils_shim.sh
new file mode 100644
index 0000000..6026454
--- /dev/null
+++ b/create_ca-certificates-utils_shim.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+. "./default.conf"
+
+# the ca-certificates-utils-shim shim
+
+if test ! -f $STAGE1_CHROOT/packages/$TARGET_CPU/ca-certificates-utils-shim-20170307-1-any.pkg.tar.xz; then
+
+ cd $STAGE1_BUILD
+ rm -rf ca-certificates-utils-shim
+
+ mkdir ca-certificates-utils-shim
+ cd ca-certificates-utils-shim
+ mkdir -p pkg/ca-certificates-utils-shim/etc/ssl/certs/
+ cp /etc/ssl/certs/ca-certificates.crt pkg/ca-certificates-utils-shim/etc/ssl/certs/.
+
+ BUILDDATE=`date '+%s'`
+ size=`du -sk --apparent-size pkg/`
+ size="$(( ${size%%[^0-9]*} * 1024 ))"
+ cat > pkg/ca-certificates-utils-shim/.PKGINFO <<EOF
+pkgname = ca-certificates-utils-shim
+pkgver = 20170307-1
+pkgdesc = Common CA certificates (utilities, from host machine)
+url = http://pkgs.fedoraproject.org/cgit/rpms/ca-certificates.git
+builddate = $BUILDDATE
+size = $size
+arch = any
+provides = ca-certificates-utils
+conflict = ca-certificates-utils
+EOF
+
+ cd pkg/ca-certificates-utils-shim
+ tar cJvf - .PKGINFO * | xz > ../../ca-certificates-utils-shim-20170307-1-any.pkg.tar.xz
+ cd ../..
+
+ cp -v *.pkg.tar.xz $STAGE1_CHROOT/packages/$TARGET_CPU/.
+ rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
+ rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db*
+ rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.files*
+ repo-add $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db.tar.gz $STAGE1_CHROOT/packages/$TARGET_CPU/*pkg.tar.xz
+ sudo pacman --force --noconfirm --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Syy ca-certificates-utils-shim
+
+fi
+
+echo "ca-certificate shim exists."
diff --git a/create_gcc-lib_shim.sh b/create_gcc-lib_shim.sh
new file mode 100644
index 0000000..5045a45
--- /dev/null
+++ b/create_gcc-lib_shim.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+. "./default.conf"
+
+# the gcc-lib shim
+
+if test ! -f $STAGE1_CHROOT/packages/$TARGET_CPU/gcc-libs-shim-7.2.0-1-$TARGET_CPU.pkg.tar.xz; then
+
+ cd $STAGE1_BUILD
+ rm -rf gcc-libs-shim
+ mkdir gcc-libs-shim
+ cd gcc-libs-shim
+ mkdir -p pkg/gcc-libs-shim/usr/lib
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libgcc_s.so pkg/gcc-libs-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libgcc_s.so.1 pkg/gcc-libs-shim/usr/lib/.
+ cp -L $XTOOLS_ARCH/$TARGET_ARCH/lib/libatomic.so.1.2.0 pkg/gcc-libs-shim/usr/lib/.
+ ln -s libatomic.so.1.2.0 pkg/gcc-libs-shim/usr/lib/libatomic.so.1
+ ln -s libatomic.so.1.2.0 pkg/gcc-libs-shim/usr/lib/libatomic.so
+ cp -L $XTOOLS_ARCH/$TARGET_ARCH/lib/libatomic.a pkg/gcc-libs-shim/usr/lib/.
+ cp -L $XTOOLS_ARCH/$TARGET_ARCH/lib/libstdc++.so.6.0.24 pkg/gcc-libs-shim/usr/lib/.
+ ln -s libstdc++.so.6.0.24 pkg/gcc-libs-shim/usr/lib/libstdc++.so.6
+ ln -s libstdc++.so.6.0.24 pkg/gcc-libs-shim/usr/lib/libstdc++.so
+
+ BUILDDATE=`date '+%s'`
+ size=`du -sk --apparent-size pkg/`
+ size="$(( ${size%%[^0-9]*} * 1024 ))"
+ cat > pkg/gcc-libs-shim/.PKGINFO <<EOF
+pkgname = gcc-libs-shim
+pkgver = 4.9.4-1
+pkgdesc = Runtime libraries shipped by GCC (from crosstool-ng sysroot)
+url = http://gcc.gnu.org
+builddate = $BUILDDATE
+size = $size
+arch = $TARGET_CPU
+provides = gcc-libs
+conflict = gcc-libs
+EOF
+
+ cd pkg/gcc-libs-shim
+ tar cJvf - .PKGINFO * | xz > ../../gcc-libs-shim-7.2.0-1-$TARGET_CPU.pkg.tar.xz
+ cd ../..
+
+ cp -v *.pkg.tar.xz $STAGE1_CHROOT/packages/$TARGET_CPU/.
+ rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
+ rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db*
+ rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.files*
+ repo-add -R $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db.tar.gz $STAGE1_CHROOT/packages/$TARGET_CPU/*pkg.tar.xz
+ sudo pacman --noconfirm --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Syy gcc-libs-shim
+fi
+
+echo "gcc-lib shim exists."
diff --git a/create_glibc_shim.sh b/create_glibc_shim.sh
new file mode 100644
index 0000000..c8ce59d
--- /dev/null
+++ b/create_glibc_shim.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+. "./default.conf"
+
+# the glibc-shim shim
+
+if test ! -f $STAGE1_CHROOT/packages/$TARGET_CPU/glibc-shim-2.26-1-$TARGET_CPU.pkg.tar.xz; then
+
+ cd $STAGE1_BUILD
+ rm -rf glibc-shim
+ mkdir glibc-shim
+ cd glibc-shim
+ mkdir -p pkg/glibc-shim/usr/include
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/include/* pkg/glibc-shim/usr/include
+ sudo rm -rf pkg/glibc-shim/usr/include/{linux,misc,mtd,rdma,scsi,sound,video,xen,asm,asm-generic}
+ mkdir -p pkg/glibc-shim/etc
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/etc/rpc pkg/glibc-shim/etc/.
+ mkdir -p pkg/glibc-shim/usr/bin
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/bin/* pkg/glibc-shim/usr/bin/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/sbin/* pkg/glibc-shim/usr/bin/.
+ mkdir -p pkg/glibc-shim/usr/lib
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/lib/*.o pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/lib/*.a pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/lib/*.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/ld-linux.so.2 pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/ld-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libc.so.6 pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libc-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libpthread.so.0 pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libpthread-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/lib/gconv pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libutil.so* pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libutil-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libanl.so.1 pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libanl-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libBrokenLocale.so.1 pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libBrokenLocale-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libcrypt.so.1 pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libcrypt-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libdl.so.2 pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libdl-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libm.so.6 pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libm-2.26.so pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libnsl* pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libnss* pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libresolv* pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/librt* pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/lib/libthread_db* pkg/glibc-shim/usr/lib/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/lib/audit pkg/glibc-shim/usr/lib/.
+ mkdir -p pkg/glibc-shim/usr/share
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/share/i18n pkg/glibc-shim/usr/share/.
+ cp -a $XTOOLS_ARCH/$TARGET_ARCH/sysroot/usr/share/locale pkg/glibc-shim/usr/share/.
+
+ BUILDDATE=`date '+%s'`
+ size=`du -sk --apparent-size pkg/`
+ size="$(( ${size%%[^0-9]*} * 1024 ))"
+ cat > pkg/glibc-shim/.PKGINFO <<EOF
+pkgname = glibc-shim
+pkgver = 2.26-1
+pkgdesc = GNU C Library (from crosstool-ng sysroot)
+url = http://www.gnu.org/software/libc
+builddate = $BUILDDATE
+size = $size
+arch = $TARGET_CPU
+provides = glibc
+conflict = glibc
+EOF
+
+ cd pkg/glibc-shim
+ tar cJvf - .PKGINFO * | xz > ../../glibc-shim-2.26-1-$TARGET_CPU.pkg.tar.xz
+ cd ../..
+
+ cp -v *.pkg.tar.xz $STAGE1_CHROOT/packages/$TARGET_CPU/.
+ rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
+ rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db*
+ rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.files*
+ repo-add $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db.tar.gz $STAGE1_CHROOT/packages/$TARGET_CPU/*pkg.tar.xz
+ sudo pacman --force --noconfirm --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Syy glibc-shim
+
+fi
+
+echo "glibc shim exists."
diff --git a/default.conf b/default.conf
index 20f5972..8786157 100644
--- a/default.conf
+++ b/default.conf
@@ -3,14 +3,20 @@
# target architecture
TARGET_ARCH=i486-unknown-linux-gnu
+# target cpu
+TARGET_CPU=i486
+
# where to build the cross compiler
CROSS_HOME=/home/cross
-# where is the cross compiler installed
+# where is/are the cross compiler(s) installed
XTOOLS_HOME=$CROSS_HOME/x-tools
+# where is the cross compiler of our target architecture installed
+XTOOLS_ARCH=$XTOOLS_HOME/$TARGET_ARCH
+
# the chroot of stage 1
-STAGE1_CHROOT=$CROSS_HOME/i486-root
+STAGE1_CHROOT=$CROSS_HOME/$TARGET_CPU-root
# the place where we build stage 1
-STAGE1_BUILD=$CROSS_HOME/build
+STAGE1_BUILD=$CROSS_HOME/$TARGET_CPU-build
diff --git a/prepare_stage1_repo.sh b/prepare_stage1_repo.sh
index b93635d..dcce93b 100755
--- a/prepare_stage1_repo.sh
+++ b/prepare_stage1_repo.sh
@@ -94,3 +94,5 @@ if test ! -d $CROSS_HOME/packages32; then
echo "Fetched Archlinux32 diffs for packages."
fi
+
+echo "Stage 1 repos ready."