feat: Implement complete Zero OS Alpine Initramfs Builder

- Complete bash framework with strict error handling
- Modular library system (docker, alpine, components, initramfs, kernel, testing)
- Rust component integration (zinit, rfs, mycelium) with musl targeting
- Rootless Docker/Podman support for GitHub Actions
- Centralized configuration in config/build.conf
- 2-stage module loading system
- Strip + UPX optimization for minimal size
- Complete zinit integration replacing OpenRC
- GitHub Actions CI/CD pipeline
- Comprehensive documentation and usage guides

Components:
- Latest stable kernel 6.12.44
- Alpine Linux 3.22 base
- ThreeFold components: zinit, mycelium, rfs, corex
- Target: ~8-12MB final initramfs.cpio.xz
This commit is contained in:
2025-08-31 12:31:49 +02:00
commit 860b9aa161
81 changed files with 30118 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
#!/bin/bash
echo "start ash terminal"
while true; do
getty -l /bin/ash -n 19200 tty2
done

10
configs/zinit/init/cgroup.sh Executable file
View File

@@ -0,0 +1,10 @@
set -x
mount -t tmpfs cgroup_root /sys/fs/cgroup
subsys="pids cpuset cpu cpuacct blkio memory devices freezer net_cls perf_event net_prio hugetlb"
for sys in $subsys; do
mkdir -p /sys/fs/cgroup/$sys
mount -t cgroup $sys -o $sys /sys/fs/cgroup/$sys/
done

10
configs/zinit/init/modprobe.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
modprobe fuse
modprobe btrfs
modprobe tun
modprobe br_netfilter
echo never > /sys/kernel/mm/transparent_hugepage/enabled
ulimit -n 524288

10
configs/zinit/init/ntpd.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
ntp_flags=$(grep -o 'ntp=.*' /proc/cmdline | sed 's/^ntp=//')
params=""
if [ -n "$ntp_flags" ]; then
params=$(echo "-p $ntp_flags" | sed s/,/' -p '/g)
fi
exec ntpd -n $params

4
configs/zinit/init/routing.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
echo "Enable ip forwarding"
echo 1 > /proc/sys/net/ipv4/ip_forward

3
configs/zinit/init/shm.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
mkdir /dev/shm
mount -t tmpfs shm /dev/shm

View File

@@ -0,0 +1,15 @@
#!/bin/ash
if [ -f /etc/ssh/ssh_host_rsa_key ]; then
# ensure existing file permissions
chown root:root /etc/ssh/ssh_host_*
chmod 600 /etc/ssh/ssh_host_*
exit 0
fi
echo "Setting up sshd"
mkdir -p /run/sshd
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa -b 521
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519

4
configs/zinit/init/udev.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
udevadm trigger --action=add
udevadm settle