mirror of
https://github.com/blazblue547-afk/ForgeOS-ARM64.git
synced 2026-12-02 14:44:17 -05:00
Initial ForgeOS project
This commit is contained in:
commit
7db7cf1540
42 files changed
+3308
No files matched your search
@@ -0,0 +1,100 @@
|
||||
# ForgeOS Architecture
|
||||
|
||||
## Goal
|
||||
|
||||
ForgeOS defaults to a CLI-only operating system for `x86_64` desktops and laptops that does not use an existing Linux distribution as its base. It composes upstream projects directly:
|
||||
|
||||
- Linux kernel for the kernel layer
|
||||
- systemd for PID 1 and service supervision
|
||||
- D-Bus for the system message bus
|
||||
- BusyBox for `/bin/sh`, early switch-root support, and compact rescue tools
|
||||
- custom units and configuration files from this repository
|
||||
|
||||
There is also an optional `DESKTOP=gnome` image flavor. That flavor keeps the ForgeOS kernel, GRUB/EFI boot flow, image builder, and kernel modules, but uses a Debian `trixie` GNOME userspace because GNOME's dependency closure is much larger than the current source-built ForgeOS userspace.
|
||||
|
||||
The normal ForgeOS rootfs can also be built with `ENABLE_DESKTOP=1`. That does not switch to a new OS flavor: it keeps the source-built ForgeOS userspace and stages an Openbox/tint2/PCManFM desktop layer into the same rootfs.
|
||||
|
||||
## Boot Model
|
||||
|
||||
ForgeOS currently targets UEFI systems.
|
||||
|
||||
1. The disk image contains a GPT.
|
||||
2. Partition 1 is a FAT32 EFI System Partition labeled `FORGE_EFI`.
|
||||
3. By default, `out/BOOTX64.EFI` is a standalone GRUB UEFI fallback loader with a small debug boot menu.
|
||||
4. The built kernel EFI stub is copied to `EFI/BOOT/FORGEOS.EFI`.
|
||||
5. UEFI firmware executes GRUB from `EFI/BOOT/BOOTX64.EFI`, and GRUB starts the kernel.
|
||||
6. The built-in kernel command line mounts `PARTLABEL=root` as the real root filesystem.
|
||||
7. systemd starts as `/sbin/init`, activates the D-Bus system bus, starts `systemd-resolved` and `systemd-networkd`, reaches `multi-user.target`, and launches ForgeOS root-shell services on `tty1` and `ttyS0`.
|
||||
|
||||
## Root Filesystem Model
|
||||
|
||||
The root filesystem is assembled in `staging/rootfs` from:
|
||||
|
||||
- systemd install output from `staging/systemd`
|
||||
- D-Bus install output from `staging/dbus`
|
||||
- runtime library dependencies copied from the native build host for systemd and D-Bus binaries
|
||||
- BusyBox install output for shell and rescue utilities
|
||||
- kernel modules from the kernel build
|
||||
- the repository overlay in `overlay/rootfs`
|
||||
|
||||
The default network path uses DHCP through `systemd-networkd`. DNS servers learned from DHCP are exposed through `systemd-resolved`, and `/etc/resolv.conf` is a symlink to the resolved-managed compatibility file at `/run/systemd/resolve/resolv.conf`. Tools that query systemd over D-Bus use the system bus at `/run/dbus/system_bus_socket`.
|
||||
|
||||
The default console build also generates `out/rootfs.cpio.gz` for quick QEMU smoke tests. Desktop-enabled rootfs builds skip the initramfs artifact and boot through the ext4 root partition image.
|
||||
|
||||
For `DESKTOP=gnome`, `scripts/build-gnome-rootfs.sh` uses `mmdebstrap` or root-run `debootstrap` to assemble a Debian GNOME root filesystem in `staging/rootfs`, adds ForgeOS identity defaults, creates the initial desktop user, enables GDM and NetworkManager, and copies ForgeOS kernel modules. The GNOME image path deliberately does not copy `rootfs.cpio.gz` into the EFI System Partition because a desktop rootfs is too large for the initramfs-based smoke-test flow.
|
||||
|
||||
For `ENABLE_DESKTOP=1`, `scripts/stage-openbox-desktop.sh` asks apt to download the Openbox desktop package closure, extracts only the runtime payloads into `staging/rootfs`, skips base daemon packages that would replace source-built systemd or D-Bus, and enables `forgeos-desktop.service` on `tty1`.
|
||||
|
||||
## Why EFI Stub Boot
|
||||
|
||||
The project can still boot the kernel EFI stub directly with `BOOTLOADER=stub`, which keeps the implementation smaller and more direct:
|
||||
|
||||
- no external distro boot stack
|
||||
- no dependency on GRUB or systemd-boot
|
||||
- one kernel artifact doubles as the EFI executable
|
||||
|
||||
The tradeoff is that the current implementation depends on a built-in kernel command line.
|
||||
|
||||
## Secure Boot Model
|
||||
|
||||
ForgeOS supports a signed EFI-stub loader path for machines where the signing certificate has been enrolled in firmware Secure Boot `db`, or imported through a trusted shim/MOK flow.
|
||||
|
||||
This does not make ForgeOS trusted by stock Microsoft Secure Boot keys. That would require a Microsoft-signed shim or another trusted first-stage loader. The current project keeps the direct EFI-stub model and signs that EFI executable with a user-controlled key.
|
||||
|
||||
## Hardware Scope
|
||||
|
||||
The kernel fragment forces built-in support for:
|
||||
|
||||
- UEFI boot
|
||||
- serial and virtual terminals
|
||||
- devtmpfs
|
||||
- ext4 and vfat
|
||||
- GPT partition tables
|
||||
- AHCI / SATA
|
||||
- NVMe
|
||||
- USB storage
|
||||
- common keyboard and USB input paths
|
||||
- common QEMU virtio paths
|
||||
|
||||
This is enough for a first CLI OS image and a development boot path, but not yet a broad hardware certification matrix.
|
||||
|
||||
## Known Gaps
|
||||
|
||||
- BIOS boot path
|
||||
- Microsoft/shim-signed Secure Boot chain
|
||||
- measured boot and full verified boot
|
||||
- full laptop Wi-Fi and firmware coverage
|
||||
- package management
|
||||
- source-built GNOME and graphical desktop dependency closure
|
||||
- source-built Openbox/Xorg/GTK graphical dependency closure
|
||||
- source-built dependency closure for systemd and D-Bus runtime libraries
|
||||
- user management beyond the root shell
|
||||
- in-OS guided installer and update system
|
||||
- hardening review of the kernel and userspace defaults
|
||||
|
||||
## Suggested Next Steps
|
||||
|
||||
1. Add a source-built libc and dependency sysroot so systemd no longer needs copied host libraries.
|
||||
2. Teach the installer to support target-specific kernel command lines so multiple ForgeOS disks can coexist more safely.
|
||||
3. Add network profiles, SSH, and a package/update mechanism.
|
||||
4. Expand kernel coverage for Wi-Fi, Bluetooth, audio, suspend, and vendor input devices.
|
||||
@@ -0,0 +1,89 @@
|
||||
# ForgeOS Installer
|
||||
|
||||
ForgeOS currently ships with a host-side installer script:
|
||||
|
||||
- [scripts/install-to-disk.sh](/home/joe/forgeos/scripts/install-to-disk.sh)
|
||||
|
||||
It installs the built raw ForgeOS image to a real block device from an existing Linux host.
|
||||
|
||||
## What It Does
|
||||
|
||||
1. validates that the target is a disk
|
||||
2. refuses to overwrite obvious active system storage
|
||||
3. optionally unmounts non-critical target partitions
|
||||
4. writes the ForgeOS raw image to the target disk
|
||||
5. repairs the GPT backup header on larger disks
|
||||
6. expands partition `2` and the ext4 root filesystem to fill the device
|
||||
7. randomizes the ext4 root filesystem UUID by default
|
||||
|
||||
## Basic Usage
|
||||
|
||||
List candidate disks:
|
||||
|
||||
```bash
|
||||
cd /home/joe/forgeos
|
||||
make list-disks
|
||||
```
|
||||
|
||||
Install to a disk:
|
||||
|
||||
```bash
|
||||
cd /home/joe/forgeos
|
||||
sudo make install DISK=/dev/nvme0n1
|
||||
```
|
||||
|
||||
Non-interactive install:
|
||||
|
||||
```bash
|
||||
cd /home/joe/forgeos
|
||||
sudo make install DISK=/dev/sdc INSTALL_ARGS="--yes --unmount"
|
||||
```
|
||||
|
||||
Install without expanding the root filesystem:
|
||||
|
||||
```bash
|
||||
cd /home/joe/forgeos
|
||||
sudo make install DISK=/dev/sdc INSTALL_ARGS="--no-expand-root"
|
||||
```
|
||||
|
||||
## Direct Script Usage
|
||||
|
||||
```bash
|
||||
sudo ./scripts/install-to-disk.sh --device /dev/sdc
|
||||
```
|
||||
|
||||
Optional arguments:
|
||||
|
||||
- `--image /path/to/forgeos.img`
|
||||
- `--yes`
|
||||
- `--unmount`
|
||||
- `--no-expand-root`
|
||||
- `--keep-root-uuid`
|
||||
|
||||
## Secure Boot Images
|
||||
|
||||
To install a Secure Boot-compatible image, build it with a signed EFI loader first:
|
||||
|
||||
```bash
|
||||
cd /home/joe/forgeos
|
||||
make secure-boot-keys
|
||||
SECURE_BOOT=1 \
|
||||
SECURE_BOOT_KEY=out/secure-boot/ForgeOS.key \
|
||||
SECURE_BOOT_CERT=out/secure-boot/ForgeOS.crt \
|
||||
make image
|
||||
sudo make install DISK=/dev/sdc
|
||||
```
|
||||
|
||||
Enroll `out/secure-boot/ForgeOS.cer` in the target firmware Secure Boot database, or through a trusted shim/MOK flow, before booting with Secure Boot enabled. Without that enrollment, firmware should reject `EFI/BOOT/BOOTX64.EFI` even though it is signed.
|
||||
|
||||
## Safety Notes
|
||||
|
||||
- The installer is destructive. It erases the target disk.
|
||||
- Run it from a Linux host, not from the disk you are installing over.
|
||||
- The current boot model uses a built-in kernel command line with `root=PARTLABEL=root`.
|
||||
- Avoid leaving multiple ForgeOS installations attached during early testing, because multiple disks with the same GPT partition label can confuse root selection.
|
||||
- Secure Boot trust is tied to the enrolled signing certificate. Protect the generated private key.
|
||||
|
||||
## Current Limitation
|
||||
|
||||
This is a host-side installer, not an in-OS guided installer yet. There is no partitioning UI, user setup wizard, or live environment workflow in this version.
|
||||
Reference in new issue
Block a user