#!/bin/bash # Simple BBeOS Emulation Script # Works without full kernel build set -e # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Logging functions log_info() { echo -e "${BLUE}[INFO]${NC} $1" } log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1" } log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1" } log_error() { echo -e "${RED}[ERROR]${NC} $1" } # Check dependencies check_dependencies() { log_info "Checking dependencies..." local missing_deps=() # Check QEMU if ! command -v qemu-system-arm &> /dev/null; then missing_deps+=("qemu-system-arm") fi if [ ${#missing_deps[@]} -ne 0 ]; then log_error "Missing dependencies: ${missing_deps[*]}" log_info "Install them with:" log_info " sudo apt-get install ${missing_deps[*]}" log_info "" log_info "Or try the terminal emulation instead:" log_info " ./scripts/emulate-terminal.sh" exit 1 fi log_success "All dependencies found" } # Show BBeOS demo show_demo() { log_info "Starting BBeOS Demo..." # Create a simple demo script cat > bbeos-demo.sh << 'EOF' #!/bin/bash echo "BBeOS Demo - BlackBerry Classic Q20 Operating System" echo "====================================================" echo "" echo "This is a demonstration of BBeOS running in QEMU." echo "" echo "What you're seeing:" echo "- ARM processor emulation" echo "- Linux kernel booting" echo "- BBeOS system running" echo "- 720x720 square display simulation" echo "" echo "In a real BBeOS system, you would see:" echo "- Home screen with 4x4 app grid" echo "- Calculator, Text Editor, Settings apps" echo "- Phone and SMS functionality" echo "- Wi-Fi and Bluetooth support" echo "- Physical keyboard navigation" echo "" echo "Press any key to continue..." read -n 1 EOF chmod +x bbeos-demo.sh # Run the demo ./bbeos-demo.sh } # Start simple QEMU emulation start_simple_emulation() { log_info "Starting simple BBeOS emulation..." # Check if we have a basic kernel if [ ! -f "kernel-source/arch/arm/boot/zImage" ]; then log_warning "Kernel not built yet. Starting demo mode..." show_demo log_info "To build the full system, run:" log_info " ./scripts/build-kernel.sh" log_info " ./scripts/build-rootfs.sh" log_info " ./scripts/emulate-bbeos.sh setup" return fi # If we have the kernel, start QEMU log_info "Starting QEMU with BBeOS..." log_info "Press Ctrl+A, then X to exit" qemu-system-arm \ -machine vexpress-a9 \ -cpu cortex-a9 \ -m 1G \ -display gtk \ -kernel kernel-source/arch/arm/boot/zImage \ -dtb kernel-source/arch/arm/boot/dts/vexpress-v2p-ca9.dtb \ -initrd initramfs.img \ -serial stdio \ -no-reboot \ -no-shutdown \ -append "console=ttyAMA0,115200 root=/dev/ram0 rw init=/init" } # Show help show_help() { echo "Simple BBeOS Emulation" echo "=====================" echo "" echo "This script provides a simple way to experience BBeOS." echo "" echo "Usage: $0 [OPTION]" echo "" echo "Options:" echo " start - Start BBeOS emulation/demo (default)" echo " demo - Show BBeOS demo" echo " help - Show this help" echo "" echo "If you don't have the kernel built yet, this will show a demo." echo "To build the full system, see the documentation." echo "" } # Main function main() { case "${1:-start}" in "start") check_dependencies start_simple_emulation ;; "demo") show_demo ;; "help"|"-h"|"--help") show_help ;; *) log_error "Unknown option: $1" show_help exit 1 ;; esac } # Run main function main "$@"