Files
BBeOS/scripts/build-rootfs.sh
Eliott 7b53cde2ae
Some checks failed
CI / markdown-lint (push) Failing after 14s
Complete BBeOS project implementation with BlackBerry-inspired website
- Updated .gitignore with comprehensive exclusions for build artifacts, IDE files, and OS-specific files
- Created BlackBerry-inspired website with Heroicons and Gitea integration
- Added complete project structure with all 7 phases implemented
- Included kernel drivers, UI components, telephony stack, and packaging tools
- Added emulation scripts for testing and development
- Comprehensive documentation for all development phases
- Security analysis and hardware testing guides
- SDK and application framework for third-party development
2025-08-01 10:20:28 +02:00

128 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# BBeOS Minimal Root Filesystem Build Script
# Creates a BusyBox-based initramfs for BlackBerry Classic Q20
set -e
echo "Building minimal root filesystem for BBeOS..."
# Configuration
ROOTFS_DIR="rootfs"
BUSYBOX_VERSION="1.36.1"
BUSYBOX_URL="https://busybox.net/downloads/busybox-${BUSYBOX_VERSION}.tar.bz2"
BUSYBOX_DIR="busybox-${BUSYBOX_VERSION}"
# Set up environment
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
# Create directories
echo "Creating directories..."
rm -rf ${ROOTFS_DIR}
mkdir -p ${ROOTFS_DIR}/{bin,dev,etc,lib,proc,sys,tmp,usr/bin,usr/sbin}
# Download and build BusyBox
echo "Downloading BusyBox ${BUSYBOX_VERSION}..."
if [ ! -f "${BUSYBOX_DIR}.tar.bz2" ]; then
wget ${BUSYBOX_URL}
fi
if [ ! -d "${BUSYBOX_DIR}" ]; then
tar xf ${BUSYBOX_DIR}.tar.bz2
fi
echo "Building BusyBox..."
cd ${BUSYBOX_DIR}
# Configure BusyBox
make defconfig
sed -i 's/# CONFIG_STATIC is not set/CONFIG_STATIC=y/' .config
sed -i 's/# CONFIG_FEATURE_PREFER_APPLETS is not set/CONFIG_FEATURE_PREFER_APPLETS=y/' .config
sed -i 's/# CONFIG_FEATURE_SH_STANDALONE is not set/CONFIG_FEATURE_SH_STANDALONE=y/' .config
# Build BusyBox
make -j$(nproc)
make install
# Copy BusyBox to rootfs
echo "Installing BusyBox to rootfs..."
cp busybox ../${ROOTFS_DIR}/bin/
cd ..
# Create init script
echo "Creating init script..."
cat > ${ROOTFS_DIR}/init << 'EOF'
#!/bin/sh
# BBeOS Init Script
echo "BBeOS starting..."
# Mount essential filesystems
mount -t proc none /proc
mount -t sysfs none /sys
mount -t tmpfs none /tmp
# Create device nodes
mknod /dev/console c 5 1
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/tty c 5 0
mknod /dev/tty0 c 4 0
mknod /dev/ttyMSM0 c 251 0
# Set up console
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
echo "BBeOS root filesystem loaded"
echo "Welcome to BBeOS on BlackBerry Classic Q20!"
# Start shell
exec /bin/sh
EOF
chmod +x ${ROOTFS_DIR}/init
# Create basic configuration files
echo "Creating configuration files..."
# /etc/passwd
cat > ${ROOTFS_DIR}/etc/passwd << 'EOF'
root:x:0:0:root:/root:/bin/sh
EOF
# /etc/group
cat > ${ROOTFS_DIR}/etc/group << 'EOF'
root:x:0:
EOF
# /etc/hostname
echo "bbeos-q20" > ${ROOTFS_DIR}/etc/hostname
# /etc/hosts
cat > ${ROOTFS_DIR}/etc/hosts << 'EOF'
127.0.0.1 localhost
127.0.1.1 bbeos-q20
EOF
# Create symlinks for BusyBox
echo "Creating BusyBox symlinks..."
cd ${ROOTFS_DIR}/bin
for cmd in sh ls cat echo mount umount mknod chmod chown; do
ln -sf busybox $cmd
done
cd ../..
# Create initramfs
echo "Creating initramfs..."
cd ${ROOTFS_DIR}
find . | cpio -o -H newc | gzip > ../initramfs.img
cd ..
echo "Root filesystem build complete!"
echo "Files created:"
echo " - rootfs/ (root filesystem directory)"
echo " - initramfs.img (compressed initramfs)"
echo " - busybox-${BUSYBOX_VERSION}/ (BusyBox source and build)"