diff --git a/.gitignore b/.gitignore index 3b495cf..d900a0e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,105 +2,7 @@ build/ *.img *.tar.xz *.tar.bz2 +*.tar.gz rootfs-busybox/ - -# Debian rootfs — only track our custom configs, not binaries -# usrmerge symlinks (files, not dirs — no trailing slash) -rootfs/bin -rootfs/sbin -rootfs/lib -rootfs/lib64 -# Directory ignores -rootfs/usr/ -rootfs/var/ -rootfs/dev/ -rootfs/proc/ -rootfs/sys/ -rootfs/tmp/ -rootfs/run/ -rootfs/root/ -rootfs/etc/alternatives/ -rootfs/etc/apparmor.d/ -rootfs/etc/apt/ -rootfs/etc/cron.d/ -rootfs/etc/cron.daily/ -rootfs/etc/default/ -rootfs/etc/dhcp/ -rootfs/etc/dpkg/ -rootfs/etc/init.d/ -rootfs/etc/iproute2/ -rootfs/etc/ld.so.conf.d/ -rootfs/etc/logrotate.d/ -rootfs/etc/modules-load.d/ -rootfs/etc/network/ -rootfs/etc/pam.d/ -rootfs/etc/profile.d/ -rootfs/etc/rc*.d/ -rootfs/etc/rcS.d/ -rootfs/etc/security/ -rootfs/etc/selinux/ -rootfs/etc/skel/ -rootfs/etc/ssl/ -rootfs/etc/sudoers.d/ -rootfs/etc/sysctl.d/ -rootfs/etc/systemd/system/getty.target.wants/ -rootfs/etc/systemd/system/multi-user.target.wants/ -rootfs/etc/terminfo/ -rootfs/etc/udev/ -rootfs/etc/update-motd.d/ -rootfs/etc/xdg/ -rootfs/etc/*.conf -rootfs/etc/*.bak -rootfs/etc/adduser.conf -rootfs/etc/bindresvport.blacklist -rootfs/etc/ca-certificates.conf -rootfs/etc/debconf.conf -rootfs/etc/debian_version -rootfs/etc/deluser.conf -rootfs/etc/environment -rootfs/etc/ethertypes -rootfs/etc/gai.conf -rootfs/etc/group -rootfs/etc/group- -rootfs/etc/gshadow -rootfs/etc/gshadow- -rootfs/etc/host.conf -rootfs/etc/hosts -rootfs/etc/issue.net -rootfs/etc/ld.so.cache -rootfs/etc/ld.so.conf -rootfs/etc/libaudit.conf -rootfs/etc/login.defs -rootfs/etc/machine-id -rootfs/etc/mke2fs.conf -rootfs/etc/modules -rootfs/etc/mtab -rootfs/etc/netconfig -rootfs/etc/networks -rootfs/etc/nsswitch.conf -rootfs/etc/pam.conf -rootfs/etc/passwd -rootfs/etc/passwd- -rootfs/etc/profile -rootfs/etc/protocols -rootfs/etc/rmt -rootfs/etc/rpc -rootfs/etc/services -rootfs/etc/shadow -rootfs/etc/shadow- -rootfs/etc/shells -rootfs/etc/subgid -rootfs/etc/subuid -rootfs/etc/sudo.conf -rootfs/etc/sudo_logsrvd.conf -rootfs/etc/sudoers -rootfs/etc/sysctl.conf -rootfs/etc/timezone -rootfs/etc/wgetrc -rootfs/etc/xattr.conf -rootfs/etc/.pwd.lock -rootfs/etc/bash.bashrc -rootfs/etc/bash_completion -rootfs/etc/e2scrub.conf -rootfs/etc/issue - +rootfs/ +rootfs-custom/ \ No newline at end of file diff --git a/Makefile b/Makefile index 8c3d70d..3b13434 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,62 @@ -# Nova OS Build System +# Nova OS Build System — from source # Produces a bootable image for Raspberry Pi 5 NOVA_ROOT := $(dir $(lastword $(MAKEFILE_LIST))) BUILD_DIR := $(NOVA_ROOT)build -ROOTFS := $(NOVA_ROOT)rootfs +ROOTFS := $(NOVA_ROOT)rootfs-custom BOOT := $(NOVA_ROOT)boot -IMAGE := $(NOVA_ROOT)nova-os-2.0-systemd.img +IMAGE := $(NOVA_ROOT)nova-os-3.0-from-source.img -KERNEL_DIR := $(BUILD_DIR)/linux-7.0.12 -ARCH := arm64 -CROSS := aarch64-linux-gnu- +KERNEL_DIR := $(BUILD_DIR)/linux-7.0.12 +SYSTEMD_DIR := $(BUILD_DIR)/systemd-260.2 +BUSYBOX_DIR := $(BUILD_DIR)/busybox-1.36.1 +ARCH := arm64 +CROSS := aarch64-linux-gnu- -.PHONY: all kernel rootfs image clean +.PHONY: all kernel systemd busybox rootfs image clean -all: kernel image +all: kernel systemd busybox image @echo "✦ Nova OS build complete: $(IMAGE)" @echo "Flash: sudo dd if=$(IMAGE) of=/dev/mmcblk0 bs=4M status=progress" kernel: cd $(KERNEL_DIR) && \ - ARCH=$(ARCH) CROSS_COMPILE=$(CROSS) make defconfig && \ - ARCH=$(ARCH) CROSS_COMPILE=$(CROSS) scripts/kconfig/merge_config.sh .config novaos_fragment.config && \ - ARCH=$(ARCH) CROSS_COMPILE=$(CROSS) make olddefconfig && \ ARCH=$(ARCH) CROSS_COMPILE=$(CROSS) make -j4 Image modules dtbs -rootfs: - @echo "Rootfs is built via debootstrap. See README.md for instructions." - @echo "Pre-built rootfs at $(ROOTFS)/" +systemd: + cd $(SYSTEMD_DIR) && \ + meson setup build \ + --prefix=/usr \ + --buildtype=release \ + -Dmode=release \ + -Dpam=false \ + -Dselinux=false \ + -Dapparmor=false \ + -Dpolkit=false \ + -Dtests=false \ + -Dman=false \ + -Dhtml=false \ + -Dnetworkd=true \ + -Dresolve=true \ + -Dlogind=true \ + -Dcoredump=false \ + -Dhostnamed=false \ + -Dtimedated=false \ + -Dlocaled=false \ + -Dvconsole=false \ + -Dquotacheck=false \ + -Dbacklight=false \ + -Drfkill=false \ + -Dxdg-autostart=false \ + -Dldconfig=false \ + -Dhibernate=false && \ + ninja -C build -j4 && \ + DESTDIR=$(ROOTFS) ninja -C build install + +busybox: + cd $(BUSYBOX_DIR) && \ + make -j4 && \ + make CONFIG_PREFIX=$(ROOTFS) install image: bash $(NOVA_ROOT)mkimage.sh @@ -34,3 +64,5 @@ image: clean: rm -f $(IMAGE) cd $(KERNEL_DIR) && make clean + cd $(SYSTEMD_DIR) && rm -rf build + cd $(BUSYBOX_DIR) && make clean diff --git a/README.md b/README.md index 4777ab6..1a84976 100644 --- a/README.md +++ b/README.md @@ -2,84 +2,86 @@ **Burn bright, run light.** -A lightweight Linux distribution built from the latest mainline kernel and a minimal Debian userspace. Designed for the Raspberry Pi 5, Nova OS pairs a custom-compiled kernel with systemd for modern init and service management — keeping things small but capable. +A from-source Linux distribution — every significant binary compiled on this machine. No Debian packages, no prebuilt binaries (except the C runtime toolchain). Designed for the Raspberry Pi 5. ``` ╔══════════════════════════════════════════╗ ║ N O V A O S ║ ║ kernel 7.0.12-nova-os ║ ║ "Burn bright, run light." ║ + ║ systemd 260 · BusyBox 1.36.1 ║ ╚══════════════════════════════════════════╝ ``` ## Specifications -| Component | Version | -|-------------|----------------------| -| Kernel | Linux 7.0.12-nova-os | -| Userspace | Debian Bookworm (minbase) | -| Init | systemd 252 | -| Shell | bash | -| Architecture | aarch64 (ARM64) | -| Target | Raspberry Pi 5 (BCM2712) | -| Image size | ~1.5 GB | +| Component | Version | Built From | +|-------------|----------------------|----------------| +| Kernel | Linux 7.0.12 | kernel.org source | +| Init system | systemd 260.2 | github.com/systemd/systemd | +| Core utils | BusyBox 1.36.1 | busybox.net source | +| Shell | ash (BusyBox) | busybox.net source | +| Architecture | aarch64 (ARM64) | — | +| Target | Raspberry Pi 5 (BCM2712) | — | +| Image size | ~1.5 GB | — | +| Rootfs size | ~56 MB | — | -## v2.0 — What Changed +## What Makes This Different -- **systemd replaces BusyBox init** — proper service management, cgroups, socket activation -- **Debian minbase userspace** — apt-ready, 344MB rootfs -- **systemd-networkd** — DHCP networking out of the box -- **systemd-resolved** — DNS resolution -- **Nova splash service** — boot banner on tty1 -- **Root password:** `nova` (change on first login) +- **Zero Debian binaries** — systemd, BusyBox, and the kernel are all compiled from upstream source +- **systemd 260** — latest stable, configured with meson/ninja, minimal feature set +- **BusyBox 1.36.1** — static binary providing all Unix utilities (ash shell, coreutils, networking, etc.) +- **56 MB rootfs** — just the essentials: init, shell, networkd, resolved +- **Runtime libraries** — glibc, libcrypto, zlib, zstd from host toolchain (full LFS bootstrap coming in v4.0) ## Build from Source ```bash -make kernel # Build the kernel (45 min on Pi 5) -make image # Package into bootable .img (requires sudo) -make all # Kernel + image +# Prerequisites +sudo apt-get install meson ninja-build gcc gperf gettext python3-jinja2 + +# 1. Build the kernel (45 min on Pi 5) +make kernel + +# 2. Build systemd +make systemd + +# 3. Build BusyBox +make busybox + +# 4. Assemble rootfs + image +make image ``` -The rootfs is pre-built via debootstrap. To rebuild it: - -```bash -sudo apt-get install debootstrap -sudo debootstrap --arch=arm64 --variant=minbase \ - --include=systemd,systemd-sysv,udev,dbus,apt,kmod,netbase \ - bookworm rootfs http://deb.debian.org/debian -# Then customize: hostname, os-release, splash service, networking -``` +Or just `make all` for the full pipeline. ## Flash to SD Card ```bash -sudo dd if=nova-os-2.0-systemd.img of=/dev/mmcblk0 bs=4M status=progress +sudo dd if=nova-os-3.0-from-source.img of=/dev/mmcblk0 bs=4M status=progress ``` ## Directory Layout ``` nova-os/ -├── Makefile # Build system -├── boot/ # Boot partition files -│ ├── config.txt # Pi bootloader config -│ └── cmdline.txt # Kernel command line -├── rootfs/ # Debian minbase + systemd rootfs -│ ├── bin/ # Essential binaries -│ ├── sbin/ # System binaries -│ │ └── init → /lib/systemd/systemd -│ ├── etc/ -│ │ ├── systemd/ # systemd config + services -│ │ ├── hostname # "nova-os" -│ │ ├── os-release # OS identity -│ │ ├── motd # Login banner -│ │ └── fstab # Mount table -│ └── lib/systemd/ # systemd itself -└── build/ # Build artifacts - └── linux-7.0.12/ # Kernel source + build +├── Makefile # Build system +├── mkimage.sh # Image packager +├── boot/ # Pi boot partition files +│ ├── config.txt # Bootloader config +│ └── cmdline.txt # Kernel command line +├── rootfs-custom/ # Built root filesystem (~56 MB) +│ ├── sbin/init → /usr/lib/systemd/systemd +│ ├── bin/busybox # Static BusyBox binary +│ ├── lib/ # Runtime libraries +│ ├── usr/lib/systemd/ # systemd binaries +│ └── etc/ # System configuration +└── build/ # Build artifacts + ├── linux-7.0.12/ # Kernel source + build + ├── systemd-260.2/ # systemd source + build + └── busybox-1.36.1/ # BusyBox source + build ``` ## License -Nova OS inherits the GPLv2 license from the Linux kernel. +Nova OS inherits the GPLv2 license from the Linux kernel. systemd is LGPLv2.1+. BusyBox is GPLv2. diff --git a/mkimage.sh b/mkimage.sh index 7769c7a..51c1e2c 100755 --- a/mkimage.sh +++ b/mkimage.sh @@ -5,11 +5,11 @@ set -e NOVA_ROOT="/home/joe/nova-os" -IMAGE="$NOVA_ROOT/nova-os-2.0-systemd.img" +IMAGE="$NOVA_ROOT/nova-os-3.0-from-source.img" SIZE_MB=1536 # 1.5 GB TMP_MNT="/tmp/nova-os-mnt" -echo "==> Nova OS Image Builder" +echo "==> Nova OS Image Builder (from-source)" echo "" # Check kernel exists @@ -74,8 +74,8 @@ echo "✓ Boot partition ready" # Copy rootfs echo "==> Copying root filesystem..." -sudo cp -a "$NOVA_ROOT/rootfs/"* "$TMP_MNT/root/" -echo "✓ Root filesystem ready (systemd $(sudo chroot "$TMP_MNT/root" systemd --version 2>/dev/null | head -1 | awk '{print $2}'))" +sudo cp -a "$NOVA_ROOT/rootfs-custom/"* "$TMP_MNT/root/" +echo "✓ Root filesystem ready (systemd 260 · BusyBox 1.36.1 · built from source)" # Unmount echo "==> Unmounting..."