summaryrefslogtreecommitdiff
path: root/fbgl_qemu_test_env.sh
diff options
context:
space:
mode:
Diffstat (limited to 'fbgl_qemu_test_env.sh')
-rwxr-xr-xfbgl_qemu_test_env.sh45
1 files changed, 14 insertions, 31 deletions
diff --git a/fbgl_qemu_test_env.sh b/fbgl_qemu_test_env.sh
index c44a144..76ed978 100755
--- a/fbgl_qemu_test_env.sh
+++ b/fbgl_qemu_test_env.sh
@@ -2,15 +2,13 @@
# Variables
TINYCORE_URL="http://tinycorelinux.net/14.x/x86/release/TinyCore-current.iso" # TinyCore Linux ISO URL
-ISO_FILE="TinyCore.iso" # Local TinyCore ISO file
-DISK_IMAGE="tinycore_test.img" # Disk image for TinyCore
-DISK_SIZE="128M" # Size of the disk image
-MOUNT_DIR="mnt_tinycore" # Temporary mount point for the ISO
-KERNEL_FILE="vmlinuz" # Extracted kernel file
-INITRD_FILE="core.gz" # Extracted initrd file
+ISO_FILE="TinyCore.iso" # TinyCore Linux ISO file
+DISK_IMAGE="tinycore_disk.img" # Writable disk image for TinyCore
+DISK_SIZE="64M" # Size of the writable disk
+MOUNT_DIR="mnt_tinycore" # Temporary mount point for disk
BINARY="$1" # Precompiled binary passed as argument
-# Ensure a binary is provided as an argument
+# Check if a binary is provided
if [ -z "$BINARY" ]; then
echo "Usage: $0 <path_to_precompiled_binary>"
exit 1
@@ -31,48 +29,33 @@ for tool in "${REQUIRED_TOOLS[@]}"; do
fi
done
-# Step 1: Download TinyCore Linux ISO
+# Step 1: Download TinyCore Linux ISO if not already present
if [ ! -f "$ISO_FILE" ]; then
echo "Downloading TinyCore Linux ISO..."
wget -O $ISO_FILE $TINYCORE_URL
fi
-# Step 2: Extract Kernel and Initrd from ISO
-if [ ! -f "$KERNEL_FILE" ] || [ ! -f "$INITRD_FILE" ]; then
- echo "Extracting kernel and initrd from TinyCore ISO..."
- mkdir -p $MOUNT_DIR
- sudo mount -o loop $ISO_FILE $MOUNT_DIR
- cp $MOUNT_DIR/boot/vmlinuz $KERNEL_FILE
- cp $MOUNT_DIR/boot/core.gz $INITRD_FILE
- sudo umount $MOUNT_DIR
- rmdir $MOUNT_DIR
-fi
-
-# Step 3: Create a Disk Image
-echo "Creating disk image..."
+# Step 2: Create a writable disk image
+echo "Creating writable disk image..."
dd if=/dev/zero of=$DISK_IMAGE bs=1M count=${DISK_SIZE/M/} status=progress
mkfs.ext4 $DISK_IMAGE
-# Step 4: Mount and Prepare Disk Image
+# Step 3: Mount the disk image and add the binary
echo "Mounting disk image and adding binary..."
mkdir -p $MOUNT_DIR
sudo mount -o loop $DISK_IMAGE $MOUNT_DIR
-
-# Add precompiled binary to the disk
-sudo mkdir -p $MOUNT_DIR/tce
sudo cp "$BINARY" $MOUNT_DIR/
sudo umount $MOUNT_DIR
rmdir $MOUNT_DIR
-# Step 5: Boot TinyCore Linux in QEMU
-echo "Booting TinyCore Linux with QEMU..."
+# Step 4: Run TinyCore Linux in QEMU
+echo "Running TinyCore Linux in QEMU..."
qemu-system-x86_64 \
- -kernel $KERNEL_FILE \
- -initrd $INITRD_FILE \
- -append "loglevel=3 tce=sda1 init=/init" \
+ -cdrom $ISO_FILE \
-hda $DISK_IMAGE \
-m 512M \
-vga std \
- -nographic
+ -display gtk \
+ -boot d
echo "QEMU exited. Check above for errors or results."