2003-03-13 15:24:49 +01:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
. ./settings
|
|
|
|
|
|
|
|
if ! ./mountloop; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Cleanup.
|
|
|
|
rm -rf $target/dev
|
|
|
|
rm -rf $target/proc
|
|
|
|
|
|
|
|
# Create the basic directory structure.
|
|
|
|
mkdir $target
|
|
|
|
mkdir $target/dev
|
|
|
|
mkdir $target/proc
|
|
|
|
mkdir $target/pkg
|
|
|
|
mkdir $target/pkg/sys
|
|
|
|
mkdir $target/pkg/sys/bin
|
|
|
|
mkdir $target/pkg/sys/var
|
|
|
|
mkdir $target/mnt
|
|
|
|
mkdir $target/mnt/host
|
|
|
|
mkdir -m 1777 $target/tmp
|
|
|
|
|
|
|
|
# Make package registrations.
|
|
|
|
pkgdb=$target/pkg/sys/var/pkginfo
|
|
|
|
|
|
|
|
# Copy some programs and its libraries.
|
2003-03-14 17:43:14 +01:00
|
|
|
utils="/usr/bin/vi /bin/sh /bin/mount /bin/umount /bin/ls /bin/ln /bin/cp /bin/mv /bin/rm /bin/cat /bin/df /bin/pwd /usr/bin/ld /usr/bin/as /bin/sed /bin/chmod /bin/chown /usr/bin/expr /bin/mkdir /bin/rmdir /usr/bin/sort /usr/bin/uniq /bin/uname /usr/bin/grep /bin/sleep /bin/gzip /usr/bin/make /usr/bin/cmp /bin/date /usr/bin/tr /usr/bin/ar /usr/bin/ranlib /usr/bin/basename /usr/bin/less /usr/bin/md5sum /bin/tar ../src/nix"
|
2003-03-13 15:24:49 +01:00
|
|
|
bootlib=/pkg/prog-bootstrap/lib
|
|
|
|
bootbin=/pkg/prog-bootstrap/bin
|
|
|
|
mkdir -p $target/$bootlib
|
|
|
|
mkdir -p $target/$bootbin
|
|
|
|
cp -p $utils $target/$bootbin
|
|
|
|
libs=`ldd $utils | awk '{ print $3 }' | sort | uniq`
|
|
|
|
echo $libs
|
|
|
|
cp -p $libs $target/$bootlib
|
|
|
|
for i in libc.so.6 libdl.so.2 libpthread.so.0 librt.so.1 libresolv.so.2 ld-linux.so.2; do rm $target/$bootlib/$i; done
|
2003-03-14 17:43:14 +01:00
|
|
|
../src/nix -d $pkgdb regpkg 5703121fe19cbeeaee7edd659cf4a25b /pkg/prog-bootstrap
|
2003-03-13 15:24:49 +01:00
|
|
|
|
|
|
|
mv $target/$bootbin/nix $target/pkg/sys/bin
|
2003-03-14 17:43:14 +01:00
|
|
|
../src/nix -d $pkgdb regpkg 36bcbb801f5052739af8220c6ea51434 /pkg/sys
|
2003-03-13 15:24:49 +01:00
|
|
|
|
|
|
|
# Copy the bootstrap gcc.
|
|
|
|
echo Copying gcc...
|
|
|
|
rsync -a ../bootstrap/gcc/inst/pkg $target
|
2003-03-14 17:43:14 +01:00
|
|
|
../src/nix -d $pkgdb regpkg 02212b3dc4e50349376975367d433929 /pkg/gcc-bootstrap
|
2003-03-13 15:24:49 +01:00
|
|
|
|
|
|
|
# Copy the bootstrap glibc.
|
|
|
|
echo Copying glibc...
|
|
|
|
glibcdir=/pkg/glibc-bootstrap
|
|
|
|
rsync -a ../bootstrap/glibc/inst/pkg $target
|
2003-03-14 17:43:14 +01:00
|
|
|
../src/nix -d $pkgdb regpkg c0ce03ee0bab298babbe7e3b6159d36c $glibcdir
|
2003-03-13 15:24:49 +01:00
|
|
|
|
|
|
|
# Copy the bootstrap kernel header files.
|
|
|
|
echo Copying kernel headers...
|
|
|
|
kerneldir=/pkg/kernel-bootstrap
|
|
|
|
rsync -a ../bootstrap/kernel/inst/pkg $target
|
2003-03-14 17:43:14 +01:00
|
|
|
../src/nix -d $pkgdb regpkg 3dc8333a2c2b4d627b892755417acf89 $kerneldir
|
2003-03-13 15:24:49 +01:00
|
|
|
|
|
|
|
# Compatibility.
|
|
|
|
rm -rf $target/lib
|
|
|
|
mkdir $target/lib
|
|
|
|
ln -sf $glibcdir/lib/ld-linux.so.2 $target/lib/ld-linux.so.2
|
|
|
|
|
|
|
|
rm -rf $target/bin
|
|
|
|
mkdir $target/bin
|
|
|
|
ln -sf $bootbin/sh $target/bin/sh
|
|
|
|
|
|
|
|
# Build ld.so.cache.
|
|
|
|
ldsoconf=$target/$glibcdir/etc/ld.so.conf
|
|
|
|
echo $glibcdir/lib > $ldsoconf
|
|
|
|
echo $bootlib >> $ldsoconf
|
|
|
|
$target/$glibcdir/sbin/ldconfig -r $target
|
|
|
|
|
|
|
|
# Source repository.
|
|
|
|
rm -f $target/src
|
2003-03-14 17:43:14 +01:00
|
|
|
ln -sf /mnt/host/`pwd`/../pkg $target/src
|
2003-03-13 15:24:49 +01:00
|
|
|
|
|
|
|
# Copy boot script.
|
|
|
|
cp -p ./start $target/pkg/sys/bin
|
|
|
|
|
|
|
|
# Done.
|
|
|
|
echo Done!
|
|
|
|
umount $target
|
|
|
|
rmdir $target
|