2020-12-16 23:19:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
|
2021-01-09 08:19:16 +00:00
|
|
|
QEMU_CMD=$1
|
|
|
|
RAM=$2
|
|
|
|
|
2020-12-17 00:25:36 +00:00
|
|
|
pushd sysa
|
|
|
|
|
|
|
|
# SYSTEM A
|
|
|
|
|
2020-12-16 23:19:25 +00:00
|
|
|
# Setup tmp
|
|
|
|
mkdir -p tmp/
|
|
|
|
sudo mount -t tmpfs -o size=8G tmpfs tmp
|
|
|
|
|
|
|
|
# base: mescc-tools-seed
|
2020-12-23 06:02:57 +00:00
|
|
|
# copy in all the mescc-tools-seed stuff
|
2020-12-16 23:19:25 +00:00
|
|
|
cp -r mescc-tools-seed/x86/* tmp
|
2021-01-10 05:02:38 +00:00
|
|
|
cp -r mescc-tools-seed/{M2-Planet,mes-m2} tmp/
|
|
|
|
cp -r mescc-tools-patched tmp/mescc-tools
|
2020-12-23 06:02:57 +00:00
|
|
|
# and the kaem seed
|
2020-12-17 00:25:36 +00:00
|
|
|
cp ../bootstrap-seeds/POSIX/x86/kaem-optional-seed tmp/init
|
|
|
|
cp ../bootstrap-seeds/POSIX/x86/kaem-optional-seed tmp/
|
|
|
|
cp -r ../bootstrap-seeds tmp/
|
2020-12-23 06:02:57 +00:00
|
|
|
# replace the init kaem with our own custom one
|
|
|
|
mv tmp/kaem.run tmp/mescc-tools-seed.kaem.run
|
|
|
|
cp base.kaem.run tmp/kaem.run
|
|
|
|
# create directories needed
|
2020-12-16 23:19:25 +00:00
|
|
|
mkdir tmp/bin
|
|
|
|
|
2021-01-09 08:19:16 +00:00
|
|
|
# after mescc-tools-seed we get into our own directory because
|
2020-12-23 06:02:57 +00:00
|
|
|
# the mescc-tools-seed one is hella messy
|
|
|
|
mkdir tmp/after/bin -p
|
2020-12-25 07:40:14 +00:00
|
|
|
mkdir tmp/after/{lib,include}
|
2021-01-09 08:19:16 +00:00
|
|
|
mkdir tmp/after/lib/{tcc,linux}
|
|
|
|
ln -s . tmp/after/lib/x86-mes
|
|
|
|
ln -s . tmp/after/lib/linux/x86-mes
|
2020-12-25 07:40:14 +00:00
|
|
|
mkdir tmp/after/include/{mes,gnu,linux,sys,mach}
|
2021-01-09 08:19:16 +00:00
|
|
|
mkdir tmp/after/include/linux/{x86,x86_64}
|
2020-12-23 06:02:57 +00:00
|
|
|
cp after.kaem tmp/
|
|
|
|
cp after.kaem.run tmp/after/kaem.run
|
|
|
|
|
2020-12-25 07:40:14 +00:00
|
|
|
# mescc-tools-extra
|
|
|
|
cp -r mescc-tools-extra tmp/after/
|
|
|
|
|
2020-12-16 23:19:25 +00:00
|
|
|
# blynn-compiler
|
2020-12-23 06:02:57 +00:00
|
|
|
pushd tmp/after
|
|
|
|
git clone ../../blynn-compiler-oriansj blynn-compiler
|
|
|
|
cp ../../blynn-compiler.kaem blynn-compiler/go.kaem
|
2020-12-16 23:19:25 +00:00
|
|
|
mkdir blynn-compiler/{bin,generated}
|
|
|
|
popd
|
|
|
|
|
2020-12-25 07:40:14 +00:00
|
|
|
# mes
|
2021-01-04 21:30:53 +00:00
|
|
|
cp -r mes tmp/after/
|
2021-01-09 08:19:16 +00:00
|
|
|
cp -r mes tmp/after/tcc-mes
|
2021-01-04 21:30:53 +00:00
|
|
|
ln -s lib/x86-mes tmp/after/mes/x86-mes
|
|
|
|
cp -r nyacc tmp/after/
|
2020-12-25 07:40:14 +00:00
|
|
|
cp mes.kaem tmp/after/
|
2021-01-04 21:30:53 +00:00
|
|
|
cp mes-files/mescc.scm tmp/after/bin/
|
|
|
|
cp mes-files/config.h tmp/after/mes/include/mes/
|
2021-01-09 08:19:16 +00:00
|
|
|
cp mes-files/config.h tmp/after/tcc-mes/include/mes/
|
2021-01-04 21:30:53 +00:00
|
|
|
mkdir tmp/after/mes/{bin,m2}
|
2020-12-25 07:40:14 +00:00
|
|
|
|
2021-01-10 23:40:25 +00:00
|
|
|
# tcc
|
2021-01-09 08:19:16 +00:00
|
|
|
cp tcc.kaem tmp/after/
|
|
|
|
cp -r tcc-0.9.26p1 tmp/after/
|
2021-01-10 23:40:25 +00:00
|
|
|
cp -r tcc-0.9.27 tmp/after/
|
|
|
|
touch tmp/after/tcc-0.9.27/config.h
|
|
|
|
touch tmp/after/tcc-0.9.26p1/config.h
|
2021-01-09 08:19:16 +00:00
|
|
|
pushd tmp/after/tcc-0.9.26p1
|
|
|
|
ln -s ../mes/module .
|
|
|
|
ln -s ../mes/mes .
|
|
|
|
ln -s /after/lib x86-mes
|
|
|
|
ln -s /after/lib/linux .
|
|
|
|
popd
|
|
|
|
|
2020-12-16 23:19:25 +00:00
|
|
|
# General cleanup
|
|
|
|
find tmp -name .git -exec rm -rf \;
|
|
|
|
|
|
|
|
# initramfs
|
|
|
|
cd tmp
|
|
|
|
find . | cpio -H newc -o | gzip > initramfs.igz
|
2020-12-17 00:20:22 +00:00
|
|
|
|
|
|
|
# Run
|
2021-01-09 08:19:16 +00:00
|
|
|
${QEMU_CMD:-qemu-system-x86_64} -enable-kvm \
|
|
|
|
-m ${RAM:-8G} \
|
2020-12-17 00:20:22 +00:00
|
|
|
-nographic \
|
|
|
|
-no-reboot \
|
2021-01-09 08:19:16 +00:00
|
|
|
-kernel ../../kernel -initrd initramfs.igz -append console=ttyS0
|
2020-12-16 23:19:25 +00:00
|
|
|
|
2020-12-25 07:40:14 +00:00
|
|
|
cd ../..
|
2020-12-17 00:25:36 +00:00
|
|
|
|
2020-12-25 07:40:14 +00:00
|
|
|
# Cleanup
|
|
|
|
sudo umount sysa/tmp
|
2021-01-09 08:19:16 +00:00
|
|
|
|