summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2023-05-08 20:16:38 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2023-05-08 20:16:38 +0200
commitca0e8f54b76e66aa5f8770a495873ad2399cae8f (patch)
treed1ca6269bbcca2a5ce441b45ed3874c431fc2f41 /scripts
parent943a8ffa9a08c11d8c5e76513a8f0a5e881a601a (diff)
downloadi486tcc-linux-ca0e8f54b76e66aa5f8770a495873ad2399cae8f.tar.gz
i486tcc-linux-ca0e8f54b76e66aa5f8770a495873ad2399cae8f.tar.bz2
improved size of ramdisk, we can boot with 24M now
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create_ramdisk.sh66
-rwxr-xr-xscripts/create_root.sh4
-rwxr-xr-xscripts/run_qemu.sh2
-rwxr-xr-xscripts/run_qemu_direct.sh4
4 files changed, 32 insertions, 44 deletions
diff --git a/scripts/create_ramdisk.sh b/scripts/create_ramdisk.sh
index 5fd1229..816a77a 100755
--- a/scripts/create_ramdisk.sh
+++ b/scripts/create_ramdisk.sh
@@ -21,57 +21,43 @@ BASE=$(dirname ${SCRIPT})/..
RAMDISK="${BASE}"/ramdisk
LOCAL="${BASE}"/local
-rm -rf "${BASE}/ramdisk"
-cp -R "${BASE}/build/stage1" "${BASE}/ramdisk"
+rm -rf "${RAMDISK}"
+mkdir "${RAMDISK}"
-# remove cross-compilers
-# TODO: they should not be built in the first place
-rm -f "${RAMDISK}"/bin/x86_64*tcc
-rm -f "${RAMDISK}"/bin/tcc
-rm -f "${RAMDISK}"/bin/arm*tcc
-rm -f "${RAMDISK}"/bin/c67*tcc
-rm -f "${RAMDISK}"/bin/riscv64*tcc
-rm -f "${RAMDISK}"/bin/*win32*tcc
-rm -rf "${RAMDISK}"/lib/tcc/x86_64*
-rm -rf "${RAMDISK}"/lib/tcc/arm*
-rm -rf "${RAMDISK}"/lib/tcc/riscv64*
-rm -rf "${RAMDISK}"/lib/tcc/win32
-rm -rf "${RAMDISK}"/lib/tcc/libtcc1.a
-rm -rf "${RAMDISK}"/lib/tcc/bt-*.o
-rm -rf "${RAMDISK}"/lib/tcc/bcheck.o
+# the ramdisk init script
+cp "${BASE}"/local/init "${RAMDISK}"
-# remove the kernel and the /boot directory
-rm -rf "${RAMDISK}"/boot
-
-# remove some unneeded development stuff
-rm -rf "${RAMDISK}"/lib/pkgconfig
-
-# no HTML or info documentation
-rm -rf "${RAMDISK}"/share/info
-rm -rf "${RAMDISK}"/share/doc
+# the kernel modules
+mkdir "${RAMDISK}/lib"
+cp -R "${BASE}/build/stage1/lib/modules" "${RAMDISK}/lib"
# make sure mount points exist
test -d "${RAMDISK}"/dev || mkdir "${RAMDISK}"/dev
test -d "${RAMDISK}"/dev/pts || mkdir "${RAMDISK}"/dev/pts
test -d "${RAMDISK}"/proc || mkdir "${RAMDISK}"/proc
test -d "${RAMDISK}"/sys || mkdir "${RAMDISK}"/sys
-test -d "${RAMDISK}"/tmp || mkdir "${RAMDISK}"/tmp
-test -d "${RAMDISK}"/var || mkdir "${RAMDISK}"/var
-test -d "${RAMDISK}"/var/run || mkdir "${RAMDISK}"/var/run
+#~ test -d "${RAMDISK}"/tmp || mkdir "${RAMDISK}"/tmp
+#~ test -d "${RAMDISK}"/var || mkdir "${RAMDISK}"/var
+#~ test -d "${RAMDISK}"/var/run || mkdir "${RAMDISK}"/var/run
-# copy locally adapted scripts
-test -d "${RAMDISK}/root" || mkdir "${RAMDISK}/root"
-cp "${LOCAL}"/root/.profile "${RAMDISK}/root"
+# just copy the stuff needed by '/init'
test -d "${RAMDISK}/bin" || mkdir "${RAMDISK}/bin"
-cp -dR "${LOCAL}"/bin/* "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/oksh "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/sh "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/ubase-box "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/mount "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/insmod "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/switch_root "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/sbase-box "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/mkdir "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/sdhcp "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/abase-box "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/ifconfig "${RAMDISK}/bin"
+cp -dR "${BASE}/build/stage1"/bin/nbd-client "${RAMDISK}/bin"
+
+# mount calls setmntent which want to write to '/etc/fstab'?
test -d "${RAMDISK}/etc" || mkdir "${RAMDISK}/etc"
-cp -dR "${LOCAL}"/etc/* "${RAMDISK}/etc"
-cp -dR "${LOCAL}"/init "${RAMDISK}/."
-
-# default passwd is SHA-256 or SHA-512 which can take a minute to verify
-# on old machines! We are using unsafe MD5 crypt1, beware of hacks!
-HASH=$(openssl passwd -1 -salt '5RPVAd' 'xx')
-echo "root:${HASH}:17718::::::" >"${RAMDISK}/etc/shadow"
+cp "${BASE}/local"/etc/fstab "${RAMDISK}/etc"
# package ramdisk directory with cpio and compress it with xz
cd "${RAMDISK}"
diff --git a/scripts/create_root.sh b/scripts/create_root.sh
index 70171ed..f24d637 100755
--- a/scripts/create_root.sh
+++ b/scripts/create_root.sh
@@ -77,8 +77,10 @@ cp -dR "${LOCAL}"/bin/* "${ROOT}/bin"
test -d "${ROOT}/etc" || mkdir "${ROOT}/etc"
cp -dR "${LOCAL}"/etc/* "${ROOT}/etc"
-# copy ramdisk to /boot
+# copy ramdisk, boot loader and kernel to /boot
cp ramdisk.img "${ROOT}/boot"
+cp "${BASE}/build/stage1/boot/bzImage" "${ROOT}/boot"
+cp "${BASE}/build/stage1/boot/boot.img" "${ROOT}/boot"
# default passwd is SHA-256 or SHA-512 which can take a minute to verify
# on old machines! We are using unsafe MD5 crypt1, beware of hacks!
diff --git a/scripts/run_qemu.sh b/scripts/run_qemu.sh
index d041bee..140dcfd 100755
--- a/scripts/run_qemu.sh
+++ b/scripts/run_qemu.sh
@@ -1,7 +1,7 @@
#!/bin/sh
sleep 2 && \
-qemu-system-i386 -cpu 486 -m 64M \
+qemu-system-i386 -cpu 486 -m 24M \
-drive "file=floppy00,if=floppy,format=raw" \
-netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16,hostfwd=tcp::8080-:80,hostfwd=udp::8081-:81 \
-device ne2k_isa,iobase=0x300,irq=10,netdev=net0
diff --git a/scripts/run_qemu_direct.sh b/scripts/run_qemu_direct.sh
index aac3bc9..76290ec 100755
--- a/scripts/run_qemu_direct.sh
+++ b/scripts/run_qemu_direct.sh
@@ -1,8 +1,8 @@
#!/bin/oksh
sleep 2 && \
-qemu-system-i386 -cpu 486 -m 64M \
+qemu-system-i386 -cpu 486 -m 24M \
-kernel bzImage -initrd ramdisk.img \
- -append "debug loglevel=7 earlycon=uart8250,io,0x3f8,9600n8 console=tty0 console=ttyS0,9600n8 init=/init iommu=off" \
+ -append "debug loglevel=7 earlycon=uart8250,io,0x3f8,9600n8 console=tty0 console=ttyS0,9600n8 iommu=off nomodeset init=/init" \
-netdev user,id=net0,net=10.0.0.0/24,host=10.0.0.2,dhcpstart=10.0.0.16,hostfwd=tcp::8080-:80 \
-device ne2k_isa,iobase=0x300,irq=10,netdev=net0