Initial commit

This commit is contained in:
Fierelier 2023-05-11 13:57:12 +02:00
commit b2ca9d9145
4 changed files with 62 additions and 0 deletions

3
env.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
export BD="$(dirname "$(realpath -s "$BASH_SOURCE")")"
export PATH="$BD/path:$PATH"

2
path/get-deps Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo apt install git build-essential flex bison libncurses-dev qemu-system-x86 syslinux

39
path/make-initrd Executable file
View File

@ -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?

18
path/make-linux Executable file
View File

@ -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 .