mirror of
https://github.com/johndoe6345789/SparkOS.git
synced 2026-04-24 13:34:56 +00:00
Add wired networking configuration and sudo requirement
- Add DNS configuration with fallback servers (8.8.8.8, 1.1.1.1, etc.) - Create /etc/network/interfaces for wired DHCP networking - Add init-network script to bring up wired interface on boot - Update init.c to call network initialization - Update documentation to include sudo in default packages - Update README with network testing and binary installation guide - Update ARCHITECTURE.md with networking strategy details Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -11,6 +11,7 @@ SparkOS is designed as a minimal Linux distribution with a custom init system an
|
||||
The init system is the first process started by the kernel (PID 1). It is responsible for:
|
||||
|
||||
- **Mounting filesystems**: proc, sys, dev, tmp
|
||||
- **Network initialization**: Bringing up wired networking via DHCP
|
||||
- **Process management**: Spawning and respawning the shell
|
||||
- **Signal handling**: Reaping zombie processes
|
||||
- **System initialization**: Setting up the initial environment
|
||||
@@ -71,6 +72,8 @@ Init System (/sbin/init) [PID 1]
|
||||
↓
|
||||
Mount filesystems
|
||||
↓
|
||||
Initialize network (/sbin/init-network)
|
||||
↓
|
||||
Spawn busybox sh shell
|
||||
↓
|
||||
User interaction
|
||||
@@ -97,6 +100,23 @@ User interaction
|
||||
- **Small footprint**: Typically <1MB for full feature set
|
||||
- **Efficient**: Less memory and storage overhead than full GNU coreutils
|
||||
- **Standard**: De facto standard for embedded Linux systems
|
||||
- **Networking**: Includes DHCP client (udhcpc), ping, wget, and network tools
|
||||
|
||||
### Networking Strategy
|
||||
|
||||
SparkOS uses a two-phase networking approach:
|
||||
|
||||
**Phase 1: Bootstrap (Wired Only)**
|
||||
- Wired networking configured via DHCP
|
||||
- Automatic interface detection (eth0, enp0s3, etc.)
|
||||
- DNS fallback to public servers (8.8.8.8, 1.1.1.1)
|
||||
- Enables git clone to install spark CLI
|
||||
|
||||
**Phase 2: Full Configuration (via spark CLI)**
|
||||
- WiFi configuration
|
||||
- Advanced networking features
|
||||
- Custom DNS settings
|
||||
- Network profiles
|
||||
|
||||
## Future Architecture
|
||||
|
||||
@@ -112,15 +132,16 @@ User interaction
|
||||
- Minimal resource usage
|
||||
- Touch and mouse support
|
||||
|
||||
3. **C++ CLI Tools**
|
||||
3. **Spark CLI Tools (C++)**
|
||||
- System management utilities
|
||||
- Package management
|
||||
- Network configuration
|
||||
- Network configuration (WiFi, VPN, etc.)
|
||||
- GUI launcher
|
||||
|
||||
4. **Sudo Integration**
|
||||
- Proper privilege elevation
|
||||
- Security policies
|
||||
- Audit logging
|
||||
4. **Bootstrap Utilities (Included)**
|
||||
- Git for cloning spark CLI
|
||||
- Sudo for proper privilege elevation
|
||||
- Busybox for core system utilities and networking
|
||||
|
||||
## Security Considerations
|
||||
|
||||
|
||||
83
README.md
83
README.md
@@ -7,8 +7,10 @@ A minimal Linux distribution designed for simplicity and portability. SparkOS fe
|
||||
- **Custom init**: Lightweight C init system
|
||||
- **Future-ready**: Designed to support Qt6/QML GUI and Wayland
|
||||
- **Root elevation**: Uses sudo for privilege management
|
||||
- Wired networking only at first to bootstrap system, once you have installed spark command, the spark cli will configure the rest of the system imcl wifi.
|
||||
- Next to nothing installed by default, just kernel, init system, busybox and git.
|
||||
- **Bootstrap networking**: Wired networking with DHCP for initial setup
|
||||
- Minimal installation by default: kernel, init system, busybox, git, and sudo
|
||||
- DNS configured with fallback to public DNS servers (8.8.8.8, 1.1.1.1)
|
||||
- WiFi and advanced networking configured later via spark CLI
|
||||
|
||||
## MVP Status
|
||||
|
||||
@@ -18,6 +20,8 @@ The current MVP provides:
|
||||
- ✅ dd-able AMD64 image creation scripts
|
||||
- ✅ Minimal root filesystem structure
|
||||
- ✅ Build system (Makefile)
|
||||
- ✅ Wired networking configuration with DHCP
|
||||
- ✅ DNS configuration with public fallback servers
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -101,6 +105,7 @@ SparkOS/
|
||||
|
||||
SparkOS uses a custom init system (`/sbin/init`) that:
|
||||
- Mounts essential filesystems (proc, sys, dev, tmp)
|
||||
- Initializes wired networking via DHCP
|
||||
- Spawns a busybox sh login shell
|
||||
- Handles process reaping
|
||||
- Respawns shell on exit
|
||||
@@ -117,6 +122,14 @@ Follows the Filesystem Hierarchy Standard (FHS):
|
||||
- `/root`: Root user home
|
||||
- `/home`: User home directories
|
||||
|
||||
### Networking
|
||||
|
||||
SparkOS provides wired networking for initial bootstrap:
|
||||
- **DHCP**: Automatic IP configuration via busybox udhcpc
|
||||
- **DNS**: Fallback to public DNS servers (8.8.8.8, 8.8.4.4, 1.1.1.1, 1.0.0.1)
|
||||
- **Interface**: Primary wired interface (eth0) configured automatically
|
||||
- **WiFi**: Will be configured later via spark CLI after installation
|
||||
|
||||
## Development
|
||||
|
||||
### Building Components
|
||||
@@ -140,30 +153,58 @@ make help
|
||||
To create a fully functional system, you need to populate the rootfs with binaries:
|
||||
|
||||
```bash
|
||||
# Example: Add busybox (statically linked is best)
|
||||
cp /bin/busybox rootfs/bin/
|
||||
# Required binaries (statically linked recommended)
|
||||
# 1. Busybox - provides shell and most utilities including networking
|
||||
cp /path/to/busybox rootfs/bin/
|
||||
|
||||
# 2. Git - for cloning spark CLI
|
||||
cp /path/to/git rootfs/bin/
|
||||
# Note: If git is dynamically linked, you'll need to copy its libraries too
|
||||
|
||||
# 3. Sudo - for privilege elevation
|
||||
cp /path/to/sudo rootfs/bin/
|
||||
|
||||
# Create busybox symlinks for common utilities
|
||||
cd rootfs/bin
|
||||
for cmd in sh ls cat mkdir rm cp mount umount chmod chown ln; do
|
||||
for cmd in sh ls cat mkdir rm cp mount umount chmod chown ln \
|
||||
ip ifconfig ping wget udhcpc; do
|
||||
ln -sf busybox $cmd
|
||||
done
|
||||
cd ../..
|
||||
|
||||
# If using dynamically linked busybox, copy required libraries
|
||||
# If using dynamically linked binaries, copy required libraries
|
||||
ldd rootfs/bin/busybox # Check dependencies
|
||||
# Copy libraries to rootfs/lib or rootfs/lib64
|
||||
ldd rootfs/bin/git # Check dependencies
|
||||
ldd rootfs/bin/sudo # Check dependencies
|
||||
# Copy libraries to rootfs/lib or rootfs/lib64 as needed
|
||||
```
|
||||
|
||||
### Testing Network Connectivity
|
||||
|
||||
Once booted, you can test the network:
|
||||
|
||||
```bash
|
||||
# Check interface status
|
||||
ip addr show
|
||||
|
||||
# Test DNS resolution
|
||||
ping -c 3 google.com
|
||||
|
||||
# Test direct IP connectivity
|
||||
ping -c 3 8.8.8.8
|
||||
|
||||
# Download a file
|
||||
wget http://example.com/file
|
||||
```
|
||||
|
||||
## Future Roadmap
|
||||
|
||||
- [ ] Qt6/QML full screen GUI
|
||||
- [ ] Wayland compositor integration
|
||||
- [ ] C++ CLI tools
|
||||
- [ ] Package management
|
||||
- [ ] sudo integration
|
||||
- [ ] Network configuration
|
||||
- [ ] Android-like UI/UX
|
||||
- [ ] C++ CLI tools (spark command)
|
||||
- [ ] Package management via spark CLI
|
||||
- [ ] WiFi configuration via spark CLI
|
||||
- [ ] Advanced network configuration
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -179,15 +220,29 @@ See LICENSE file for details.
|
||||
## Notes
|
||||
|
||||
This is an MVP implementation. The system currently provides:
|
||||
- Basic init system
|
||||
- Basic init system with network initialization
|
||||
- Shell environment
|
||||
- Build infrastructure
|
||||
- Image creation tooling
|
||||
- Wired networking configuration
|
||||
|
||||
To create a fully bootable system, you'll also need:
|
||||
- Linux kernel binary (`vmlinuz`)
|
||||
- Essential system binaries and libraries
|
||||
- Essential system binaries: busybox, git, sudo
|
||||
- Required libraries (if using dynamically linked binaries)
|
||||
- Bootloader installation (handled by scripts)
|
||||
|
||||
Minimum System Requirements:
|
||||
- Kernel: Linux kernel with networking support
|
||||
- Init: Custom SparkOS init (included)
|
||||
- Shell: Busybox with networking utilities (udhcpc, ip/ifconfig, ping, wget)
|
||||
- VCS: Git (for installing spark CLI)
|
||||
- Security: Sudo (for privilege elevation)
|
||||
|
||||
After bootstrap:
|
||||
1. Use wired network to clone spark CLI via git
|
||||
2. Use spark CLI to configure WiFi and other system features
|
||||
3. Install additional packages as needed via spark CLI
|
||||
A single binary on top of Linux / Wayland that manages the OS, C++ CLI and Qt6/QML Full screen GUI. Android like design but more desktop orientated. A distribution that can be dd'ed to a USB flash drive. Root elevation powered by sudo. This project will need to set up a barebones distro (doesn't really need to be based on another, to keep things clean)
|
||||
|
||||
MVP is just a to get to a shell prompt with sudo support. Install minimum on system using busybox for minimal footprint.
|
||||
|
||||
@@ -3,6 +3,13 @@ SparkOS Root Filesystem
|
||||
|
||||
This is the root filesystem for SparkOS, a minimal Linux distribution.
|
||||
|
||||
Minimal System Packages:
|
||||
- Linux Kernel (with networking support)
|
||||
- SparkOS Init System (custom)
|
||||
- Busybox (shell, utilities, networking)
|
||||
- Git (for installing spark CLI)
|
||||
- Sudo (privilege elevation)
|
||||
|
||||
Directory Structure:
|
||||
/bin, /sbin - Essential binaries
|
||||
/etc - Configuration files
|
||||
@@ -13,6 +20,17 @@ Directory Structure:
|
||||
/root - Root home directory
|
||||
/home - User home directories
|
||||
|
||||
Network Configuration:
|
||||
/etc/network/interfaces - Wired network (DHCP)
|
||||
/etc/resolv.conf - DNS configuration (8.8.8.8, 1.1.1.1)
|
||||
/sbin/init-network - Network initialization script
|
||||
|
||||
Bootstrap Process:
|
||||
1. System boots with wired networking (DHCP)
|
||||
2. Use git to clone spark CLI repository
|
||||
3. Use spark CLI to configure WiFi and system
|
||||
4. Install additional packages via spark CLI
|
||||
|
||||
Note: This is a minimal system. You'll need to populate /bin and /usr/bin
|
||||
with actual binaries (busybox, etc.) from a proper Linux system
|
||||
with actual binaries (busybox, git, sudo) from a proper Linux system
|
||||
or by cross-compiling.
|
||||
|
||||
10
rootfs/etc/network/interfaces
Normal file
10
rootfs/etc/network/interfaces
Normal file
@@ -0,0 +1,10 @@
|
||||
# SparkOS Network Configuration
|
||||
# Wired networking only for bootstrapping
|
||||
|
||||
# Loopback interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# Primary wired interface (DHCP)
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
6
rootfs/etc/resolv.conf
Normal file
6
rootfs/etc/resolv.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
# SparkOS DNS Configuration
|
||||
# Fallback to public DNS servers for reliability
|
||||
nameserver 8.8.8.8
|
||||
nameserver 8.8.4.4
|
||||
nameserver 1.1.1.1
|
||||
nameserver 1.0.0.1
|
||||
@@ -56,6 +56,30 @@ devtmpfs /dev devtmpfs defaults 0 0
|
||||
tmpfs /tmp tmpfs defaults 0 0
|
||||
EOF
|
||||
|
||||
# /etc/resolv.conf - DNS configuration
|
||||
cat > "$ROOTFS_DIR/etc/resolv.conf" << 'EOF'
|
||||
# SparkOS DNS Configuration
|
||||
# Fallback to public DNS servers for reliability
|
||||
nameserver 8.8.8.8
|
||||
nameserver 8.8.4.4
|
||||
nameserver 1.1.1.1
|
||||
nameserver 1.0.0.1
|
||||
EOF
|
||||
|
||||
# /etc/network/interfaces - Wired network configuration
|
||||
cat > "$ROOTFS_DIR/etc/network/interfaces" << 'EOF'
|
||||
# SparkOS Network Configuration
|
||||
# Wired networking only for bootstrapping
|
||||
|
||||
# Loopback interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# Primary wired interface (DHCP)
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
EOF
|
||||
|
||||
# /etc/profile
|
||||
cat > "$ROOTFS_DIR/etc/profile" << 'EOF'
|
||||
# SparkOS System Profile
|
||||
@@ -94,18 +118,35 @@ cat << 'HELP'
|
||||
SparkOS - Minimal Linux Distribution
|
||||
====================================
|
||||
|
||||
Default Packages:
|
||||
- Kernel (Linux)
|
||||
- Init system (custom)
|
||||
- Busybox (shell and utilities)
|
||||
- Git (for installing spark CLI)
|
||||
- Sudo (privilege elevation)
|
||||
|
||||
Available commands:
|
||||
ls, cd, pwd - Navigate filesystem
|
||||
cat, less - View files
|
||||
mkdir, rm, cp - File operations
|
||||
mount, umount - Mount filesystems
|
||||
ip, ifconfig - Network configuration
|
||||
ping, wget - Network testing
|
||||
git - Version control
|
||||
sudo - Run commands as root
|
||||
poweroff, reboot - System control
|
||||
help - Show this help
|
||||
|
||||
This is a minimal system. To extend functionality:
|
||||
1. Mount additional filesystems
|
||||
2. Install packages (if package manager available)
|
||||
3. Build from source
|
||||
Network:
|
||||
Wired networking (eth0) configured via DHCP
|
||||
DNS: 8.8.8.8, 1.1.1.1 (Google and Cloudflare)
|
||||
To check network: ping 8.8.8.8
|
||||
To test DNS: ping google.com
|
||||
|
||||
Next Steps:
|
||||
1. Install spark CLI: git clone <spark-repo>
|
||||
2. Use spark CLI to configure WiFi and system
|
||||
3. Install additional packages as needed
|
||||
|
||||
For more information: https://github.com/johndoe6345789/SparkOS
|
||||
HELP
|
||||
@@ -114,6 +155,37 @@ EOF
|
||||
chmod +x "$ROOTFS_DIR/bin/sparkos-help"
|
||||
ln -sf sparkos-help "$ROOTFS_DIR/bin/help"
|
||||
|
||||
# Create network initialization script
|
||||
cat > "$ROOTFS_DIR/sbin/init-network" << 'EOF'
|
||||
#!/bin/sh
|
||||
# SparkOS Network Initialization
|
||||
# Brings up wired networking for system bootstrap
|
||||
|
||||
echo "Initializing network..."
|
||||
|
||||
# Bring up loopback
|
||||
ip link set lo up 2>/dev/null || ifconfig lo up 2>/dev/null
|
||||
|
||||
# Bring up primary wired interface with DHCP
|
||||
# Try eth0 first, then other common interface names
|
||||
for iface in eth0 enp0s3 enp0s8 ens33; do
|
||||
if ip link show "$iface" >/dev/null 2>&1; then
|
||||
echo "Bringing up $iface..."
|
||||
ip link set "$iface" up 2>/dev/null || ifconfig "$iface" up 2>/dev/null
|
||||
|
||||
# Try to get IP via DHCP using busybox udhcpc
|
||||
if command -v udhcpc >/dev/null 2>&1; then
|
||||
udhcpc -i "$iface" -q -n -t 5 2>/dev/null &
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Network initialization complete"
|
||||
EOF
|
||||
|
||||
chmod +x "$ROOTFS_DIR/sbin/init-network"
|
||||
|
||||
# Create README
|
||||
cat > "$ROOTFS_DIR/README.txt" << 'EOF'
|
||||
SparkOS Root Filesystem
|
||||
@@ -121,6 +193,13 @@ SparkOS Root Filesystem
|
||||
|
||||
This is the root filesystem for SparkOS, a minimal Linux distribution.
|
||||
|
||||
Minimal System Packages:
|
||||
- Linux Kernel (with networking support)
|
||||
- SparkOS Init System (custom)
|
||||
- Busybox (shell, utilities, networking)
|
||||
- Git (for installing spark CLI)
|
||||
- Sudo (privilege elevation)
|
||||
|
||||
Directory Structure:
|
||||
/bin, /sbin - Essential binaries
|
||||
/etc - Configuration files
|
||||
@@ -131,19 +210,41 @@ Directory Structure:
|
||||
/root - Root home directory
|
||||
/home - User home directories
|
||||
|
||||
Network Configuration:
|
||||
/etc/network/interfaces - Wired network (DHCP)
|
||||
/etc/resolv.conf - DNS configuration (8.8.8.8, 1.1.1.1)
|
||||
/sbin/init-network - Network initialization script
|
||||
|
||||
Bootstrap Process:
|
||||
1. System boots with wired networking (DHCP)
|
||||
2. Use git to clone spark CLI repository
|
||||
3. Use spark CLI to configure WiFi and system
|
||||
4. Install additional packages via spark CLI
|
||||
|
||||
Note: This is a minimal system. You'll need to populate /bin and /usr/bin
|
||||
with actual binaries (busybox, etc.) from a proper Linux system
|
||||
with actual binaries (busybox, git, sudo) from a proper Linux system
|
||||
or by cross-compiling.
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo "Root filesystem structure created at: $ROOTFS_DIR"
|
||||
echo ""
|
||||
echo "Network configuration:"
|
||||
echo " - Wired networking (DHCP) configured for eth0"
|
||||
echo " - DNS: 8.8.8.8, 1.1.1.1, 8.8.4.4, 1.0.0.1"
|
||||
echo " - Network init script: /sbin/init-network"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Build init: make init"
|
||||
echo " 2. Install init: make install"
|
||||
echo " 3. Copy busybox to rootfs/bin/ and create symlinks"
|
||||
echo " 4. Create bootable image: sudo make image"
|
||||
echo " 3. Copy busybox, git, and sudo binaries to rootfs/bin/"
|
||||
echo " 4. Create busybox symlinks"
|
||||
echo " 5. Create bootable image: sudo make image"
|
||||
echo ""
|
||||
echo "Note: You'll need to populate the rootfs with busybox binary"
|
||||
echo " before creating a bootable image."
|
||||
echo "Minimum required binaries:"
|
||||
echo " - busybox (provides shell, networking, utilities)"
|
||||
echo " - git (for installing spark CLI)"
|
||||
echo " - sudo (for privilege elevation)"
|
||||
echo ""
|
||||
echo "Note: Busybox should be compiled with networking support"
|
||||
echo " (CONFIG_UDHCPC, CONFIG_IFCONFIG, CONFIG_IP, CONFIG_PING, CONFIG_WGET)"
|
||||
|
||||
@@ -76,6 +76,12 @@ int main(int argc, char *argv[]) {
|
||||
fprintf(stderr, "Warning: Failed to mount /tmp\n");
|
||||
}
|
||||
|
||||
// Initialize network (wired only for bootstrap)
|
||||
printf("Initializing wired network...\n");
|
||||
if (system("/sbin/init-network 2>/dev/null") != 0) {
|
||||
fprintf(stderr, "Warning: Network initialization failed or not available\n");
|
||||
}
|
||||
|
||||
printf("Starting shell...\n");
|
||||
printf("Welcome to SparkOS!\n");
|
||||
printf("===================\n\n");
|
||||
|
||||
Reference in New Issue
Block a user