feat: Create minimal Zero-OS initramfs with console support
- Fixed build system to clone source repositories instead of downloading binaries - Enhanced scripts/fetch-github.sh with proper git repo cloning and branch handling - Updated scripts/compile-components.sh for RFS compilation with build-binary feature - Added minimal firmware installation for essential network drivers (73 modules) - Created comprehensive zinit configuration set (15 config files including getty) - Added util-linux package for getty/agetty console support - Optimized package selection for minimal 27MB initramfs footprint - Successfully builds bootable vmlinuz.efi with embedded initramfs - Confirmed working: VM boot, console login, network drivers, zinit init system Components: - initramfs.cpio.xz: 27MB compressed minimal Zero-OS image - vmlinuz.efi: 35MB bootable kernel with embedded initramfs - Complete Zero-OS toolchain: zinit, rfs, mycelium compiled from source
This commit is contained in:
@@ -10,6 +10,9 @@ musl
|
||||
eudev
|
||||
kmod
|
||||
|
||||
# Console/terminal management
|
||||
util-linux
|
||||
|
||||
# Essential networking (for Zero-OS connectivity)
|
||||
iproute2
|
||||
ethtool
|
||||
@@ -24,6 +27,9 @@ zlib
|
||||
# Network utilities (minimal)
|
||||
dhcpcd
|
||||
|
||||
# Random number generation (for crypto/security)
|
||||
haveged
|
||||
|
||||
# NO debugging tools, NO development tools, NO SSH, NO curl/wget
|
||||
# NO python, NO redis, NO massive linux-firmware package
|
||||
# These will be loaded from RFS after network connectivity
|
||||
2
configs/zinit/cgroup.yaml
Normal file
2
configs/zinit/cgroup.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
exec: sh /etc/zinit/init/cgroup.sh
|
||||
oneshot: true
|
||||
2
configs/zinit/console.yaml
Normal file
2
configs/zinit/console.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
exec: /sbin/getty -L 9600 console
|
||||
restart: always
|
||||
2
configs/zinit/getty.yaml
Normal file
2
configs/zinit/getty.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
exec: /sbin/getty -L 115200 ttyS0 vt100
|
||||
restart: always
|
||||
2
configs/zinit/haveged.yaml
Normal file
2
configs/zinit/haveged.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
exec: haveged -w 1024 -d 32 -i 32 -v 1
|
||||
oneshot: true
|
||||
6
configs/zinit/init/ashloging.sh
Normal file
6
configs/zinit/init/ashloging.sh
Normal 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
Normal file
10
configs/zinit/init/cgroup.sh
Normal 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
Normal file
10
configs/zinit/init/modprobe.sh
Normal 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
Normal file
10
configs/zinit/init/ntpd.sh
Normal 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
Normal file
4
configs/zinit/init/routing.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Enable ip forwarding"
|
||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||
15
configs/zinit/init/sshd-setup.sh
Normal file
15
configs/zinit/init/sshd-setup.sh
Normal 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
Normal file
4
configs/zinit/init/udev.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
udevadm trigger --action=add
|
||||
udevadm settle
|
||||
2
configs/zinit/local-modprobe.yaml
Normal file
2
configs/zinit/local-modprobe.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
exec: sh /etc/zinit/init/modprobe.sh
|
||||
oneshot: true
|
||||
3
configs/zinit/ntp.yaml
Normal file
3
configs/zinit/ntp.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
exec: sh /etc/zinit/init/ntpd.sh
|
||||
after:
|
||||
- internet
|
||||
2
configs/zinit/routing.yaml
Normal file
2
configs/zinit/routing.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
exec: sh /etc/zinit/init/routing.sh
|
||||
oneshot: true
|
||||
2
configs/zinit/sshd-setup.yaml
Normal file
2
configs/zinit/sshd-setup.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
exec: sh /etc/zinit/init/sshd-setup.sh
|
||||
oneshot: true
|
||||
3
configs/zinit/sshd.yaml
Normal file
3
configs/zinit/sshd.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
exec: /usr/sbin/sshd -D -e
|
||||
after:
|
||||
- sshd-setup
|
||||
4
configs/zinit/udev-trigger.yaml
Normal file
4
configs/zinit/udev-trigger.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
exec: sh /etc/zinit/init/udev.sh
|
||||
oneshot: true
|
||||
after:
|
||||
- udevd
|
||||
1
configs/zinit/udevd.yaml
Normal file
1
configs/zinit/udevd.yaml
Normal file
@@ -0,0 +1 @@
|
||||
exec: udevd
|
||||
@@ -1,30 +0,0 @@
|
||||
# Zero-OS Zinit Configuration
|
||||
exec:
|
||||
# Core Zero-OS Services
|
||||
rfs:
|
||||
exec: /usr/bin/rfs
|
||||
after:
|
||||
- mycelium
|
||||
|
||||
seektime:
|
||||
exec: /usr/bin/seektime
|
||||
|
||||
core-x:
|
||||
exec: /usr/bin/core-x
|
||||
after:
|
||||
- rfs
|
||||
- mycelium
|
||||
|
||||
mycelium:
|
||||
exec: /usr/bin/mycelium
|
||||
|
||||
# System Services
|
||||
sshd:
|
||||
exec: /usr/sbin/sshd -D
|
||||
after:
|
||||
- mycelium
|
||||
|
||||
# Network configuration
|
||||
networking:
|
||||
exec: /bin/sh -c "ip link set lo up"
|
||||
oneshot: true
|
||||
Reference in New Issue
Block a user