diff --git a/.gitignore b/.gitignore index 385f871..d7c388c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tmp/ kernel +sources/ diff --git a/.gitmodules b/.gitmodules index dcb71ab..e91e301 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,6 +22,6 @@ [submodule "sysa/tcc-0.9.27"] path = sysa/tcc-0.9.27 url = git://repo.or.cz/tinycc.git -[submodule "sysa/sed-1.18"] - path = sysa/sed-1.18 - url = git://git.savannah.gnu.org/sed/sed-history.git +[submodule "sysa/sed-4.0.7"] + path = sysa/sed-4.0.7 + url = https://git.savannah.gnu.org/git/sed/sed-history.git diff --git a/rootfs.sh b/rootfs.sh index 09007c8..5045c9c 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -75,9 +75,36 @@ popd mkdir -p ../sources -# sed 1.18 -cp sed-1.18.kaem tmp/after -cp -r sed-1.18 tmp/after +# sed 4.0.7 +cp sed-4.0.7.kaem tmp/after +cp -r sed-4.0.7 tmp/after + +# tar 1.12 +url=https://ftp.gnu.org/gnu/tar/tar-1.12.tar.gz +pushd ../sources +wget --continue "$url" +popd +cp "$(basename $url .tar.gz).kaem" tmp/after +tar -C tmp/after -xf "../sources/$(basename $url)" + +get_file() { + url=$1 + pushd ../sources + wget --continue "$url" + popd + ext="${url##*.}" + if [ "$ext" = "tar" ]; then + bname=$(basename "$url" .tar) + else + bname=$(basename "$url" ".tar.${ext}") + fi + cp "${bname}.kaem" tmp/after + cp "../sources/$(basename "$url")" tmp/after +} + +# Download remaining sources +get_file https://ftp.gnu.org/gnu/gzip/gzip-1.2.4.tar +get_file https://ftp.gnu.org/gnu/diffutils/diffutils-2.7.tar.gz # General cleanup find tmp -name .git -exec rm -rf \; @@ -88,7 +115,7 @@ find . | cpio -H newc -o | gzip > initramfs.igz # Run ${QEMU_CMD:-qemu-system-x86_64} -enable-kvm \ - -m ${RAM:-8G} \ + -m "${RAM:-8G}" \ -nographic \ -no-reboot \ -kernel ../../kernel -initrd initramfs.igz -append console=ttyS0 diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run index 9c80b03..944e177 100755 --- a/sysa/after.kaem.run +++ b/sysa/after.kaem.run @@ -49,6 +49,24 @@ kaem --file mes.kaem kaem --file tcc.kaem # Part 7: sed -cd sed-1.18 -kaem --file ../sed-1.18.kaem +cd sed-4.0.7 +kaem --file ../sed-4.0.7.kaem +cd .. + +# Part 8: tar +cd tar-1.12 +kaem --file ../tar-1.12.kaem +cd .. + +# Part 9: gzip +/after/bin/tar xf gzip-1.2.4.tar +cd gzip-1.2.4 +kaem --file ../gzip-1.2.4.kaem +cd .. + +# Part 10: diffutils +/after/bin/gunzip diffutils-2.7.tar.gz +/after/bin/tar xf diffutils-2.7.tar +cd diffutils-2.7 +kaem --file ../diffutils-2.7.kaem cd .. diff --git a/sysa/diffutils-2.7.kaem b/sysa/diffutils-2.7.kaem new file mode 100755 index 0000000..ed8ac10 --- /dev/null +++ b/sysa/diffutils-2.7.kaem @@ -0,0 +1,34 @@ +#!/bin/sh + +set -ex + +# Variables +bindir=/after/bin + +# Touch config.h file +catm config.h + +# Compile +tcc -c -I. -DNULL_DEVICE=\"/dev/null\" cmp.c +tcc -c -I. cmpbuf.c +tcc -c -I. error.c +tcc -c -I. getopt.c +tcc -c -I. getopt1.c +tcc -c -I. xmalloc.c +tcc -c -I. version.c +tcc -c -I. diff.c +tcc -c -I. analyze.c +tcc -c -I. -DHAVE_DIRENT_H dir.c +tcc -c -I. io.c +tcc -c -I. -DHAVE_DUP2 -DHAVE_FORK=0 util.c +tcc -c -I. context.c +tcc -c -I. ed.c +tcc -c -I. ifdef.c +tcc -c -I. normal.c +tcc -c -I. side.c +tcc -c -I. fnmatch.c +tcc -c -I. regex.c + +# Link +tcc -static -o ${bindir}/cmp cmp.o cmpbuf.o error.o getopt.o getopt1.o xmalloc.o version.o +tcc -static -o ${bindir}/diff diff.o analyze.o cmpbuf.o dir.o io.o util.o context.o ed.o ifdef.o normal.o side.o fnmatch.o getopt.o getopt1.o regex.o version.o diff --git a/sysa/gzip-1.2.4.kaem b/sysa/gzip-1.2.4.kaem new file mode 100755 index 0000000..3aa58dc --- /dev/null +++ b/sysa/gzip-1.2.4.kaem @@ -0,0 +1,34 @@ +#!/bin/sh + +set -ex + +# Variables +bindir=/after/bin + +# Compile +tcc -c -DNO_UTIME gzip.c +tcc -c bits.c +tcc -c crypt.c +tcc -c deflate.c +tcc -c getopt.c +tcc -c inflate.c +tcc -c lzw.c +tcc -c trees.c +tcc -c unlzh.c +tcc -c unlzw.c +tcc -c unpack.c +tcc -c unzip.c +# Remove strlwr, it does not build with mes libc +cp util.c util_patched.c +sed -i 165,174d util_patched.c +tcc -c util_patched.c +tcc -c zip.c + +# Link +tcc -static -o ${bindir}/gzip gzip.o zip.o deflate.o trees.o bits.o unzip.o inflate.o util_patched.o crypt.o lzw.o unlzw.o unpack.o unlzh.o getopt.o + +# Install +cp ${bindir}/gzip ${bindir}/gunzip +cp ${bindir}/gzip ${bindir}/zcat +chmod 755 ${bindir}/gunzip +chmod 755 ${bindir}/zcat diff --git a/sysa/sed-1.18 b/sysa/sed-1.18 deleted file mode 160000 index cff4df5..0000000 --- a/sysa/sed-1.18 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cff4df55786bae5f4f0c042a13d30cd1a962040c diff --git a/sysa/sed-1.18.kaem b/sysa/sed-1.18.kaem deleted file mode 100755 index 43596da..0000000 --- a/sysa/sed-1.18.kaem +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -set -ex - -# Variables -bindir=/after/bin - -# Compile -tcc -c getopt1.c -tcc -c getopt.c -tcc -c regex.c -tcc -c utils.c -tcc -c -Dalloca alloca.c -tcc -c -DHAVE_BCOPY sed.c - -# Link -tcc -static -o ${bindir}/sed alloca.o getopt1.o getopt.o regex.o sed.o utils.o diff --git a/sysa/sed-4.0.7 b/sysa/sed-4.0.7 new file mode 160000 index 0000000..b8fb156 --- /dev/null +++ b/sysa/sed-4.0.7 @@ -0,0 +1 @@ +Subproject commit b8fb156db0eedfd28db3340b418591e8fcab08bc diff --git a/sysa/sed-4.0.7.kaem b/sysa/sed-4.0.7.kaem new file mode 100755 index 0000000..dade234 --- /dev/null +++ b/sysa/sed-4.0.7.kaem @@ -0,0 +1,37 @@ +#!/bin/sh + +set -ex + +# Variables +bindir=/after/bin + +catm config.h + +# Compile + +## libsed.a +cd lib + +tcc -c getopt1.c +tcc -c -I .. getopt.c +tcc -c -I .. -DENABLE_NLS=0 utils.c +cp regex_.h regex.h +tcc -c -I . regex.c +tcc -c obstack.c +tcc -c strverscmp.c +tcc -c getline.c +tcc -c -DHAVE_FCNTL_H mkstemp.c + +tcc -ar cr libsed.a getopt1.o getopt.o utils.o regex.o obstack.o strverscmp.o getline.o mkstemp.o +cd .. + +## sed +tcc -c -I . -I lib -DSED_FEATURE_VERSION=\"4.0\" sed/compile.c +tcc -c -I . -I lib sed/execute.c +tcc -c -I . -I lib sed/regex.c +tcc -c -I . -I lib sed/fmt.c +tcc -c -I . -I lib -DPACKAGE=\"sed\" -DVERSION=\"4.0.7\" sed/sed.c + +# Link +tcc -static -o ${bindir}/sed -L lib lib/libsed.a compile.o execute.o regex.o fmt.o sed.o -lsed + diff --git a/sysa/tar-1.12.kaem b/sysa/tar-1.12.kaem new file mode 100755 index 0000000..f038f0d --- /dev/null +++ b/sysa/tar-1.12.kaem @@ -0,0 +1,51 @@ +#!/bin/sh + +set -ex + +# Variables +bindir=/after/bin + +# Compile + +## libtar.a +cd lib + +tcc -c argmatch.c +tcc -c -DHAVE_DIRENT_H backupfile.c +tcc -c -I . error.c +tcc -c -I . fnmatch.c +tcc -c ftruncate.c +tcc -c getdate.c +tcc -c getopt.c +tcc -c getopt1.c +tcc -c getversion.c +tcc -c modechange.c +tcc -c msleep.c +tcc -c -DHAVE_GETCWD xgetcwd.c +tcc -c xmalloc.c +tcc -c xstrdup.c + +tcc -ar cr libtar.a argmatch.o backupfile.o error.o fnmatch.o ftruncate.o getdate.o getopt.o getopt1.o getversion.o modechange.o msleep.o xgetcwd.o xmalloc.o xstrdup.o +cd .. + +## tar +# -DSIZEOF_UNSIGNED_LONG=4 forces use of simulated arithmetic +# This is to avoid running configure test to determine sizeof(long long) +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/arith.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/buffer.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/compare.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H -DHAVE_DIRENT_H src/create.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/delete.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/extract.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H -DHAVE_GETCWD -DHAVE_DIRENT_H src/incremen.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/list.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/mangle.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H -DHAVE_DIRENT_H src/misc.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H -DHAVE_GETCWD src/names.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/open3.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/rtapelib.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H -DPACKAGE=\"tar\" -DVERSION=\"1.12\" src/tar.c +tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/update.c + +# Link +tcc -static -o ${bindir}/tar -L lib lib/libtar.a arith.o buffer.o compare.o create.o delete.o extract.o incremen.o list.o mangle.o misc.o names.o open3.o rtapelib.o tar.o update.o -ltar