commit b2ca9d914507db4f6f91ba2c6b0601375170dccd Author: Fierelier Date: Thu May 11 13:57:12 2023 +0200 Initial commit diff --git a/env.sh b/env.sh new file mode 100644 index 0000000..82d786b --- /dev/null +++ b/env.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +export BD="$(dirname "$(realpath -s "$BASH_SOURCE")")" +export PATH="$BD/path:$PATH" diff --git a/path/get-deps b/path/get-deps new file mode 100755 index 0000000..ecb11f0 --- /dev/null +++ b/path/get-deps @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +sudo apt install git build-essential flex bison libncurses-dev qemu-system-x86 syslinux diff --git a/path/make-initrd b/path/make-initrd new file mode 100755 index 0000000..229a63e --- /dev/null +++ b/path/make-initrd @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -e +cd "$BD" +bbver="1.33.1" +mkdir -p initrd +cd initrd +wget "https://busybox.net/downloads/busybox-$bbver.tar.bz2" +tar -xvf "busybox-$bbver.tar.bz2" +cd "busybox-$bbver" +make allnoconfig + +make menuconfig +# Settings > Build static binary (no shared libs) +# Coreutils > chroot, sleep, mkdir +# Linux Module Utilities > modprobe +# Linux System Utilities > switch_root +# Shells > ash, Optimize for size instead of speed + +make +make install +mkdir -p ../fs +mv _install/. ../fs +cd ../fs +mkdir -p "proc" "sys" "lib/modules" +#sudo mknod -m 644 "dev/console" c 5 1 +#sudo mknod -m 644 "dev/null" c 1 3 + +echo '#!/bin/sh +mkdir -p /proc /sys /mnt/root +mount -t proc none /proc +mount -t sysfs none /sys +modprobe ata_generic +modprobe vfat +sleep 5 +mount "/sys/dev/block/8:1" /mnt/root +exec switch_root /mnt/root /sbin/init +' >"bin/init" +chmod +x "bin/init" +find . | cpio -H newc -o | gzip -9 > ../rootfs.cpio.gz # use XZ instead? diff --git a/path/make-linux b/path/make-linux new file mode 100755 index 0000000..bb03f5a --- /dev/null +++ b/path/make-linux @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -e +cd "$BD" +git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git +cd linux +make tinyconfig + +make menuconfig +# General Setup > Initial RAM filesystem and RAM disk (initramfs/initrd) +# General Setup > Configure standard kernel features (expert users) > Enable support for printk +# Processor type and features > Processor family > 486 +# Device Drivers > Character devices > Enable TTY +# Executable file formats > Kernel support for ELF binaries +# Executable file formats > Kernel support for scripts starting with #! +# CONFIG_ATA_GENERIC + +make bzImage +mv arch/x86/boot/bzImage .