2. Adjusted toolchain

todo: compile glibc, wkpkg, make the wakes prep

2.1. Compile wkpkg

wkpkg: wkpkg.o
	gcc -o wkpkg -Wall -g -lm -lrt -ldl wkpkg.o /tools/lib/libtar.a  \
        /tools/lib/libz.a /tools/lib/libarchive.a /tools/lib/libbz2.a    \
        /tools/lib/libcurl.a /tools/lib/libssl.a /tools/lib/libcrypto.a

wkpkg.o: wkpkg.c
	gcc -Wall -g -c wkpkg.c

clean:
	rm wkpkg.o wkpkg

2.2. Wakes preparation

cat <<EOF > /etc/wkpkg.conf

# Default network depot
http://www.gnuwakes.org/depot main

#usb://depot main

#ftp://www.gnuwakes.org/depot main
#cdrom://depot    main

#disk://var/wkpkg/rep main

EOF

cat <<EOF > /etc/wakes_version
1.0
EOF

mkdir /var/wkpkg/{cat,rep,db,mnt,run}
mkdir /var/wkpkg/mnt/{cdrom,usb}

2.3. Adjust the toolchain

# install linux header and glibc
wkpkg -i linux-headers-4.1.1
wkpkg -i glibc

# ld
mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld

# gcc
gcc -dumpspecs | sed -e 's@/tools@@g'                   \
    -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
    -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' >      \
    `dirname $(gcc --print-libgcc-file-name)`/specs

2.4. Make the docker image

commit change from the running container to a new one:

# id: from docker ps
docker commit id toolchain-wakes-adjusted

run the adjusted container:

docker run -d -p 2223:22 -it toolchain-wakes-adjusted /tools/sbin/sshd -D

enter the adjusted container:

ssh -p 2223 root@0